gatt-service/vcs_server: update event names

This commit is contained in:
Milanka Ringwald 2023-01-27 15:01:34 +01:00 committed by Matthias Ringwald
parent 987f62e6cb
commit 6633124e53
2 changed files with 15 additions and 12 deletions

View File

@ -97,7 +97,7 @@ static uint8_t vcs_volume_flags;
// characteristic: CONTROL_POINT // characteristic: CONTROL_POINT
static uint16_t vcs_control_point_value_handle; static uint16_t vcs_control_point_value_handle;
static btstack_packet_handler_t vcs_event_callback; static btstack_packet_handler_t vcs_server_event_callback;
static audio_input_control_service_server_t aics_services[AICS_MAX_NUM_SERVICES]; static audio_input_control_service_server_t aics_services[AICS_MAX_NUM_SERVICES];
static uint8_t aics_services_num; static uint8_t aics_services_num;
@ -135,23 +135,23 @@ static void volume_control_service_unmute(void){
} }
static void vcs_emit_volume_state(void){ static void vcs_emit_volume_state(void){
btstack_assert(vcs_event_callback != NULL); btstack_assert(vcs_server_event_callback != NULL);
uint8_t event[8]; uint8_t event[8];
uint8_t pos = 0; uint8_t pos = 0;
event[pos++] = HCI_EVENT_GATTSERVICE_META; event[pos++] = HCI_EVENT_GATTSERVICE_META;
event[pos++] = sizeof(event) - 2; event[pos++] = sizeof(event) - 2;
event[pos++] = GATTSERVICE_SUBEVENT_VCS_VOLUME_STATE; event[pos++] = GATTSERVICE_SUBEVENT_VCS_SERVER_VOLUME_STATE;
little_endian_store_16(event, pos, vcs_con_handle); little_endian_store_16(event, pos, vcs_con_handle);
pos += 2; pos += 2;
event[pos++] = vcs_volume_state_volume_setting; event[pos++] = vcs_volume_state_volume_setting;
event[pos++] = vcs_volume_change_step_size; event[pos++] = vcs_volume_change_step_size;
event[pos++] = (uint8_t)vcs_volume_state_mute; event[pos++] = (uint8_t)vcs_volume_state_mute;
(*vcs_event_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); (*vcs_server_event_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static void vcs_emit_volume_flags(void){ static void vcs_emit_volume_flags(void){
btstack_assert(vcs_event_callback != NULL); btstack_assert(vcs_server_event_callback != NULL);
uint8_t event[6]; uint8_t event[6];
uint8_t pos = 0; uint8_t pos = 0;
@ -161,7 +161,7 @@ static void vcs_emit_volume_flags(void){
little_endian_store_16(event, pos, vcs_con_handle); little_endian_store_16(event, pos, vcs_con_handle);
pos += 2; pos += 2;
event[pos++] = vcs_volume_flags; event[pos++] = vcs_volume_flags;
(*vcs_event_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event)); (*vcs_server_event_callback)(HCI_EVENT_PACKET, 0, event, sizeof(event));
} }
static uint16_t volume_control_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){ static uint16_t volume_control_service_read_callback(hci_con_handle_t con_handle, uint16_t attribute_handle, uint16_t offset, uint8_t * buffer, uint16_t buffer_size){
@ -443,9 +443,9 @@ void volume_control_service_server_init(uint8_t volume_setting, vcs_mute_t mute,
att_server_register_service_handler(&volume_control_service); att_server_register_service_handler(&volume_control_service);
} }
void volume_control_service_server_register_packet_handler(btstack_packet_handler_t callback){ void volume_control_service_server_register_packet_handler(btstack_packet_handler_t packet_handler){
btstack_assert(callback != NULL); btstack_assert(packet_handler != NULL);
vcs_event_callback = callback; vcs_server_event_callback = packet_handler;
} }
void volume_control_service_server_set_volume_state(uint8_t volume_setting, vcs_mute_t mute){ void volume_control_service_server_set_volume_state(uint8_t volume_setting, vcs_mute_t mute){

View File

@ -97,10 +97,13 @@ void volume_control_service_server_init(uint8_t volume_setting, vcs_mute_t mute,
uint8_t vocs_info_num, vocs_info_t * vocs_info); uint8_t vocs_info_num, vocs_info_t * vocs_info);
/** /**
* @brief Register callback to receive updates of volume state and volume flags GATTSERVICE_SUBEVENT_VCS_VOLUME_STATE and GATTSERVICE_SUBEVENT_VCS_VOLUME_FLAGS events respectively. * @brief Register packet handler to receive updates of volume state and volume flags:
* @param callback * - GATTSERVICE_SUBEVENT_VCS_SERVER_VOLUME_STATE
* - GATTSERVICE_SUBEVENT_VCS_VOLUME_FLAGS
*
* @param packet_handler
*/ */
void volume_control_service_server_register_packet_handler(btstack_packet_handler_t callback); void volume_control_service_server_register_packet_handler(btstack_packet_handler_t packet_handler);
/** /**