takashi yamanoue
/
XBee_API_ex3
Xbee API Test 3
> help h or help m <status-in-hex>,. ... Modem status l <cmd>,<val-in-hex>. ... exec <cmd> (AT) at this host. lset fid <val-in-hex>. ... set local frame id. default is 1. lset cmd <val-in-hex>. ... set local command. lset val <val-in-hex>. ... set local command value. q <cmd>,<val-in-hex>. ... set queue parameter value. r <cmd>,<val-in-hex>. ... exec <cmd> (AT)at remote host. rset a16 <val-in-hex>. ... set remote address high. rset a64 <val-in-hex>,<val-in-hex>. ... set remote address low. rset fid <val-in-hex>. ... set remote frame id. default is 1. > l D4,0x05 cmd=D4 val=0x05 apiId=88 object 100008c8:35 01 00 10 88 00 05 FE 04 01 00 FF l OK: > l D4,0x04 cmd=D4 val=0x04 apiId=88 object 100008c8:35 01 00 10 88 00 05 FE 04 01 00 FF l OK: >
LPC1768/if/net/netdnsrequest.h@0:3edcfa3aba71, 2012-07-21 (annotated)
- Committer:
- takashiyamanoue
- Date:
- Sat Jul 21 04:09:54 2012 +0000
- Revision:
- 0:3edcfa3aba71
xbee test 3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
takashiyamanoue | 0:3edcfa3aba71 | 1 | |
takashiyamanoue | 0:3edcfa3aba71 | 2 | /* |
takashiyamanoue | 0:3edcfa3aba71 | 3 | Copyright (c) 2010 Donatien Garnier (donatiengar [at] gmail [dot] com) |
takashiyamanoue | 0:3edcfa3aba71 | 4 | |
takashiyamanoue | 0:3edcfa3aba71 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy |
takashiyamanoue | 0:3edcfa3aba71 | 6 | of this software and associated documentation files (the "Software"), to deal |
takashiyamanoue | 0:3edcfa3aba71 | 7 | in the Software without restriction, including without limitation the rights |
takashiyamanoue | 0:3edcfa3aba71 | 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
takashiyamanoue | 0:3edcfa3aba71 | 9 | copies of the Software, and to permit persons to whom the Software is |
takashiyamanoue | 0:3edcfa3aba71 | 10 | furnished to do so, subject to the following conditions: |
takashiyamanoue | 0:3edcfa3aba71 | 11 | |
takashiyamanoue | 0:3edcfa3aba71 | 12 | The above copyright notice and this permission notice shall be included in |
takashiyamanoue | 0:3edcfa3aba71 | 13 | all copies or substantial portions of the Software. |
takashiyamanoue | 0:3edcfa3aba71 | 14 | |
takashiyamanoue | 0:3edcfa3aba71 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
takashiyamanoue | 0:3edcfa3aba71 | 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
takashiyamanoue | 0:3edcfa3aba71 | 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
takashiyamanoue | 0:3edcfa3aba71 | 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
takashiyamanoue | 0:3edcfa3aba71 | 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
takashiyamanoue | 0:3edcfa3aba71 | 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
takashiyamanoue | 0:3edcfa3aba71 | 21 | THE SOFTWARE. |
takashiyamanoue | 0:3edcfa3aba71 | 22 | */ |
takashiyamanoue | 0:3edcfa3aba71 | 23 | |
takashiyamanoue | 0:3edcfa3aba71 | 24 | #ifndef NETDNSREQUEST_H |
takashiyamanoue | 0:3edcfa3aba71 | 25 | #define NETDNSREQUEST_H |
takashiyamanoue | 0:3edcfa3aba71 | 26 | |
takashiyamanoue | 0:3edcfa3aba71 | 27 | //class Socket; |
takashiyamanoue | 0:3edcfa3aba71 | 28 | class Host; |
takashiyamanoue | 0:3edcfa3aba71 | 29 | //class NetService; |
takashiyamanoue | 0:3edcfa3aba71 | 30 | class NetDnsRequest; |
takashiyamanoue | 0:3edcfa3aba71 | 31 | |
takashiyamanoue | 0:3edcfa3aba71 | 32 | #include "netservice.h" |
takashiyamanoue | 0:3edcfa3aba71 | 33 | #include "ipaddr.h" |
takashiyamanoue | 0:3edcfa3aba71 | 34 | #include "host.h" |
takashiyamanoue | 0:3edcfa3aba71 | 35 | |
takashiyamanoue | 0:3edcfa3aba71 | 36 | enum NetDnsReply |
takashiyamanoue | 0:3edcfa3aba71 | 37 | { |
takashiyamanoue | 0:3edcfa3aba71 | 38 | NETDNS_PRTCL, |
takashiyamanoue | 0:3edcfa3aba71 | 39 | NETDNS_NOTFOUND, //Hostname is unknown |
takashiyamanoue | 0:3edcfa3aba71 | 40 | NETDNS_ERROR, //Problem with DNS Service |
takashiyamanoue | 0:3edcfa3aba71 | 41 | //... |
takashiyamanoue | 0:3edcfa3aba71 | 42 | NETDNS_FOUND, |
takashiyamanoue | 0:3edcfa3aba71 | 43 | }; |
takashiyamanoue | 0:3edcfa3aba71 | 44 | |
takashiyamanoue | 0:3edcfa3aba71 | 45 | class NetDnsRequest : public NetService |
takashiyamanoue | 0:3edcfa3aba71 | 46 | { |
takashiyamanoue | 0:3edcfa3aba71 | 47 | public: |
takashiyamanoue | 0:3edcfa3aba71 | 48 | NetDnsRequest(const char* hostname); |
takashiyamanoue | 0:3edcfa3aba71 | 49 | NetDnsRequest(Host* pHost); |
takashiyamanoue | 0:3edcfa3aba71 | 50 | virtual ~NetDnsRequest(); |
takashiyamanoue | 0:3edcfa3aba71 | 51 | |
takashiyamanoue | 0:3edcfa3aba71 | 52 | class CDummy; |
takashiyamanoue | 0:3edcfa3aba71 | 53 | template<class T> |
takashiyamanoue | 0:3edcfa3aba71 | 54 | //Linker bug : Must be defined here :( |
takashiyamanoue | 0:3edcfa3aba71 | 55 | void setOnReply( T* pItem, void (T::*pMethod)(NetDnsReply) ) |
takashiyamanoue | 0:3edcfa3aba71 | 56 | { |
takashiyamanoue | 0:3edcfa3aba71 | 57 | m_pCbItem = (CDummy*) pItem; |
takashiyamanoue | 0:3edcfa3aba71 | 58 | m_pCbMeth = (void (CDummy::*)(NetDnsReply)) pMethod; |
takashiyamanoue | 0:3edcfa3aba71 | 59 | } |
takashiyamanoue | 0:3edcfa3aba71 | 60 | |
takashiyamanoue | 0:3edcfa3aba71 | 61 | //Execute request & return OK if found, NOTFOUND or ERROR on error, or PROCESSING if the request has not completed yet |
takashiyamanoue | 0:3edcfa3aba71 | 62 | // virtual DnsErr pollState() = 0; |
takashiyamanoue | 0:3edcfa3aba71 | 63 | virtual void poll() = 0; //NetService fn |
takashiyamanoue | 0:3edcfa3aba71 | 64 | |
takashiyamanoue | 0:3edcfa3aba71 | 65 | void getResult(IpAddr* pIp); |
takashiyamanoue | 0:3edcfa3aba71 | 66 | |
takashiyamanoue | 0:3edcfa3aba71 | 67 | virtual void close(); |
takashiyamanoue | 0:3edcfa3aba71 | 68 | |
takashiyamanoue | 0:3edcfa3aba71 | 69 | protected: |
takashiyamanoue | 0:3edcfa3aba71 | 70 | void onReply(NetDnsReply reply); //Must be called by impl when the request completes |
takashiyamanoue | 0:3edcfa3aba71 | 71 | |
takashiyamanoue | 0:3edcfa3aba71 | 72 | IpAddr m_ip; |
takashiyamanoue | 0:3edcfa3aba71 | 73 | char* m_hostname; |
takashiyamanoue | 0:3edcfa3aba71 | 74 | |
takashiyamanoue | 0:3edcfa3aba71 | 75 | private: |
takashiyamanoue | 0:3edcfa3aba71 | 76 | CDummy* m_pCbItem; |
takashiyamanoue | 0:3edcfa3aba71 | 77 | void (CDummy::*m_pCbMeth)(NetDnsReply); |
takashiyamanoue | 0:3edcfa3aba71 | 78 | |
takashiyamanoue | 0:3edcfa3aba71 | 79 | Host* m_pHost; |
takashiyamanoue | 0:3edcfa3aba71 | 80 | |
takashiyamanoue | 0:3edcfa3aba71 | 81 | bool m_closed; |
takashiyamanoue | 0:3edcfa3aba71 | 82 | }; |
takashiyamanoue | 0:3edcfa3aba71 | 83 | |
takashiyamanoue | 0:3edcfa3aba71 | 84 | #endif |