/**************************************************************************** *NAME * avrcpHandleInternalAddressPlayerChangedEvent * *DESCRIPTION * Internal function to send event Notification for Addressed Player Changed * event. * *PARAMETERS * avrcp - AVRCP instance * res - Address Player changed response. ******************************************************************************/ void avrcpHandleInternalAddressPlayerChangedEvent(AVRCP *avrcp, const AVRCP_INTERNAL_EVENT_ADDRESSED_PLAYER_CHANGED_RES_T *res) { uint8 mandatory_data[AVRCP_PLAYER_CHANGED_EVENT_SIZE]; /* 5 */ /* Frame the packet */ mandatory_data[0] = avrcp_event_addressed_player_changed; AVRCP_UINT16_TO_UINT8(res->player_id, mandatory_data, 1); AVRCP_UINT16_TO_UINT8(res->uid_counter, mandatory_data, 3); /* Send the Notification response */ sendRegisterNotificationResponse(avrcp, res->response, AVRCP_PLAYER_CHANGED_EVENT_SIZE, mandatory_data, 0, 0); if(res->response == avctp_response_changed) { /* Reject all Events associated with the Current Player and clear that Notifications. All Associated events are defined in Table 6.43 of AVRCP 1.4 specification */ avrcpRejectRegisterNotifications(avrcp, AVRCP_PLAYER_ID_ASSOCIATED_EVENTS, avrcp_response_rejected_addressed_player_changed); } }
void avrcpHandleInternalEventTrackReachedStartResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_TRACK_REACHED_START_RES_T *res) { uint8 mandatory_data[AVRCP_EVENT_DEFAULT_HDR_SIZE]; mandatory_data[0] = avrcp_event_track_reached_start; sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_DEFAULT_HDR_SIZE, mandatory_data, 0, 0); }
/**************************************************************************** *NAME * avrcpHandleInternalCommonEventResponse * *DESCRIPTION * Internal function to send event Notification * *PARAMETERS * avrcp - AVRCP instance * res - Common event response. ******************************************************************************/ void avrcpHandleInternalCommonEventResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_COMMON_RES_T *res) { uint8 mandatory_data[AVRCP_EVENT_DEFAULT_HDR_SIZE]; mandatory_data[0] = res->event; sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_DEFAULT_HDR_SIZE, mandatory_data, 0, 0); }
void avrcpHandleInternalEventSystemStatusChangedResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_SYSTEM_STATUS_CHANGED_RES_T *res) { uint8 mandatory_data[AVRCP_EVENT_STATUS_HDR_SIZE]; mandatory_data[0] = avrcp_event_system_status_changed; mandatory_data[1] = res->system_status; sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_STATUS_HDR_SIZE, mandatory_data, 0, 0); }
/**************************************************************************** *NAME * avrcpHandleInternalEventUidsChangedEvent * *DESCRIPTION * Send a UIDs changed response to CT on application request. * *PARAMETERS * avrcp - AVRCP instance * res - Notification response. ****************************************************************************/ void avrcpHandleInternalEventUidsChangedEvent(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_UIDS_CHANGED_RES_T *res) { uint8 mandatory[AVRCP_UID_CHANGED_EVENT_SIZE]; mandatory[0] = avrcp_event_uids_changed; AVRCP_UINT16_TO_UINT8(res->uid_counter, mandatory, 1); sendRegisterNotificationResponse(avrcp, res->response, AVRCP_UID_CHANGED_EVENT_SIZE, mandatory, 0, 0); }
void avrcpHandleInternalEventPlayerAppSettingChangedResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_PLAYER_APP_SETTING_CHANGED_RES_T *res) { uint8 mandatory_data[AVRCP_EVENT_STATUS_HDR_SIZE]; mandatory_data[0] = avrcp_event_player_app_setting_changed; mandatory_data[1] = res->size_attributes / 2; sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_STATUS_HDR_SIZE, mandatory_data, res->size_attributes, res->attributes); }
void avrcpHandleInternalEventPlaybackPosChangedResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_PLAYBACK_POS_CHANGED_RES_T *res) { /* 5 Byte length data for play back position changed response */ uint8 mandatory_data[AVRCP_EVENT_POS_HDR_SIZE]; mandatory_data[0] = avrcp_event_playback_pos_changed; convertUint32ToUint8Values(&mandatory_data[1], res->playback_pos); sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_POS_HDR_SIZE, mandatory_data, 0, 0); }
void avrcpHandleInternalEventPlaybackStatusChangedResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_PLAYBACK_STATUS_CHANGED_RES_T *res) { /* 2 Byte length data for Play back status changed event */ uint8 mandatory_data[AVRCP_EVENT_STATUS_HDR_SIZE]; mandatory_data[0] = avrcp_event_playback_status_changed; mandatory_data[1] = res->play_status; sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_STATUS_HDR_SIZE, mandatory_data, 0, 0); }
void avrcpHandleInternalEventTrackChangedResponse(AVRCP *avrcp, AVRCP_INTERNAL_EVENT_TRACK_CHANGED_RES_T *res) { uint8 mandatory_data[AVRCP_EVENT_TRACK_HDR_SIZE]; mandatory_data[0] = avrcp_event_track_changed; convertUint32ToUint8Values(&mandatory_data[1], res->track_index_high); convertUint32ToUint8Values(&mandatory_data[5], res->track_index_low); sendRegisterNotificationResponse(avrcp, res->response, AVRCP_EVENT_TRACK_HDR_SIZE, mandatory_data, 0, 0); }
/**************************************************************************** *NAME * avrcpHandleInternalAbsoluteVolumeEvent * *DESCRIPTION * Internal function to send the Event response for Absolute Volume * *PARAMETERS * avrcp - AVRCP instance * res - Absolute volume response ******************************************************************************/ void avrcpHandleInternalAbsoluteVolumeEvent(AVRCP *avrcp, const AVRCP_INTERNAL_SET_ABSOLUTE_VOL_RES_T *res) { uint8 mandatory_data[AVRCP_DEFAULT_EVENT_DATA_SIZE]; /* 2 */ mandatory_data[0] = avrcp_event_volume_changed; mandatory_data[1] = res->volume; /* Send the Notification response */ sendRegisterNotificationResponse(avrcp, res->response, AVRCP_DEFAULT_EVENT_DATA_SIZE, mandatory_data, 0, 0); }
/**************************************************************************** *NAME * avrcpRejectRegisterNotifications * *DESCRIPTION * Internal function to reset the Registered Notifications * *PARAMETERS * avrcp - Task * uint16 - Registered Events * avrcp_response_type - Response * *RETURN *****************************************************************************/ void avrcpRejectRegisterNotifications( AVRCP* avrcp, uint16 event_bits, avrcp_response_type response) { uint8 id; uint16 events_enabled = avrcp->registered_events & event_bits; for(id = 1; events_enabled; id++) { if((events_enabled >>= 1) & 0x01) { sendRegisterNotificationResponse(avrcp, response, AVRCP_EVENT_DEFAULT_HDR_SIZE, &id, 0, 0); } } }