Lines Matching refs:vol_rend
47 ((uint8_t)MAX(0, (int)current_vol - vol_rend.volume_step))
49 ((uint8_t)MIN(UINT8_MAX, (int)current_vol + vol_rend.volume_step))
73 static struct bt_vcp_vol_rend vol_rend; variable
86 vol_rend.state.volume, vol_rend.state.mute, in read_vol_state()
87 vol_rend.state.change_counter); in read_vol_state()
90 &vol_rend.state, sizeof(vol_rend.state)); in read_vol_state()
190 if (cp_val->cp.counter != vol_rend.state.change_counter) { in write_vcs_control()
197 if (vol_rend.state.volume > 0) { in write_vcs_control()
198 vol_rend.state.volume = VOLUME_DOWN(vol_rend.state.volume); in write_vcs_control()
205 if (vol_rend.state.volume != UINT8_MAX) { in write_vcs_control()
206 vol_rend.state.volume = VOLUME_UP(vol_rend.state.volume); in write_vcs_control()
213 if (vol_rend.state.volume > 0) { in write_vcs_control()
214 vol_rend.state.volume = VOLUME_DOWN(vol_rend.state.volume); in write_vcs_control()
217 if (vol_rend.state.mute) { in write_vcs_control()
218 vol_rend.state.mute = BT_VCP_STATE_UNMUTED; in write_vcs_control()
225 if (vol_rend.state.volume != UINT8_MAX) { in write_vcs_control()
226 vol_rend.state.volume = VOLUME_UP(vol_rend.state.volume); in write_vcs_control()
229 if (vol_rend.state.mute) { in write_vcs_control()
230 vol_rend.state.mute = BT_VCP_STATE_UNMUTED; in write_vcs_control()
237 opcode, vol_rend.state.volume); in write_vcs_control()
238 if (vol_rend.state.volume != cp_val->volume) { in write_vcs_control()
239 vol_rend.state.volume = cp_val->volume; in write_vcs_control()
246 if (vol_rend.state.mute) { in write_vcs_control()
247 vol_rend.state.mute = BT_VCP_STATE_UNMUTED; in write_vcs_control()
253 if (vol_rend.state.mute == BT_VCP_STATE_UNMUTED) { in write_vcs_control()
254 vol_rend.state.mute = BT_VCP_STATE_MUTED; in write_vcs_control()
264 vol_rend.state.change_counter++; in write_vcs_control()
266 vol_rend.state.volume, vol_rend.state.mute, in write_vcs_control()
267 vol_rend.state.change_counter); in write_vcs_control()
269 value_changed(&vol_rend, NOTIFY_STATE); in write_vcs_control()
271 if (vol_rend.cb && vol_rend.cb->state) { in write_vcs_control()
272 vol_rend.cb->state(conn, 0, vol_rend.state.volume, vol_rend.state.mute); in write_vcs_control()
276 if (volume_change && !vol_rend.flags) { in write_vcs_control()
277 vol_rend.flags = 1; in write_vcs_control()
280 value_changed(&vol_rend, NOTIFY_FLAGS); in write_vcs_control()
283 if (vol_rend.cb && vol_rend.cb->flags) { in write_vcs_control()
284 vol_rend.cb->flags(conn, 0, vol_rend.flags); in write_vcs_control()
300 LOG_DBG("0x%02x", vol_rend.flags); in read_flags()
301 return bt_gatt_attr_read(conn, attr, buf, len, offset, &vol_rend.flags, in read_flags()
302 sizeof(vol_rend.flags)); in read_flags()
355 vol_rend.vocs_insts[j] = bt_vocs_free_instance_get(); in prepare_vocs_inst()
357 if (vol_rend.vocs_insts[j] == NULL) { in prepare_vocs_inst()
363 err = bt_vocs_register(vol_rend.vocs_insts[j], in prepare_vocs_inst()
371 vcs_attrs[i].user_data = bt_vocs_svc_decl_get(vol_rend.vocs_insts[j]); in prepare_vocs_inst()
401 vol_rend.aics_insts[j] = bt_aics_free_instance_get(); in prepare_aics_inst()
403 if (vol_rend.aics_insts[j] == NULL) { in prepare_aics_inst()
409 err = bt_aics_register(vol_rend.aics_insts[j], in prepare_aics_inst()
417 vcs_attrs[i].user_data = bt_aics_svc_decl_get(vol_rend.aics_insts[j]); in prepare_aics_inst()
478 vol_rend.state.volume = param->volume; in bt_vcp_vol_rend_register()
479 vol_rend.state.mute = param->mute; in bt_vcp_vol_rend_register()
480 vol_rend.volume_step = param->step; in bt_vcp_vol_rend_register()
481 vol_rend.service_p = &vcs_svc; in bt_vcp_vol_rend_register()
488 vol_rend.cb = param->cb; in bt_vcp_vol_rend_register()
490 atomic_clear(vol_rend.notify); in bt_vcp_vol_rend_register()
491 k_work_init_delayable(&vol_rend.notify_work, notify_work_handler); in bt_vcp_vol_rend_register()
504 included->vocs_cnt = ARRAY_SIZE(vol_rend.vocs_insts); in bt_vcp_vol_rend_included_get()
505 included->vocs = vol_rend.vocs_insts; in bt_vcp_vol_rend_included_get()
507 included->aics_cnt = ARRAY_SIZE(vol_rend.aics_insts); in bt_vcp_vol_rend_included_get()
508 included->aics = vol_rend.aics_insts; in bt_vcp_vol_rend_included_get()
516 vol_rend.volume_step = volume_step; in bt_vcp_vol_rend_set_step()
525 if (vol_rend.cb && vol_rend.cb->state) { in bt_vcp_vol_rend_get_state()
526 vol_rend.cb->state(NULL, 0, vol_rend.state.volume, vol_rend.state.mute); in bt_vcp_vol_rend_get_state()
534 if (vol_rend.cb && vol_rend.cb->flags) { in bt_vcp_vol_rend_get_flags()
535 vol_rend.cb->flags(NULL, 0, vol_rend.flags); in bt_vcp_vol_rend_get_flags()
545 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_vol_down()
558 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_vol_up()
571 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_unmute_vol_down()
584 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_unmute_vol_up()
598 .counter = vol_rend.state.change_counter in bt_vcp_vol_rend_set_vol()
613 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_unmute()
626 .counter = vol_rend.state.change_counter, in bt_vcp_vol_rend_mute()