nRF51 SDK v10.0.0
Functions

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...
 

Detailed Description

Function Documentation

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.

Parameters
[in]p_ble_nus_cPointer to the NUS client structure.
[in]p_ble_nus_c_initPointer to the NUS initialization structure containing the initialization information.
Return values
NRF_SUCCESSIf 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.

Parameters
[in]p_ble_nus_cPointer to the NUS client structure.
[in]p_ble_evtPointer 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.

Parameters
p_ble_nus_cPointer to the NUS client structure.
Return values
NRF_SUCCESSIf 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.

Parameters
[in]p_ble_nus_cPointer to the NUS client structure.
[in]p_stringString to be sent.
[in]lengthLength of the string.
Return values
NRF_SUCCESSIf the string was sent successfully. Otherwise, an error code is returned.

This document was last updated on Mon Nov 9 2015.
Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone.