Functions | |
uint32_t | ble_nus_c_init (ble_nus_c_t *p_ble_nus_c, ble_nus_c_init_t *p_ble_nus_c_init) |
Function for initializing the Nordic UART client module. More... | |
void | ble_nus_c_on_ble_evt (ble_nus_c_t *p_ble_nus_c, const ble_evt_t *p_ble_evt) |
Function for handling BLE events from the SoftDevice. More... | |
uint32_t | ble_nus_c_rx_notif_enable (ble_nus_c_t *p_ble_nus_c) |
Function for requesting the peer to start sending notification of RX characteristic. More... | |
uint32_t | ble_nus_c_string_send (ble_nus_c_t *p_ble_nus_c, uint8_t *p_string, uint16_t length) |
Function for sending a string to the server. More... | |
uint32_t ble_nus_c_init | ( | ble_nus_c_t * | p_ble_nus_c, |
ble_nus_c_init_t * | p_ble_nus_c_init | ||
) |
Function for initializing the Nordic UART client module.
This function registers with the Database Discovery module for the NUS. Doing so will make the Database Discovery module look for the presence of a NUS instance at the peer when a discovery is started.
[in] | p_ble_nus_c | Pointer to the NUS client structure. |
[in] | p_ble_nus_c_init | Pointer to the NUS initialization structure containing the initialization information. |
NRF_SUCCESS | If the module was initialized successfully. Otherwise, an error code is returned. This function propagates the error code returned by the Database Discovery module API ble_db_discovery_evt_register. |
void ble_nus_c_on_ble_evt | ( | ble_nus_c_t * | p_ble_nus_c, |
const ble_evt_t * | p_ble_evt | ||
) |
Function for handling BLE events from the SoftDevice.
This function handles the BLE events received from the SoftDevice. If a BLE event is relevant to the NUS module, it is used to update internal variables and, if necessary, send events to the application.
[in] | p_ble_nus_c | Pointer to the NUS client structure. |
[in] | p_ble_evt | Pointer to the BLE event. |
uint32_t ble_nus_c_rx_notif_enable | ( | ble_nus_c_t * | p_ble_nus_c | ) |
Function for requesting the peer to start sending notification of RX characteristic.
This function enables notifications of the NUS RX characteristic at the peer by writing to the CCCD of the NUS RX characteristic.
p_ble_nus_c | Pointer to the NUS client structure. |
NRF_SUCCESS | If the SoftDevice has been requested to write to the CCCD of the peer. Otherwise, an error code is returned. This function propagates the error code returned by the SoftDevice API sd_ble_gattc_write. |
uint32_t ble_nus_c_string_send | ( | ble_nus_c_t * | p_ble_nus_c, |
uint8_t * | p_string, | ||
uint16_t | length | ||
) |
Function for sending a string to the server.
This function writes the TX characteristic of the server.
[in] | p_ble_nus_c | Pointer to the NUS client structure. |
[in] | p_string | String to be sent. |
[in] | length | Length of the string. |
NRF_SUCCESS | If the string was sent successfully. Otherwise, an error code is returned. |