nRF5 SDK v17.1.0
Modules | Data Structures | Macros | Typedefs | Enumerations | Functions
Immediate Alert Service Client

Immediate Alert Service Client module. More...

Modules

 Immediate Alert Service Client configuration
 

Data Structures

struct  ble_ias_c_evt_t
 Immediate Alert Service client event. More...
 
struct  ble_ias_c_s
 IAS Client structure. Contains various status information for the client. More...
 
struct  ble_ias_c_init_t
 IAS Client init structure. Contains all options and data needed for the initialization of the client. More...
 

Macros

#define BLE_IAS_C_DEF(_name)
 Macro for defining a ble_ias_c instance. More...
 
#define BLE_IAS_C_ARRAY_DEF(_name, _cnt)
 Macro for defining multiple ble_ias_c instances. More...
 

Typedefs

typedef struct ble_ias_c_s ble_ias_c_t
 
typedef void(* ble_ias_c_evt_handler_t )(ble_ias_c_t *p_ias_c, ble_ias_c_evt_t *p_evt)
 Immediate Alert Service client event handler type.
 

Enumerations

enum  ble_ias_c_evt_type_t {
  BLE_IAS_C_EVT_DISCOVERY_COMPLETE,
  BLE_IAS_C_EVT_DISCOVERY_FAILED,
  BLE_IAS_C_EVT_DISCONN_COMPLETE
}
 Immediate Alert Service client event type. More...
 

Functions

uint32_t ble_ias_c_init (ble_ias_c_t *p_ias_c, ble_ias_c_init_t const *p_ias_c_init)
 Function for initializing the Immediate Alert Service client. More...
 
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. More...
 
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. More...
 
static __INLINE bool ble_ias_c_is_discovered (ble_ias_c_t const *p_ias_c)
 Function for checking whether the peer's Immediate Alert Service instance and the Alert Level characteristic have been discovered. More...
 
void ble_ias_c_on_db_disc_evt (ble_ias_c_t *p_ias_c, ble_db_discovery_evt_t const *p_evt)
 Function for handling events from the Database Discovery module. More...
 
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. More...
 

Detailed Description

Immediate Alert Service Client module.

This module implements the Immediate Alert Service client - the 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 inform the application about the successful service and characteristic discovery with the 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 the BLE event observer by using the NRF_SDH_BLE_OBSERVER macro. Example:

Macro Definition Documentation

#define BLE_IAS_C_ARRAY_DEF (   _name,
  _cnt 
)

Macro for defining multiple ble_ias_c instances.

Parameters
_nameName of the array of instances.
_cntNumber of instances to define.
#define BLE_IAS_C_DEF (   _name)

Macro for defining a ble_ias_c instance.

Parameters
_nameName of the instance.

Enumeration Type Documentation

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 completed the processing of BLE_GAP_EVT_DISCONNECTED event. This event is triggered only if a valid instance of IAS was found at the peer during the discovery phase. The application can use this event to do a cleanup related to the IAS Client.

Function Documentation

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 the 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 are provided from the discovery event BLE_IAS_C_EVT_DISCOVERY_COMPLETE.

Parameters
[in]p_ias_cPointer to the IAS client structure instance for associating the link.
[in]conn_handleConnection handle to associated with the given IAS instance.
[in]alert_level_handleAttribute handle on the IAS server that you want this IAS_C client to interact with.
Return values
NRF_SUCCESSIf the operation was successful.
NRF_ERROR_NULLIf a p_ias_c was a NULL pointer.
err_codeOtherwise, this API propagates the error code returned by function nrf_ble_gq_conn_handle_register.
uint32_t ble_ias_c_init ( ble_ias_c_t p_ias_c,
ble_ias_c_init_t const *  p_ias_c_init 
)

Function for initializing the Immediate Alert Service client.

This call allows the application to initialize the Immediate Alert Service client.

Parameters
[out]p_ias_cImmediate Alert Service client structure. This structure must be supplied by the application. It is initialized by this function, and is later used to identify this particular client instance.
[in]p_ias_c_initInformation 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_cImmediate Alert Service client structure.
Returns
True, if a handle is 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_evtEvent received from the BLE stack.
[in]p_contextImmediate Alert Service client structure.
void ble_ias_c_on_db_disc_evt ( ble_ias_c_t p_ias_c,
ble_db_discovery_evt_t const *  p_evt 
)

Function for handling events from the Database Discovery module.

Call this function when you get a callback event from the Database Discovery module. This function handles an event from the Database Discovery module, and determines whether it relates to the discovery of Immediate Alert Service at the peer. If it does, the function calls the application's event handler to indicate that the Immediate Alert Service was discovered at the peer. The function also populates the event with service-related information before providing it to the application.

Parameters
[in]p_ias_cPointer to the Immediate Alert client structure instance that will handle the discovery.
[in]p_evtPointer 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_cImmediate Alert Service client structure.
[in]alert_levelRequired alert level to be sent to the peer.
Return values
NRF_SUCCESSOn success.
err_codeOtherwise, this API propagates the error code returned by function nrf_ble_gq_item_add.

Documentation feedback | Developer Zone | Subscribe | Updated