Remove unnecessary C-style casts with BLE UUIDs
Instead of casting the UUID object to the ble_uuid_t* used throughout the NimBLE API just pass the address of the ble_uuid_t member that's at the start of each of the UUID structs.
This commit is contained in:
parent
1ba99d2427
commit
487ae478ad
10 changed files with 54 additions and 63 deletions
|
|
@ -26,11 +26,8 @@ void AlertNotificationService::Init() {
|
|||
}
|
||||
|
||||
AlertNotificationService::AlertNotificationService(System::SystemTask& systemTask, NotificationManager& notificationManager)
|
||||
: characteristicDefinition {{.uuid = (ble_uuid_t*) &ansCharUuid,
|
||||
.access_cb = AlertNotificationCallback,
|
||||
.arg = this,
|
||||
.flags = BLE_GATT_CHR_F_WRITE},
|
||||
{.uuid = (ble_uuid_t*) ¬ificationEventUuid,
|
||||
: characteristicDefinition {{.uuid = &ansCharUuid.u, .access_cb = AlertNotificationCallback, .arg = this, .flags = BLE_GATT_CHR_F_WRITE},
|
||||
{.uuid = ¬ificationEventUuid.u,
|
||||
.access_cb = AlertNotificationCallback,
|
||||
.arg = this,
|
||||
.flags = BLE_GATT_CHR_F_NOTIFY,
|
||||
|
|
@ -39,7 +36,7 @@ AlertNotificationService::AlertNotificationService(System::SystemTask& systemTas
|
|||
serviceDefinition {
|
||||
{/* Device Information Service */
|
||||
.type = BLE_GATT_SVC_TYPE_PRIMARY,
|
||||
.uuid = (ble_uuid_t*) &ansUuid,
|
||||
.uuid = &ansUuid.u,
|
||||
.characteristics = characteristicDefinition},
|
||||
{0},
|
||||
},
|
||||
|
|
@ -123,4 +120,4 @@ void AlertNotificationService::MuteIncomingCall() {
|
|||
}
|
||||
|
||||
ble_gattc_notify_custom(connectionHandle, eventHandle, om);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue