Dependencies: BLE_API mbed nRF51822
Fork of eco_Labs_ble_Client by
Diff: ble_msg_handler.cpp
- Revision:
- 22:7980e0aa7938
- Parent:
- 21:b2fc4f8b1d4e
- Child:
- 23:7c71b3313b9c
--- a/ble_msg_handler.cpp Wed Oct 19 08:07:16 2016 +0000 +++ b/ble_msg_handler.cpp Fri Oct 21 04:19:39 2016 +0000 @@ -35,7 +35,7 @@ /******************************************************************************/ /* Global Variables */ /******************************************************************************/ - +extern bool init_success; /******************************************************************************/ /* Static Variable Declarations */ /******************************************************************************/ @@ -76,9 +76,14 @@ } else if (rx_data[1] == BLE_SOF_CMD) { switch (rx_data[2]) { case BLE_INIT_CMD: - // TODO: Get the BLE Device name from rx_data and pass it to ble_init - ble_init(); - toggle_led(); + /* TODO: Get the BLE Device name from rx_data and pass it to + ble_init */ + if(init_success ==false) + { + ble_init(); + toggle_led(); + } + break; case BLE_START_ADV_CMD: @@ -88,19 +93,19 @@ case BLE_SEND_DATA_CMD: toggle_led(); memcpy(tmp_buf, &rx_data[4], rx_data[3]); - ble_send_data(rx_data, len); //jinuu + ble_send_data(tmp_buf, rx_data[3]); //jinuu break; case BLE_START_OF_FILE: toggle_led(); memcpy(tmp_buf, &rx_data[4], rx_data[3]); - ble_send_data(rx_data, len); //jinuu + ble_send_data(tmp_buf, rx_data[3]); //jinuu break; case BLE_END_OF_FILE: toggle_led(); memcpy(tmp_buf, &rx_data[4], rx_data[3]); - ble_send_data(rx_data, len); //jinuu + ble_send_data(tmp_buf, rx_data[3]); //jinuu break; default :