警报通知配置文件
警报通知配置文件允许像手表这样的设备从设备中获取信息手机的来电、未接电话和短信/彩信信息。信息包括来电时的来电显示或电邮/短讯/彩信的发送人的显示,但不是信息。该配置文件还使客户端设备能够获取有关服务器设备上未读消息数。
示例
API 参考
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. 
 - 参数
- 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 
 
- 返回
- 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. 
 - 参数
- cat_id – [in] The ID of the category to request or recover the notification to 
- option – [in] Disable or enable supported new alert category 
 
- 返回
- 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. 
 - 参数
- 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 
 
- 返回
- 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. 
 - 参数
- 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 
 
- 返回
- 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. - 返回
- 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. - 返回
- 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 
 
- 
uint8_t cat_id
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