Nordic Thingy:52 v2.2.0
Thingy Environment Service

Thingy Environment Service implementation. More...

Data Structures

struct  ble_tes_init_t
 Thingy Environment Service initialization structure. More...
 
struct  ble_tes_s
 Thingy Environment Service structure. More...
 

Macros

#define BLE_TES_MAX_DATA_LEN   (BLE_GATT_ATT_MTU_DEFAULT - 3)
 
#define BLE_UUID_TES_SERVICE   0x0200
 

Typedefs

typedef void(* ble_tes_evt_handler_t) (ble_tes_t *p_tes, ble_tes_evt_type_t evt_type, uint8_t *p_data, uint16_t length)
 Thingy Environment Service event handler type.
 

Functions

uint32_t ble_tes_color_set (ble_tes_t *p_tes, ble_tes_color_t *p_data)
 Function for setting the color data. More...
 
uint32_t ble_tes_gas_set (ble_tes_t *p_tes, ble_tes_gas_t *p_data)
 Function for setting the gas data. More...
 
uint32_t ble_tes_humidity_set (ble_tes_t *p_tes, ble_tes_humidity_t *p_data)
 Function for setting the humidity. More...
 
uint32_t ble_tes_init (ble_tes_t *p_tes, const ble_tes_init_t *p_tes_init)
 Function for initializing the Thingy Environment Service. More...
 
void ble_tes_on_ble_evt (ble_tes_t *p_tes, ble_evt_t *p_ble_evt)
 Function for handling the Thingy Environment Service's BLE events. More...
 
uint32_t ble_tes_pressure_set (ble_tes_t *p_tes, ble_tes_pressure_t *p_data)
 Function for setting the pressure. More...
 
uint32_t ble_tes_temperature_set (ble_tes_t *p_tes, ble_tes_temperature_t *p_data)
 Function for setting the temperature. More...
 

Detailed Description

Thingy Environment Service implementation.

The Thingy Environment 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 Environment Service module by calling the ble_tes_on_ble_evt() function from the ble_stack_handler callback.

Macro Definition Documentation

◆ BLE_TES_MAX_DATA_LEN

#define BLE_TES_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 Environment service module.

◆ BLE_UUID_TES_SERVICE

#define BLE_UUID_TES_SERVICE   0x0200

The UUID of the Thingy Environment Service.

Function Documentation

◆ ble_tes_color_set()

uint32_t ble_tes_color_set ( ble_tes_t p_tes,
ble_tes_color_t *  p_data 
)

Function for setting the color data.

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

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

◆ ble_tes_gas_set()

uint32_t ble_tes_gas_set ( ble_tes_t p_tes,
ble_tes_gas_t *  p_data 
)

Function for setting the gas data.

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

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

◆ ble_tes_humidity_set()

uint32_t ble_tes_humidity_set ( ble_tes_t p_tes,
ble_tes_humidity_t *  p_data 
)

Function for setting the humidity.

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

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

◆ ble_tes_init()

uint32_t ble_tes_init ( ble_tes_t p_tes,
const ble_tes_init_t p_tes_init 
)

Function for initializing the Thingy Environment Service.

Parameters
[out]p_tesThingy Environment 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_tes_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_tes or p_tes_init is NULL.

◆ ble_tes_on_ble_evt()

void ble_tes_on_ble_evt ( ble_tes_t p_tes,
ble_evt_t *  p_ble_evt 
)

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

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

Parameters
[in]p_tesThingy Environment Service structure.
[in]p_ble_evtEvent received from the S110 SoftDevice.

◆ ble_tes_pressure_set()

uint32_t ble_tes_pressure_set ( ble_tes_t p_tes,
ble_tes_pressure_t *  p_data 
)

Function for setting the pressure.

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

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

◆ ble_tes_temperature_set()

uint32_t ble_tes_temperature_set ( ble_tes_t p_tes,
ble_tes_temperature_t *  p_data 
)

Function for setting the temperature.

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

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