Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Alert Notification Service (ANS)

Alert Notification Service (ANS) More...

Macros

#define BT_ANS_ERR_CMD_NOT_SUP   0xa0
 Command not supported error code.
#define BT_ANS_MAX_TEXT_STR_SIZE   18
 ANS max text string size in octets.

Enumerations

enum  bt_ans_cat {
  BT_ANS_CAT_SIMPLE_ALERT , BT_ANS_CAT_EMAIL , BT_ANS_CAT_NEWS , BT_ANS_CAT_CALL ,
  BT_ANS_CAT_MISSED_CALL , BT_ANS_CAT_SMS_MMS , BT_ANS_CAT_VOICE_MAIL , BT_ANS_CAT_SCHEDULE ,
  BT_ANS_CAT_HIGH_PRI_ALERT , BT_ANS_CAT_INSTANT_MESSAGE
}
 ANS Category ID Enum. More...

Functions

int bt_ans_set_new_alert_support_category (uint16_t mask)
 Set the support for a given new alert category.
int bt_ans_set_unread_support_category (uint16_t mask)
 Set the support for a given unread new alert category.
int bt_ans_notify_new_alert (struct bt_conn *conn, enum bt_ans_cat category, uint8_t num_new, const char *text)
 Send a new alert to remote devices.
int bt_ans_set_unread_count (struct bt_conn *conn, enum bt_ans_cat category, uint8_t unread)
 Set the total unread count for a given category.

Detailed Description

Alert Notification Service (ANS)

Since
4.4
Version
0.1.0

Macro Definition Documentation

◆ BT_ANS_ERR_CMD_NOT_SUP

#define BT_ANS_ERR_CMD_NOT_SUP   0xa0

#include <zephyr/bluetooth/services/ans.h>

Command not supported error code.

◆ BT_ANS_MAX_TEXT_STR_SIZE

#define BT_ANS_MAX_TEXT_STR_SIZE   18

#include <zephyr/bluetooth/services/ans.h>

ANS max text string size in octets.

This is the max string size in octets to be saved in a New Alert. Text longer than the max is truncated.

section 3.165 of https://btprodspecificationrefs.blob.core.windows.net/gatt-specification-supplement/GATT_Specification_Supplement.pdf

Enumeration Type Documentation

◆ bt_ans_cat

enum bt_ans_cat

#include <zephyr/bluetooth/services/ans.h>

ANS Category ID Enum.

Enumeration for whether the category is supported.

Enumerator
BT_ANS_CAT_SIMPLE_ALERT 

Simple alerts (general notifications).

BT_ANS_CAT_EMAIL 

Email messages.

BT_ANS_CAT_NEWS 

News updates.

BT_ANS_CAT_CALL 

Incoming call alerts.

BT_ANS_CAT_MISSED_CALL 

Missed call alerts.

BT_ANS_CAT_SMS_MMS 

SMS/MMS text messages.

BT_ANS_CAT_VOICE_MAIL 

Voicemail notifications.

BT_ANS_CAT_SCHEDULE 

Calendar or schedule alerts.

BT_ANS_CAT_HIGH_PRI_ALERT 

High-priority alerts.

BT_ANS_CAT_INSTANT_MESSAGE 

Instant messaging alerts.

Function Documentation

◆ bt_ans_notify_new_alert()

int bt_ans_notify_new_alert ( struct bt_conn * conn,
enum bt_ans_cat category,
uint8_t num_new,
const char * text )

#include <zephyr/bluetooth/services/ans.h>

Send a new alert to remote devices.

The new alert is transmitted to the remote devices if notifications are enabled. Each category will save the latest call to this function in case an immediate replay is requested via the ANS control point.

Note
This function waits on a Mutex with K_FOREVER to ensure atomic updates to notification structs. To avoid deadlocks, do not call this function in BT RX or System Workqueue threads.
Parameters
connThe connection object to send the alert to
categoryThe category the notification is for
num_newNumber of new alerts since last alert
textText brief of alert, null terminated
Returns
0 on success
negative error codes on failure

◆ bt_ans_set_new_alert_support_category()

int bt_ans_set_new_alert_support_category ( uint16_t mask)

#include <zephyr/bluetooth/services/ans.h>

Set the support for a given new alert category.

Parameters
maskThe bitmask of supported categories
Returns
0 on success
negative error codes on failure

◆ bt_ans_set_unread_count()

int bt_ans_set_unread_count ( struct bt_conn * conn,
enum bt_ans_cat category,
uint8_t unread )

#include <zephyr/bluetooth/services/ans.h>

Set the total unread count for a given category.

The unread count is transmitted to the remote devices if notifications are enabled. Each category will save the latest call to this function in case an immediate replay is requested via the ANS control point.

Note
This function waits on a Mutex with K_FOREVER to ensure atomic updates to notification structs. To avoid deadlocks, do not call this function in BT RX or System Workqueue threads.
Parameters
connThe connection object to send the alert to
categoryThe category the unread count is for
unreadTotal number of unread alerts
Returns
0 on success
negative error codes on failure

◆ bt_ans_set_unread_support_category()

int bt_ans_set_unread_support_category ( uint16_t mask)

#include <zephyr/bluetooth/services/ans.h>

Set the support for a given unread new alert category.

Parameters
maskThe bitmask of supported categories
Returns
0 on success
negative error codes on failure