avrcp_target.c (8904232662bfa6862e1c9def1ef6bab9e01bc902) avrcp_target.c (0346f11d884525c33c2c73350b5a6313c7a831a1)
1/*
2 * Copyright (C) 2016 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 619 unchanged lines hidden (view full) ---

628 connection->cmd_operands_length += 3;
629 }
630
631 connection->state = AVCTP_W2_SEND_RESPONSE;
632 avrcp_request_can_send_now(connection, connection->l2cap_signaling_cid);
633 return ERROR_CODE_SUCCESS;
634}
635
1/*
2 * Copyright (C) 2016 BlueKitchen GmbH
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright

--- 619 unchanged lines hidden (view full) ---

628 connection->cmd_operands_length += 3;
629 }
630
631 connection->state = AVCTP_W2_SEND_RESPONSE;
632 avrcp_request_can_send_now(connection, connection->l2cap_signaling_cid);
633 return ERROR_CODE_SUCCESS;
634}
635
636uint8_t avrcp_target_support_event(uint16_t avrcp_cid, avrcp_notification_event_id_t event_id){
637 avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_TARGET, avrcp_cid);
638 if (!connection){
639 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
640 }
641
642 if ((event_id < (uint8_t)AVRCP_NOTIFICATION_EVENT_FIRST_INDEX) || (event_id > (uint8_t)AVRCP_NOTIFICATION_EVENT_LAST_INDEX)){
643 return ERROR_CODE_UNSUPPORTED_FEATURE_OR_PARAMETER_VALUE;
644 }
645
646 connection->target_supported_notifications |= (1 << (uint8_t)event_id);
647 return ERROR_CODE_SUCCESS;
636}
637
648}
649
650uint8_t avrcp_target_support_companies(uint16_t avrcp_cid, uint8_t num_companies, const uint32_t *companies){
651 avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_TARGET, avrcp_cid);
652 if (!connection){
653 return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
654 }
655
656 connection->target_supported_companies_num = num_companies;
657 connection->target_supported_companies = companies;
658 return ERROR_CODE_SUCCESS;
638}
639
640uint8_t avrcp_target_play_status(uint16_t avrcp_cid, uint32_t song_length_ms, uint32_t song_position_ms, avrcp_playback_status_t play_status){
641 avrcp_connection_t * connection = NULL;
642 uint8_t status = avrcp_prepare_vendor_dependent_response(avrcp_cid, &connection, AVRCP_PDU_ID_GET_PLAY_STATUS, 11);
643 if (status != ERROR_CODE_SUCCESS) return status;
644
645 big_endian_store_32(connection->cmd_operands, connection->cmd_operands_length, song_length_ms);

--- 679 unchanged lines hidden ---
659}
660
661uint8_t avrcp_target_play_status(uint16_t avrcp_cid, uint32_t song_length_ms, uint32_t song_position_ms, avrcp_playback_status_t play_status){
662 avrcp_connection_t * connection = NULL;
663 uint8_t status = avrcp_prepare_vendor_dependent_response(avrcp_cid, &connection, AVRCP_PDU_ID_GET_PLAY_STATUS, 11);
664 if (status != ERROR_CODE_SUCCESS) return status;
665
666 big_endian_store_32(connection->cmd_operands, connection->cmd_operands_length, song_length_ms);

--- 679 unchanged lines hidden ---