A libery to connect to telegesis zigbee module. Bassed on implemtation of XBEE
Fork of xbee_lib by
telegesis.h@7:45511c3d2950, 2013-10-13 (annotated)
- Committer:
- gert_lauritsen
- Date:
- Sun Oct 13 09:46:49 2013 +0000
- Revision:
- 7:45511c3d2950
- Parent:
- xbee.h@6:6455a079bdb3
- Child:
- 8:4682155753ec
First test of zigbee
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tristanjph | 0:2656fb225c5d | 1 | #include "mbed.h" |
tristanjph | 0:2656fb225c5d | 2 | |
gert_lauritsen | 7:45511c3d2950 | 3 | /** Zigbee interface class for configuring, sending and recieving data using an telegesis zigbee */ |
gert_lauritsen | 7:45511c3d2950 | 4 | class zigbee |
tristanjph | 2:cb627ea9b817 | 5 | { |
tristanjph | 0:2656fb225c5d | 6 | private: |
tristanjph | 0:2656fb225c5d | 7 | PinName _tx; |
tristanjph | 0:2656fb225c5d | 8 | PinName _rx; |
tristanjph | 3:682615a0717e | 9 | PinName _reset; |
tristanjph | 0:2656fb225c5d | 10 | public: |
gert_lauritsen | 7:45511c3d2950 | 11 | |
gert_lauritsen | 7:45511c3d2950 | 12 | zigbee(PinName tx, PinName rx, PinName reset); |
gert_lauritsen | 7:45511c3d2950 | 13 | ~zigbee(); |
gert_lauritsen | 7:45511c3d2950 | 14 | |
gert_lauritsen | 7:45511c3d2950 | 15 | |
gert_lauritsen | 7:45511c3d2950 | 16 | /** Gets the serial number/mac address of the zigbee and places it into serial_no. |
gert_lauritsen | 7:45511c3d2950 | 17 | * @param serial_no array to store the serial of zigbee (must be 8 long). |
tristanjph | 2:cb627ea9b817 | 18 | * @return Returns 1 on success. |
tristanjph | 2:cb627ea9b817 | 19 | */ |
tristanjph | 2:cb627ea9b817 | 20 | int GetSerial(int*); |
tristanjph | 6:6455a079bdb3 | 21 | /** Sets the encryption key. This should be a 128-bit key. |
tristanjph | 2:cb627ea9b817 | 22 | * @param key Pointer to the network key to set. |
tristanjph | 2:cb627ea9b817 | 23 | * @return Returns 1 on success. |
tristanjph | 1:c3d9bdcb0b03 | 24 | */ |
tristanjph | 5:714651141a83 | 25 | int SetKey(char*); |
gert_lauritsen | 7:45511c3d2950 | 26 | |
tristanjph | 2:cb627ea9b817 | 27 | /** Recieves data sent to the xbee. |
tristanjph | 2:cb627ea9b817 | 28 | * @param data_buf Pointer to the buffer to put recieved data into. |
tristanjph | 2:cb627ea9b817 | 29 | * @param numchar Number of characters to read. If 0, will use the size of data_buf. |
tristanjph | 2:cb627ea9b817 | 30 | */ |
tristanjph | 2:cb627ea9b817 | 31 | void RecieveData(char*, int); |
tristanjph | 3:682615a0717e | 32 | /** Resets the Xbee. |
tristanjph | 3:682615a0717e | 33 | */ |
gert_lauritsen | 7:45511c3d2950 | 34 | |
gert_lauritsen | 7:45511c3d2950 | 35 | int ATI(); |
gert_lauritsen | 7:45511c3d2950 | 36 | /** |
gert_lauritsen | 7:45511c3d2950 | 37 | */ |
gert_lauritsen | 7:45511c3d2950 | 38 | int PingOut(); |
gert_lauritsen | 7:45511c3d2950 | 39 | /** |
gert_lauritsen | 7:45511c3d2950 | 40 | */ |
gert_lauritsen | 7:45511c3d2950 | 41 | int PanScan(); |
gert_lauritsen | 7:45511c3d2950 | 42 | /** |
gert_lauritsen | 7:45511c3d2950 | 43 | */ |
gert_lauritsen | 7:45511c3d2950 | 44 | int Establish_Network(); |
gert_lauritsen | 7:45511c3d2950 | 45 | /** |
gert_lauritsen | 7:45511c3d2950 | 46 | */ |
gert_lauritsen | 7:45511c3d2950 | 47 | int JoinNetwork(); |
gert_lauritsen | 7:45511c3d2950 | 48 | /** |
gert_lauritsen | 7:45511c3d2950 | 49 | */ |
gert_lauritsen | 7:45511c3d2950 | 50 | int ScanNetwork(); |
gert_lauritsen | 7:45511c3d2950 | 51 | /** |
gert_lauritsen | 7:45511c3d2950 | 52 | */ |
gert_lauritsen | 7:45511c3d2950 | 53 | int NetworkInfo(); |
gert_lauritsen | 7:45511c3d2950 | 54 | /** |
gert_lauritsen | 7:45511c3d2950 | 55 | */ |
gert_lauritsen | 7:45511c3d2950 | 56 | |
gert_lauritsen | 7:45511c3d2950 | 57 | void UniCast(char *adr,char *payload); |
gert_lauritsen | 7:45511c3d2950 | 58 | /** |
gert_lauritsen | 7:45511c3d2950 | 59 | */ |
gert_lauritsen | 7:45511c3d2950 | 60 | void UniCastb(char *adr,char *payload, char payloadSize); |
gert_lauritsen | 7:45511c3d2950 | 61 | |
gert_lauritsen | 7:45511c3d2950 | 62 | void Reset(); |
gert_lauritsen | 7:45511c3d2950 | 63 | |
gert_lauritsen | 7:45511c3d2950 | 64 | unsigned long hexToLong(const char *hex); |
gert_lauritsen | 7:45511c3d2950 | 65 | |
gert_lauritsen | 7:45511c3d2950 | 66 | unsigned int hexToInt(const char *hex) |
gert_lauritsen | 7:45511c3d2950 | 67 | |
gert_lauritsen | 7:45511c3d2950 | 68 | int EUI64; |
gert_lauritsen | 7:45511c3d2950 | 69 | char Devicetype[3]; |
gert_lauritsen | 7:45511c3d2950 | 70 | int channel, NodeID, EPID; |
tristanjph | 0:2656fb225c5d | 71 | }; |