Compare commits
9 Commits
cb4a9d77e3
...
d798868660
Author | SHA1 | Date | |
---|---|---|---|
d798868660 | |||
c04c035a4a | |||
|
f7c692c751 | ||
|
e194de3eee | ||
|
a20b35b600 | ||
|
d97db47fad | ||
|
5387213c06 | ||
|
3faa1162e2 | ||
|
286eb408ab |
@ -333,7 +333,7 @@ bool ble_service_request_mtu_exchange(void)
|
||||
|
||||
bool ble_service_send_nus_data(const uint8_t *data, uint16_t length)
|
||||
{
|
||||
// The NUS is TX is using notifications
|
||||
// The NUS TX is using notifications
|
||||
if(notification_data.transfer_in_progress)
|
||||
{
|
||||
TLS_BT_APPL_TRACE_WARNING("%s, a transfer is already in progress"NEW_LINE, __FUNCTION__);
|
||||
|
@ -523,9 +523,46 @@ int _rtc(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
||||
|
||||
int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
||||
{
|
||||
if(argc >= 3)
|
||||
if(argc > 1)
|
||||
{
|
||||
if(strcmp(argv[1], "send_ble_notif") == 0)
|
||||
if(strcmp(argv[1], "enable") == 0)
|
||||
{
|
||||
if(argc == 3)
|
||||
{
|
||||
bool result = ble_modem_on(true);
|
||||
shell_printf("Enabling bluetooth modem with ble service : %d"NEW_LINE, result);
|
||||
|
||||
if(result)
|
||||
ble_service_nus_register_data_rx_cb(&(nus_data_rx_cb));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell_printf("Enabling bluetooth modem only : %d"NEW_LINE, ble_modem_on(false));
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "disable") == 0)
|
||||
{
|
||||
shell_printf("Disabling bluetooth : %d"NEW_LINE, ble_modem_off());
|
||||
}
|
||||
else if(strcmp(argv[1], "start_demo") == 0)
|
||||
{
|
||||
bool result = ble_service_start();
|
||||
shell_printf("Starting demo : %d"NEW_LINE"Use a BLE app to find the device"NEW_LINE, result /*demo_ble_server_on()*/);
|
||||
if(result)
|
||||
{
|
||||
ble_service_nus_register_data_rx_cb(&(nus_data_rx_cb));
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "stop_demo") == 0)
|
||||
{
|
||||
shell_printf("Stopping demo : %d"NEW_LINE, ble_service_stop() /*demo_ble_server_off()*/);
|
||||
ble_service_nus_register_data_rx_cb(NULL);
|
||||
}
|
||||
else if(strcmp(argv[1], "mtu_exch") == 0)
|
||||
{
|
||||
shell_printf("MTU exchange request : %d"NEW_LINE, ble_service_request_mtu_exchange());
|
||||
}
|
||||
else if(strcmp(argv[1], "send_ble_notif") == 0 && argc > 2)
|
||||
{
|
||||
char cmd[200] = "";
|
||||
bool found = false;
|
||||
@ -583,51 +620,7 @@ int _bluetooth(const shell_cmd_t *pcmd, int argc, char *const argv[])
|
||||
}
|
||||
else
|
||||
{
|
||||
shell_printf("Unknown %s action"NEW_LINE, argv[0]);
|
||||
}
|
||||
}
|
||||
else if(argc > 1)
|
||||
{
|
||||
if(strcmp(argv[1], "enable") == 0)
|
||||
{
|
||||
if(argc == 3)
|
||||
{
|
||||
bool result = ble_modem_on(true);
|
||||
shell_printf("Enabling bluetooth modem with ble service : %d"NEW_LINE, result);
|
||||
|
||||
if(result)
|
||||
ble_service_nus_register_data_rx_cb(&(nus_data_rx_cb));
|
||||
}
|
||||
else
|
||||
{
|
||||
shell_printf("Enabling bluetooth modem only : %d"NEW_LINE, ble_modem_on(false));
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "disable") == 0)
|
||||
{
|
||||
shell_printf("Disabling bluetooth : %d"NEW_LINE, ble_modem_off());
|
||||
}
|
||||
else if(strcmp(argv[1], "start_demo") == 0)
|
||||
{
|
||||
bool result = ble_service_start();
|
||||
shell_printf("Starting demo : %d"NEW_LINE"Use a BLE app to find the device"NEW_LINE, result /*demo_ble_server_on()*/);
|
||||
if(result)
|
||||
{
|
||||
ble_service_nus_register_data_rx_cb(&(nus_data_rx_cb));
|
||||
}
|
||||
}
|
||||
else if(strcmp(argv[1], "stop_demo") == 0)
|
||||
{
|
||||
shell_printf("Stopping demo : %d"NEW_LINE, ble_service_stop() /*demo_ble_server_off()*/);
|
||||
ble_service_nus_register_data_rx_cb(NULL);
|
||||
}
|
||||
else if(strcmp(argv[1], "mtu_exch") == 0)
|
||||
{
|
||||
shell_printf("MTU exchange request : %d"NEW_LINE, ble_service_request_mtu_exchange());
|
||||
}
|
||||
else
|
||||
{
|
||||
shell_printf("Unknown %s action"NEW_LINE, argv[0]);
|
||||
shell_printf("Unknown %s action"NEW_LINE, argv[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -167,14 +167,14 @@ tls_bt_init(uint8_t uart_idx)
|
||||
ble_hs_cfg.gatts_register_cb = on_svr_register_cb;
|
||||
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
|
||||
/* Initialize all packages. */
|
||||
nimble_port_init();
|
||||
nimble_port_init(); // 7 k ram gone --> 112691
|
||||
/*Application levels code entry*/
|
||||
tls_ble_gap_init();
|
||||
tls_bt_util_init();
|
||||
tls_ble_gap_init(); // 0k ram gone
|
||||
tls_bt_util_init(); // 0k ram gone
|
||||
/*Initialize the vuart interface and enable controller*/
|
||||
ble_hci_vuart_init(uart_idx);
|
||||
ble_hci_vuart_init(uart_idx); // 47k gone --> 65423
|
||||
/* As the last thing, process events from default event queue. */
|
||||
tls_nimble_start();
|
||||
tls_nimble_start(); // 3k gone --> 62175
|
||||
|
||||
while(bt_adapter_state == WM_BT_STATE_OFF) {
|
||||
tls_os_time_delay(10);
|
||||
|
@ -17,7 +17,7 @@ void tls_nimble_start(void)
|
||||
{
|
||||
tls_host_task_stack_ptr = (void *)tls_mem_alloc(MYNEWT_VAL(OS_HS_STACK_SIZE) * sizeof(uint32_t));
|
||||
assert(tls_host_task_stack_ptr != NULL);
|
||||
tls_os_task_create(&tls_host_task_hdl, "bth",
|
||||
tls_os_task_create(&tls_host_task_hdl, "ble_svc",
|
||||
nimble_host_task,
|
||||
(void *)0,
|
||||
(void *)tls_host_task_stack_ptr,
|
||||
|
Loading…
Reference in New Issue
Block a user