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:13:35 2013 +0000
Revision:
9:c8e4339ccc29
Parent:
8:4682155753ec
Child:
10:263f7251c111
It compiles...:)

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 8:4682155753ec 57 /** Sends data using the ascii mode
gert_lauritsen 7:45511c3d2950 58 */
gert_lauritsen 9:c8e4339ccc29 59
gert_lauritsen 9:c8e4339ccc29 60 int UniCast(char *adr,char *payload);
gert_lauritsen 8:4682155753ec 61 /** Sends data using the binary mode
gert_lauritsen 8:4682155753ec 62 */
gert_lauritsen 9:c8e4339ccc29 63 int UniCastb(char *adr,char *payload, char payloadSize);
gert_lauritsen 9:c8e4339ccc29 64 /** Pulls Resetpin
gert_lauritsen 9:c8e4339ccc29 65 */
gert_lauritsen 7:45511c3d2950 66 void Reset();
gert_lauritsen 7:45511c3d2950 67
gert_lauritsen 9:c8e4339ccc29 68 /** converts a string to a long
gert_lauritsen 9:c8e4339ccc29 69 */
gert_lauritsen 7:45511c3d2950 70 unsigned long hexToLong(const char *hex);
gert_lauritsen 8:4682155753ec 71 /** convertes a string to a int
gert_lauritsen 8:4682155753ec 72 */
gert_lauritsen 9:c8e4339ccc29 73 unsigned int hexToInt(const char *hex);
gert_lauritsen 9:c8e4339ccc29 74 /**
gert_lauritsen 9:c8e4339ccc29 75 */
gert_lauritsen 7:45511c3d2950 76 int EUI64;
gert_lauritsen 9:c8e4339ccc29 77 /** COO or FBB
gert_lauritsen 9:c8e4339ccc29 78 */
gert_lauritsen 7:45511c3d2950 79 char Devicetype[3];
gert_lauritsen 9:c8e4339ccc29 80 /** Gives type of HW
gert_lauritsen 9:c8e4339ccc29 81 */
gert_lauritsen 9:c8e4339ccc29 82 char HWType[15];
gert_lauritsen 9:c8e4339ccc29 83 /** incomming data
gert_lauritsen 9:c8e4339ccc29 84 */
gert_lauritsen 9:c8e4339ccc29 85 char Zdata[100];
gert_lauritsen 9:c8e4339ccc29 86
gert_lauritsen 9:c8e4339ccc29 87 int channel, NodeID, EPID,framesize;
tristanjph 0:2656fb225c5d 88 };