Lines Matching +full:step +full:- +full:down

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))
110 atomic_set_bit(inst->notify, notify);
112 err = k_work_reschedule(&inst->notify_work, delay);
118 k_ticks_to_ms_floor32(k_work_delayable_remaining_get(&inst->notify_work)));
127 err = bt_gatt_notify_uuid(NULL, uuid, inst->service_p->attrs, data, len);
128 if (err == -ENOMEM) {
130 } else if (err < 0 && err != -ENOTCONN) {
140 if (atomic_test_and_clear_bit(inst->notify, NOTIFY_STATE)) {
141 notify(inst, NOTIFY_STATE, BT_UUID_VCS_STATE, &inst->state, sizeof(inst->state));
145 atomic_test_and_clear_bit(inst->notify, NOTIFY_FLAGS)) {
146 notify(inst, NOTIFY_FLAGS, BT_UUID_VCS_FLAGS, &inst->flags, sizeof(inst->flags));
174 if (!VALID_VCP_OPCODE(cp_val->cp.opcode)) {
175 LOG_DBG("Invalid opcode %u", cp_val->cp.opcode);
181 cp_val->cp.opcode != BT_VCP_OPCODE_SET_ABS_VOL) ||
186 opcode = cp_val->cp.opcode;
188 LOG_DBG("Opcode %u, counter %u", opcode, cp_val->cp.counter);
190 if (cp_val->cp.counter != vol_rend.state.change_counter) {
196 LOG_DBG("Relative Volume Down (0x%x)", opcode);
212 LOG_DBG("(Unmute) relative Volume Down (0x%x)", opcode);
238 if (vol_rend.state.volume != cp_val->volume) {
239 vol_rend.state.volume = cp_val->volume;
271 if (vol_rend.cb && vol_rend.cb->state) {
272 vol_rend.cb->state(conn, 0, vol_rend.state.volume, vol_rend.state.mute);
283 if (vol_rend.cb && vol_rend.cb->flags) {
284 vol_rend.cb->flags(conn, 0, vol_rend.flags);
360 return -ENOMEM;
364 &param->vocs_param[j]);
406 return -ENOMEM;
410 &param->aics_param[j]);
442 return -EINVAL;
445 CHECKIF(param->mute > BT_VCP_STATE_MUTED) {
446 LOG_DBG("Invalid mute value: %u", param->mute);
447 return -EINVAL;
450 CHECKIF(param->step == 0) {
451 LOG_DBG("Invalid step value: %u", param->step);
452 return -EINVAL;
456 return -EALREADY;
478 vol_rend.state.volume = param->volume;
479 vol_rend.state.mute = param->mute;
480 vol_rend.volume_step = param->step;
488 vol_rend.cb = param->cb;
501 return -EINVAL;
504 included->vocs_cnt = ARRAY_SIZE(vol_rend.vocs_insts);
505 included->vocs = vol_rend.vocs_insts;
507 included->aics_cnt = ARRAY_SIZE(vol_rend.aics_insts);
508 included->aics = vol_rend.aics_insts;
519 return -EINVAL;
525 if (vol_rend.cb && vol_rend.cb->state) {
526 vol_rend.cb->state(NULL, 0, vol_rend.state.volume, vol_rend.state.mute);
534 if (vol_rend.cb && vol_rend.cb->flags) {
535 vol_rend.cb->flags(NULL, 0, vol_rend.flags);