Home > other >  Add two channels in the nus services
Add two channels in the nus services

Time:10-05

1, adding in the structure ble_nus_s ble_gatts_char_handles_t rx_handles1; Ble_gatts_char_handles_t rx_handles2;
2, the imitation rx_char_add function add rx_char_add1 rx_char_add2 two functions, new functions need to be modified in the UUID BLE_UUID_NUS_RX_CHARACTERISTIC and rx_handles1 value
3, imitate ble_nus_string_send function add ble_nus_string_send1 ble_nus_string_send2 two data sending function, need to modify rx_handles1 value of new function in the
4, on_write modified as follows:
/*
If (
(p_evt_write - & gt; Handle==p_nus - & gt; Rx_handles. Cccd_handle)
& &
(p_evt_write - & gt; Len==2)
)
*/
If (
((p_evt_write - & gt; Handle==p_nus - & gt; Rx_handles. Cccd_handle) | |
(p_evt_write - & gt; Handle==p_nus - & gt; Rx_handles1. Cccd_handle) | |
(p_evt_write - & gt; Handle==p_nus - & gt; Rx_handles2. Cccd_handle))
& &
(p_evt_write - & gt; Len==2)
)
5, add the following code in ble_nus_init functions:
Err_code=rx_char_add_1 (p_nus p_nus_init);
VERIFY_SUCCESS (err_code);
Err_code=rx_char_add_2 (p_nus p_nus_init);
VERIFY_SUCCESS (err_code);
  • Related