Alert Notification Profile

[中文]

The Alert Notification profile allows a device like a watch to obtain information from a cellphone about incoming calls, missed calls and SMS/MMS messages. The information may include the caller ID for an incoming call or the sender’s ID for email/SMS/MMS but not the message. This profile also enables the client device to get information about the number of unread messages on the server device.

Examples

bluetooth/ble_profiles/ble_anp.

API Reference

Header File

Functions

esp_err_t esp_ble_anp_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 alert

esp_err_t esp_ble_anp_set_new_alert(uint8_t cat_id, esp_ble_anp_option_t option)

Request or recovery supported new alert notification to the given category.

Attention

1. When cat_id is 0xFF, recover for all supported new alert category to get the current message counts.

Attention

2. When cat_id isn’t 0xFF, request for a supported new alert category to get the current message counts.

Parameters
  • cat_id[in] The ID of the category to request or recover the notification to

  • option[in] Disable or enable supported new alert category

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong category of the alert

esp_err_t esp_ble_anp_get_unr_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 alert

esp_err_t esp_ble_anp_set_unr_alert(uint8_t cat_id, esp_ble_anp_option_t option)

Request or recovery supported unread alert status notification to the given category.

Attention

1. When cat_id is 0xFF, recover for all supported unread alert status category to get the current message counts.

Attention

2. When cat_id isn’t 0xFF, request for an supported unread alert status category to get the current message counts.

Parameters
  • cat_id[in] The ID of the category to request or recover the notification to

  • option[in] Disable or enable supported unread alert status category

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong category of the alert

esp_err_t esp_ble_anp_init(void)

Initialization GATT Alert Notification Profile.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

esp_err_t esp_ble_anp_deinit(void)

Deinitialization GATT Alert Notification Profile.

Returns

  • ESP_OK on successful

  • ESP_ERR_INVALID_ARG on wrong initialization

  • ESP_FAIL on error

Structures

struct esp_ble_anp_data_t

The status of the new or unread alert.

Public Members

uint8_t cat_id

The predefined categories of unread alerts and messages

The predefined categories of new alerts and messages

uint8_t count

The number of unread alerts in the server ranging from 0 to 255

The number of new alerts in the server ranging from 0 to 255

struct esp_ble_anp_data_t::[anonymous]::[anonymous] unr_alert_stat

The status of unread alerts

uint8_t cat_info[BLE_ANP_INFO_STR_MAX_LEN]

The brief text information for the last alert

struct esp_ble_anp_data_t::[anonymous]::[anonymous] new_alert_val

The status of new alerts

union esp_ble_anp_data_t::[anonymous] [anonymous]

Alert notification status

Macros

BLE_ANP_UUID16
BLE_ANP_CHR_UUID16_SUP_NEW_ALERT_CAT
BLE_ANP_CHR_UUID16_NEW_ALERT
BLE_ANP_CHR_UUID16_SUP_UNR_ALERT_CAT
BLE_ANP_CHR_UUID16_UNR_ALERT_STAT
BLE_ANP_CHR_UUID16_ALERT_NOT_CTRL_PT
BLE_ANP_CAT_BM_NONE
BLE_ANP_CAT_BM_SIMPLE_ALERT
BLE_ANP_CAT_BM_EMAIL
BLE_ANP_CAT_BM_NEWS
BLE_ANP_CAT_BM_CALL
BLE_ANP_CAT_BM_MISSED_CALL
BLE_ANP_CAT_BM_SMS
BLE_ANP_CAT_BM_VOICE_MAIL
BLE_ANP_CAT_BM_SCHEDULE
BLE_ANP_CAT_ID_SIMPLE_ALERT
BLE_ANP_CAT_ID_EMAIL
BLE_ANP_CAT_ID_NEWS
BLE_ANP_CAT_ID_CALL
BLE_ANP_CAT_ID_MISSED_CALL
BLE_ANP_CAT_ID_SMS
BLE_ANP_CAT_ID_VOICE_MAIL
BLE_ANP_CAT_ID_SCHEDULE
BLE_ANP_CAT_NUM
BLE_ANP_CMD_EN_NEW_ALERT_CAT
BLE_ANP_CMD_EN_UNR_ALERT_CAT
BLE_ANP_CMD_DIS_NEW_ALERT_CAT
BLE_ANP_CMD_DIS_UNR_ALERT_CAT
BLE_ANP_CMD_NOT_NEW_ALERT_IMMEDIATE
BLE_ANP_CMD_NOT_UNR_ALERT_IMMEDIATE
BLE_ANP_INFO_STR_MAX_LEN
BLE_ANP_NEW_ALERT_MAX_LEN

Enumerations

enum esp_ble_anp_option_t

The option of the new or unread alert.

Values:

enumerator BLE_ANP_OPT_ENABLE
enumerator BLE_ANP_OPT_DISABLE
enumerator BLE_ANP_OPT_RECOVER