XBee-mbed library http://mbed.org/users/okini3939/notebook/xbee-mbed/

Dependents:   device_server_udp led_sender_post XBee_API_ex1 XBee_API_ex2 ... more

Revision:
4:f6d73acc1f75
Parent:
3:8573b122fa84
Child:
5:547cfff7adf7
--- a/XBeeWiFi.h	Thu Mar 08 17:41:29 2012 +0000
+++ b/XBeeWiFi.h	Tue Mar 13 09:01:52 2012 +0000
@@ -72,8 +72,8 @@
 #define DNS_CLASS_IN 1
 
 #define DNS_PORT 53
-#define DNS_SRC_PORT 1234
-#define DNS_TIMEOUT 5 // x 3s
+#define DNS_SRC_PORT 10053
+#define DNS_TIMEOUT 15000 // ms
 
 struct DNSHeader {
         uint16_t id; 
@@ -104,21 +104,26 @@
  */
 class XBeeWiFi : public XBee {
 public:
-    XBeeWiFi (PinName p_tx, PinName p_rx, PinName p_cts);
+    XBeeWiFi (PinName p_tx, PinName p_rx, PinName p_cts, PinName p_rts);
 
     int setup (int security, const char *ssid, const char *pin);
     int setup (const char *ssid);
     int reset ();
+    int baud (int b);
     int setAddress ();
     int setAddress (IpAddr &ipaddr, IpAddr &netmask, IpAddr &gateway, IpAddr &nameserver);
     int getAddress (IpAddr &ipaddr, IpAddr &netmask, IpAddr &gateway, IpAddr &nameserver);
     int setTimeout (int timeout);
     int getStatus ();
-    int getWiResponse (int apiId, int frameid = 0, int timeout = 1500);
+    int getWiResponse (int apiId, int frameid = 0, int timeout = 3000);
 #ifdef USE_WIFIDNS
     int setNameserver (IpAddr &nameserver);
     int getHostByName (const char* name, IpAddr &addr);
 #endif
+    /**
+     * Call with instance of AtCommandResponse only if getApiId() == AT_COMMAND_RESPONSE
+     */
+//    void getIPV4RxFrame (XBeeResponse &responses);
 
 protected:
     int getWiAddr (IpAddr &ipaddr);
@@ -140,8 +145,8 @@
     /**
      * Creates a unicast IPv4TransmitRequest with the DEFAULT_FRAME_ID
      */
-    IPv4TransmitRequest(IpAddr &dstAddr, uint16_t dstPort, uint16_t srcPort, uint8_t protocol, uint8_t option, uint8_t *data, uint8_t dataLength, uint8_t frameId);
-    IPv4TransmitRequest(IpAddr &dstAddr, uint16_t dstPort, uint8_t *data, uint8_t dataLength);
+    IPv4TransmitRequest(IpAddr &dstAddr, uint16_t dstPort, uint16_t srcPort, uint8_t protocol, uint8_t option, uint8_t *data, uint16_t dataLength, uint8_t frameId);
+    IPv4TransmitRequest(IpAddr &dstAddr, uint16_t dstPort, uint8_t *data, uint16_t dataLength);
     /**
      * Creates a default instance of this class.  At a minimum you must specify
      * a payload, payload length and a destination address before sending this request.
@@ -159,8 +164,8 @@
     void setOption(uint8_t option);
 protected:
     // declare virtual functions
-    virtual uint8_t getFrameData(uint8_t pos);
-    virtual uint8_t getFrameDataLength();
+    virtual uint8_t getFrameData(uint16_t pos);
+    virtual uint16_t getFrameDataLength();
 private:
     IpAddr _dstAddr;
     uint16_t _dstPort;
@@ -190,7 +195,7 @@
     uint16_t getSrcPort();
     uint8_t getProtocol();
     uint8_t getStatus();
-    virtual uint8_t getDataLength();
+    virtual uint16_t getDataLength();
     // frame position where data starts
     virtual uint8_t getDataOffset();
 private: