@@ -192,9 +192,11 @@ static ssize_t write_vcs_control(struct bt_conn *conn,
192
192
if (volume_change && !vol_rend .flags ) {
193
193
vol_rend .flags = 1 ;
194
194
195
- bt_gatt_notify_uuid (NULL , BT_UUID_VCS_FLAGS ,
196
- vol_rend .service_p -> attrs ,
197
- & vol_rend .flags , sizeof (vol_rend .flags ));
195
+ if (IS_ENABLED (CONFIG_BT_VCP_VOL_REND_VOL_FLAGS_NOTIFIABLE )) {
196
+ bt_gatt_notify_uuid (NULL , BT_UUID_VCS_FLAGS ,
197
+ vol_rend .service_p -> attrs ,
198
+ & vol_rend .flags , sizeof (vol_rend .flags ));
199
+ }
198
200
199
201
if (vol_rend .cb && vol_rend .cb -> flags ) {
200
202
vol_rend .cb -> flags (0 , vol_rend .flags );
@@ -203,10 +205,12 @@ static ssize_t write_vcs_control(struct bt_conn *conn,
203
205
return len ;
204
206
}
205
207
208
+ #if defined(CONFIG_BT_VCP_VOL_REND_VOL_FLAGS_NOTIFIABLE )
206
209
static void flags_cfg_changed (const struct bt_gatt_attr * attr , uint16_t value )
207
210
{
208
211
LOG_DBG ("value 0x%04x" , value );
209
212
}
213
+ #endif /* CONFIG_BT_VCP_VOL_REND_VOL_FLAGS_NOTIFIABLE */
210
214
211
215
static ssize_t read_flags (struct bt_conn * conn , const struct bt_gatt_attr * attr ,
212
216
void * buf , uint16_t len , uint16_t offset )
@@ -220,26 +224,34 @@ static ssize_t read_flags(struct bt_conn *conn, const struct bt_gatt_attr *attr,
220
224
#define VOCS_INCLUDES (cnt ) LISTIFY(cnt, DUMMY_INCLUDE, ())
221
225
#define AICS_INCLUDES (cnt ) LISTIFY(cnt, DUMMY_INCLUDE, ())
222
226
223
- #define BT_VCS_DEFINITION \
224
- BT_GATT_PRIMARY_SERVICE(BT_UUID_VCS), \
225
- VOCS_INCLUDES(CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT) \
226
- AICS_INCLUDES(CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT) \
227
- BT_AUDIO_CHRC(BT_UUID_VCS_STATE, \
228
- BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
229
- BT_GATT_PERM_READ_ENCRYPT, \
230
- read_vol_state, NULL, NULL), \
231
- BT_AUDIO_CCC(volume_state_cfg_changed), \
232
- BT_AUDIO_CHRC(BT_UUID_VCS_CONTROL, \
233
- BT_GATT_CHRC_WRITE, \
234
- BT_GATT_PERM_WRITE_ENCRYPT, \
235
- NULL, write_vcs_control, NULL), \
236
- BT_AUDIO_CHRC(BT_UUID_VCS_FLAGS, \
237
- BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY, \
238
- BT_GATT_PERM_READ_ENCRYPT, \
239
- read_flags, NULL, NULL), \
227
+ /* Volume Control Service GATT Attributes */
228
+ static struct bt_gatt_attr vcs_attrs [] = {
229
+ BT_GATT_PRIMARY_SERVICE (BT_UUID_VCS ),
230
+ VOCS_INCLUDES (CONFIG_BT_VCP_VOL_REND_VOCS_INSTANCE_COUNT )
231
+ AICS_INCLUDES (CONFIG_BT_VCP_VOL_REND_AICS_INSTANCE_COUNT )
232
+ BT_AUDIO_CHRC (BT_UUID_VCS_STATE ,
233
+ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY ,
234
+ BT_GATT_PERM_READ_ENCRYPT ,
235
+ read_vol_state , NULL , NULL ),
236
+ BT_AUDIO_CCC (volume_state_cfg_changed ),
237
+ BT_AUDIO_CHRC (BT_UUID_VCS_CONTROL ,
238
+ BT_GATT_CHRC_WRITE ,
239
+ BT_GATT_PERM_WRITE_ENCRYPT ,
240
+ NULL , write_vcs_control , NULL ),
241
+ #if defined(CONFIG_BT_VCP_VOL_REND_VOL_FLAGS_NOTIFIABLE )
242
+ BT_AUDIO_CHRC (BT_UUID_VCS_FLAGS ,
243
+ BT_GATT_CHRC_READ | BT_GATT_CHRC_NOTIFY ,
244
+ BT_GATT_PERM_READ_ENCRYPT ,
245
+ read_flags , NULL , NULL ),
240
246
BT_AUDIO_CCC (flags_cfg_changed )
247
+ #else
248
+ BT_AUDIO_CHRC (BT_UUID_VCS_FLAGS ,
249
+ BT_GATT_CHRC_READ ,
250
+ BT_GATT_PERM_READ_ENCRYPT ,
251
+ read_flags , NULL , NULL )
252
+ #endif /* CONFIG_BT_VCP_VOL_REND_VOL_FLAGS_NOTIFIABLE */
253
+ };
241
254
242
- static struct bt_gatt_attr vcs_attrs [] = { BT_VCS_DEFINITION };
243
255
static struct bt_gatt_service vcs_svc ;
244
256
245
257
static int prepare_vocs_inst (struct bt_vcp_vol_rend_register_param * param )
0 commit comments