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.
Dependents: JRO_DDSv2 JRO_DDSv2_rev2019
Diff: JroIpdata.cpp
- Revision:
- 5:6500be930b36
- Parent:
- 4:de495ce256b8
- Child:
- 6:dd61acd77e2c
--- a/JroIpdata.cpp Tue Feb 10 14:28:42 2015 +0000 +++ b/JroIpdata.cpp Mon Feb 23 20:36:23 2015 +0000 @@ -169,6 +169,8 @@ this->len_payload = len_data - 5; //1B id_class, 1B id_dev, 2B cmd y 1B xor this->xor_rd = ip_data[4+len_data-1]; + this->payload[this->len_payload] = 0x00; //the last byte should be set to 0x00 (end of payload) + //printf("\r\nID_CLASS = 0x%x, ID_DEV = 0x%x, CMD = 0x%x, XOR = 0x%x", id_class, id_dev, cmd, xor_rd); //printf("\r\nPAYLOAD[0] = 0x%x, PYLD_LEN = 0x%x\r\n", payload[0], len_payload); @@ -231,7 +233,7 @@ return this->len_tx_buffer; } - + char* IpData::getNIData(unsigned short cmd){ char tx_data[5]; @@ -244,4 +246,32 @@ unsigned long IpData::getNIDataLen(){ return this->len_tx_buffer; +} + +char* IpData::getOKData(unsigned short cmd){ + + char tx_data[5]; + + strcpy(tx_data, OK_PAYLOAD); + + return this->encode(cmd, tx_data, OK_LEN); +} + +unsigned long IpData::getOKDataLen(){ + + return this->len_tx_buffer; +} + +char* IpData::getKOData(unsigned short cmd){ + + char tx_data[5]; + + strcpy(tx_data, KO_PAYLOAD); + + return this->encode(cmd, tx_data, KO_LEN); +} + +unsigned long IpData::getKODataLen(){ + + return this->len_tx_buffer; } \ No newline at end of file