Updated the notification callback logic

This commit is contained in:
anschrammh 2023-12-18 21:20:57 +01:00
parent 0787496aa4
commit f78a1f3a1a

View File

@ -524,7 +524,7 @@ static void ble_service_nus_data_rx_cb(const uint8_t *data, uint16_t length)
gadget_bridge_parser_feed((const char *)data, length);
while(gadget_bridge_parser_run() == GADGET_BRIDGE_PARSER_CODE_PARSING);
}
static uint32_t bt_ctrl_sleep_ms = 0;
static void ble_service_state_change_cb(ble_service_state_e ble_service_state)
{
switch(ble_service_state)
@ -537,7 +537,7 @@ static void ble_service_state_change_cb(ble_service_state_e ble_service_state)
ble_service_update_connection_parameters(
84, // itvl_min 105 ms
120, // itvl_max 150 ms
5, // latency 5
2, // latency 2
1000, // supervision timeout 10 s
0x0010, // min connection event length 10 ms
0x0300 // max connection event length 480 ms
@ -656,7 +656,7 @@ static void sendMusicPlaybackBLECommandCb(MusicPlaybackCtrlAction_e musicPlaybac
gadget_bridge_send_music_control(musicPlaybackCtrlAction);
}
static void notification_on_state_change_cb(NotificationState_e notificationState)
static void notification_on_state_change_cb(NotificationState_e notificationState, uint32_t notification_handle)
{
switch (notificationState)
{
@ -669,6 +669,9 @@ static void notification_on_state_change_cb(NotificationState_e notificationStat
case NOTIFICATION_STATE_CLEARED:
// Let's restore MCU clocks to it's default
watch_power_management_restore_default_cpu_clocks(true, true);
// Don't forget to tell GadgetBridge that the notification was dismissed
gadget_bridge_send_notification_action(GADGET_BRIDGE_NOTIFICATION_ACTION_DISMISS, notification_handle, NULL, NULL);
default:
break;
}