A libery to connect to telegesis zigbee module. Bassed on implemtation of XBEE

Fork of xbee_lib by Tristan Hughes

Committer:
gert_lauritsen
Date:
Sun Oct 13 10:00:23 2013 +0000
Revision:
8:4682155753ec
Parent:
7:45511c3d2950
Child:
9:c8e4339ccc29
add funktions not tested

Who changed what in which revision?

UserRevisionLine numberNew 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 8:4682155753ec 32 /** Read data from zigbee
tristanjph 3:682615a0717e 33 */
gert_lauritsen 7:45511c3d2950 34
gert_lauritsen 7:45511c3d2950 35 int ATI();
gert_lauritsen 8:4682155753ec 36 /**
gert_lauritsen 8:4682155753ec 37 *
gert_lauritsen 7:45511c3d2950 38 */
gert_lauritsen 7:45511c3d2950 39 int PingOut();
gert_lauritsen 8:4682155753ec 40 /** Sends a ping to Coo
gert_lauritsen 7:45511c3d2950 41 */
gert_lauritsen 7:45511c3d2950 42 int PanScan();
gert_lauritsen 8:4682155753ec 43 /** Scan the Pan for nodes
gert_lauritsen 7:45511c3d2950 44 */
gert_lauritsen 7:45511c3d2950 45 int Establish_Network();
gert_lauritsen 7:45511c3d2950 46 /**
gert_lauritsen 7:45511c3d2950 47 */
gert_lauritsen 7:45511c3d2950 48 int JoinNetwork();
gert_lauritsen 8:4682155753ec 49 /** Join a pan
gert_lauritsen 7:45511c3d2950 50 */
gert_lauritsen 7:45511c3d2950 51 int ScanNetwork();
gert_lauritsen 8:4682155753ec 52 /** Scan network
gert_lauritsen 7:45511c3d2950 53 */
gert_lauritsen 7:45511c3d2950 54 int NetworkInfo();
gert_lauritsen 8:4682155753ec 55 /** Give info on what role the modem has in the network
gert_lauritsen 7:45511c3d2950 56 */
gert_lauritsen 7:45511c3d2950 57
gert_lauritsen 7:45511c3d2950 58 void UniCast(char *adr,char *payload);
gert_lauritsen 8:4682155753ec 59 /** Sends data using the ascii mode
gert_lauritsen 7:45511c3d2950 60 */
gert_lauritsen 7:45511c3d2950 61 void UniCastb(char *adr,char *payload, char payloadSize);
gert_lauritsen 8:4682155753ec 62 /** Sends data using the binary mode
gert_lauritsen 8:4682155753ec 63 */
gert_lauritsen 7:45511c3d2950 64
gert_lauritsen 7:45511c3d2950 65 void Reset();
gert_lauritsen 7:45511c3d2950 66
gert_lauritsen 7:45511c3d2950 67 unsigned long hexToLong(const char *hex);
gert_lauritsen 8:4682155753ec 68 /** converts a string to a long
gert_lauritsen 8:4682155753ec 69 */
gert_lauritsen 7:45511c3d2950 70 unsigned int hexToInt(const char *hex)
gert_lauritsen 8:4682155753ec 71 /** convertes a string to a int
gert_lauritsen 8:4682155753ec 72 */
gert_lauritsen 7:45511c3d2950 73
gert_lauritsen 7:45511c3d2950 74 int EUI64;
gert_lauritsen 7:45511c3d2950 75 char Devicetype[3];
gert_lauritsen 7:45511c3d2950 76 int channel, NodeID, EPID;
tristanjph 0:2656fb225c5d 77 };