mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-24 22:43:35 +00:00
avrcp: extract avrcp controller
This commit is contained in:
parent
c1fc8abcd5
commit
6983e65e8f
@ -91,6 +91,8 @@
|
||||
#include "classic/avdtp_source.h"
|
||||
#include "classic/avdtp_util.h"
|
||||
#include "classic/avrcp.h"
|
||||
#include "classic/avrcp_controller.h"
|
||||
#include "classic/avrcp_target.h"
|
||||
#include "classic/bnep.h"
|
||||
#include "classic/btstack_link_key_db.h"
|
||||
#include "classic/device_id_server.h"
|
||||
|
1337
src/classic/avrcp.c
1337
src/classic/avrcp.c
File diff suppressed because it is too large
Load Diff
@ -54,7 +54,19 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#define BT_SIG_COMPANY_ID 0x001958
|
||||
/* API_START */
|
||||
|
||||
typedef enum {
|
||||
AVRCP_SINGLE_PACKET= 0,
|
||||
AVRCP_START_PACKET ,
|
||||
AVRCP_CONTINUE_PACKET ,
|
||||
AVRCP_END_PACKET
|
||||
} avrcp_packet_type_t;
|
||||
|
||||
typedef enum {
|
||||
AVRCP_COMMAND_FRAME = 0,
|
||||
AVRCP_RESPONSE_FRAME
|
||||
} avrcp_frame_type_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
AVRCP_CAPABILITY_ID_COMPANY = 0x02,
|
||||
@ -244,256 +256,15 @@ typedef struct {
|
||||
btstack_linked_list_t connections;
|
||||
btstack_packet_handler_t avrcp_callback;
|
||||
btstack_packet_handler_t packet_handler;
|
||||
} avrcp_context_t;
|
||||
|
||||
typedef struct {
|
||||
avrcp_connection_t * connection;
|
||||
avrcp_context_t * avrcp_context;
|
||||
// SDP query
|
||||
uint16_t avrcp_cid;
|
||||
uint16_t avrcp_l2cap_psm;
|
||||
uint16_t avrcp_version;
|
||||
uint16_t avrcp_browsing_l2cap_psm;
|
||||
uint16_t avrcp_browsing_version;
|
||||
uint8_t role_supported;
|
||||
} avrcp_sdp_query_context_t;
|
||||
|
||||
|
||||
/**
|
||||
* @brief AVDTP Sink service record.
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param browsing 1 - supported, 0 - not supported
|
||||
* @param supported_features 16-bit bitmap, see AVDTP_SINK_SF_* values in avdtp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
*/
|
||||
void avrcp_controller_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
/**
|
||||
* @brief AVDTP Sink service record.
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param browsing 1 - supported, 0 - not supported
|
||||
* @param supported_features 16-bit bitmap, see AVDTP_SINK_SF_* values in avdtp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
*/
|
||||
void avrcp_target_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set up AVDTP Sink device.
|
||||
*/
|
||||
void avrcp_controller_init(void);
|
||||
|
||||
/**
|
||||
* @brief Register callback for the AVRCP Sink client.
|
||||
* @param callback
|
||||
*/
|
||||
void avrcp_register_packet_handler(btstack_packet_handler_t callback);
|
||||
|
||||
/**
|
||||
* @brief Connect to device with a Bluetooth address.
|
||||
* @param bd_addr
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
|
||||
|
||||
uint8_t avrcp_connect(bd_addr_t bd_addr, avrcp_context_t * context, uint16_t * avrcp_cid);
|
||||
uint8_t avrcp_controller_connect(bd_addr_t bd_addr, uint16_t * avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Disconnect from AVRCP target
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_disconnect(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Unit info.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_unit_info(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Get capabilities.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_get_supported_company_ids(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Get supported Events.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_get_supported_events(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Play. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_play(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_stop(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Pause. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_pause(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Start Fast Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_start_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Fast Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_stop_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Single step - fast forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_start_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_stop_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Single step rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Backward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_backward(uint16_t avrcp_cid);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get play status. Returns event of type AVRCP_SUBEVENT_PLAY_STATUS (length, position, play_status).
|
||||
* If TG does not support SongLength And SongPosition on TG, then TG shall return 0xFFFFFFFF.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_get_play_status(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Enable notification. Response via AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE.
|
||||
* @param avrcp_cid
|
||||
* @param event_id
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_enable_notification(uint16_t avrcp_cid, avrcp_notification_event_id_t event_id);
|
||||
|
||||
/**
|
||||
* @brief Disable notification. Response via AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE.
|
||||
* @param avrcp_cid
|
||||
* @param event_id
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_disable_notification(uint16_t avrcp_cid, avrcp_notification_event_id_t event_id);
|
||||
|
||||
/**
|
||||
* @brief Get info on now playing media.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_get_now_playing_info(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Set absolute volume 0-127 (corresponds to 0-100%). Response via AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_set_absolute_volume(uint16_t avrcp_cid, uint8_t volume);
|
||||
|
||||
/**
|
||||
* @brief Turns the volume to high. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_volume_up(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Turns the volume to low. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_volume_down(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Puts the sound out. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_mute(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Skip to next playing media. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_skip(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Query repeat and shuffle mode. Response via AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_query_shuffle_and_repeat_modes(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Set shuffle mode. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_set_shuffle_mode(uint16_t avrcp_cid, avrcp_shuffle_mode_t mode);
|
||||
|
||||
/**
|
||||
* @brief Set repeat mode. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_set_repeat_mode(uint16_t avrcp_cid, avrcp_repeat_mode_t mode);
|
||||
} avrcp_context_t;
|
||||
|
||||
const char * avrcp_subunit2str(uint16_t index);
|
||||
const char * avrcp_event2str(uint16_t index);
|
||||
@ -504,7 +275,17 @@ const char * avrcp_ctype2str(uint8_t index);
|
||||
const char * avrcp_repeat2str(uint8_t index);
|
||||
const char * avrcp_shuffle2str(uint8_t index);
|
||||
|
||||
/* API_END */
|
||||
void avrcp_packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size, avrcp_context_t * context);
|
||||
|
||||
void avrcp_create_sdp_record(uint8_t controller, uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
uint8_t avrcp_connect(bd_addr_t bd_addr, avrcp_context_t * context, uint16_t * avrcp_cid);
|
||||
void avrcp_emit_connection_established(btstack_packet_handler_t callback, uint16_t avrcp_cid, bd_addr_t addr, uint8_t status);
|
||||
void avrcp_emit_connection_closed(btstack_packet_handler_t callback, uint16_t avrcp_cid);
|
||||
|
||||
avrcp_connection_t * get_avrcp_connection_for_l2cap_signaling_cid(uint16_t l2cap_cid, avrcp_context_t * context);
|
||||
avrcp_connection_t * get_avrcp_connection_for_avrcp_cid(uint16_t l2cap_cid, avrcp_context_t * context);
|
||||
void avrcp_request_can_send_now(avrcp_connection_t * connection, uint16_t l2cap_cid);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
1076
src/classic/avrcp_controller.c
Normal file
1076
src/classic/avrcp_controller.c
Normal file
File diff suppressed because it is too large
Load Diff
287
src/classic/avrcp_controller.h
Normal file
287
src/classic/avrcp_controller.h
Normal file
@ -0,0 +1,287 @@
|
||||
/*
|
||||
* Copyright (C) 2016 BlueKitchen GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holders nor the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* 4. Any redistribution, use, or modification is done solely for
|
||||
* personal benefit and not for any commercial purpose or for
|
||||
* monetary gain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Please inquire about commercial licensing options at
|
||||
* contact@bluekitchen-gmbh.com
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* avrcp.h
|
||||
*
|
||||
* Audio/Video Remote Control Profile
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __AVRCP_CONTROLLER_H
|
||||
#define __AVRCP_CONTROLLER_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "btstack_run_loop.h"
|
||||
#include "btstack_linked_list.h"
|
||||
#include "avrcp.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* API_START */
|
||||
|
||||
/**
|
||||
* @brief AVDTP Sink service record.
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param browsing 1 - supported, 0 - not supported
|
||||
* @param supported_features 16-bit bitmap, see AVDTP_SINK_SF_* values in avdtp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
*/
|
||||
void avrcp_controller_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
/**
|
||||
* @brief Set up AVDTP Sink device.
|
||||
*/
|
||||
void avrcp_controller_init(void);
|
||||
|
||||
/**
|
||||
* @brief Register callback for the AVRCP Sink client.
|
||||
* @param callback
|
||||
*/
|
||||
void avrcp_controller_register_packet_handler(btstack_packet_handler_t callback);
|
||||
|
||||
/**
|
||||
* @brief Connect to device with a Bluetooth address.
|
||||
* @param bd_addr
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_connect(bd_addr_t bd_addr, uint16_t * avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Disconnect from AVRCP target
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_disconnect(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Unit info.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_unit_info(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Get capabilities.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_get_supported_company_ids(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Get supported Events.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_get_supported_events(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Play. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_play(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_stop(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Pause. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_pause(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Start Fast Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_start_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Fast Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_stop_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Single step - fast forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_fast_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_start_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Stop Rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_stop_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Single step rewind. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_rewind(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Forward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_forward(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Backward. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_backward(uint16_t avrcp_cid);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get play status. Returns event of type AVRCP_SUBEVENT_PLAY_STATUS (length, position, play_status).
|
||||
* If TG does not support SongLength And SongPosition on TG, then TG shall return 0xFFFFFFFF.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_get_play_status(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Enable notification. Response via AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE.
|
||||
* @param avrcp_cid
|
||||
* @param event_id
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_enable_notification(uint16_t avrcp_cid, avrcp_notification_event_id_t event_id);
|
||||
|
||||
/**
|
||||
* @brief Disable notification. Response via AVRCP_SUBEVENT_ENABLE_NOTIFICATION_COMPLETE.
|
||||
* @param avrcp_cid
|
||||
* @param event_id
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_disable_notification(uint16_t avrcp_cid, avrcp_notification_event_id_t event_id);
|
||||
|
||||
/**
|
||||
* @brief Get info on now playing media.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_get_now_playing_info(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Set absolute volume 0-127 (corresponds to 0-100%). Response via AVRCP_SUBEVENT_SET_ABSOLUTE_VOLUME_RESPONSE
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_set_absolute_volume(uint16_t avrcp_cid, uint8_t volume);
|
||||
|
||||
/**
|
||||
* @brief Turns the volume to high. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_volume_up(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Turns the volume to low. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_volume_down(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Puts the sound out. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_mute(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Skip to next playing media. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_skip(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Query repeat and shuffle mode. Response via AVRCP_SUBEVENT_SHUFFLE_AND_REPEAT_MODE.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_query_shuffle_and_repeat_modes(uint16_t avrcp_cid);
|
||||
|
||||
/**
|
||||
* @brief Set shuffle mode. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_set_shuffle_mode(uint16_t avrcp_cid, avrcp_shuffle_mode_t mode);
|
||||
|
||||
/**
|
||||
* @brief Set repeat mode. Event AVRCP_SUBEVENT_OPERATION_COMPLETE returns operation id and status.
|
||||
* @param avrcp_cid
|
||||
* @returns status
|
||||
*/
|
||||
uint8_t avrcp_controller_set_repeat_mode(uint16_t avrcp_cid, avrcp_repeat_mode_t mode);
|
||||
|
||||
/* API_END */
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __AVRCP_CONTROLLER_H
|
74
src/classic/avrcp_target.h
Normal file
74
src/classic/avrcp_target.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2016 BlueKitchen GmbH
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the copyright holders nor the names of
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
* 4. Any redistribution, use, or modification is done solely for
|
||||
* personal benefit and not for any commercial purpose or for
|
||||
* monetary gain.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY BLUEKITCHEN GMBH AND CONTRIBUTORS
|
||||
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MATTHIAS
|
||||
* RINGWALD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
|
||||
* THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* Please inquire about commercial licensing options at
|
||||
* contact@bluekitchen-gmbh.com
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* avrcp.h
|
||||
*
|
||||
* Audio/Video Remote Control Profile
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __AVRCP_H
|
||||
#define __AVRCP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include "avrcp.h"
|
||||
|
||||
#if defined __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* API_START */
|
||||
|
||||
|
||||
/**
|
||||
* @brief AVDTP Sink service record.
|
||||
* @param service
|
||||
* @param service_record_handle
|
||||
* @param browsing 1 - supported, 0 - not supported
|
||||
* @param supported_features 16-bit bitmap, see AVDTP_SINK_SF_* values in avdtp.h
|
||||
* @param service_name
|
||||
* @param service_provider_name
|
||||
*/
|
||||
void avrcp_target_create_sdp_record(uint8_t * service, uint32_t service_record_handle, uint8_t browsing, uint16_t supported_features, const char * service_name, const char * service_provider_name);
|
||||
|
||||
/* API_END */
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __AVRCP_H
|
@ -66,7 +66,7 @@ SBC_ENCODER += \
|
||||
AVRCP += \
|
||||
avrcp.c \
|
||||
|
||||
AVRCP_TESTS = avrcp_test
|
||||
AVRCP_TESTS = avrcp_controller_test
|
||||
|
||||
CORE_OBJ = $(CORE:.c=.o)
|
||||
COMMON_OBJ = $(COMMON:.c=.o)
|
||||
@ -76,7 +76,7 @@ AVRCP_OBJ = $(AVRCP:.c=.o)
|
||||
|
||||
all: ${AVRCP_TESTS}
|
||||
|
||||
avrcp_test: ${CORE_OBJ} ${COMMON_OBJ} ${SBC_DECODER_OBJ} ${SBC_ENCODER_OBJ} ${AVRCP_OBJ} avrcp_test.o
|
||||
avrcp_controller_test: ${CORE_OBJ} ${COMMON_OBJ} ${SBC_DECODER_OBJ} ${SBC_ENCODER_OBJ} ${AVRCP_OBJ} avrcp_controller.o avrcp_controller_test.o
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
test: all
|
||||
|
BIN
test/avrcp/avrcp_controller_test
Executable file
BIN
test/avrcp/avrcp_controller_test
Executable file
Binary file not shown.
@ -40,18 +40,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack_config.h"
|
||||
#include "btstack_debug.h"
|
||||
#include "btstack_event.h"
|
||||
#include "btstack_memory.h"
|
||||
#include "btstack_run_loop.h"
|
||||
#include "gap.h"
|
||||
#include "hci.h"
|
||||
#include "hci_cmd.h"
|
||||
#include "hci_dump.h"
|
||||
#include "l2cap.h"
|
||||
#include "btstack_stdin.h"
|
||||
#include "classic/avrcp.h"
|
||||
#include "btstack.h"
|
||||
|
||||
#define AVRCP_BROWSING_ENABLED 0
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
@ -99,8 +88,8 @@ static void packet_handler(uint8_t packet_type, uint16_t channel, uint8_t *packe
|
||||
}
|
||||
printf("Channel successfully opened: %s, avrcp_cid 0x%02x\n", bd_addr_to_str(event_addr), avrcp_cid);
|
||||
// automatically enable notifications
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
return;
|
||||
}
|
||||
case AVRCP_SUBEVENT_CONNECTION_RELEASED:
|
||||
@ -240,95 +229,95 @@ static void stdin_process(char cmd){
|
||||
break;
|
||||
case 'B':
|
||||
printf(" - Disconnect\n");
|
||||
avrcp_disconnect(avrcp_cid);
|
||||
avrcp_controller_disconnect(avrcp_cid);
|
||||
break;
|
||||
case 'i':
|
||||
printf(" - get play status\n");
|
||||
avrcp_get_play_status(avrcp_cid);
|
||||
avrcp_controller_get_play_status(avrcp_cid);
|
||||
break;
|
||||
case 'j':
|
||||
printf(" - get now playing info\n");
|
||||
avrcp_get_now_playing_info(avrcp_cid);
|
||||
avrcp_controller_get_now_playing_info(avrcp_cid);
|
||||
break;
|
||||
case 'k':
|
||||
printf(" - play\n");
|
||||
avrcp_play(avrcp_cid);
|
||||
avrcp_controller_play(avrcp_cid);
|
||||
break;
|
||||
case 'K':
|
||||
printf(" - stop\n");
|
||||
avrcp_stop(avrcp_cid);
|
||||
avrcp_controller_stop(avrcp_cid);
|
||||
break;
|
||||
case 'L':
|
||||
printf(" - pause\n");
|
||||
avrcp_pause(avrcp_cid);
|
||||
avrcp_controller_pause(avrcp_cid);
|
||||
break;
|
||||
case 'm':
|
||||
printf(" - start fast forward\n");
|
||||
avrcp_start_fast_forward(avrcp_cid);
|
||||
avrcp_controller_start_fast_forward(avrcp_cid);
|
||||
break;
|
||||
case 'M':
|
||||
printf(" - stop fast forward\n");
|
||||
avrcp_stop_fast_forward(avrcp_cid);
|
||||
avrcp_controller_stop_fast_forward(avrcp_cid);
|
||||
break;
|
||||
case 'n':
|
||||
printf(" - start rewind\n");
|
||||
avrcp_start_rewind(avrcp_cid);
|
||||
avrcp_controller_start_rewind(avrcp_cid);
|
||||
break;
|
||||
case 'N':
|
||||
printf(" - stop rewind\n");
|
||||
avrcp_stop_rewind(avrcp_cid);
|
||||
avrcp_controller_stop_rewind(avrcp_cid);
|
||||
break;
|
||||
case 'o':
|
||||
printf(" - forward\n");
|
||||
avrcp_forward(avrcp_cid);
|
||||
avrcp_controller_forward(avrcp_cid);
|
||||
break;
|
||||
case 'O':
|
||||
printf(" - backward\n");
|
||||
avrcp_backward(avrcp_cid);
|
||||
avrcp_controller_backward(avrcp_cid);
|
||||
break;
|
||||
case 'p':
|
||||
printf(" - volume up\n");
|
||||
avrcp_volume_up(avrcp_cid);
|
||||
avrcp_controller_volume_up(avrcp_cid);
|
||||
break;
|
||||
case 'P':
|
||||
printf(" - volume down\n");
|
||||
avrcp_volume_down(avrcp_cid);
|
||||
avrcp_controller_volume_down(avrcp_cid);
|
||||
break;
|
||||
case 'r':
|
||||
printf(" - absolute volume of 50 percent\n");
|
||||
avrcp_set_absolute_volume(avrcp_cid, 50);
|
||||
avrcp_controller_set_absolute_volume(avrcp_cid, 50);
|
||||
break;
|
||||
case 's':
|
||||
printf(" - mute\n");
|
||||
avrcp_mute(avrcp_cid);
|
||||
avrcp_controller_mute(avrcp_cid);
|
||||
break;
|
||||
case 't':
|
||||
printf(" - skip\n");
|
||||
avrcp_skip(avrcp_cid);
|
||||
avrcp_controller_skip(avrcp_cid);
|
||||
break;
|
||||
case 'u':
|
||||
printf(" - query repeat and shuffle mode\n");
|
||||
avrcp_query_shuffle_and_repeat_modes(avrcp_cid);
|
||||
avrcp_controller_query_shuffle_and_repeat_modes(avrcp_cid);
|
||||
break;
|
||||
case 'v':
|
||||
printf(" - repeat single track\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_SINGLE_TRACK);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_SINGLE_TRACK);
|
||||
break;
|
||||
case 'x':
|
||||
printf(" - repeat all tracks\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_ALL_TRACKS);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_ALL_TRACKS);
|
||||
break;
|
||||
case 'X':
|
||||
printf(" - disable repeat mode\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_OFF);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_OFF);
|
||||
break;
|
||||
case 'z':
|
||||
printf(" - shuffle all tracks\n");
|
||||
avrcp_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_ALL_TRACKS);
|
||||
avrcp_controller_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_ALL_TRACKS);
|
||||
break;
|
||||
case 'Z':
|
||||
printf(" - disable shuffle mode\n");
|
||||
avrcp_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_OFF);
|
||||
avrcp_controller_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_OFF);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
@ -349,7 +338,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
// Initialize AVRCP COntroller
|
||||
avrcp_controller_init();
|
||||
avrcp_register_packet_handler(&packet_handler);
|
||||
avrcp_controller_register_packet_handler(&packet_handler);
|
||||
|
||||
// Initialize SDP
|
||||
sdp_init();
|
@ -82,12 +82,12 @@ SBC_ENCODER_OBJ = $(SBC_ENCODER:.c=.o)
|
||||
AVDTP_OBJ = $(AVDTP:.c=.o)
|
||||
|
||||
EXAMPLES = iopt ble_peripheral_test ble_central_test l2cap_test classic_test bnep_test hsp_ag_test hsp_hs_test sco_loopback le_data_channel
|
||||
EXAMPLES = avdtp_source_test avdtp_sink_test le_data_channel avrcp_test
|
||||
EXAMPLES = avdtp_source_test avdtp_sink_test le_data_channel avrcp_controller_test
|
||||
|
||||
all: ${EXAMPLES}
|
||||
|
||||
# compile .gatt descriptions
|
||||
avrcp_test: ${CORE_OBJ} ${COMMON_OBJ} ${SBC_DECODER_OBJ} ${SM_OBJ} ${SBC_ENCODER_OBJ} ${AVDTP_OBJ} sdp_client.o avrcp.o avrcp_test.o
|
||||
avrcp_controller_test: ${CORE_OBJ} ${COMMON_OBJ} ${SBC_DECODER_OBJ} ${SM_OBJ} ${SBC_ENCODER_OBJ} ${AVDTP_OBJ} sdp_client.o avrcp.o avrcp_controller.o avrcp_controller_test.o
|
||||
${CC} $^ ${CFLAGS} ${LDFLAGS} -o $@
|
||||
|
||||
avdtp_sink_test: ${CORE_OBJ} ${COMMON_OBJ} ${SBC_DECODER_OBJ} ${SM_OBJ} ${SBC_ENCODER_OBJ} ${AVDTP_OBJ} avdtp_sink_test.o
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "btstack.h"
|
||||
// #include "wav_util.h"
|
||||
|
||||
#define AVRCP_BROWSING_ENABLED 0
|
||||
|
||||
@ -290,7 +289,7 @@ static void stdin_process(char cmd){
|
||||
break;
|
||||
case 'C':
|
||||
printf("Disconnect AVRCP\n");
|
||||
avrcp_disconnect(avrcp_cid);
|
||||
avrcp_controller_disconnect(avrcp_cid);
|
||||
break;
|
||||
|
||||
case '\n':
|
||||
@ -298,197 +297,197 @@ static void stdin_process(char cmd){
|
||||
break;
|
||||
case 'q':
|
||||
printf("AVRCP: get capabilities: supported events\n");
|
||||
avrcp_get_supported_events(avrcp_cid);
|
||||
avrcp_controller_get_supported_events(avrcp_cid);
|
||||
break;
|
||||
case 'w':
|
||||
printf("AVRCP: get unit info\n");
|
||||
avrcp_unit_info(avrcp_cid);
|
||||
avrcp_controller_unit_info(avrcp_cid);
|
||||
break;
|
||||
case 'r':
|
||||
printf("AVRCP: get play status\n");
|
||||
avrcp_get_play_status(avrcp_cid);
|
||||
avrcp_controller_get_play_status(avrcp_cid);
|
||||
break;
|
||||
case 't':
|
||||
printf("AVRCP: get now playing info\n");
|
||||
avrcp_get_now_playing_info(avrcp_cid);
|
||||
avrcp_controller_get_now_playing_info(avrcp_cid);
|
||||
break;
|
||||
case '1':
|
||||
printf("AVRCP: play\n");
|
||||
avrcp_play(avrcp_cid);
|
||||
avrcp_controller_play(avrcp_cid);
|
||||
break;
|
||||
case '2':
|
||||
printf("AVRCP: stop\n");
|
||||
avrcp_stop(avrcp_cid);
|
||||
avrcp_controller_stop(avrcp_cid);
|
||||
break;
|
||||
case '3':
|
||||
printf("AVRCP: pause\n");
|
||||
avrcp_pause(avrcp_cid);
|
||||
avrcp_controller_pause(avrcp_cid);
|
||||
break;
|
||||
case '4':
|
||||
printf("AVRCP: fast forward\n");
|
||||
avrcp_fast_forward(avrcp_cid);
|
||||
avrcp_controller_fast_forward(avrcp_cid);
|
||||
break;
|
||||
case '5':
|
||||
printf("AVRCP: rewind\n");
|
||||
avrcp_rewind(avrcp_cid);
|
||||
avrcp_controller_rewind(avrcp_cid);
|
||||
break;
|
||||
case '6':
|
||||
printf("AVRCP: forward\n");
|
||||
avrcp_forward(avrcp_cid);
|
||||
avrcp_controller_forward(avrcp_cid);
|
||||
break;
|
||||
case '7':
|
||||
printf("AVRCP: backward\n");
|
||||
avrcp_backward(avrcp_cid);
|
||||
avrcp_controller_backward(avrcp_cid);
|
||||
break;
|
||||
case '8':
|
||||
printf("AVRCP: volume up\n");
|
||||
avrcp_volume_up(avrcp_cid);
|
||||
avrcp_controller_volume_up(avrcp_cid);
|
||||
break;
|
||||
case '9':
|
||||
printf("AVRCP: volume down\n");
|
||||
avrcp_volume_down(avrcp_cid);
|
||||
avrcp_controller_volume_down(avrcp_cid);
|
||||
break;
|
||||
case '0':
|
||||
printf("AVRCP: mute\n");
|
||||
avrcp_mute(avrcp_cid);
|
||||
avrcp_controller_mute(avrcp_cid);
|
||||
break;
|
||||
case 'R':
|
||||
printf("AVRCP: absolute volume of 50 percent\n");
|
||||
avrcp_set_absolute_volume(avrcp_cid, 50);
|
||||
avrcp_controller_set_absolute_volume(avrcp_cid, 50);
|
||||
break;
|
||||
case 'u':
|
||||
printf("AVRCP: skip\n");
|
||||
avrcp_skip(avrcp_cid);
|
||||
avrcp_controller_skip(avrcp_cid);
|
||||
break;
|
||||
case 'i':
|
||||
printf("AVRCP: query repeat and shuffle mode\n");
|
||||
avrcp_query_shuffle_and_repeat_modes(avrcp_cid);
|
||||
avrcp_controller_query_shuffle_and_repeat_modes(avrcp_cid);
|
||||
break;
|
||||
case 'o':
|
||||
printf("AVRCP: repeat single track\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_SINGLE_TRACK);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_SINGLE_TRACK);
|
||||
break;
|
||||
case 'x':
|
||||
printf("AVRCP: repeat all tracks\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_ALL_TRACKS);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_ALL_TRACKS);
|
||||
break;
|
||||
case 'X':
|
||||
printf("AVRCP: disable repeat mode\n");
|
||||
avrcp_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_OFF);
|
||||
avrcp_controller_set_repeat_mode(avrcp_cid, AVRCP_REPEAT_MODE_OFF);
|
||||
break;
|
||||
case 'z':
|
||||
printf("AVRCP: shuffle all tracks\n");
|
||||
avrcp_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_ALL_TRACKS);
|
||||
avrcp_controller_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_ALL_TRACKS);
|
||||
break;
|
||||
case 'Z':
|
||||
printf("AVRCP: disable shuffle mode\n");
|
||||
avrcp_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_OFF);
|
||||
avrcp_controller_set_shuffle_mode(avrcp_cid, AVRCP_SHUFFLE_MODE_OFF);
|
||||
break;
|
||||
|
||||
case 'a':
|
||||
printf("AVRCP: enable notification PLAYBACK_STATUS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
break;
|
||||
case 's':
|
||||
printf("AVRCP: enable notification TRACK_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED);
|
||||
break;
|
||||
case 'd':
|
||||
printf("AVRCP: enable notification TRACK_REACHED_END\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END);
|
||||
break;
|
||||
case 'f':
|
||||
printf("AVRCP: enable notification TRACK_REACHED_START\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START);
|
||||
break;
|
||||
case 'g':
|
||||
printf("AVRCP: enable notification PLAYBACK_POS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED);
|
||||
break;
|
||||
case 'h':
|
||||
printf("AVRCP: enable notification BATT_STATUS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED);
|
||||
break;
|
||||
case 'j':
|
||||
printf("AVRCP: enable notification SYSTEM_STATUS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED);
|
||||
break;
|
||||
case 'k':
|
||||
printf("AVRCP: enable notification PLAYER_APPLICATION_SETTING_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED);
|
||||
break;
|
||||
case 'l':
|
||||
printf("AVRCP: enable notification NOW_PLAYING_CONTENT_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
break;
|
||||
case 'm':
|
||||
printf("AVRCP: enable notification AVAILABLE_PLAYERS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED);
|
||||
break;
|
||||
case 'n':
|
||||
printf("AVRCP: enable notification ADDRESSED_PLAYER_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED);
|
||||
break;
|
||||
case 'y':
|
||||
printf("AVRCP: enable notification UIDS_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED);
|
||||
break;
|
||||
case 'v':
|
||||
printf("AVRCP: enable notification VOLUME_CHANGED\n");
|
||||
avrcp_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED);
|
||||
avrcp_controller_enable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED);
|
||||
break;
|
||||
|
||||
case 'A':
|
||||
printf("AVRCP: disable notification PLAYBACK_STATUS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_STATUS_CHANGED);
|
||||
break;
|
||||
case 'S':
|
||||
printf("AVRCP: disable notification TRACK_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_CHANGED);
|
||||
break;
|
||||
case 'D':
|
||||
printf("AVRCP: disable notification TRACK_REACHED_END\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_END);
|
||||
break;
|
||||
case 'F':
|
||||
printf("AVRCP: disable notification TRACK_REACHED_START\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_TRACK_REACHED_START);
|
||||
break;
|
||||
case 'G':
|
||||
printf("AVRCP: disable notification PLAYBACK_POS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYBACK_POS_CHANGED);
|
||||
break;
|
||||
case 'H':
|
||||
printf("AVRCP: disable notification BATT_STATUS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_BATT_STATUS_CHANGED);
|
||||
break;
|
||||
case 'J':
|
||||
printf("AVRCP: disable notification SYSTEM_STATUS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_SYSTEM_STATUS_CHANGED);
|
||||
break;
|
||||
case 'K':
|
||||
printf("AVRCP: disable notification PLAYER_APPLICATION_SETTING_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_PLAYER_APPLICATION_SETTING_CHANGED);
|
||||
break;
|
||||
case 'L':
|
||||
printf("AVRCP: disable notification NOW_PLAYING_CONTENT_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_NOW_PLAYING_CONTENT_CHANGED);
|
||||
break;
|
||||
case 'M':
|
||||
printf("AVRCP: disable notification AVAILABLE_PLAYERS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_AVAILABLE_PLAYERS_CHANGED);
|
||||
break;
|
||||
case 'N':
|
||||
printf("AVRCP: disable notification ADDRESSED_PLAYER_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_ADDRESSED_PLAYER_CHANGED);
|
||||
break;
|
||||
case 'Y':
|
||||
printf("AVRCP: disable notification UIDS_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_UIDS_CHANGED);
|
||||
break;
|
||||
case 'V':
|
||||
printf("AVRCP: disable notification VOLUME_CHANGED\n");
|
||||
avrcp_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED);
|
||||
avrcp_controller_disable_notification(avrcp_cid, AVRCP_NOTIFICATION_EVENT_VOLUME_CHANGED);
|
||||
break;
|
||||
default:
|
||||
show_usage();
|
||||
@ -521,7 +520,7 @@ int btstack_main(int argc, const char * argv[]){
|
||||
|
||||
// Initialize AVRCP COntroller
|
||||
avrcp_controller_init();
|
||||
avrcp_register_packet_handler(&packet_handler);
|
||||
avrcp_controller_register_packet_handler(&packet_handler);
|
||||
|
||||
// Initialize SDP
|
||||
sdp_init();
|
||||
|
Loading…
x
Reference in New Issue
Block a user