警报通知服务

[English]

警报通知服务公开设备中的警报信息。这些信息包括以下内容:

  1. 设备中发生的警报类型

  2. 其他文本信息,如来电显示或发件人ID

  3. 新警报的计数

  4. 未读警报项的计数。

示例

bluetooth/ble_services/ble_ans.

API 参考

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.

参数
  • 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 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.

参数
  • cat_id – The ID of the category to send the notification to

  • cat_info – The info string to send with the notification

返回

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

参数
  • 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 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.

参数

cat_id – The ID of the category which should be incremented and notified

返回

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

返回

  • 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