avrcp_target: increase notifications_transaction_label array to fit max notification id

This commit is contained in:
Matthias Ringwald 2019-10-30 15:35:10 +01:00
parent cebe3e9ef6
commit fe93465675
2 changed files with 4 additions and 4 deletions

View File

@ -162,7 +162,7 @@ typedef enum {
AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED = 0x0b, // The Addressed Player has been changed, see 6.9.2.
AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED = 0x0c, // The UIDs have changed, see 6.10.3.3.
AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED = 0x0d, // The volume has been changed locally on the TG, see 6.13.3.
AVRCP_NOTIFICATION_EVENT_COUNT = 0x0d
AVRCP_NOTIFICATION_EVENT_MAX_VALUE = 0x0d
} avrcp_notification_event_id_t;
@ -436,7 +436,7 @@ typedef struct {
uint16_t notifications_enabled;
uint16_t notifications_to_register;
uint16_t notifications_to_deregister;
uint8_t notifications_transaction_label[AVRCP_NOTIFICATION_EVENT_COUNT];
uint8_t notifications_transaction_label[AVRCP_NOTIFICATION_EVENT_MAX_VALUE+1];
avrcp_subunit_type_t unit_type;
uint32_t company_id;

View File

@ -769,12 +769,12 @@ uint8_t avrcp_target_volume_changed(uint16_t avrcp_cid, uint8_t volume_percentag
}
static void avrcp_target_set_transaction_label_for_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t notification, uint8_t transaction_label){
if (notification > AVRCP_NOTIFICATION_EVENT_COUNT) return;
if (notification > AVRCP_NOTIFICATION_EVENT_MAX_VALUE) return;
connection->notifications_transaction_label[notification] = transaction_label;
}
static uint8_t avrcp_target_get_transaction_label_for_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t notification){
if (notification > AVRCP_NOTIFICATION_EVENT_COUNT) return 0;
if (notification > AVRCP_NOTIFICATION_EVENT_MAX_VALUE) return 0;
return connection->notifications_transaction_label[notification];
}