Nordic Thingy:52 v2.2.0
Thingy Configuration Service

Thingy Configuration Service implementation. More...

Data Structures

struct  ble_tcs_init_t
 Thingy Configuration Service initialization structure. More...
 
struct  ble_tcs_s
 Thingy Configuration Service structure. More...
 

Macros

#define BLE_TCS_MAX_DATA_LEN   (BLE_GATT_ATT_MTU_DEFAULT - 3)
 
#define BLE_UUID_TCS_SERVICE   0x0100
 

Typedefs

typedef void(* ble_tcs_evt_handler_t) (ble_tcs_t *p_tcs, ble_tcs_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
 Thingy Configuration Service event handler type.
 

Functions

uint32_t ble_tcs_init (ble_tcs_t *p_tcs, const ble_tcs_init_t *p_tcs_init)
 Function for initializing the Thingy Configuration Service. More...
 
uint32_t ble_tcs_mtu_set (ble_tcs_t *p_tcs, ble_tcs_mtu_t *p_data)
 Function for setting the MTU char data. More...
 
uint32_t ble_tcs_nfc_set (ble_tcs_t *p_tcs, ble_tcs_nfc_t *p_data)
 Function for setting the NFC char data. More...
 
void ble_tcs_on_ble_evt (ble_tcs_t *p_tcs, ble_evt_t *p_ble_evt)
 Function for handling the Thingy Configuration Service's BLE events. More...
 

Detailed Description

Thingy Configuration Service implementation.

The Thingy Configuration Service is a simple GATT-based service with TX and RX characteristics. Data received from the peer is passed to the application, and the data received from the application of this service is sent to the peer as Handle Value Notifications. This module demonstrates how to implement a custom GATT-based service and characteristics using the S110 SoftDevice. The service is used by the application to send and receive ASCII text strings to and from the peer.

Note
The application must propagate S110 SoftDevice events to the Thingy Configuration Service module by calling the ble_tcs_on_ble_evt() function from the ble_stack_handler callback.

Macro Definition Documentation

◆ BLE_TCS_MAX_DATA_LEN

#define BLE_TCS_MAX_DATA_LEN   (BLE_GATT_ATT_MTU_DEFAULT - 3)

Maximum length of data (in bytes) that can be transmitted to the peer by the Thingy Configuration service module.

◆ BLE_UUID_TCS_SERVICE

#define BLE_UUID_TCS_SERVICE   0x0100

The UUID of the Thingy Configuration Service.

Function Documentation

◆ ble_tcs_init()

uint32_t ble_tcs_init ( ble_tcs_t p_tcs,
const ble_tcs_init_t p_tcs_init 
)

Function for initializing the Thingy Configuration Service.

Parameters
[out]p_tcsThingy Configuration Service structure. This structure must be supplied by the application. It is initialized by this function and will later be used to identify this particular service instance.
[in]p_tcs_initInformation needed to initialize the service.
Return values
NRF_SUCCESSIf the service was successfully initialized. Otherwise, an error code is returned.
NRF_ERROR_NULLIf either of the pointers p_tcs or p_tcs_init is NULL.

◆ ble_tcs_mtu_set()

uint32_t ble_tcs_mtu_set ( ble_tcs_t p_tcs,
ble_tcs_mtu_t *  p_data 
)

Function for setting the MTU char data.

This function updates the MTU characteristic.

Parameters
[in]p_tcsPointer to the Thingy Configuration Service structure.
[in]p_dataPointer to the MTU data.
Return values
NRF_SUCCESSIf the string was sent successfully. Otherwise, an error code is returned.

◆ ble_tcs_nfc_set()

uint32_t ble_tcs_nfc_set ( ble_tcs_t p_tcs,
ble_tcs_nfc_t *  p_data 
)

Function for setting the NFC char data.

This function updates the NFC characteristic.

Parameters
[in]p_tcsPointer to the Thingy Configuration Service structure.
[in]p_dataPointer to the NFC data.
Return values
NRF_SUCCESSIf the string was sent successfully. Otherwise, an error code is returned.

◆ ble_tcs_on_ble_evt()

void ble_tcs_on_ble_evt ( ble_tcs_t p_tcs,
ble_evt_t *  p_ble_evt 
)

Function for handling the Thingy Configuration Service's BLE events.

The Thingy Configuration Service expects the application to call this function each time an event is received from the S110 SoftDevice. This function processes the event if it is relevant and calls the Thingy Configuration Service event handler of the application if necessary.

Parameters
[in]p_tcsThingy Configuration Service structure.
[in]p_ble_evtEvent received from the S110 SoftDevice.