Alert Notification Service
The Alert Notification service exposes alert information in a device. This information includes the following:
- Type of alert occurring in a device 
- Additional text information such as caller ID or sender ID 
- Count of new alerts 
- Count of unread alert items. 
Examples
API Reference
Header File
Functions
- 
esp_err_t esp_ble_ans_get_new_alert(uint8_t cat_id, uint8_t *cat_val)
- Read the value of or check supported new alert category. - Attention
- 1. When cat_id is 0xFF, read the value of supported new alert category. 
- Attention
- 2. When cat_id isn’t 0xFF, check supported new alert category is enable or disable. 
 - Parameters
- cat_id – [in] The ID of the category to read or check 
- cat_val – [out] The value of read or check supported new alert category 
 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong category of the new alert 
 
 
- 
esp_err_t esp_ble_ans_set_new_alert(uint8_t cat_id, const char *cat_info)
- Send a new alert notification to the given category with the given info string. - Parameters
- cat_id – The ID of the category to send the notification to 
- cat_info – The info string to send with the notification 
 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong category of the new alert 
 
 
- 
esp_err_t esp_ble_ans_get_unread_alert(uint8_t cat_id, uint8_t *cat_val)
- Read the value of or check supported unread alert status category. - Attention
- 1. When cat_id is 0xFF, read the value of supported unread alert status category. 
- Attention
- 2. When cat_id isn’t 0xFF, check supported unread alert status category is enable or disable. 
 - Parameters
- cat_id – [in] The ID of the category to read or check 
- cat_val – [out] The value of read or check supported unread alert status category 
 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong category of the unread alert 
 
 
- 
esp_err_t esp_ble_ans_set_unread_alert(uint8_t cat_id)
- Send an unread alert to the given category then notifies the client if the given category is valid and enabled. - Parameters
- cat_id – The ID of the category which should be incremented and notified 
- Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong category of the unread alert 
 
 
- 
esp_err_t esp_ble_ans_init(void)
- Initialization GATT Alert Notification Service. - Returns
- ESP_OK on successful 
- ESP_ERR_INVALID_ARG on wrong initialization 
- ESP_FAIL on error 
 
 
Macros
- 
BLE_ANS_UUID16
- 
BLE_ANS_CHR_UUID16_SUP_NEW_ALERT_CAT
- 
BLE_ANS_CHR_UUID16_NEW_ALERT
- 
BLE_ANS_CHR_UUID16_SUP_UNR_ALERT_CAT
- 
BLE_ANS_CHR_UUID16_UNR_ALERT_STAT
- 
BLE_ANS_CHR_UUID16_ALERT_NOT_CTRL_PT
- 
BLE_ANS_CAT_BM_NONE
- 
BLE_ANS_CAT_BM_SIMPLE_ALERT
- 
BLE_ANS_CAT_BM_EMAIL
- 
BLE_ANS_CAT_BM_NEWS
- 
BLE_ANS_CAT_BM_CALL
- 
BLE_ANS_CAT_BM_MISSED_CALL
- 
BLE_ANS_CAT_BM_SMS
- 
BLE_ANS_CAT_BM_VOICE_MAIL
- 
BLE_ANS_CAT_BM_SCHEDULE
- 
BLE_ANS_CAT_ID_SIMPLE_ALERT
- 
BLE_ANS_CAT_ID_EMAIL
- 
BLE_ANS_CAT_ID_NEWS
- 
BLE_ANS_CAT_ID_CALL
- 
BLE_ANS_CAT_ID_MISSED_CALL
- 
BLE_ANS_CAT_ID_SMS
- 
BLE_ANS_CAT_ID_VOICE_MAIL
- 
BLE_ANS_CAT_ID_SCHEDULE
- 
BLE_ANS_CAT_NUM
- 
BLE_ANS_CMD_EN_NEW_ALERT_CAT
- 
BLE_ANS_CMD_EN_UNR_ALERT_CAT
- 
BLE_ANS_CMD_DIS_NEW_ALERT_CAT
- 
BLE_ANS_CMD_DIS_UNR_ALERT_CAT
- 
BLE_ANS_CMD_NOT_NEW_ALERT_IMMEDIATE
- 
BLE_ANS_CMD_NOT_UNR_ALERT_IMMEDIATE
- 
BLE_ANS_INFO_STR_MAX_LEN
- 
BLE_ANS_NEW_ALERT_MAX_LEN