Constants, type definitions, and functions that are common to all services.
More...
|
typedef void(* | ble_srv_error_handler_t )(uint32_t nrf_error) |
| Type definition for error handler function that will be called in case of an error in a service or a service library module.
|
|
Constants, type definitions, and functions that are common to all services.
#define BLE_CCCD_VALUE_LEN 2 |
The length of a CCCD value.
#define BLE_SRV_ENCODED_REPORT_REF_LEN 2 |
The length of an encoded Report Reference Descriptor.
Security Access enumeration.
This enumeration gives the possible requirements for accessing a characteristic value.
Enumerator |
---|
SEC_NO_ACCESS |
Not possible to access.
|
SEC_OPEN |
Access open.
|
SEC_JUST_WORKS |
Access possible with 'Just Works' security at least.
|
SEC_MITM |
Access possible with 'MITM' security at least.
|
SEC_SIGNED |
Access possible with 'signed' security at least.
|
SEC_SIGNED_MITM |
Access possible with 'signed and MITM' security at least.
|
Function for making a UTF-8 structure refer to an ASCII string.
- Parameters
-
[out] | p_utf8 | UTF-8 structure to be set. |
[in] | p_ascii | ASCII string to be referred to. |
bool ble_srv_is_indication_enabled |
( |
uint8_t const * |
p_encoded_data | ) |
|
Function for decoding a CCCD value, and then testing if indication is enabled.
- Parameters
-
[in] | p_encoded_data | Buffer where the encoded CCCD is stored. |
- Return values
-
TRUE | If indication is enabled. |
FALSE | Otherwise. |
bool ble_srv_is_notification_enabled |
( |
uint8_t const * |
p_encoded_data | ) |
|
Function for decoding a CCCD value, and then testing if notification is enabled.
- Parameters
-
[in] | p_encoded_data | Buffer where the encoded CCCD is stored. |
- Return values
-
TRUE | If notification is enabled. |
FALSE | Otherwise. |
uint8_t ble_srv_report_ref_encode |
( |
uint8_t * |
p_encoded_buffer, |
|
|
const ble_srv_report_ref_t * |
p_report_ref |
|
) |
| |
Function for encoding a Report Reference Descriptor.
- Parameters
-
[in] | p_encoded_buffer | The buffer of the encoded data. |
[in] | p_report_ref | Report Reference value to be encoded. |
- Returns
- Length of the encoded data.
Function for adding a characteristic to a given service.
If no pointer is given for the initial value, the initial length parameter will be ignored and the initial length will be 0.
- Parameters
-
[in] | service_handle | Handle of the service to which the characteristic is to be added. |
[in] | p_char_props | Information needed to add the characteristic. |
[out] | p_char_handle | Handle of the added characteristic. |
- Return values
-
NRF_SUCCESS | If the characteristic was added successfully. Otherwise, an error code is returned. |
uint32_t descriptor_add |
( |
uint16_t |
char_handle, |
|
|
ble_add_descr_params_t * |
p_descr_props, |
|
|
uint16_t * |
p_descr_handle |
|
) |
| |
Function for adding a characteristic's descriptor to a given characteristic.
- Parameters
-
[in] | char_handle | Handle of the characteristic to which the descriptor is to be added, if BLE_GATT_HANDLE_INVALID is used, it will be placed sequentially. |
[in] | p_descr_props | Information needed to add the descriptor. |
[out] | p_descr_handle | Handle of the added descriptor. |
- Return values
-
NRF_SUCCESS | If the characteristic was added successfully. Otherwise, an error code is returned. |