Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of jro by
Diff: JroIpdata.h
- Revision:
- 2:3d8d52e9751c
- Parent:
- 1:7c424a3e12ea
- Child:
- 4:de495ce256b8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/JroIpdata.h Thu Feb 05 19:01:42 2015 +0000 @@ -0,0 +1,77 @@ +#include "mbed.h" + +#define HEADER "$JRO$" +#define ID_CLASS 2 +#define ID_DEV 1 + +/* +IP DATA STRUCTURE + +5B 4B 1B 1B 2B NB 1B +CAB LEN ID_CLASS ID_DEV CMD PAYLOAD XOR + +ID_CLASS: Identifica la clase de dispositivo a programar + + 1 -> CR + 2 -> DDS + 3 -> JARS + 4 -> USRP + 5 -> ECHOTEK + 6 -> ABS + 7 -> CLK_GEN + +ID_DEV: Identifica el id del dispositivo a programar + + Desde el 1-255, el 0 es usado como broadcast. + +CMD: Identifica el comando enviado que define la operacion a realizar + + 1 -> RESET + 2 -> DEV. ENABLE + 3 -> CONFIG + 4 -> + 5 -> + +*/ + +class IpData{ + + private: + + char* rx_buff; + + char id_class; + char id_dev; + unsigned short cmd; + char* payload; + unsigned long len_payload; + char xor_rd; + + char *tx_buff; + unsigned long len_tx_data; + unsigned long len_tx_buffer; + + bool isValidData; + + char* __findHeader(char* buffer); + char __getXor(char* data, unsigned long len_data); + int __verifyData(char* ip_data, unsigned long len_data); + int __getParameters(); + + public: + + IpData(char* tx_buffer); + char id; + char* encode( unsigned short cmd, char* payload, unsigned long len_payload); + int decode(char* buffer, unsigned long len_buffer); + char getIdClass(); + char getIdDevice(); + unsigned short getCmd(); + unsigned long getPayloadLen(); + char* getPayload(); + char* getTxData(); + unsigned long getTxDataLen(); + + +}; + \ No newline at end of file