Thingy Configuration Service implementation.
More...
|
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.
|
|
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.
#define BLE_TCS_MAX_DATA_LEN (GATT_MTU_SIZE_DEFAULT - 3) |
Maximum length of data (in bytes) that can be transmitted to the peer by the Thingy Configuration service module.
#define BLE_UUID_TCS_SERVICE 0x0100 |
The UUID of the Thingy Configuration Service.
Function for initializing the Thingy Configuration Service.
- Parameters
-
[out] | p_tcs | Thingy 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_init | Information needed to initialize the service. |
- Return values
-
NRF_SUCCESS | If the service was successfully initialized. Otherwise, an error code is returned. |
NRF_ERROR_NULL | If either of the pointers p_tcs or p_tcs_init is NULL. |
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_tcs | Pointer to the Thingy Configuration Service structure. |
[in] | p_data | Pointer to the MTU data. |
- Return values
-
NRF_SUCCESS | If the string was sent successfully. Otherwise, an error code is returned. |
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_tcs | Thingy Configuration Service structure. |
[in] | p_ble_evt | Event received from the S110 SoftDevice. |