ancs_protocol.h
Go to the documentation of this file.
1
37 #ifndef _ANCS_PROTOCOL_H_
38 #define _ANCS_PROTOCOL_H_
39
40 #include "gr55xx_sys.h"
41 #include <stdint.h>
42
44 #ifndef CFG_ANCS_ATTRIBUTE_MAXLEN
45 #define CFG_ANCS_ATTRIBUTE_MAXLEN 500
46 #endif
47
49 #define ANCS_ATTR(ID) ((uint32_t) 0x80000000 | ((uint8_t) ID))
50
52 #define ANCS_ATTR_MAXLEN(ID, LEN) ((uint32_t) 0x80000000 | ((uint8_t) ID) | ((uint16_t) LEN << 8))
53
60 typedef enum
61 {
62 ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER = 0,
63 ANCS_NOTIF_ATTR_ID_TITLE,
64 ANCS_NOTIF_ATTR_ID_SUBTITLE,
65 ANCS_NOTIF_ATTR_ID_MESSAGE,
66 ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE,
67 ANCS_NOTIF_ATTR_ID_DATE,
68 ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL,
69 ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL,
70 } ancs_notification_attr_t;
71
73 typedef enum
74 {
75 ANCS_CATEGORY_ID_OTHER,
76 ANCS_CATEGORY_ID_INCOMING_CALL,
77 ANCS_CATEGORY_ID_MISSED_CALL,
78 ANCS_CATEGORY_ID_VOICE_MAIL,
79 ANCS_CATEGORY_ID_SOCIAL,
80 ANCS_CATEGORY_ID_SCHEDULE,
81 ANCS_CATEGORY_ID_EMAIL,
82 ANCS_CATEGORY_ID_NEWS,
83 ANCS_CATEGORY_ID_HEALTH_AND_FITNESS,
84 ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE,
85 ANCS_CATEGORY_ID_LOCATION,
86 ANCS_CATEGORY_ID_ENTERTAINMENT
87 } ancs_category_id_t;
88
90 typedef enum
91 {
92 ANCS_EVENT_ID_NOTIFICATION_ADDED,
93 ANCS_EVENT_ID_NOTIFICATION_MODIFIED,
94 ANCS_EVENT_ID_NOTIFICATION_REMOVED
95 } ancs_evt_id_t;
96
98 typedef enum
99 {
100 ACTION_ID_POSITIVE = 0,
101 ACTION_ID_NEGATIVE
102 } ancs_c_action_id_t;
103
105 typedef enum
106 {
107 CTRL_POINT_GET_NTF_ATTRIBUTE = 0,
108 CTRL_POINT_GET_APP_ATTRIBUTE,
109 CTRL_POINT_PERFORM_NTF_ACTION,
110 } ancs_c_ctrl_point_t;
111
120 typedef struct
121 {
122 uint8_t silent : 1;
123 uint8_t important : 1;
124 uint8_t pre_existing : 1;
125 uint8_t positive_action : 1;
126 uint8_t negative_action : 1;
127 } ancs_ntf_flags_t;
128
130 typedef struct
131 {
132 ancs_evt_id_t event_id;
133 ancs_ntf_flags_t event_flags;
134 ancs_category_id_t category_id;
135 uint8_t category_count;
136 uint32_t notification_uid;
137 } ntf_source_pdu_t;
138
154 void ancs_notify_attr_get(int uid, char noti_attr);
155
165 void ancs_action_perform(int uid, int action);
166
174 int ancs_get_uid(void);
175
184 void ancs_decode_notification_source(uint8_t *p_data, uint16_t length);
185
194 void ancs_decode_data_source(uint8_t *p_data, uint16_t length);
196 #endif
197
198
ANCS_NOTIF_ATTR_ID_SUBTITLE
@ ANCS_NOTIF_ATTR_ID_SUBTITLE
Definition: ancs_protocol.h:64
ANCS_CATEGORY_ID_OTHER
@ ANCS_CATEGORY_ID_OTHER
Definition: ancs_protocol.h:75
ANCS_CATEGORY_ID_SCHEDULE
@ ANCS_CATEGORY_ID_SCHEDULE
Definition: ancs_protocol.h:80
CTRL_POINT_GET_APP_ATTRIBUTE
@ CTRL_POINT_GET_APP_ATTRIBUTE
Definition: ancs_protocol.h:108
ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE
@ ANCS_NOTIF_ATTR_ID_MESSAGE_SIZE
Definition: ancs_protocol.h:66
ntf_source_pdu_t
iOS notification structure.
Definition: ancs_protocol.h:131
ACTION_ID_NEGATIVE
@ ACTION_ID_NEGATIVE
Definition: ancs_protocol.h:101
ntf_source_pdu_t::event_flags
ancs_ntf_flags_t event_flags
Definition: ancs_protocol.h:133
ancs_ntf_flags_t::pre_existing
uint8_t pre_existing
Definition: ancs_protocol.h:124
ancs_ntf_flags_t::silent
uint8_t silent
Definition: ancs_protocol.h:122
ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL
@ ANCS_NOTIF_ATTR_ID_POSITIVE_ACTION_LABEL
Definition: ancs_protocol.h:68
ancs_ntf_flags_t::important
uint8_t important
Definition: ancs_protocol.h:123
ntf_source_pdu_t::event_id
ancs_evt_id_t event_id
Definition: ancs_protocol.h:132
ANCS_CATEGORY_ID_ENTERTAINMENT
@ ANCS_CATEGORY_ID_ENTERTAINMENT
Definition: ancs_protocol.h:86
ancs_decode_data_source
void ancs_decode_data_source(uint8_t *p_data, uint16_t length)
Decode data source message.
ANCS_NOTIF_ATTR_ID_MESSAGE
@ ANCS_NOTIF_ATTR_ID_MESSAGE
Definition: ancs_protocol.h:65
ANCS_EVENT_ID_NOTIFICATION_MODIFIED
@ ANCS_EVENT_ID_NOTIFICATION_MODIFIED
Definition: ancs_protocol.h:93
ancs_evt_id_t
ancs_evt_id_t
Event IDs for iOS notifications.
Definition: ancs_protocol.h:91
gr55xx_sys.h
GR55XX System API.
ancs_category_id_t
ancs_category_id_t
Category IDs for iOS notifications.
Definition: ancs_protocol.h:74
ancs_notification_attr_t
ancs_notification_attr_t
IDs for iOS notification attributes.
Definition: ancs_protocol.h:61
ntf_source_pdu_t::category_count
uint8_t category_count
Definition: ancs_protocol.h:135
ancs_decode_notification_source
void ancs_decode_notification_source(uint8_t *p_data, uint16_t length)
Decode notification source message.
CTRL_POINT_PERFORM_NTF_ACTION
@ CTRL_POINT_PERFORM_NTF_ACTION
Definition: ancs_protocol.h:109
ancs_c_ctrl_point_t
ancs_c_ctrl_point_t
ctrl point command that can be performed for iOS notifications.
Definition: ancs_protocol.h:106
ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE
@ ANCS_CATEGORY_ID_BUSINESS_AND_FINANCE
Definition: ancs_protocol.h:84
ancs_notify_attr_get
void ancs_notify_attr_get(int uid, char noti_attr)
Get notification attribute.
ntf_source_pdu_t::category_id
ancs_category_id_t category_id
Definition: ancs_protocol.h:134
ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER
@ ANCS_NOTIF_ATTR_ID_APP_IDENTIFIER
Definition: ancs_protocol.h:62
ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL
@ ANCS_NOTIF_ATTR_ID_NEGATIVE_ACTION_LABEL
Definition: ancs_protocol.h:69
ANCS_CATEGORY_ID_VOICE_MAIL
@ ANCS_CATEGORY_ID_VOICE_MAIL
Definition: ancs_protocol.h:78
ANCS_CATEGORY_ID_LOCATION
@ ANCS_CATEGORY_ID_LOCATION
Definition: ancs_protocol.h:85
CTRL_POINT_GET_NTF_ATTRIBUTE
@ CTRL_POINT_GET_NTF_ATTRIBUTE
Definition: ancs_protocol.h:107
ancs_ntf_flags_t
notification flags that can be performed for iOS notifications.
Definition: ancs_protocol.h:121
ancs_ntf_flags_t::negative_action
uint8_t negative_action
Definition: ancs_protocol.h:126
ancs_c_action_id_t
ancs_c_action_id_t
ID for actions that can be performed for iOS notifications.
Definition: ancs_protocol.h:99
ANCS_CATEGORY_ID_EMAIL
@ ANCS_CATEGORY_ID_EMAIL
Definition: ancs_protocol.h:81
ANCS_CATEGORY_ID_HEALTH_AND_FITNESS
@ ANCS_CATEGORY_ID_HEALTH_AND_FITNESS
Definition: ancs_protocol.h:83
ancs_ntf_flags_t::positive_action
uint8_t positive_action
Definition: ancs_protocol.h:125
ANCS_CATEGORY_ID_MISSED_CALL
@ ANCS_CATEGORY_ID_MISSED_CALL
Definition: ancs_protocol.h:77
ANCS_CATEGORY_ID_SOCIAL
@ ANCS_CATEGORY_ID_SOCIAL
Definition: ancs_protocol.h:79
ACTION_ID_POSITIVE
@ ACTION_ID_POSITIVE
Definition: ancs_protocol.h:100
ancs_get_uid
int ancs_get_uid(void)
get ancs phone call UID
ANCS_NOTIF_ATTR_ID_DATE
@ ANCS_NOTIF_ATTR_ID_DATE
Definition: ancs_protocol.h:67
ANCS_CATEGORY_ID_NEWS
@ ANCS_CATEGORY_ID_NEWS
Definition: ancs_protocol.h:82
ancs_action_perform
void ancs_action_perform(int uid, int action)
ancs perform action
ntf_source_pdu_t::notification_uid
uint32_t notification_uid
Definition: ancs_protocol.h:136
ANCS_CATEGORY_ID_INCOMING_CALL
@ ANCS_CATEGORY_ID_INCOMING_CALL
Definition: ancs_protocol.h:76
ANCS_EVENT_ID_NOTIFICATION_ADDED
@ ANCS_EVENT_ID_NOTIFICATION_ADDED
Definition: ancs_protocol.h:92
ANCS_EVENT_ID_NOTIFICATION_REMOVED
@ ANCS_EVENT_ID_NOTIFICATION_REMOVED
Definition: ancs_protocol.h:94
ANCS_NOTIF_ATTR_ID_TITLE
@ ANCS_NOTIF_ATTR_ID_TITLE
Definition: ancs_protocol.h:63