1 /** 2 * @file 3 * @brief Internal Header for Bluetooth Volume Control Service (VCS). 4 * 5 * Copyright (c) 2020 Bose Corporation 6 * Copyright (c) 2020-2022 Nordic Semiconductor ASA 7 * 8 * SPDX-License-Identifier: Apache-2.0 9 */ 10 11 #ifndef ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_ 12 #define ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_ 13 14 /* VCS opcodes */ 15 #define BT_VCP_OPCODE_REL_VOL_DOWN 0x00 16 #define BT_VCP_OPCODE_REL_VOL_UP 0x01 17 #define BT_VCP_OPCODE_UNMUTE_REL_VOL_DOWN 0x02 18 #define BT_VCP_OPCODE_UNMUTE_REL_VOL_UP 0x03 19 #define BT_VCP_OPCODE_SET_ABS_VOL 0x04 20 #define BT_VCP_OPCODE_UNMUTE 0x05 21 #define BT_VCP_OPCODE_MUTE 0x06 22 23 struct vcs_state { 24 uint8_t volume; 25 uint8_t mute; 26 uint8_t change_counter; 27 } __packed; 28 29 struct vcs_control { 30 uint8_t opcode; 31 uint8_t counter; 32 } __packed; 33 34 struct vcs_control_vol { 35 struct vcs_control cp; 36 uint8_t volume; 37 } __packed; 38 39 struct bt_vcp_vol_ctlr { 40 struct vcs_state state; 41 uint8_t flags; 42 43 uint16_t start_handle; 44 uint16_t end_handle; 45 uint16_t state_handle; 46 uint16_t control_handle; 47 uint16_t flag_handle; 48 struct bt_gatt_subscribe_params state_sub_params; 49 struct bt_gatt_discover_params state_sub_disc_params; 50 struct bt_gatt_subscribe_params flag_sub_params; 51 struct bt_gatt_discover_params flag_sub_disc_params; 52 bool cp_retried; 53 54 bool busy; 55 struct vcs_control_vol cp_val; 56 struct bt_gatt_write_params write_params; 57 struct bt_gatt_read_params read_params; 58 struct bt_gatt_discover_params discover_params; 59 struct bt_uuid_16 uuid; 60 struct bt_conn *conn; 61 62 #if defined(CONFIG_BT_VCP_VOL_CTLR_VOCS) 63 uint8_t vocs_inst_cnt; 64 struct bt_vocs *vocs[CONFIG_BT_VCP_VOL_CTLR_MAX_VOCS_INST]; 65 #endif /* CONFIG_BT_VCP_VOL_CTLR_VOCS */ 66 #if defined(CONFIG_BT_VCP_VOL_CTLR_AICS) 67 uint8_t aics_inst_cnt; 68 struct bt_aics *aics[CONFIG_BT_VCP_VOL_CTLR_MAX_AICS_INST]; 69 #endif /* CONFIG_BT_VCP_VOL_CTLR_AICS */ 70 }; 71 72 #endif /* ZEPHYR_INCLUDE_BLUETOOTH_AUDIO_VCP_INTERNAL_*/ 73