MotionService : fix typo and characteristic array size + send notification only if the host subscribed to them.
This commit is contained in:
parent
bf83493c8d
commit
d1f50157c7
3 changed files with 30 additions and 3 deletions
|
|
@ -215,6 +215,16 @@ int NimbleController::OnGAPEvent(ble_gap_event* event) {
|
|||
event->subscribe.prev_notify,
|
||||
event->subscribe.cur_notify,
|
||||
event->subscribe.prev_indicate);
|
||||
|
||||
if(event->subscribe.reason == BLE_GAP_SUBSCRIBE_REASON_TERM) {
|
||||
heartRateService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
||||
}
|
||||
else if(event->subscribe.prev_notify == 0 && event->subscribe.cur_notify == 1) {
|
||||
heartRateService.SubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
||||
}
|
||||
else if(event->subscribe.prev_notify == 1 && event->subscribe.cur_notify == 0) {
|
||||
heartRateService.UnsubscribeNotification(event->subscribe.conn_handle, event->subscribe.attr_handle);
|
||||
}
|
||||
break;
|
||||
|
||||
case BLE_GAP_EVENT_MTU:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue