dss.h
Go to the documentation of this file.
1
59 #ifndef __DSS_H__
60 #define __DSS_H__
61
62 #include "gr55xx_sys.h"
63 #include "custom_config.h"
64 #include <stdint.h>
65
70 #define DSS_CONNECTION_MAX (10 < CFG_MAX_CONNECTIONS ?\
71 10 : CFG_MAX_CONNECTIONS)
72 #define DSS_ROLE_VALUE_LEN 1
73 #define DSS_EVT_CNT_VALUE_LEN 4
74 #define DSS_EVT_PERIOD_VALUE_LEN 2
75 #define DSS_STATUS_VALUE_LEN 1
76 #define DSS_CTRL_PT_VALUE_LEN 7
77 #define DSS_CTRL_PT_RSP_VAL_LEN 3
79 #define DSS_SYNC_DEV_MAX_NUM 5
80 #define DSS_CFG_ADV_IDX 0
81 #define DSS_SYNC_ADV_IDX 1
89 typedef enum
90 {
91 DSS_ROLE_SYNC_INVALID,
92 DSS_ROLE_SYNC_SOURCE,
93 DSS_ROLE_SYNC_DEVICE,
94 } dss_role_t;
95
97 typedef enum
98 {
99 DSS_STATUS_CFG_READY,
100 DSS_STATUS_IN_ADV,
101 DSS_STATUS_IN_SCAN,
102 DSS_STATUS_IN_INITIATING
103 } dss_staus_t;
104
106 typedef enum
107 {
108 DSS_OP_ID_INVALID,
109 DSS_OP_ID_ROLE_SET,
110 DSS_OP_ID_SYNC_SRC_CREATE,
111 DSS_OP_ID_SYNC,
112 DSS_OP_ID_CANCEL_SYNC,
113 DSS_OP_ID_LP_ENTER,
114 DSS_OP_ID_SYNC_DESTROY,
115 DSS_OP_ID_RSP = 0xff
116 } dss_op_id_t;
117
119 typedef enum
120 {
121 DSS_RSP_ID_SUCCESS,
122 DSS_RSP_ID_UNSUPPORT,
123 DSS_RSP_ID_DISALLOWED,
124 DSS_RSP_ID_STATUS_ERR,
125 DSS_RSP_ID_PARAM_ERR,
126 DSS_RSP_ID_ROLE_ERR,
127 DSS_RSP_ID_NO_HANDLER,
128 DSS_RSP_ID_ADV_START_FAIL,
129 DSS_RSP_ID_ADV_TIMEOUT,
130 DSS_RSP_ID_SCAN_START_FAIL,
131 DSS_RSP_ID_SCAN_TIMEOUT,
132 DSS_RSP_ID_CONN_EST_FAIL,
133 DSS_RSP_ID_CREATE_SRC_FAIL,
134 DSS_RSP_ID_DISTR_SRC_FAIL,
135 DSS_RSP_ID_DESTROY_SRC_FAIL,
136 DSS_RSP_ID_ENTER_LP_FAIL,
137 DSS_RSP_ID_CANCEL_SYNC_FAIL,
138 } dss_rsp_id_t;
139
140
142 typedef enum
143 {
144 DSS_EVT_INVALID,
145 DSS_EVT_SOURCE_ROLE_SET,
146 DSS_EVT_DEVICE_ROLE_SET,
147 DSS_EVT_SYNC_SRC_CREATE,
148 DSS_EVT_SYNC_DESTROY,
149 DSS_EVT_SYNC_OCCUR,
150 DSS_EVT_SYNC_SELF_OR_PEER,
151 DSS_EVT_SYNC_CANCEL,
152 DSS_EVT_LP_ENTER,
153 } dss_evt_type_t;
161 typedef struct
162 {
163 dss_evt_type_t evt_type;
164 uint8_t conn_idx;
165 uint32_t sync_cnt;
166 uint8_t sync_dev_num;
167 bool is_enter_lp_mode;
168 } dss_evt_t;
176 typedef void (*dss_evt_handler_t)(dss_evt_t *p_evt);
193 sdk_err_t dss_service_init(dss_evt_handler_t evt_handler);
194
206 sdk_err_t dss_sync_op_result_send(uint8_t conn_idx, dss_evt_type_t evt_type, dss_rsp_id_t rsp_id);
207
215 void dss_sync_src_distribute(uint8_t conn_idx);
216
225 void dss_set_status(uint8_t conn_idx, dss_staus_t status);
226
236 void dss_set_sync_params(uint8_t conn_idx, bool is_auto_enter_lp, bool is_auto_calib_drift);
237
246 void dss_set_lp_mode(uint8_t conn_idx, bool is_in_lp_mode);
249 #endif
250
dss_rsp_id_t
dss_rsp_id_t
Device Synchronize Service control point response IDs.
Definition: dss.h:120
DSS_RSP_ID_SCAN_START_FAIL
@ DSS_RSP_ID_SCAN_START_FAIL
Definition: dss.h:130
dss_set_sync_params
void dss_set_sync_params(uint8_t conn_idx, bool is_auto_enter_lp, bool is_auto_calib_drift)
Set Sync params.
dss_role_t
dss_role_t
Device Synchronize Service roles.
Definition: dss.h:90
DSS_RSP_ID_ADV_TIMEOUT
@ DSS_RSP_ID_ADV_TIMEOUT
Definition: dss.h:129
DSS_EVT_SOURCE_ROLE_SET
@ DSS_EVT_SOURCE_ROLE_SET
Definition: dss.h:145
DSS_OP_ID_CANCEL_SYNC
@ DSS_OP_ID_CANCEL_SYNC
Definition: dss.h:112
DSS_ROLE_SYNC_SOURCE
@ DSS_ROLE_SYNC_SOURCE
Definition: dss.h:92
DSS_RSP_ID_ROLE_ERR
@ DSS_RSP_ID_ROLE_ERR
Definition: dss.h:126
DSS_EVT_SYNC_SRC_CREATE
@ DSS_EVT_SYNC_SRC_CREATE
Definition: dss.h:147
gr55xx_sys.h
GR55XX System API.
DSS_ROLE_SYNC_DEVICE
@ DSS_ROLE_SYNC_DEVICE
Definition: dss.h:93
dss_evt_t::evt_type
dss_evt_type_t evt_type
Definition: dss.h:163
dss_sync_op_result_send
sdk_err_t dss_sync_op_result_send(uint8_t conn_idx, dss_evt_type_t evt_type, dss_rsp_id_t rsp_id)
Send Control Point Response.
DSS_RSP_ID_DISALLOWED
@ DSS_RSP_ID_DISALLOWED
Definition: dss.h:123
DSS_RSP_ID_STATUS_ERR
@ DSS_RSP_ID_STATUS_ERR
Definition: dss.h:124
dss_evt_handler_t
void(* dss_evt_handler_t)(dss_evt_t *p_evt)
Device Synchronize Service event handler type.
Definition: dss.h:176
DSS_EVT_SYNC_CANCEL
@ DSS_EVT_SYNC_CANCEL
Definition: dss.h:151
dss_evt_t::is_enter_lp_mode
bool is_enter_lp_mode
Definition: dss.h:167
DSS_RSP_ID_ENTER_LP_FAIL
@ DSS_RSP_ID_ENTER_LP_FAIL
Definition: dss.h:136
DSS_STATUS_IN_INITIATING
@ DSS_STATUS_IN_INITIATING
Definition: dss.h:102
DSS_EVT_SYNC_DESTROY
@ DSS_EVT_SYNC_DESTROY
Definition: dss.h:148
DSS_OP_ID_SYNC_DESTROY
@ DSS_OP_ID_SYNC_DESTROY
Definition: dss.h:114
dss_evt_t::conn_idx
uint8_t conn_idx
Definition: dss.h:164
dss_op_id_t
dss_op_id_t
Device Synchronize Service control point OP IDs.
Definition: dss.h:107
dss_evt_t
Device Synchronize Service Synchronize event.
Definition: dss.h:162
DSS_RSP_ID_ADV_START_FAIL
@ DSS_RSP_ID_ADV_START_FAIL
Definition: dss.h:128
DSS_OP_ID_RSP
@ DSS_OP_ID_RSP
Definition: dss.h:115
dss_staus_t
dss_staus_t
Device Synchronize Service status.
Definition: dss.h:98
dss_service_init
sdk_err_t dss_service_init(dss_evt_handler_t evt_handler)
Initialize a Device Synchronize Service instance and add in the database.
dss_evt_t::sync_dev_num
uint8_t sync_dev_num
Definition: dss.h:166
DSS_RSP_ID_NO_HANDLER
@ DSS_RSP_ID_NO_HANDLER
Definition: dss.h:127
DSS_STATUS_IN_SCAN
@ DSS_STATUS_IN_SCAN
Definition: dss.h:101
DSS_EVT_LP_ENTER
@ DSS_EVT_LP_ENTER
Definition: dss.h:152
DSS_EVT_DEVICE_ROLE_SET
@ DSS_EVT_DEVICE_ROLE_SET
Definition: dss.h:146
sdk_err_t
uint16_t sdk_err_t
SDK API result type.
Definition: ble_error.h:243
DSS_OP_ID_ROLE_SET
@ DSS_OP_ID_ROLE_SET
Definition: dss.h:109
DSS_ROLE_SYNC_INVALID
@ DSS_ROLE_SYNC_INVALID
Definition: dss.h:91
dss_set_lp_mode
void dss_set_lp_mode(uint8_t conn_idx, bool is_in_lp_mode)
Set Device whether in low power mode.
DSS_RSP_ID_PARAM_ERR
@ DSS_RSP_ID_PARAM_ERR
Definition: dss.h:125
DSS_RSP_ID_SCAN_TIMEOUT
@ DSS_RSP_ID_SCAN_TIMEOUT
Definition: dss.h:131
dss_set_status
void dss_set_status(uint8_t conn_idx, dss_staus_t status)
Set dss status.
DSS_STATUS_IN_ADV
@ DSS_STATUS_IN_ADV
Definition: dss.h:100
DSS_RSP_ID_CONN_EST_FAIL
@ DSS_RSP_ID_CONN_EST_FAIL
Definition: dss.h:132
DSS_OP_ID_SYNC_SRC_CREATE
@ DSS_OP_ID_SYNC_SRC_CREATE
Definition: dss.h:110
DSS_EVT_INVALID
@ DSS_EVT_INVALID
Definition: dss.h:144
DSS_RSP_ID_CREATE_SRC_FAIL
@ DSS_RSP_ID_CREATE_SRC_FAIL
Definition: dss.h:133
DSS_STATUS_CFG_READY
@ DSS_STATUS_CFG_READY
Definition: dss.h:99
DSS_OP_ID_LP_ENTER
@ DSS_OP_ID_LP_ENTER
Definition: dss.h:113
DSS_EVT_SYNC_SELF_OR_PEER
@ DSS_EVT_SYNC_SELF_OR_PEER
Definition: dss.h:150
dss_sync_src_distribute
void dss_sync_src_distribute(uint8_t conn_idx)
Distribute sync source to peer.
DSS_EVT_SYNC_OCCUR
@ DSS_EVT_SYNC_OCCUR
Definition: dss.h:149
dss_evt_type_t
dss_evt_type_t
Device Synchronize Service event types.
Definition: dss.h:143
DSS_OP_ID_SYNC
@ DSS_OP_ID_SYNC
Definition: dss.h:111
DSS_RSP_ID_SUCCESS
@ DSS_RSP_ID_SUCCESS
Definition: dss.h:121
DSS_RSP_ID_DESTROY_SRC_FAIL
@ DSS_RSP_ID_DESTROY_SRC_FAIL
Definition: dss.h:135
DSS_RSP_ID_DISTR_SRC_FAIL
@ DSS_RSP_ID_DISTR_SRC_FAIL
Definition: dss.h:134
DSS_OP_ID_INVALID
@ DSS_OP_ID_INVALID
Definition: dss.h:108
DSS_RSP_ID_UNSUPPORT
@ DSS_RSP_ID_UNSUPPORT
Definition: dss.h:122
dss_evt_t::sync_cnt
uint32_t sync_cnt
Definition: dss.h:165
DSS_RSP_ID_CANCEL_SYNC_FAIL
@ DSS_RSP_ID_CANCEL_SYNC_FAIL
Definition: dss.h:137