Immediate Alert Service Client module.
More...
Immediate Alert Service Client module.
This module implements the Immediate Alert Service client - locator role of the Find Me profile. On BLE_GAP_EVT_CONNECTED event, this module starts discovery of the Immediate Alert Service with Alert Level characteristic at the peer. This module will indicate the application about a successful service & characteristic discovery using BLE_IAS_C_EVT_DISCOVERY_COMPLETE event. The application can use ble_ias_c_send_alert_level function to signal alerts to the peer.
- Note
- The application must register this module as BLE event observer using the NRF_SDH_BLE_OBSERVER macro. Example:
#define BLE_IAS_C_DEF |
( |
|
_name | ) |
|
Macro for defining a ble_ias_c instance.
- Parameters
-
_name | Name of the instance. |
Immediate Alert Service client event type.
Enumerator |
---|
BLE_IAS_C_EVT_DISCOVERY_COMPLETE |
Event indicating that the Immediate Alert Service is found at the peer.
|
BLE_IAS_C_EVT_DISCOVERY_FAILED |
Event indicating that the Immediate Alert Service is not found at the peer.
|
BLE_IAS_C_EVT_DISCONN_COMPLETE |
Event indicating that the Immediate Alert Service client module has completed the processing of BLE_GAP_EVT_DISCONNECTED event. This event is raised only if a valid instance of IAS was found at the peer during the discovery phase. This event can be used the application to do clean up related to the IAS Client.
|
uint32_t ble_ias_c_handles_assign |
( |
ble_ias_c_t * |
p_ias_c, |
|
|
uint16_t |
conn_handle, |
|
|
uint16_t |
alert_level_handle |
|
) |
| |
Function for assigning handles to an instance of ias_c.
Call this function when a link has been established with a peer to associate this link to this instance of the module. This makes it possible to handle several links and associate each link to a particular instance of this module. The connection handle and attribute handles will be provided from the discovery event BLE_IAS_C_EVT_DISCOVERY_COMPLETE.
- Parameters
-
[in] | p_ias_c | Pointer to the IAS client structure instance to associate. |
[in] | conn_handle | Connection handle to associated with the given IAS Instance. |
[in] | alert_level_handle | Attribute handle on the IAS server that you want this IAS_C client to interact with. |
- Return values
-
NRF_SUCCESS | If the operation was successful. |
NRF_ERROR_NULL | If a p_ias_c was a NULL pointer. |
Function for initializing the Immediate Alert Service client.
This call allows the application to initialize the Immediate Alert Service client.
- Parameters
-
[out] | p_ias_c | Immediate Alert Service client structure. This structure will have to be supplied by the application. It will be initialized by this function, and will later be used to identify this particular client instance. |
[in] | p_ias_c_init | Information needed to initialize the Immediate Alert Service client. |
- Returns
- NRF_SUCCESS on successful initialization of service.
static __INLINE bool ble_ias_c_is_discovered |
( |
ble_ias_c_t const * |
p_ias_c | ) |
|
|
static |
Function for checking whether the peer's Immediate Alert Service instance and the alert level characteristic have been discovered.
- Parameters
-
[in] | p_ias_c | Immediate Alert Service client structure. |
- Returns
- TRUE if a handle has been assigned to alert_level_handle, meaning it must have been discovered. FALSE if the handle is invalid.
void ble_ias_c_on_ble_evt |
( |
ble_evt_t const * |
p_ble_evt, |
|
|
void * |
p_context |
|
) |
| |
Function for handling the Application's BLE Stack events for Immediate Alert Service client.
Handles all events from the BLE stack of interest to the Immediate Alert Service client.
- Parameters
-
[in] | p_ble_evt | Event received from the BLE stack. |
[in] | p_context | Immediate Alert Service client structure. |
Function for handling events from the database discovery module.
Call this function when getting a callback event from the DB discovery modue. This function will handle an event from the database discovery module, and determine if it relates to the discovery of heart rate service at the peer. If so, it will call the application's event handler indicating that the heart rate service has been discovered at the peer. It also populates the event with the service related information before providing it to the application.
- Parameters
-
[in] | p_ias_c | Pointer to the immediate alert client structure instance that will handle the discovery. |
[in] | p_evt | Pointer to the event received from the database discovery module. |
uint32_t ble_ias_c_send_alert_level |
( |
ble_ias_c_t const * |
p_ias_c, |
|
|
uint8_t |
alert_level |
|
) |
| |
Function for sending alert level to the peer.
This function allows the application to send an alert to the peer.
- Parameters
-
[in] | p_ias_c | Immediate Alert Service client structure. |
[in] | alert_level | Required alert level to be sent to the peer. |
- Returns
- NRF_SUCCESS on success, otherwise an error code.