android/hal-pan: Add implementation of .init
Luiz Augusto von Dentz
maintainerPATCH 1/5 android/hal-pan: Add implementation of .init
From: Luiz Augusto von Dentz <[email protected]>
--- android/hal-pan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
android/hal-pan.c +7 -4
@@ -20,6 +20,8 @@#include "hal-log.h" #include "hal.h" +#include "hal-msg.h" +#include "hal-ipc.h" static const btpan_callbacks_t *cbs =NULL ;
@@ -77,15 +79,16 @@ static bt_status_t pan_disconnect(const bt_bdaddr_t *bd_addr)static bt_status_t pan_init (const btpan_callbacks_t *callbacks) { +struct hal_cmd_register_module cmd; +DBG ("" ); cbs = callbacks; -/* TODO: start HID Host thread */ - -/* TODO: enable service */ + cmd.service_id =HAL_SERVICE_ID_PAN ; -return BT_STATUS_SUCCESS ; +return hal_ipc_cmd (HAL_SERVICE_ID_CORE ,HAL_OP_REGISTER_MODULE , +sizeof (cmd), &cmd,0 ,NULL ,NULL ); }static void pan_cleanup ()
Signature · 1 line
1.8.3.1
Luiz Augusto von Dentz
maintainerPATCH 2/5 android/hal-pan: Add implementation of .enable
From: Luiz Augusto von Dentz <[email protected]>
--- android/hal-msg.h | 7 +++++++ android/hal-pan.c | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
android/hal-msg.h +7 -0
@@ -290,6 +290,13 @@ struct hal_cmd_av_disconnect {uint8_t bdaddr[6 ]; } __attribute__((packed)); +/* PAN HAL API */ + +#define HAL_OP_PAN_ENABLE 0x01 +struct hal_cmd_pan_enable { +uint8_t local_role; +} __attribute__((packed)); +/* Notifications and confirmations */
android/hal-pan.c +6 -1
@@ -32,12 +32,17 @@ static bool interface_ready(void)static bt_status_t pan_enable (int local_role) { +struct hal_cmd_pan_enable cmd; +DBG ("" );if (!interface_ready ())return BT_STATUS_NOT_READY ; -return BT_STATUS_UNSUPPORTED ; + cmd.local_role = local_role; + +return hal_ipc_cmd (HAL_SERVICE_ID_PAN ,HAL_OP_PAN_ENABLE , +sizeof (cmd), &cmd,0 ,NULL ,NULL ); }static int pan_get_local_role (void )
Signature · 1 line
1.8.3.1
Luiz Augusto von Dentz
maintainerPATCH 3/5 android/hal-pan: Add implementation of .get_local_role
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
--- android/hal-msg.h | 5 +++++ android/hal-pan.c | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-)
android/hal-msg.h +5 -0
@@ -297,6 +297,11 @@ struct hal_cmd_pan_enable {uint8_t local_role; } __attribute__((packed)); +#define HAL_OP_PAN_GET_ROLE 0x02 +struct hal_rsp_pan_get_role { +uint8_t local_role; +} __attribute__((packed)); +/* Notifications and confirmations */
android/hal-pan.c +10 -1
@@ -47,12 +47,21 @@ static bt_status_t pan_enable(int local_role)static int pan_get_local_role (void ) { +struct hal_rsp_pan_get_role rsp; +size_t len =sizeof (rsp); +bt_status_t status; +DBG ("" );if (!interface_ready ())return BTPAN_ROLE_NONE ; -return BTPAN_ROLE_NONE ; + status =hal_ipc_cmd (HAL_SERVICE_ID_PAN ,HAL_OP_PAN_GET_ROLE ,0 ,NULL , + &len, &rsp,NULL ); +if (status !=BT_STATUS_SUCCESS ) +return BTPAN_ROLE_NONE ; + +return rsp.local_role; } static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,
Signature · 1 line
1.8.3.1
Luiz Augusto von Dentz
maintainerPATCH 4/5 android/hal-pan: Add implementation of .connect
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
--- android/hal-msg.h | 7 +++++++ android/hal-pan.c | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-)
android/hal-msg.h +7 -0
@@ -302,6 +302,13 @@ struct hal_rsp_pan_get_role {uint8_t local_role; } __attribute__((packed)); +#define HAL_OP_PAN_CONNECT 0x03 +struct hal_cmd_pan_connect { +uint8_t bdaddr[6 ]; +uint8_t local_role; +uint8_t remote_role; +} __attribute__((packed)); +/* Notifications and confirmations */
android/hal-pan.c +8 -3
@@ -17,6 +17,7 @@#include <stdbool.h> #include <stddef.h> +#include <string.h> #include "hal-log.h" #include "hal.h"
@@ -67,15 +68,19 @@ static int pan_get_local_role(void)static bt_status_t pan_connect (const bt_bdaddr_t *bd_addr,int local_role,int remote_role) { +struct hal_cmd_pan_connect cmd; +DBG ("" );if (!interface_ready ())return BT_STATUS_NOT_READY ; -if (!bd_addr) -return BT_STATUS_PARM_INVALID ; +memcpy (cmd.bdaddr, bd_addr,sizeof (cmd.bdaddr)); + cmd.local_role = local_role; + cmd.remote_role = remote_role; -return BT_STATUS_UNSUPPORTED ; +return hal_ipc_cmd (HAL_SERVICE_ID_PAN ,HAL_OP_PAN_CONNECT , +sizeof (cmd), &cmd,0 ,NULL ,NULL ); }static bt_status_t pan_disconnect (const bt_bdaddr_t *bd_addr)
Signature · 1 line
1.8.3.1
Luiz Augusto von Dentz
maintainerPATCH 5/5 android/hal-pan: Add implementation of .disconnect
In reply to Luiz Augusto von DentzFrom: Luiz Augusto von Dentz <[email protected]>
--- android/hal-msg.h | 5 +++++ android/hal-pan.c | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-)
android/hal-msg.h +5 -0
@@ -309,6 +309,11 @@ struct hal_cmd_pan_connect {uint8_t remote_role; } __attribute__((packed)); +#define HAL_OP_PAN_DISCONNECT 0x04 +struct hal_cmd_pan_disconnect { +uint8_t bdaddr[6 ]; +} __attribute__((packed)); +/* Notifications and confirmations */
android/hal-pan.c +5 -3
@@ -85,15 +85,17 @@ static bt_status_t pan_connect(const bt_bdaddr_t *bd_addr, int local_role,static bt_status_t pan_disconnect (const bt_bdaddr_t *bd_addr) { +struct hal_cmd_pan_disconnect cmd; +DBG ("" );if (!interface_ready ())return BT_STATUS_NOT_READY ; -if (!bd_addr) -return BT_STATUS_PARM_INVALID ; +memcpy (cmd.bdaddr, bd_addr,sizeof (cmd.bdaddr)); -return BT_STATUS_UNSUPPORTED ; +return hal_ipc_cmd (HAL_SERVICE_ID_PAN ,HAL_OP_PAN_DISCONNECT , +sizeof (cmd), &cmd,0 ,NULL ,NULL ); }static bt_status_t pan_init (const btpan_callbacks_t *callbacks)
Signature · 1 line
1.8.3.1
Hi Luiz,
Quoted 3 lines · Luiz Augusto von Dentz
--- android/hal-pan.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
All five patches have been applied. Thanks.
Johan