A libery to connect to telegesis zigbee module. Bassed on implemtation of XBEE
Fork of xbee_lib by
telegesis.h@10:263f7251c111, 2013-10-13 (annotated)
- Committer:
- gert_lauritsen
- Date:
- Sun Oct 13 20:49:23 2013 +0000
- Revision:
- 10:263f7251c111
- Parent:
- 9:c8e4339ccc29
- Child:
- 11:18ff088287ea
Starting to make a libery to be able to talk to telegesis zigbee module
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); |
gert_lauritsen | 10:263f7251c111 | 32 | /** Get hw version and local ID (64bit uniq number) |
gert_lauritsen | 10:263f7251c111 | 33 | * |
gert_lauritsen | 10:263f7251c111 | 34 | */ |
gert_lauritsen | 7:45511c3d2950 | 35 | int ATI(); |
gert_lauritsen | 10:263f7251c111 | 36 | /** Sends a ping to Coo or any other adresse |
gert_lauritsen | 8:4682155753ec | 37 | * |
gert_lauritsen | 7:45511c3d2950 | 38 | */ |
gert_lauritsen | 7:45511c3d2950 | 39 | int PingOut(); |
gert_lauritsen | 10:263f7251c111 | 40 | /** Scan the Pan for nodes |
gert_lauritsen | 7:45511c3d2950 | 41 | */ |
gert_lauritsen | 7:45511c3d2950 | 42 | int PanScan(); |
gert_lauritsen | 10:263f7251c111 | 43 | /** Make a new network. It then gets the role as coordinator |
gert_lauritsen | 7:45511c3d2950 | 44 | */ |
gert_lauritsen | 7:45511c3d2950 | 45 | int Establish_Network(); |
gert_lauritsen | 10:263f7251c111 | 46 | /** Join a pan |
gert_lauritsen | 7:45511c3d2950 | 47 | */ |
gert_lauritsen | 7:45511c3d2950 | 48 | int JoinNetwork(); |
gert_lauritsen | 10:263f7251c111 | 49 | /** |
gert_lauritsen | 10:263f7251c111 | 50 | * Scan network |
gert_lauritsen | 7:45511c3d2950 | 51 | */ |
gert_lauritsen | 7:45511c3d2950 | 52 | int ScanNetwork(); |
gert_lauritsen | 10:263f7251c111 | 53 | /** |
gert_lauritsen | 10:263f7251c111 | 54 | *Give info on what role the modem has in the network |
gert_lauritsen | 7:45511c3d2950 | 55 | */ |
gert_lauritsen | 10:263f7251c111 | 56 | |
gert_lauritsen | 7:45511c3d2950 | 57 | int NetworkInfo(); |
gert_lauritsen | 10:263f7251c111 | 58 | /** |
gert_lauritsen | 7:45511c3d2950 | 59 | */ |
gert_lauritsen | 8:4682155753ec | 60 | /** Sends data using the ascii mode |
gert_lauritsen | 10:263f7251c111 | 61 | */ |
gert_lauritsen | 9:c8e4339ccc29 | 62 | int UniCast(char *adr,char *payload); |
gert_lauritsen | 8:4682155753ec | 63 | /** Sends data using the binary mode |
gert_lauritsen | 8:4682155753ec | 64 | */ |
gert_lauritsen | 9:c8e4339ccc29 | 65 | int UniCastb(char *adr,char *payload, char payloadSize); |
gert_lauritsen | 9:c8e4339ccc29 | 66 | /** Pulls Resetpin |
gert_lauritsen | 9:c8e4339ccc29 | 67 | */ |
gert_lauritsen | 7:45511c3d2950 | 68 | void Reset(); |
gert_lauritsen | 10:263f7251c111 | 69 | |
gert_lauritsen | 9:c8e4339ccc29 | 70 | /** converts a string to a long |
gert_lauritsen | 9:c8e4339ccc29 | 71 | */ |
gert_lauritsen | 7:45511c3d2950 | 72 | unsigned long hexToLong(const char *hex); |
gert_lauritsen | 8:4682155753ec | 73 | /** convertes a string to a int |
gert_lauritsen | 8:4682155753ec | 74 | */ |
gert_lauritsen | 9:c8e4339ccc29 | 75 | unsigned int hexToInt(const char *hex); |
gert_lauritsen | 9:c8e4339ccc29 | 76 | /** |
gert_lauritsen | 9:c8e4339ccc29 | 77 | */ |
gert_lauritsen | 7:45511c3d2950 | 78 | int EUI64; |
gert_lauritsen | 9:c8e4339ccc29 | 79 | /** COO or FBB |
gert_lauritsen | 9:c8e4339ccc29 | 80 | */ |
gert_lauritsen | 7:45511c3d2950 | 81 | char Devicetype[3]; |
gert_lauritsen | 9:c8e4339ccc29 | 82 | /** Gives type of HW |
gert_lauritsen | 9:c8e4339ccc29 | 83 | */ |
gert_lauritsen | 9:c8e4339ccc29 | 84 | char HWType[15]; |
gert_lauritsen | 9:c8e4339ccc29 | 85 | /** incomming data |
gert_lauritsen | 9:c8e4339ccc29 | 86 | */ |
gert_lauritsen | 9:c8e4339ccc29 | 87 | char Zdata[100]; |
gert_lauritsen | 9:c8e4339ccc29 | 88 | |
gert_lauritsen | 9:c8e4339ccc29 | 89 | int channel, NodeID, EPID,framesize; |
tristanjph | 0:2656fb225c5d | 90 | }; |