android/handsfree-client: Add Call Action command

This commit is contained in:
Lukasz Rymanowski 2014-09-15 13:51:24 +02:00 committed by Szymon Janc
parent 800b2b23a3
commit 2d5408941e
3 changed files with 47 additions and 0 deletions

View File

@ -229,6 +229,23 @@ static bt_status_t dial_memory(int location)
sizeof(cmd), &cmd, NULL, NULL, NULL); sizeof(cmd), &cmd, NULL, NULL, NULL);
} }
static bt_status_t call_action(bthf_client_call_action_t action, int index)
{
struct hal_cmd_hf_client_call_action cmd;
DBG("");
if (!interface_ready())
return BT_STATUS_NOT_READY;
cmd.action = action;
cmd.index = index;
return hal_ipc_cmd(HAL_SERVICE_ID_HANDSFREE_CLIENT,
HAL_OP_HF_CLIENT_CALL_ACTION, sizeof(cmd), &cmd,
NULL, NULL, NULL);
}
static void cleanup(void) static void cleanup(void)
{ {
struct hal_cmd_unregister_module cmd; struct hal_cmd_unregister_module cmd;
@ -260,6 +277,7 @@ static bthf_client_interface_t iface = {
.volume_control = volume_control, .volume_control = volume_control,
.dial = dial, .dial = dial,
.dial_memory = dial_memory, .dial_memory = dial_memory,
.handle_call_action = call_action,
.cleanup = cleanup .cleanup = cleanup
}; };

View File

@ -1021,6 +1021,25 @@ struct hal_cmd_hf_client_dial_memory {
int32_t location; int32_t location;
} __attribute__((packed)); } __attribute__((packed));
#define HAL_HF_CLIENT_ACTION_CHLD_0 0x00
#define HAL_HF_CLIENT_ACTION_CHLD_1 0x01
#define HAL_HF_CLIENT_ACTION_CHLD_2 0x02
#define HAL_HF_CLIENT_ACTION_CHLD_3 0x03
#define HAL_HF_CLIENT_ACTION_CHLD_4 0x04
#define HAL_HF_CLIENT_ACTION_CHLD_1x 0x05
#define HAL_HF_CLIENT_ACTION_CHLD_2x 0x06
#define HAL_HF_CLIENT_ACTION_ATA 0x07
#define HAL_HF_CLIENT_ACTION_CHUP 0x08
#define HAL_HF_CLIENT_ACTION_BRTH_0 0x09
#define HAL_HF_CLIENT_ACTION_BRTH_1 0x10
#define HAL_HF_CLIENT_ACTION_BRTH_02 0x11
#define HAL_OP_HF_CLIENT_CALL_ACTION 0x0a
struct hal_cmd_hf_client_call_action {
uint8_t action;
uint8_t index;
} __attribute__((packed));
/* Notifications and confirmations */ /* Notifications and confirmations */
#define HAL_POWER_OFF 0x00 #define HAL_POWER_OFF 0x00

View File

@ -109,6 +109,13 @@ static void handle_dial_memory(const void *buf, uint16_t len)
HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED); HAL_OP_HF_CLIENT_DIAL_MEMORY, HAL_STATUS_UNSUPPORTED);
} }
static void handle_call_action(const void *buf, uint16_t len)
{
DBG("Not Implemented");
ipc_send_rsp(hal_ipc, HAL_SERVICE_ID_HANDSFREE_CLIENT,
HAL_OP_HF_CLIENT_CALL_ACTION, HAL_STATUS_UNSUPPORTED);
}
static const struct ipc_handler cmd_handlers[] = { static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_CONNECT */ /* HAL_OP_HF_CLIENT_CONNECT */
{ handle_connect, false, { handle_connect, false,
@ -134,6 +141,9 @@ static const struct ipc_handler cmd_handlers[] = {
/* HAL_OP_HF_CLIENT_DIAL_MEMORY */ /* HAL_OP_HF_CLIENT_DIAL_MEMORY */
{ handle_dial_memory, false, { handle_dial_memory, false,
sizeof(struct hal_cmd_hf_client_dial_memory) }, sizeof(struct hal_cmd_hf_client_dial_memory) },
/* HAL_OP_HF_CLIENT_CALL_ACTION */
{ handle_call_action, false,
sizeof(struct hal_cmd_hf_client_call_action) },
}; };
bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr) bool bt_hf_client_register(struct ipc *ipc, const bdaddr_t *addr)