bluetooth control motor
Dependents: BLE_LED_IDB0XA1_demo MOTOR_BLE_V2 Motor_Ble_v1 Motor_Ble_v10223 ... more
Fork of X_NUCLEO_IDB0XA1 by
Revision 260:e93cbde933ce, committed 2016-09-15
- Comitter:
- Vincent Coubard
- Date:
- Thu Sep 15 10:51:22 2016 +0100
- Branch:
- 1aeef67153f6b42d9e1e60ea8fbf09a130d23621
- Parent:
- 259:323f588e5f57
- Child:
- 261:16cdf278f70a
- Commit message:
- Sync with 1aeef67153f6b42d9e1e60ea8fbf09a130d23621
2016-07-08 14:37:03+01:00: Vincent Coubard
Revert write characteristic event bit to GATT_NOTIFY_ATTRIBUTE_WRITE
instead of GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP.
Fix length comparison when a characteristic is writen
Changed in this revision
source/BlueNRGGattServer.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/BlueNRGGattServer.cpp Thu Sep 15 10:51:21 2016 +0100 +++ b/source/BlueNRGGattServer.cpp Thu Sep 15 10:51:22 2016 +0100 @@ -176,7 +176,7 @@ (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE| GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE))) { PRINTF("Setting up Gatt GATT_NOTIFY_ATTRIBUTE_WRITE Mask\n\r"); - Gatt_Evt_Mask = Gatt_Evt_Mask | GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP /* | GATT_NOTIFY_ATTRIBUTE_WRITE */; + Gatt_Evt_Mask = Gatt_Evt_Mask | GATT_NOTIFY_ATTRIBUTE_WRITE /* | GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP */; } if((p_char->getProperties() & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ| @@ -440,6 +440,7 @@ // check that the len of the data to write are compatible with the characteristic GattCharacteristic* characteristic = getCharacteristicFromHandle(attributeHandle); if (!characteristic) { + printf("characteristic not found\r\n"); return BLE_ERROR_INVALID_PARAM; } @@ -448,12 +449,14 @@ // reject write if the lenght exceed the maximum lenght of this attribute if (value_attribute.getMaxLength() < len) { + printf("invalid variable length: %u, max length is: %u\r\n", len, value_attribute.getMaxLength()); return BLE_ERROR_INVALID_PARAM; } // reject write if the attribute size is fixed and the lenght in input is different than the // length of the attribute. - if (value_attribute.hasVariableLength() == false && value_attribute.getLength() != len) { + if (value_attribute.hasVariableLength() == false && value_attribute.getMaxLength() != len) { + printf("invalid fixed length: %u, len should be %u\r\n", len, value_attribute.getMaxLength()); return BLE_ERROR_INVALID_PARAM; }