pass_c.h
Go to the documentation of this file.
1
59 #ifndef __PASS_C_H__
60 #define __PASS_C_H__
61
62 #include "ble_prf_types.h"
63 #include "gr55xx_sys.h"
64 #include "custom_config.h"
65 #include <stdint.h>
66 #include <stdbool.h>
67
77 #define PASS_C_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
78 10 : CFG_MAX_CONNECTIONS)
79 #define PASS_C_NO_STATE_ACTIVE (0x00)
80 #define PASS_C_RINGER_ACTIVE (0x01 << 0)
81 #define PASS_C_VIBRATE_ACTIVE (0x01 << 1)
82 #define PASS_C_DISPLAY_ALERT_ACTIVE (0x01 << 2)
83 #define PASS_C_ALL_STATE_ACTIVE (0x07)
86 #define PASS_C_RINGER_CTRL_PT_VAL_LEN 1
93 #define PASS_C_RINGER_SET_SILENT 0
94 #define PASS_C_RINGER_SET_NORMAL 1
103 typedef enum
104 {
105 PASS_C_CTRL_PT_SILENT_MODE = 0x01,
106 PASS_C_CTRL_PT_MUTE_ONCE,
107 PASS_C_CTRL_PT_CANCEL_SLIENT_MODE,
108 } pass_c_ringer_ctrl_pt_t;
109
111 typedef enum
112 {
113 PASS_C_EVT_INVALID, /*<* PASS Client invalid event. */
114 PASS_C_EVT_DISCOVERY_COMPLETE,
115 PASS_C_EVT_DISCOVERY_FAIL,
116 PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS,
117 PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS,
118 PASS_C_EVT_ALERT_STATUS_RECEIVE,
119 PASS_C_EVT_RINGER_SET_RECEIVE,
120 PASS_C_EVT_CTRL_POINT_SET_SUCCESS,
121 PASS_C_EVT_WRITE_OP_ERR,
122 } pass_c_evt_type_t;
123
131 typedef struct
132 {
133 uint16_t pass_srvc_start_handle;
134 uint16_t pass_srvc_end_handle;
135 uint16_t pass_alert_status_handle;
136 uint16_t pass_alert_status_cccd_handle;
137 uint16_t pass_ringer_set_handle;
138 uint16_t pass_ringer_set_cccd_handle;
139 uint16_t pass_ringer_ctrl_pt_handle;
140 } pass_c_handles_t;
141
143 typedef struct
144 {
145 uint8_t conn_idx;
146 pass_c_evt_type_t evt_type;
147 union
148 {
149 uint8_t alert_status;
150 uint8_t ringer_set;
151 } value;
152 } pass_c_evt_t;
160 typedef void (*pass_c_evt_handler_t)(pass_c_evt_t *p_evt);
176 sdk_err_t pass_client_init(pass_c_evt_handler_t evt_handler);
177
187 sdk_err_t pass_c_disc_srvc_start(uint8_t conn_idx);
188
199 sdk_err_t pass_c_alert_status_notify_set(uint8_t conn_idx, bool is_enable);
200
211 sdk_err_t pass_c_ringer_set_notify_set(uint8_t conn_idx, bool is_enable);
212
222 sdk_err_t pass_c_alert_status_read(uint8_t conn_idx);
223
233 sdk_err_t pass_c_ringer_set_read(uint8_t conn_idx);
234
245 sdk_err_t pass_c_ctrl_point_set(uint8_t conn_idx, uint8_t ctrl_value);
248 #endif
249
PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS
@ PASS_C_EVT_RINGER_SET_NTF_SET_SUCCESS
Definition: pass_c.h:117
PASS_C_EVT_ALERT_STATUS_RECEIVE
@ PASS_C_EVT_ALERT_STATUS_RECEIVE
Definition: pass_c.h:118
pass_c_alert_status_notify_set
sdk_err_t pass_c_alert_status_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer Alert Status characteristic notify.
PASS_C_EVT_DISCOVERY_FAIL
@ PASS_C_EVT_DISCOVERY_FAIL
Definition: pass_c.h:115
pass_c_handles_t
Handles on the connected peer device needed to interact with it.
Definition: pass_c.h:132
pass_c_evt_t::alert_status
uint8_t alert_status
Definition: pass_c.h:149
PASS_C_EVT_WRITE_OP_ERR
@ PASS_C_EVT_WRITE_OP_ERR
Definition: pass_c.h:121
pass_c_ringer_ctrl_pt_t
pass_c_ringer_ctrl_pt_t
Phone Alert Status Service Client Ringer Control Point.
Definition: pass_c.h:104
PASS_C_EVT_CTRL_POINT_SET_SUCCESS
@ PASS_C_EVT_CTRL_POINT_SET_SUCCESS
Definition: pass_c.h:120
pass_c_handles_t::pass_ringer_set_handle
uint16_t pass_ringer_set_handle
Definition: pass_c.h:137
pass_c_handles_t::pass_alert_status_cccd_handle
uint16_t pass_alert_status_cccd_handle
Definition: pass_c.h:136
gr55xx_sys.h
GR55XX System API.
pass_c_handles_t::pass_srvc_start_handle
uint16_t pass_srvc_start_handle
Definition: pass_c.h:133
pass_c_alert_status_read
sdk_err_t pass_c_alert_status_read(uint8_t conn_idx)
Read Alert Status characteristic value.
pass_c_evt_t::conn_idx
uint8_t conn_idx
Definition: pass_c.h:145
pass_c_evt_t::evt_type
pass_c_evt_type_t evt_type
Definition: pass_c.h:146
pass_client_init
sdk_err_t pass_client_init(pass_c_evt_handler_t evt_handler)
Register PASS Client event handler.
pass_c_handles_t::pass_ringer_set_cccd_handle
uint16_t pass_ringer_set_cccd_handle
Definition: pass_c.h:138
PASS_C_CTRL_PT_SILENT_MODE
@ PASS_C_CTRL_PT_SILENT_MODE
Definition: pass_c.h:105
pass_c_ringer_set_notify_set
sdk_err_t pass_c_ringer_set_notify_set(uint8_t conn_idx, bool is_enable)
Enable or disable peer Ringer Setting characteristic notify.
ble_prf_types.h
Profile/Service Common Types.
pass_c_handles_t::pass_ringer_ctrl_pt_handle
uint16_t pass_ringer_ctrl_pt_handle
Definition: pass_c.h:139
PASS_C_EVT_RINGER_SET_RECEIVE
@ PASS_C_EVT_RINGER_SET_RECEIVE
Definition: pass_c.h:119
PASS_C_CTRL_PT_MUTE_ONCE
@ PASS_C_CTRL_PT_MUTE_ONCE
Definition: pass_c.h:106
PASS_C_CTRL_PT_CANCEL_SLIENT_MODE
@ PASS_C_CTRL_PT_CANCEL_SLIENT_MODE
Definition: pass_c.h:107
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
pass_c_evt_handler_t
void(* pass_c_evt_handler_t)(pass_c_evt_t *p_evt)
Phone Alert Status Service Client event handler type.
Definition: pass_c.h:160
pass_c_ctrl_point_set
sdk_err_t pass_c_ctrl_point_set(uint8_t conn_idx, uint8_t ctrl_value)
Set Control Point characteristic value.
PASS_C_EVT_DISCOVERY_COMPLETE
@ PASS_C_EVT_DISCOVERY_COMPLETE
Definition: pass_c.h:114
pass_c_evt_t
Phone Alert Status Client Service event.
Definition: pass_c.h:144
pass_c_handles_t::pass_alert_status_handle
uint16_t pass_alert_status_handle
Definition: pass_c.h:135
pass_c_evt_type_t
pass_c_evt_type_t
Phone Alert Status Service Client event type.
Definition: pass_c.h:112
pass_c_evt_t::ringer_set
uint8_t ringer_set
Definition: pass_c.h:150
pass_c_ringer_set_read
sdk_err_t pass_c_ringer_set_read(uint8_t conn_idx)
Read Ringer Setting characteristic value.
PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS
@ PASS_C_EVT_ALERT_STATUS_NTF_SET_SUCCESS
Definition: pass_c.h:116
pass_c_disc_srvc_start
sdk_err_t pass_c_disc_srvc_start(uint8_t conn_idx)
Discovery Phone Alert Status Service on peer.
pass_c_handles_t::pass_srvc_end_handle
uint16_t pass_srvc_end_handle
Definition: pass_c.h:134