bluetooth control motor
Dependents: BLE_LED_IDB0XA1_demo MOTOR_BLE_V2 Motor_Ble_v1 Motor_Ble_v10223 ... more
Fork of X_NUCLEO_IDB0XA1 by
Diff: source/platform/btle.cpp
- Branch:
- f75800800e6bd3fe65cb03783b4ceec360909c66
- Revision:
- 263:8516afb5e29c
- Parent:
- 257:90b0bb40fb45
- Child:
- 266:b49e28134d83
--- a/source/platform/btle.cpp Thu Sep 15 10:51:24 2016 +0100 +++ b/source/platform/btle.cpp Thu Sep 15 10:51:25 2016 +0100 @@ -338,6 +338,7 @@ //PRINTF("Notify DISABLED\n\r"); BlueNRGGattServer::getInstance().HCIEvent(GattServerEvents::GATT_EVENT_UPDATES_DISABLED, charDescHandle); } + return; } //Check if attr handle property is WRITEABLE, in the case generate GATT_EVENT_DATA_WRITTEN Event @@ -355,16 +356,28 @@ writeParams.data = att_data; writeParams.offset = offset; - BlueNRGGattServer::getInstance().HCIDataWrittenEvent(&writeParams); - //BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_WRITTEN, attr_handle); //Write the actual Data to the Attr Handle? (uint8_1[])att_data contains the data if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getLength() > 0)) { BlueNRGGattServer::getInstance().write(p_char->getValueAttribute().getHandle(), - (uint8_t*)att_data, - data_length, - false); + (uint8_t*)att_data, + data_length, + false); + + BlueNRGGattServer::getInstance().HCIDataWrittenEvent(&writeParams); } + } else { + PRINTF("*****WRITE DESCRIPTOR CASE\n\r"); + + GattWriteCallbackParams writeParams; + writeParams.connHandle = conn_handle; + writeParams.handle = attr_handle; + writeParams.writeOp = GattWriteCallbackParams::OP_WRITE_REQ;//Where to find this property in BLUENRG? + writeParams.len = data_length; + writeParams.data = att_data; + writeParams.offset = offset; + + BlueNRGGattServer::getInstance().HCIDataWrittenEvent(&writeParams); } }