Working Code

Dependencies:   BLE_API mbed nRF51822

Fork of BLE_Central_Light_Demo by HM_IOT_Demo

Committer:
hmiot
Date:
Tue Jan 31 11:28:52 2017 +0000
Revision:
12:cd54180657ee
Parent:
11:58d8a3129877
Child:
13:9b2a587ee7ac
update

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hmiot 7:66586d2d7cb5 1 /************************************************************************
hmiot 7:66586d2d7cb5 2 * *
hmiot 7:66586d2d7cb5 3 * *
hmiot 7:66586d2d7cb5 4 ************************************************************************/
hmiot 6:71e7a446ae6a 5
hmiot 7:66586d2d7cb5 6 #include "hm_config.h"
hmiot 9:b967a01810e1 7 //#include "rtos.h"
hmiot 7:66586d2d7cb5 8
hmiot 12:cd54180657ee 9 //DiscoveredCharacteristic lightCharacteristic;
hmiot 12:cd54180657ee 10 static s_serviceInfo lightChar = {NULL,NULL,NULL,NULL};
hmiot 6:71e7a446ae6a 11 Serial pc(USBTX, USBRX);
hmiot 6:71e7a446ae6a 12
hmiot 9:b967a01810e1 13 void bleint();
hmiot 9:b967a01810e1 14 void SPI_Slave_read();
hmiot 10:5e5fa5bf77b5 15 void waitBleEvent();
hmiot 10:5e5fa5bf77b5 16 void ble_actions(int spi_data);
hmiot 9:b967a01810e1 17
hmiot 8:285ebd0e83fb 18 SPISlave spiSlave(P0_9, P0_11, P0_8, P0_10);
hmiot 8:285ebd0e83fb 19
mbed_tw_hoehoe 3:d6f80e11a7f4 20
hmiot 6:71e7a446ae6a 21 void advertisementCallback(const Gap::AdvertisementCallbackParams_t *params) {
hmiot 6:71e7a446ae6a 22 uint8_t con_status =0;
hmiot 6:71e7a446ae6a 23 //0x51 for Magic light
hmiot 6:71e7a446ae6a 24 //0x5A
hmiot 11:58d8a3129877 25 int i;
hmiot 11:58d8a3129877 26 //for(i=0; i<2; i++){
hmiot 11:58d8a3129877 27 if ((params->peerAddr[0] == 0x51) || (params->peerAddr[0] == 0x5A)) { // 0x2F for red bear1.5 /* !ALERT! Alter this filter to suit your device. */
hmiot 8:285ebd0e83fb 28
hmiot 8:285ebd0e83fb 29 pc.printf("adv peerAddr[%02x %02x %02x %02x %02x %02x] rssi %d, isScanResponse %u, AdvertisementType %u\r\n",
mbed_tw_hoehoe 0:83b5c6efd8d7 30 params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],
mbed_tw_hoehoe 0:83b5c6efd8d7 31 params->rssi, params->isScanResponse, params->type);
hmiot 6:71e7a446ae6a 32 pc.printf("Data Length : %d\r\n",params->advertisingDataLen);
hmiot 8:285ebd0e83fb 33 con_status = BLE::Instance().gap().connect(params->peerAddr, Gap::ADDR_TYPE_PUBLIC, NULL, NULL);
hmiot 8:285ebd0e83fb 34 pc.printf("Connection Status : %d\r\n",con_status);
hmiot 8:285ebd0e83fb 35 connect_status = 1;
hmiot 11:58d8a3129877 36 i++;
hmiot 11:58d8a3129877 37 //BLE::Instance().gap().stopScan();
hmiot 9:b967a01810e1 38
hmiot 11:58d8a3129877 39 }else{
hmiot 11:58d8a3129877 40 printf("Not Matched your device\r\n");
hmiot 11:58d8a3129877 41 return;
hmiot 11:58d8a3129877 42 }
hmiot 11:58d8a3129877 43 //}
hmiot 8:285ebd0e83fb 44 }
mbed_tw_hoehoe 0:83b5c6efd8d7 45
mbed_tw_hoehoe 0:83b5c6efd8d7 46 void serviceDiscoveryCallback(const DiscoveredService *service) {
hmiot 6:71e7a446ae6a 47 pc.printf("Service Discovery Callback\r\n");
hmiot 6:71e7a446ae6a 48 if (service->getUUID().shortOrLong() == UUID::UUID_TYPE_SHORT) {
hmiot 6:71e7a446ae6a 49 pc.printf("S UUID-%x attrs[%u %u]\r\n", service->getUUID().getShortUUID(), service->getStartHandle(), service->getEndHandle());
hmiot 6:71e7a446ae6a 50 } else {
hmiot 6:71e7a446ae6a 51 pc.printf("S UUID-");
hmiot 6:71e7a446ae6a 52 const uint8_t *longUUIDBytes = service->getUUID().getBaseUUID();
hmiot 6:71e7a446ae6a 53 for (unsigned i = 0; i < UUID::LENGTH_OF_LONG_UUID; i++) {
hmiot 6:71e7a446ae6a 54 printf("%02x", longUUIDBytes[i]);
hmiot 6:71e7a446ae6a 55 }
hmiot 6:71e7a446ae6a 56 pc.printf(" attrs[%u %u]\r\n", service->getStartHandle(), service->getEndHandle());
hmiot 6:71e7a446ae6a 57 }
mbed_tw_hoehoe 0:83b5c6efd8d7 58 }
mbed_tw_hoehoe 0:83b5c6efd8d7 59
mbed_tw_hoehoe 0:83b5c6efd8d7 60 void characteristicDiscoveryCallback(const DiscoveredCharacteristic *characteristicP) {
hmiot 6:71e7a446ae6a 61 pc.printf(" C UUID-%x valueAttr[%u] props[%x]\r\n", characteristicP->getUUID().getShortUUID(), characteristicP->getValueHandle(), (uint8_t)characteristicP->getProperties().broadcast());
hmiot 12:cd54180657ee 62 DiscoveredCharacteristic lightCharacteristic;
hmiot 9:b967a01810e1 63 if (characteristicP->getUUID().getShortUUID() == 0xffe9) { /* !ALERT! Alter this filter to suit your device. */
hmiot 8:285ebd0e83fb 64 lightCharacteristic = *characteristicP;
hmiot 6:71e7a446ae6a 65 pc.printf("Matched char UUID\r\n");
hmiot 8:285ebd0e83fb 66 printf("Conn Handle = %dand %d \r\n",characteristicP->getConnectionHandle(), lightCharacteristic.getConnectionHandle());
hmiot 8:285ebd0e83fb 67 printf("Value Handle = %d and %d\r\n",characteristicP->getValueHandle(),lightCharacteristic.getValueHandle());
hmiot 10:5e5fa5bf77b5 68 AddCharNodes(lightCharacteristic);
hmiot 9:b967a01810e1 69 charDiscover = 1;
hmiot 9:b967a01810e1 70 serviceDiscover = true;
hmiot 9:b967a01810e1 71 }else {
hmiot 8:285ebd0e83fb 72 printf("Not Matched char UUID\r\n");
mbed_tw_hoehoe 2:4b53d13d9851 73 }
mbed_tw_hoehoe 0:83b5c6efd8d7 74 }
mbed_tw_hoehoe 0:83b5c6efd8d7 75
hmiot 8:285ebd0e83fb 76 void AddCharNodes(DiscoveredCharacteristic light_Characteristic)
hmiot 8:285ebd0e83fb 77 {
hmiot 8:285ebd0e83fb 78 printf("Add Char Nodes\r\n");
hmiot 8:285ebd0e83fb 79 lightCharacteristic_t *ptr_temp_char = NULL;
hmiot 8:285ebd0e83fb 80 ptr_temp_char = lightChar.services_Char[0];
hmiot 8:285ebd0e83fb 81
hmiot 8:285ebd0e83fb 82 if(NULL == ptr_temp_char)
hmiot 8:285ebd0e83fb 83 {
hmiot 12:cd54180657ee 84 ptr_temp_char = new lightCharacteristic_t;
hmiot 8:285ebd0e83fb 85 lightChar.services_Char[0] = ptr_temp_char;
hmiot 8:285ebd0e83fb 86 }
hmiot 8:285ebd0e83fb 87 else
hmiot 8:285ebd0e83fb 88 {
hmiot 8:285ebd0e83fb 89 while(NULL != ptr_temp_char->nextChar)
hmiot 8:285ebd0e83fb 90 {
hmiot 8:285ebd0e83fb 91 ptr_temp_char = ptr_temp_char->nextChar;
hmiot 8:285ebd0e83fb 92 }
hmiot 8:285ebd0e83fb 93
hmiot 8:285ebd0e83fb 94 /* add a new node */
hmiot 12:cd54180657ee 95 ptr_temp_char->nextChar = new lightCharacteristic_t;
hmiot 8:285ebd0e83fb 96 ptr_temp_char = ptr_temp_char->nextChar;
hmiot 8:285ebd0e83fb 97 }
hmiot 8:285ebd0e83fb 98
hmiot 8:285ebd0e83fb 99 /* assign data to the node */
hmiot 8:285ebd0e83fb 100 ptr_temp_char->u_characteristicID = 1;
hmiot 8:285ebd0e83fb 101 printf("Conn Handle = %d\r\n",light_Characteristic.getConnectionHandle());
hmiot 8:285ebd0e83fb 102 printf("Value Handle = %d\r\n",light_Characteristic.getValueHandle());
hmiot 8:285ebd0e83fb 103 ptr_temp_char->connHandle = light_Characteristic.getConnectionHandle();
hmiot 8:285ebd0e83fb 104 ptr_temp_char->valueHandle = light_Characteristic.getValueHandle();
hmiot 8:285ebd0e83fb 105 ptr_temp_char->nextChar = NULL;
hmiot 8:285ebd0e83fb 106 }
hmiot 8:285ebd0e83fb 107
mbed_tw_hoehoe 0:83b5c6efd8d7 108 void discoveryTerminationCallback(Gap::Handle_t connectionHandle) {
mbed_tw_hoehoe 1:2f1203d70643 109 pc.printf("terminated SD for handle %u\r\n", connectionHandle);
hmiot 8:285ebd0e83fb 110 serviceDiscover = false;
mbed_tw_hoehoe 0:83b5c6efd8d7 111 }
mbed_tw_hoehoe 0:83b5c6efd8d7 112
hmiot 6:71e7a446ae6a 113 void connectionCallback(const Gap::ConnectionCallbackParams_t *params) {
hmiot 6:71e7a446ae6a 114 pc.printf("Connection Callback\n\r");
hmiot 6:71e7a446ae6a 115 if (params->role == Gap::CENTRAL) {
hmiot 6:71e7a446ae6a 116 pc.printf("Service and characterstics discovery callback\r\n");
hmiot 6:71e7a446ae6a 117 BLE::Instance().gattClient().onServiceDiscoveryTermination(discoveryTerminationCallback);
hmiot 6:71e7a446ae6a 118 BLE::Instance().gattClient().launchServiceDiscovery(params->handle, serviceDiscoveryCallback, characteristicDiscoveryCallback, 0xffe5, 0xffe9);
hmiot 10:5e5fa5bf77b5 119 // 0xffe5 --> Services UUID
hmiot 10:5e5fa5bf77b5 120 // 0xffe9 --> Characteristics UUID
mbed_tw_hoehoe 0:83b5c6efd8d7 121 }
hmiot 6:71e7a446ae6a 122 }
hmiot 6:71e7a446ae6a 123
hmiot 6:71e7a446ae6a 124 void disconnectionCallback(const Gap::DisconnectionCallbackParams_t *params) {
hmiot 6:71e7a446ae6a 125 pc.printf("disconnected\r\n");
hmiot 8:285ebd0e83fb 126 BLE::Instance().gap().startScan(advertisementCallback);
mbed_tw_hoehoe 0:83b5c6efd8d7 127 }
mbed_tw_hoehoe 0:83b5c6efd8d7 128
hmiot 6:71e7a446ae6a 129
hmiot 6:71e7a446ae6a 130 /**
hmiot 6:71e7a446ae6a 131 * Callback triggered when the ble initialization process has finished
hmiot 6:71e7a446ae6a 132 */
hmiot 6:71e7a446ae6a 133 void bleInitComplete(BLE::InitializationCompleteCallbackContext *params)
hmiot 6:71e7a446ae6a 134 {
hmiot 6:71e7a446ae6a 135 BLE& ble = params->ble;
hmiot 8:285ebd0e83fb 136
hmiot 6:71e7a446ae6a 137 pc.printf("Ble Init\n\r");
hmiot 9:b967a01810e1 138 /* Ensure that it is the default instance of BLE */
hmiot 6:71e7a446ae6a 139 if(ble.getInstanceID() != BLE::DEFAULT_INSTANCE) {
hmiot 6:71e7a446ae6a 140 return;
hmiot 9:b967a01810e1 141 }
hmiot 6:71e7a446ae6a 142
hmiot 9:b967a01810e1 143 ble.gap().onConnection(connectionCallback);
hmiot 9:b967a01810e1 144 ble.gap().onDisconnection(disconnectionCallback);
hmiot 9:b967a01810e1 145 ble.gap().setScanParams(1000, 800);
hmiot 9:b967a01810e1 146 ble.gap().startScan(advertisementCallback);
hmiot 10:5e5fa5bf77b5 147
hmiot 8:285ebd0e83fb 148 }
hmiot 8:285ebd0e83fb 149
hmiot 8:285ebd0e83fb 150 void light_actions(int service_char[]){
hmiot 8:285ebd0e83fb 151 lightCharacteristic_t *ptr_tmp = NULL;
hmiot 9:b967a01810e1 152 ptr_tmp = lightChar.services_Char[service_char[1]-1];
hmiot 10:5e5fa5bf77b5 153 if(connect_status)
hmiot 10:5e5fa5bf77b5 154 {
hmiot 9:b967a01810e1 155
hmiot 10:5e5fa5bf77b5 156 switch(service_char[2])
hmiot 10:5e5fa5bf77b5 157 {
hmiot 10:5e5fa5bf77b5 158 case TURN_OFF: // off
hmiot 10:5e5fa5bf77b5 159 write_data[0]=0x56;
hmiot 10:5e5fa5bf77b5 160 write_data[1]=0x00;
hmiot 10:5e5fa5bf77b5 161 write_data[2]=0x00;
hmiot 10:5e5fa5bf77b5 162 write_data[3]=0x00;
hmiot 10:5e5fa5bf77b5 163 write_data[4]=0x00;
hmiot 10:5e5fa5bf77b5 164 write_data[5]=0xf0;
hmiot 10:5e5fa5bf77b5 165 write_data[6]=0xaa;
hmiot 10:5e5fa5bf77b5 166 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,write_data);
hmiot 10:5e5fa5bf77b5 167 break;
hmiot 8:285ebd0e83fb 168
hmiot 10:5e5fa5bf77b5 169 case TURN_ON: //on
hmiot 10:5e5fa5bf77b5 170 if(first_on){
hmiot 10:5e5fa5bf77b5 171 pre_write_data[0]=0x56;
hmiot 10:5e5fa5bf77b5 172 pre_write_data[1]=0xDE;
hmiot 10:5e5fa5bf77b5 173 pre_write_data[2]=0x8E;
hmiot 10:5e5fa5bf77b5 174 pre_write_data[3]=0xEE;
hmiot 10:5e5fa5bf77b5 175 pre_write_data[4]=0x00;
hmiot 10:5e5fa5bf77b5 176 pre_write_data[5]=0xf0;
hmiot 10:5e5fa5bf77b5 177 pre_write_data[6]=0xaa;
hmiot 10:5e5fa5bf77b5 178 }
hmiot 10:5e5fa5bf77b5 179 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,pre_write_data);
hmiot 10:5e5fa5bf77b5 180 break;
hmiot 8:285ebd0e83fb 181
hmiot 10:5e5fa5bf77b5 182 case COLOR: // Color
hmiot 12:cd54180657ee 183 switch(service_char[3])
hmiot 12:cd54180657ee 184 {
hmiot 12:cd54180657ee 185 case RED:
hmiot 12:cd54180657ee 186 write_data[0]=0x56;
hmiot 12:cd54180657ee 187 write_data[1]=0xff;
hmiot 12:cd54180657ee 188 write_data[2]=0x00;
hmiot 12:cd54180657ee 189 write_data[3]=0x00;
hmiot 12:cd54180657ee 190 write_data[4]=0x00;
hmiot 12:cd54180657ee 191 write_data[5]=0xf0;
hmiot 12:cd54180657ee 192 write_data[6]=0xaa;
hmiot 12:cd54180657ee 193 datancpy((char *)pre_write_data, (char *)write_data,6);
hmiot 12:cd54180657ee 194 first_on=false;
hmiot 12:cd54180657ee 195 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,write_data);
hmiot 12:cd54180657ee 196 break;
hmiot 12:cd54180657ee 197
hmiot 12:cd54180657ee 198 case GREEN:
hmiot 12:cd54180657ee 199 write_data[0]=0x56;
hmiot 12:cd54180657ee 200 write_data[1]=0x00;
hmiot 12:cd54180657ee 201 write_data[2]=0xff;
hmiot 12:cd54180657ee 202 write_data[3]=0x00;
hmiot 12:cd54180657ee 203 write_data[4]=0x00;
hmiot 12:cd54180657ee 204 write_data[5]=0xf0;
hmiot 12:cd54180657ee 205 write_data[6]=0xaa;
hmiot 12:cd54180657ee 206 datancpy((char *)pre_write_data, (char *)write_data,6);
hmiot 12:cd54180657ee 207 first_on=false;
hmiot 12:cd54180657ee 208 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,write_data);
hmiot 12:cd54180657ee 209 break;
hmiot 12:cd54180657ee 210 case BLUE:
hmiot 12:cd54180657ee 211 write_data[0]=0x56;
hmiot 12:cd54180657ee 212 write_data[1]=0x00;
hmiot 12:cd54180657ee 213 write_data[2]=0x00;
hmiot 12:cd54180657ee 214 write_data[3]=0xff;
hmiot 12:cd54180657ee 215 write_data[4]=0x00;
hmiot 12:cd54180657ee 216 write_data[5]=0xf0;
hmiot 12:cd54180657ee 217 write_data[6]=0xaa;
hmiot 12:cd54180657ee 218 datancpy((char *)pre_write_data, (char *)write_data,6);
hmiot 12:cd54180657ee 219 first_on=false;
hmiot 12:cd54180657ee 220 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,write_data);
hmiot 12:cd54180657ee 221 break;
hmiot 12:cd54180657ee 222 case YELLOW:
hmiot 12:cd54180657ee 223 write_data[0]=0x56;
hmiot 12:cd54180657ee 224 write_data[1]=0xff;
hmiot 12:cd54180657ee 225 write_data[2]=0xff;
hmiot 12:cd54180657ee 226 write_data[3]=0x00;
hmiot 12:cd54180657ee 227 write_data[4]=0x00;
hmiot 12:cd54180657ee 228 write_data[5]=0xf0;
hmiot 12:cd54180657ee 229 write_data[6]=0xaa;
hmiot 12:cd54180657ee 230 datancpy((char *)pre_write_data, (char *)write_data,6);
hmiot 12:cd54180657ee 231 first_on=false;
hmiot 12:cd54180657ee 232 error_status = BLE::Instance().gattClient().write(GattClient::GATT_OP_WRITE_CMD,ptr_tmp->connHandle,ptr_tmp->valueHandle,8,write_data);
hmiot 12:cd54180657ee 233 break;
hmiot 12:cd54180657ee 234 default:
hmiot 12:cd54180657ee 235 printf("Invalid\r\n");
hmiot 12:cd54180657ee 236 }
hmiot 12:cd54180657ee 237
hmiot 10:5e5fa5bf77b5 238 break;
hmiot 8:285ebd0e83fb 239
hmiot 10:5e5fa5bf77b5 240 default:
hmiot 10:5e5fa5bf77b5 241 printf("Invalid Options\r\n");
hmiot 10:5e5fa5bf77b5 242 }
hmiot 10:5e5fa5bf77b5 243 printf("Error Status =%d\n\r",error_status);
hmiot 12:cd54180657ee 244
hmiot 12:cd54180657ee 245
hmiot 10:5e5fa5bf77b5 246 }
hmiot 8:285ebd0e83fb 247 }
hmiot 8:285ebd0e83fb 248
hmiot 12:cd54180657ee 249 void datancpy(char pre_write[], char writeData[], int data_size){
hmiot 8:285ebd0e83fb 250 int numCount;
hmiot 8:285ebd0e83fb 251 for(numCount=0; numCount <= data_size; numCount++){
hmiot 8:285ebd0e83fb 252 pre_write[numCount] = writeData[numCount];
hmiot 8:285ebd0e83fb 253 }
hmiot 8:285ebd0e83fb 254
mbed_tw_hoehoe 2:4b53d13d9851 255 }
mbed_tw_hoehoe 2:4b53d13d9851 256
hmiot 8:285ebd0e83fb 257 void bleint()
hmiot 8:285ebd0e83fb 258 {
hmiot 8:285ebd0e83fb 259 printf("Init\r\n");
hmiot 9:b967a01810e1 260 BLE &ble = BLE::Instance();
hmiot 8:285ebd0e83fb 261 BLE::Instance().init(bleInitComplete);
hmiot 8:285ebd0e83fb 262 }
hmiot 8:285ebd0e83fb 263
hmiot 8:285ebd0e83fb 264 int main()
hmiot 8:285ebd0e83fb 265 {
hmiot 8:285ebd0e83fb 266 // Serial port configuration
mbed_tw_hoehoe 1:2f1203d70643 267 pc.baud(9600);
mbed_tw_hoehoe 0:83b5c6efd8d7 268 wait(8.0);
hmiot 9:b967a01810e1 269 pc.printf("Start\n\r");
hmiot 10:5e5fa5bf77b5 270 // int options;
hmiot 12:cd54180657ee 271 spiSlave.reply(191);
hmiot 9:b967a01810e1 272 bleint();
hmiot 10:5e5fa5bf77b5 273 bufferSize = 0;
hmiot 10:5e5fa5bf77b5 274 while(1){
hmiot 9:b967a01810e1 275 //printf("loop\r\n");
hmiot 11:58d8a3129877 276 // if(!(connect_status && charDiscover))
hmiot 10:5e5fa5bf77b5 277 waitBleEvent();
hmiot 10:5e5fa5bf77b5 278
hmiot 12:cd54180657ee 279 if(spiSlave.receive()){
hmiot 10:5e5fa5bf77b5 280 // printf("Slave Read loop1\r\n");
hmiot 10:5e5fa5bf77b5 281 spiRX[bufferSize] = spiSlave.read();
hmiot 10:5e5fa5bf77b5 282 spiSlave.reply(spiRX[bufferSize]);
hmiot 10:5e5fa5bf77b5 283 bufferSize++;
hmiot 10:5e5fa5bf77b5 284
hmiot 10:5e5fa5bf77b5 285 if(bufferSize >= 5){
hmiot 10:5e5fa5bf77b5 286 bufferSize=0;
hmiot 10:5e5fa5bf77b5 287 light_actions(spiRX);
hmiot 10:5e5fa5bf77b5 288 spiSlave.reply(0xAA);
hmiot 10:5e5fa5bf77b5 289 }
hmiot 10:5e5fa5bf77b5 290
hmiot 12:cd54180657ee 291 }
hmiot 10:5e5fa5bf77b5 292
hmiot 10:5e5fa5bf77b5 293 wait_us(15);
hmiot 9:b967a01810e1 294 }
hmiot 9:b967a01810e1 295
hmiot 9:b967a01810e1 296 }
hmiot 9:b967a01810e1 297
hmiot 10:5e5fa5bf77b5 298 void waitBleEvent()
hmiot 10:5e5fa5bf77b5 299 {
hmiot 10:5e5fa5bf77b5 300 while(serviceDiscover || BLE::Instance().gattClient().isServiceDiscoveryActive()){
hmiot 10:5e5fa5bf77b5 301 BLE::Instance().waitForEvent();
hmiot 10:5e5fa5bf77b5 302 }
hmiot 9:b967a01810e1 303 }
hmiot 10:5e5fa5bf77b5 304