| nRF5 SDK v12.0.0 |

Choose documentation: | nRF5 SDK | S130 SoftDevice API | S132 SoftDevice API | S212 SoftDevice API | S332 SoftDevice API

All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Modules | Data Structures | Typedefs | Enumerations | Functions
Immediate Alert Service Client
BLE Services

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. This contains various status information for the client. More...
struct | ble_ias_c_init_t
| IAS Client init structure. This contains all options and data needed for initialization of the client. 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, const ble_ias_c_init_t *p_ias_c_init)
| Function for initializing the Immediate Alert Service client. More...
uint32_t | ble_ias_c_send_alert_level (const ble_ias_c_t *p_ias_c, uint8_t alert_level)
| Function for sending alert level to the peer. More...
void | ble_ias_c_on_ble_evt (ble_ias_c_t *p_ias_c, const ble_evt_t *p_ble_evt)
| Function for handling the Application's BLE Stack events for Immediate Alert Service client. More...
static __INLINE bool | ble_ias_c_is_discovered (const ble_ias_c_t *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, const ble_db_discovery_evt_t *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 - 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 propagate BLE stack events to this module by calling ble_ias_c_on_ble_evt() from the SoftDevice Event Handler callback function.

## Enumeration Type Documentation

enum ble_ias_c_evt_type_t

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.

## 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 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.

uint32_t ble_ias_c_init | ( | ble_ias_c_t * | p_ias_c,
|  | const ble_ias_c_init_t * | 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_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 | ( | const ble_ias_c_t * | 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_ias_c_t * | p_ias_c,
|  | const ble_evt_t * | p_ble_evt
| ) |  |

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_ias_c | Immediate Alert Service client structure.
  [in] | p_ble_evt | Event received from the BLE stack.

void ble_ias_c_on_db_disc_evt | ( | ble_ias_c_t * | p_ias_c,
|  | const ble_db_discovery_evt_t * | p_evt
| ) |  |

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 | ( | const ble_ias_c_t * | 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.