ancs_c.h
Go to the documentation of this file.
1
69 #ifndef _ANCS_H_
70 #define _ANCS_H_
71
72 #include "gr55xx_sys.h"
73 #include "ble_prf_types.h"
74 #include "custom_config.h"
75 #include <stdint.h>
76
81 #define ANCS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
82 10 : CFG_MAX_CONNECTIONS)
83 #define ANCS_SRVC_UUID 0xd0, 0x00, 0x2d, 0x12, 0x1e, 0x4b, 0x0f, 0xa4,\
84 0x99,0x4e, 0xce, 0xb5, 0x31, 0xf4, 0x05, 0x79
85 #define ANCS_NTF_SOURCE_UUID 0xbd, 0x1d, 0xa2, 0x99, 0xe6, 0x25, 0x58, 0x8c,\
86 0xd9, 0x42, 0x01, 0x63, 0x0d, 0x12, 0xbf, 0x9f
87 #define ANCS_CONTROL_POINT_UUID 0xd9, 0xd9, 0xaa, 0xfd, 0xbd, 0x9b, 0x21, 0x98,\
88 0xa8, 0x49, 0xe1, 0x45, 0xf3, 0xd8, 0xd1, 0x69
89 #define ANCS_DATA_SOURCE_UUID 0xfb, 0x7b, 0x7c, 0xce, 0x6a, 0xb3, 0x44, 0xbe,\
90 0xb5, 0x4b, 0xd6, 0x24, 0xe9, 0xc6, 0xea, 0x22
99 typedef enum
100 {
101 BLE_ANCS_C_EVT_INVALID,
102 BLE_ANCS_C_EVT_DISCOVERY_CPLT,
103 BLE_ANCS_C_EVT_DISCOVERY_FAILED,
104 BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED,
105 BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED,
106 BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE,
107 BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE,
108 BLE_ANCS_C_EVT_WRITE_OP_ERR,
109 } ble_ancs_c_evt_type_t;
117 typedef struct
118 {
119 uint16_t ancs_service_handle;
120 uint16_t ancs_ntf_source_handle;
121 uint16_t ancs_ntf_source_cccd_handle;
122 uint16_t ancs_control_point_handle;
123 uint16_t ancs_data_source_handle;
124 uint16_t ancs_data_source_cccd_handle;
125 }ancs_c_att_handles_t;
126
128 typedef struct
129 {
130 uint8_t conn_idx;
131 ble_ancs_c_evt_type_t evt_type;
133 } ancs_c_evt_t;
141 typedef void (*ancs_c_evt_handler_t)(ancs_c_evt_t *p_evt);
153 sdk_err_t ancs_c_client_init(ancs_c_evt_handler_t evt_handler);
154
162 sdk_err_t ancs_c_discovery_service(uint8_t conn_idx);
163
173 sdk_err_t ancs_c_ntf_source_notify_set(uint8_t conn_idx, bool is_enable);
174
184 sdk_err_t ancs_c_data_source_notify_set(uint8_t conn_idx, bool is_enable);
185
195 sdk_err_t ancs_c_write_control_point(uint8_t conn_idx, uint8_t *p_data, uint16_t length);
196
199 #endif
200
BLE_ANCS_C_EVT_INVALID
@ BLE_ANCS_C_EVT_INVALID
Definition: ancs_c.h:101
ancs_c_att_handles_t::ancs_control_point_handle
uint16_t ancs_control_point_handle
Definition: ancs_c.h:122
ancs_c_evt_handler_t
void(* ancs_c_evt_handler_t)(ancs_c_evt_t *p_evt)
Apple Notification Center Service event handler type.
Definition: ancs_c.h:141
ancs_c_write_control_point
sdk_err_t ancs_c_write_control_point(uint8_t conn_idx, uint8_t *p_data, uint16_t length)
This function implements writing commands to control points.
BLE_ANCS_C_EVT_DISCOVERY_FAILED
@ BLE_ANCS_C_EVT_DISCOVERY_FAILED
Definition: ancs_c.h:103
BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE
@ BLE_ANCS_C_EVT_NTF_SOURCE_RECEIVE
Definition: ancs_c.h:106
ble_ancs_c_evt_type_t
ble_ancs_c_evt_type_t
Event types that are passed from client to application on an event.
Definition: ancs_c.h:100
gr55xx_sys.h
GR55XX System API.
BLE_ANCS_C_EVT_DISCOVERY_CPLT
@ BLE_ANCS_C_EVT_DISCOVERY_CPLT
Definition: ancs_c.h:102
ancs_c_data_source_notify_set
sdk_err_t ancs_c_data_source_notify_set(uint8_t conn_idx, bool is_enable)
enable ancs data source CCCD.
ancs_c_discovery_service
sdk_err_t ancs_c_discovery_service(uint8_t conn_idx)
To access phone's all services about ANCS.
ble_prf_types.h
Profile/Service Common Types.
ancs_c_att_handles_t::ancs_data_source_cccd_handle
uint16_t ancs_data_source_cccd_handle
Definition: ancs_c.h:124
ancs_c_client_init
sdk_err_t ancs_c_client_init(ancs_c_evt_handler_t evt_handler)
Initialize ANCS structure of handle.
ancs_c_att_handles_t::ancs_data_source_handle
uint16_t ancs_data_source_handle
Definition: ancs_c.h:123
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
ancs_c_att_handles_t
ancs handle structure.
Definition: ancs_c.h:118
ancs_c_ntf_source_notify_set
sdk_err_t ancs_c_ntf_source_notify_set(uint8_t conn_idx, bool is_enable)
enable ancs notification source CCCD.
ancs_c_att_handles_t::ancs_service_handle
uint16_t ancs_service_handle
Definition: ancs_c.h:119
ancs_c_att_handles_t::ancs_ntf_source_cccd_handle
uint16_t ancs_ntf_source_cccd_handle
Definition: ancs_c.h:121
BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE
@ BLE_ANCS_C_EVT_DATA_SOURCE_RECEIVE
Definition: ancs_c.h:107
ancs_c_evt_t::evt_type
ble_ancs_c_evt_type_t evt_type
Definition: ancs_c.h:131
ancs_c_evt_t
ANCS Client event.
Definition: ancs_c.h:129
BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED
@ BLE_ANCS_C_EVT_DATA_SOURCE_NTF_ENABLED
Definition: ancs_c.h:105
BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED
@ BLE_ANCS_C_EVT_NTF_SOURCE_NTF_ENABLED
Definition: ancs_c.h:104
ancs_c_evt_t::conn_idx
uint8_t conn_idx
Definition: ancs_c.h:130
ancs_c_att_handles_t::ancs_ntf_source_handle
uint16_t ancs_ntf_source_handle
Definition: ancs_c.h:120