Lines Matching +full:mute +full:- +full:control

5  * Copyright (c) 2019-2020 Bose Corporation
6 * Copyright (c) 2020-2022 Nordic Semiconductor ASA
8 * SPDX-License-Identifier: Apache-2.0
47 ((uint8_t)MAX(0, (int)current_vol - vol_rend.volume_step))
85 LOG_DBG("Volume %u, mute %u, counter %u", in read_vol_state()
86 vol_rend.state.volume, vol_rend.state.mute, in read_vol_state()
110 atomic_set_bit(inst->notify, notify); in notify_work_reschedule()
112 err = k_work_reschedule(&inst->notify_work, delay); in notify_work_reschedule()
118 k_ticks_to_ms_floor32(k_work_delayable_remaining_get(&inst->notify_work))); in notify_work_reschedule()
127 err = bt_gatt_notify_uuid(NULL, uuid, inst->service_p->attrs, data, len); in notify()
128 if (err == -ENOMEM) { in notify()
130 } else if (err < 0 && err != -ENOTCONN) { in notify()
140 if (atomic_test_and_clear_bit(inst->notify, NOTIFY_STATE)) { in notify_work_handler()
141 notify(inst, NOTIFY_STATE, BT_UUID_VCS_STATE, &inst->state, sizeof(inst->state)); in notify_work_handler()
145 atomic_test_and_clear_bit(inst->notify, NOTIFY_FLAGS)) { in notify_work_handler()
146 notify(inst, NOTIFY_FLAGS, BT_UUID_VCS_FLAGS, &inst->flags, sizeof(inst->flags)); in notify_work_handler()
174 if (!VALID_VCP_OPCODE(cp_val->cp.opcode)) { in write_vcs_control()
175 LOG_DBG("Invalid opcode %u", cp_val->cp.opcode); in write_vcs_control()
181 cp_val->cp.opcode != BT_VCP_OPCODE_SET_ABS_VOL) || in write_vcs_control()
186 opcode = cp_val->cp.opcode; in write_vcs_control()
188 LOG_DBG("Opcode %u, counter %u", opcode, cp_val->cp.counter); in write_vcs_control()
190 if (cp_val->cp.counter != vol_rend.state.change_counter) { 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()
229 if (vol_rend.state.mute) { in write_vcs_control()
230 vol_rend.state.mute = BT_VCP_STATE_UNMUTED; 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()
252 LOG_DBG("Mute (0x%x)", opcode); 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()
265 LOG_DBG("New state: volume %u, mute %u, counter %u", in write_vcs_control()
266 vol_rend.state.volume, vol_rend.state.mute, 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()
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()
309 /* Volume Control Service GATT Attributes */
360 return -ENOMEM; in prepare_vocs_inst()
364 &param->vocs_param[j]); in prepare_vocs_inst()
406 return -ENOMEM; in prepare_aics_inst()
410 &param->aics_param[j]); in prepare_aics_inst()
442 return -EINVAL; in bt_vcp_vol_rend_register()
445 CHECKIF(param->mute > BT_VCP_STATE_MUTED) { in bt_vcp_vol_rend_register()
446 LOG_DBG("Invalid mute value: %u", param->mute); in bt_vcp_vol_rend_register()
447 return -EINVAL; in bt_vcp_vol_rend_register()
450 CHECKIF(param->step == 0) { in bt_vcp_vol_rend_register()
451 LOG_DBG("Invalid step value: %u", param->step); in bt_vcp_vol_rend_register()
452 return -EINVAL; in bt_vcp_vol_rend_register()
456 return -EALREADY; in bt_vcp_vol_rend_register()
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()
488 vol_rend.cb = param->cb; in bt_vcp_vol_rend_register()
501 return -EINVAL; in bt_vcp_vol_rend_included_get()
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()
519 return -EINVAL; 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()