mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-02 07:20:16 +00:00
avrcp_controller: use bool press_and_hold_cmd field
This commit is contained in:
parent
48e6eeee0f
commit
0c436f0b86
@ -494,7 +494,7 @@ typedef struct {
|
|||||||
|
|
||||||
btstack_timer_source_t retry_timer;
|
btstack_timer_source_t retry_timer;
|
||||||
btstack_timer_source_t press_and_hold_cmd_timer;
|
btstack_timer_source_t press_and_hold_cmd_timer;
|
||||||
uint8_t continuous_fast_forward_cmd;
|
bool press_and_hold_cmd;
|
||||||
uint16_t notifications_enabled;
|
uint16_t notifications_enabled;
|
||||||
uint16_t notifications_to_register;
|
uint16_t notifications_to_register;
|
||||||
uint16_t notifications_to_deregister;
|
uint16_t notifications_to_deregister;
|
||||||
|
@ -539,14 +539,14 @@ static void avrcp_press_and_hold_timer_start(avrcp_connection_t * connection){
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void avrcp_press_and_hold_timer_stop(avrcp_connection_t * connection){
|
static void avrcp_press_and_hold_timer_stop(avrcp_connection_t * connection){
|
||||||
connection->continuous_fast_forward_cmd = 0;
|
connection->press_and_hold_cmd = 0;
|
||||||
btstack_run_loop_remove_timer(&connection->press_and_hold_cmd_timer);
|
btstack_run_loop_remove_timer(&connection->press_and_hold_cmd_timer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static uint8_t avrcp_controller_request_pass_through_release_control_cmd(avrcp_connection_t * connection){
|
static uint8_t avrcp_controller_request_pass_through_release_control_cmd(avrcp_connection_t * connection){
|
||||||
connection->state = AVCTP_W2_SEND_RELEASE_COMMAND;
|
connection->state = AVCTP_W2_SEND_RELEASE_COMMAND;
|
||||||
if (connection->continuous_fast_forward_cmd){
|
if (connection->press_and_hold_cmd){
|
||||||
avrcp_press_and_hold_timer_stop(connection);
|
avrcp_press_and_hold_timer_stop(connection);
|
||||||
}
|
}
|
||||||
connection->cmd_operands[0] = 0x80 | connection->cmd_operands[0];
|
connection->cmd_operands[0] = 0x80 | connection->cmd_operands[0];
|
||||||
@ -555,7 +555,7 @@ static uint8_t avrcp_controller_request_pass_through_release_control_cmd(avrcp_c
|
|||||||
return ERROR_CODE_SUCCESS;
|
return ERROR_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint8_t avrcp_controller_request_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed, uint8_t continuous_fast_forward_cmd){
|
static inline uint8_t avrcp_controller_request_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed, bool continuous_fast_forward_cmd){
|
||||||
log_info("Send command %d", opid);
|
log_info("Send command %d", opid);
|
||||||
avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_CONTROLLER, avrcp_cid);
|
avrcp_connection_t * connection = avrcp_get_connection_for_avrcp_cid_for_role(AVRCP_CONTROLLER, avrcp_cid);
|
||||||
if (!connection){
|
if (!connection){
|
||||||
@ -574,7 +574,7 @@ static inline uint8_t avrcp_controller_request_pass_through_press_control_cmd(ui
|
|||||||
connection->subunit_id = AVRCP_SUBUNIT_ID;
|
connection->subunit_id = AVRCP_SUBUNIT_ID;
|
||||||
connection->cmd_operands_length = 0;
|
connection->cmd_operands_length = 0;
|
||||||
|
|
||||||
connection->continuous_fast_forward_cmd = continuous_fast_forward_cmd;
|
connection->press_and_hold_cmd = continuous_fast_forward_cmd;
|
||||||
connection->cmd_operands_length = 2;
|
connection->cmd_operands_length = 2;
|
||||||
connection->cmd_operands[0] = opid;
|
connection->cmd_operands[0] = opid;
|
||||||
if (playback_speed > 0){
|
if (playback_speed > 0){
|
||||||
@ -583,7 +583,7 @@ static inline uint8_t avrcp_controller_request_pass_through_press_control_cmd(ui
|
|||||||
}
|
}
|
||||||
connection->cmd_operands[1] = connection->cmd_operands_length - 2;
|
connection->cmd_operands[1] = connection->cmd_operands_length - 2;
|
||||||
|
|
||||||
if (connection->continuous_fast_forward_cmd){
|
if (connection->press_and_hold_cmd){
|
||||||
avrcp_press_and_hold_timer_start(connection);
|
avrcp_press_and_hold_timer_start(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -593,11 +593,11 @@ static inline uint8_t avrcp_controller_request_pass_through_press_control_cmd(ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t request_single_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed){
|
static uint8_t request_single_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed){
|
||||||
return avrcp_controller_request_pass_through_press_control_cmd(avrcp_cid, opid, playback_speed, 0);
|
return avrcp_controller_request_pass_through_press_control_cmd(avrcp_cid, opid, playback_speed, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t request_continuous_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed){
|
static uint8_t request_continuous_pass_through_press_control_cmd(uint16_t avrcp_cid, avrcp_operation_id_t opid, uint16_t playback_speed){
|
||||||
return avrcp_controller_request_pass_through_press_control_cmd(avrcp_cid, opid, playback_speed, 1);
|
return avrcp_controller_request_pass_through_press_control_cmd(avrcp_cid, opid, playback_speed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int avrcp_controller_register_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t event_id){
|
static int avrcp_controller_register_notification(avrcp_connection_t * connection, avrcp_notification_event_id_t event_id){
|
||||||
@ -969,7 +969,7 @@ static void avrcp_handle_l2cap_data_packet_for_signaling_connection(avrcp_connec
|
|||||||
uint8_t operation_id = packet[pos++];
|
uint8_t operation_id = packet[pos++];
|
||||||
switch (connection->state){
|
switch (connection->state){
|
||||||
case AVCTP_W2_RECEIVE_PRESS_RESPONSE:
|
case AVCTP_W2_RECEIVE_PRESS_RESPONSE:
|
||||||
if (connection->continuous_fast_forward_cmd){
|
if (connection->press_and_hold_cmd){
|
||||||
connection->state = AVCTP_W4_STOP;
|
connection->state = AVCTP_W4_STOP;
|
||||||
} else {
|
} else {
|
||||||
connection->state = AVCTP_W2_SEND_RELEASE_COMMAND;
|
connection->state = AVCTP_W2_SEND_RELEASE_COMMAND;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user