Nordic Thingy:52 v2.2.0
Thingy Sound Service

Thingy Sound Service implementation. More...

Data Structures

struct  ble_tss_init_t
 Thingy Sound Service initialization structure. More...
 
struct  ble_tss_s
 Thingy Sound Service structure. More...
 

Macros

#define BLE_TSS_MAX_DATA_LEN   (BLE_GATT_ATT_MTU_DEFAULT - 3)
 
#define BLE_UUID_TSS_SERVICE   0x0500
 

Typedefs

typedef void(* ble_tss_evt_handler_t) (ble_tss_t *p_tss, ble_tss_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
 Thingy Sound Service event handler type.
 

Functions

uint32_t ble_tss_init (ble_tss_t *p_tss, const ble_tss_init_t *p_tss_init)
 Function for initializing the Thingy Sound Service. More...
 
uint32_t ble_tss_mic_set (ble_tss_t *p_tss, uint8_t *p_data, uint16_t size)
 Function for sending microphone data. More...
 
void ble_tss_on_ble_evt (ble_tss_t *p_tss, ble_evt_t *p_ble_evt)
 Function for handling the Thingy Sound Service's BLE events. More...
 
uint32_t ble_tss_spkr_stat_set (ble_tss_t *p_tss, ble_tss_spkr_stat_t status)
 Function for sending speaker status. More...
 

Detailed Description

Thingy Sound Service implementation.

The Thingy Sound Service is a simple GATT-based service with multiple characteristics for reading sensor data and configuring the sensors.

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

Macro Definition Documentation

◆ BLE_TSS_MAX_DATA_LEN

#define BLE_TSS_MAX_DATA_LEN   (BLE_GATT_ATT_MTU_DEFAULT - 3)

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

◆ BLE_UUID_TSS_SERVICE

#define BLE_UUID_TSS_SERVICE   0x0500

The UUID of the Thingy Sound Service.

Function Documentation

◆ ble_tss_init()

uint32_t ble_tss_init ( ble_tss_t p_tss,
const ble_tss_init_t p_tss_init 
)

Function for initializing the Thingy Sound Service.

Parameters
[out]p_tssThingy Sound 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_tss_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_tss or p_tss_init is NULL.

◆ ble_tss_mic_set()

uint32_t ble_tss_mic_set ( ble_tss_t p_tss,
uint8_t *  p_data,
uint16_t  size 
)

Function for sending microphone data.

This function sends the microphone input as an microphone characteristic notification to the peer.

Parameters
[in]p_tssPointer to the Thingy Sound Service structure.
[in]p_dataPointer to the mic data.
[in]sizeMic data size.
Return values
NRF_SUCCESSIf the string was sent successfully. Otherwise, an error code is returned.

◆ ble_tss_on_ble_evt()

void ble_tss_on_ble_evt ( ble_tss_t p_tss,
ble_evt_t *  p_ble_evt 
)

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

The Thingy Sound 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 Sound Service event handler of the application if necessary.

Parameters
[in]p_tssThingy Sound Service structure.
[in]p_ble_evtEvent received from the S110 SoftDevice.

◆ ble_tss_spkr_stat_set()

uint32_t ble_tss_spkr_stat_set ( ble_tss_t p_tss,
ble_tss_spkr_stat_t  status 
)

Function for sending speaker status.

This function sends the speaker status as an speaker status characteristic notification to the peer.

Parameters
[in]p_tssPointer to the Thingy Sound Service structure.
[in]statusThe status.
Return values
NRF_SUCCESSIf the string was sent successfully. Otherwise, an error code is returned.