Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of BLE_API by
Revision 1201:0c728c14f30e, committed 2016-05-18
- Comitter:
- chiang404
- Date:
- Wed May 18 11:21:11 2016 +0000
- Parent:
- 833:d494ad3e87bd
- Commit message:
- Security UART
Changed in this revision
| ble/services/UARTService.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/ble/services/UARTService.h Tue Sep 29 09:54:19 2015 +0100
+++ b/ble/services/UARTService.h Wed May 18 11:21:11 2016 +0000
@@ -59,9 +59,12 @@
txCharacteristic(UARTServiceTXCharacteristicUUID, receiveBuffer, 1, BLE_UART_SERVICE_MAX_DATA_LEN,
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE),
rxCharacteristic(UARTServiceRXCharacteristicUUID, sendBuffer, 1, BLE_UART_SERVICE_MAX_DATA_LEN, GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) {
+ /* Protect MITM */
+ txCharacteristic.requireSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM);
+ rxCharacteristic.requireSecurity(SecurityManager::SECURITY_MODE_ENCRYPTION_WITH_MITM);
+
GattCharacteristic *charTable[] = {&txCharacteristic, &rxCharacteristic};
GattService uartService(UARTServiceUUID, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
-
ble.addService(uartService);
ble.onDataWritten(this, &UARTService::onDataWritten);
}
