Preparing the ble_service to work in bt_controller sleep mode to save power. This will at the end be implemented in the W800_Smart_Watch ble_service module
This commit is contained in:
parent
0f376fd528
commit
6433aaa697
@ -599,6 +599,8 @@ static int ble_gap_event_cb(struct ble_gap_event *event, void *arg)
|
|||||||
}
|
}
|
||||||
//We call the state change callback if registered
|
//We call the state change callback if registered
|
||||||
if(_ble_service_state_change_cb)_ble_service_state_change_cb(_ble_service_state);
|
if(_ble_service_state_change_cb)_ble_service_state_change_cb(_ble_service_state);
|
||||||
|
|
||||||
|
tls_bt_ctrl_sleep(false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -181,7 +181,8 @@ static void nus_data_rx_cb(const uint8_t *data, uint16_t length)
|
|||||||
gadget_bridge_parser_feed((const char *)data, length);
|
gadget_bridge_parser_feed((const char *)data, length);
|
||||||
gadget_bridge_parser_code_e code;
|
gadget_bridge_parser_code_e code;
|
||||||
while((code = gadget_bridge_parser_run()) == GADGET_BRIDGE_PARSER_CODE_PARSING);
|
while((code = gadget_bridge_parser_run()) == GADGET_BRIDGE_PARSER_CODE_PARSING);
|
||||||
shell_printf("Gadget bridge parser code : %s"NEW_LINE, gadget_bridge_parser_code_2_str(code));
|
shell_printf("Gadget bridge parser code : %s"NEW_LINE, gadget_bridge_parser_code_2_str(code));
|
||||||
|
tls_bt_ctrl_sleep(false);
|
||||||
//shell_puts("#"NEW_LINE);
|
//shell_puts("#"NEW_LINE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,6 +652,18 @@ int _rtc(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tls_bt_controller_sleep_enter_cb(uint32_t sleep_duration_ms)
|
||||||
|
{
|
||||||
|
//shell_printf("BT CTRL sleep for %u"NEW_LINE, sleep_duration_ms);
|
||||||
|
//tls_bt_ctrl_wakeup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void tls_bt_controller_sleep_exit_cb(void)
|
||||||
|
{
|
||||||
|
//shell_printf("BT CTRL wakeup"NEW_LINE);
|
||||||
|
//tls_bt_ctrl_sleep(false);
|
||||||
|
}
|
||||||
|
|
||||||
int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
||||||
{
|
{
|
||||||
if(argc > 1)
|
if(argc > 1)
|
||||||
@ -668,6 +681,8 @@ int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
|||||||
gadget_bridge_parser_register_event_callback(&(parser_event_cb));
|
gadget_bridge_parser_register_event_callback(&(parser_event_cb));
|
||||||
ble_service_register_nus_data_rx_cb(&(nus_data_rx_cb));
|
ble_service_register_nus_data_rx_cb(&(nus_data_rx_cb));
|
||||||
ble_service_set_pairing_passkey(123456);
|
ble_service_set_pairing_passkey(123456);
|
||||||
|
|
||||||
|
tls_bt_register_sleep_callback(tls_bt_controller_sleep_enter_cb, tls_bt_controller_sleep_exit_cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(strcmp(argv[1], "disable") == 0)
|
else if(strcmp(argv[1], "disable") == 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user