BLE mbed Endpoint network stack for mbedConnectorInterface. The stack makes use of a special BLE Socket abstraction to create socket() semantics over BLE.
Dependencies: libnsdl_m0 BLE_API Base64 nRF51822 SplitterAssembler
Diff: NSDL/nsdl_support.cpp
- Revision:
- 7:203c348ccc66
- Parent:
- 6:98af441fd960
- Child:
- 9:bf0cf5828378
--- a/NSDL/nsdl_support.cpp Tue Feb 17 02:56:36 2015 +0000 +++ b/NSDL/nsdl_support.cpp Tue Feb 17 06:59:54 2015 +0000 @@ -16,6 +16,8 @@ #include "BLEDevice.h" +#define NSDL_BUFFER_LENGTH 1024 + extern BLEDevice ble; Endpoint nsp; @@ -175,7 +177,7 @@ sn_nsdl_addr_s received_packet_address; Endpoint from; uint8_t nsp_received_address[4]; - char nsp_buffer[1024]; + char nsp_buffer[NSDL_BUFFER_LENGTH]; memset(&received_packet_address, 0, sizeof(sn_nsdl_addr_s)); memset(nsp_received_address, 0, sizeof(nsp_received_address)); @@ -193,7 +195,7 @@ // only process if we are registered and thus connected... otherwise ignore if (__registered == true) { DBG("NSP: waiting for data...\r\n"); - int n = server.receiveFrom(from,nsp_buffer,sizeof(nsp_buffer)); + int n = server.receiveFrom(from,nsp_buffer,NSDL_BUFFER_LENGTH); if (n >= 0) { DBG("NSP: received %d bytes... processing..\r\n.",n); sn_nsdl_process_coap((uint8_t*)nsp_buffer,n,&received_packet_address);