Multitech + KL46Z NanoService example with the RTOS
Dependencies: mbed SocketModem nanoservice_client_1_12
Revision 8:f7d1fb34d71b, committed 2014-02-18
- Comitter:
- zdshelby
- Date:
- Tue Feb 18 02:03:19 2014 +0000
- Parent:
- 7:d2c5894dcd5e
- Child:
- 9:5b116d75f41a
- Commit message:
- - NSP registration successful
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Feb 18 01:50:19 2014 +0000 +++ b/main.cpp Tue Feb 18 02:03:19 2014 +0000 @@ -24,7 +24,7 @@ static const int NSP_PORT = 5683; char endpoint_name[] = {"mbed-multitech"}; uint8_t ep_type[] = {"mbed_lpc1768_appboard"}; -uint8_t lifetime_ptr[] = {"60"}; +uint8_t lifetime_ptr[] = {"86400"}; typedef uint8_t (*sn_grs_dyn_res_callback_t)(sn_coap_hdr_s *, sn_nsdl_addr_s *, sn_proto_info_s *); @@ -106,7 +106,12 @@ static uint8_t tx_cb(sn_nsdl_capab_e protocol, uint8_t *data_ptr, uint16_t data_len, sn_nsdl_addr_s *address_ptr) { DEBUG("TX callback! Sending %d bytes", data_len); - + char coap_len[2]; + coap_len[0] = data_len >> 8; + coap_len[1] = data_len & 0xFF; + + if(cellular->write((char*)&coap_len, 2, -1) != 2) + DEBUG("length sending failed"); if(cellular->write((char*)data_ptr, (int)data_len, -1) != data_len) DEBUG("sending failed");