Welcome to mirror list, hosted at ThFree Co, Russian Federation.

ancs_client_app.h « App « STM32_WPAN « BLE_HeartRate_ANCS « BLE « Applications « P-NUCLEO-WB55.Nucleo « Projects - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 69a070616a780e5e5ee819af87e704200a482a80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274

/**
 ******************************************************************************
 * @file    ancs_client_app.h
 * @author  MCD Application Team
 * @brief   Header for ancs_client_app.c module
 ******************************************************************************
 * @attention
 *
 * <h2><center>&copy; Copyright (c) 2018 STMicroelectronics.
 * All rights reserved.</center></h2>
 *
 * This software component is licensed by ST under Ultimate Liberty license
 * SLA0044, the "License"; You may not use this file except in compliance with
 * the License. You may obtain a copy of the License at:
 *                             www.st.com/SLA0044
 *
 ******************************************************************************
 */


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ANCS_APPLICATION_H
#define __ANCS_APPLICATION_H

#ifdef __cplusplus
extern "C" {
#endif
/**
 *@addtogroup ANCS ANCS
 *@brief ANCS Profile.
 *@{
 */

/**
 *@defgroup ANCS_defines ANCS defines
 *@brief List of constant used in the ANCS.
 *@{
 */

/**
 * @anchor CategoryIDs
 * @name Category ID values
 * @{
 */
typedef enum {
  CategoryIDOther = 0,
  CategoryIDIncomingCall = 1,
  CategoryIDMissedCall = 2,
  CategoryIDVoicemail = 3,
  CategoryIDSocial = 4,
  CategoryIDSchedule = 5,
  CategoryIDEmail = 6,
  CategoryIDNews = 7,
  CategoryIDHealthAndFitness = 8,
  CategoryIDBusinessAndFinance = 9,
  CategoryIDLocation = 10,
  CategoryIDEntertainment = 11,
} CategoryID;
/**
 * @}
 */

/**
 * @anchor EventIDs
 * @name Event ID values
 * @{
 */
typedef enum {
  EventIDNotificationAdded = 0,
  EventIDNotificationModified = 1,
  EventIDNotificationRemoved = 2,
} EventID;
/**
 * @}
 */

/**
 * @anchor EventFlags
 * @name Event Flag values
 * @{
 */
typedef enum {
  EventFlagSilent = (1 << 0),
  EventFlagImportant = (1 << 1),
  EventFlagPreExisting = (1 << 2),
  EventFlagPositiveAction = (1 << 3),
  EventFlagNegativeAction = (1 << 4),
} EventFlags;
/**
 * @}
 */

/**
 * @anchor CommandIDs to control point characteristic commands
 * @name Command ID values
 * @{
 */
typedef enum {
  CommandIDGetNotificationAttributes = 0,
  CommandIDGetAppAttributes = 1,
  CommandIDPerformNotificationAction = 2,
} CommandID;
/**
 * @}
 */

/**
 * @anchor NotificationAttributeIDs for Get Notification Attribute command
 * @name Notification Attribute ID values for Get notifications attributes command
 * @{
 */
typedef enum {
  NotificationAttributeIDAppIdentifier = 0,
  NotificationAttributeIDTitle = 1, 
  NotificationAttributeIDSubtitle = 2,
  NotificationAttributeIDMessage = 3,
  NotificationAttributeIDMessageSize = 4,
  NotificationAttributeIDDate = 5,
  NotificationAttributeIDPositiveActionLabel = 6,
  NotificationAttributeIDNegativeActionLabel = 7,
} NotificationAttributeID;
/**
 * @}
 */

/**
 * @anchor ActionIDs
 * @name Action ID values
 * @{
 */
typedef enum {
  ActionIDPositive = 0,
  ActionIDNegative = 1,
}ActionID;
/**
 * @}
 */

/**
 * @anchor AppAttributeIDs for Get App Attribute command
 * @name App Attribute ID values
 * @{
 */
typedef enum {
  AppAttributeIDDisplayName = 0,
} AppAttributeID;
/**
 * @}
 */


  

/**
 * @}
 */

/**
 * @}
 */

/**
 *@defgroup ANCS_NotifType ANCS Notification Attribute Types
 *@brief ANCS notification attributes types.
 *@{
 */

/**
 * @anchor notificationAttrS
 * @name Notification Attributes typedef
 * @{
 */
typedef struct notificationAttrS {
  /** A 32-bit numerical value that is the unique identifier (UID) for the iOS notification. This
   *  value can be used as a handle in commands sent to the Control Point characteristic to interact with the
   *  iOS notification.
   */
  uint32_t UID;
  /** App Identifer flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  appID_flag;
  /** Title flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  title_flag;
  /** Max title length parameter */
  uint16_t title_max_size;
  /** Subtitle flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  subtitle_flag;
  /** Max Subtitle length paramter */
  uint16_t subtitle_max_size;
  /** Message flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  message_flag;
  /** Max Message length parameter */
  uint16_t message_max_size;
  /** Message size flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  messageSize_flag;
  /** Data flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  date_flag;
  /** Positive Action flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  positiveAction_flag;
  /** Negative Action flag, if TRUE this attribute is requested from the Get Notification Attributes command */
  uint8_t  negativeAction_flag;
} notificationAttr_type;
/**
 * @}
 */

/*-------------------------------------------------------------------------*/
  /**
   * Data Transfer structure (ie. Connection events state)
   */

  typedef enum
{
  ANCS_IDLE,
  ANCS_CONNECTED,             /* Connection_Evt: ANCS_CONNECTION_ESTABLISHED */
  ANCS_DISCONNECTING,      /* Connection_Evt */
  ANCS_DISCONN_COMPLETE,      /* Connection_Evt */
  
  ANCS_SET_DATA_LENGTH,       /* Connection_Evt */
  ANCS_MTU_UPDATE,            /* Connection_Evt */
  ANCS_MTU_EXCHANGE_COMPLETE, /* Connection_Evt */
  
  ANCS_DISCOVER_ALL_SERVICES,
  ANCS_DISCOVER_ANCS_SERVICE,
  ANCS_DISCOVER_ALL_CHARS,
  ANCS_DISCOVER_ALL_CHAR_DESCS,
  ANCS_ENABLE_NOTIFICATION_NOTIFICATION_SOURCE_DESC,
  ANCS_ENABLE_NOTIFICATION_DATA_SOURCE_DESC,
  ANCS_ENABLE_NOTIFICATION_SERVICE_CHANGED_DESC,
  
  ANCS_GET_NOTIFICATION_ATTRIBUTE,
  ANCS_GET_APP_ATTRIBUTE,
  ANCS_PERFORM_NOTIFICATION_ACTION,
  ANCS_CHECK_NOTIFICATION,
  
} ANCS_ProfileState; 

typedef struct
{
  /**
  * state of the Data Transfer (state machine)
  */
  
  ANCS_ProfileState Evt_Opcode;
  /**
  * connection handle
  */
  uint16_t connection_handle;
  
} Connection_Context_t;

/*-------------------------------------------------------------------------*/

  /* Includes ------------------------------------------------------------------*/
  /* Exported types ------------------------------------------------------------*/
  /* Exported constants --------------------------------------------------------*/
  /* External variables --------------------------------------------------------*/
  /* Exported macros -----------------------------------------------------------*/
  /* Exported functions ------------------------------------------------------- */
  
void ANCS_Client_App_Init(void);
void ANCS_App_KeyButton1Action(void);
void ANCS_App_KeyButton2Action(void);
void ANCS_App_KeyButton3Action(void);
void ANCS_App_Peer_Bonded_Check(uint16_t Connection_Handle, uint8_t Peer_Address_Type, uint8_t Peer_Address[6]);
void ANCS_App_Notification( Connection_Context_t *pNotification );

#ifdef __cplusplus
}
#endif

#endif /*__ANCS_APPLICATION_H */

/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/