* [PATCH BlueZ 2/5] android/hal-pan: Add implementation of .enable
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
@ 2013-10-28 12:09 ` Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 3/5] android/hal-pan: Add implementation of .get_local_role Luiz Augusto von Dentz
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-28 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-msg.h | 7 +++++++
android/hal-pan.c | 7 ++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index a0a8390..0987eec 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -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 */
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 62fec00..8fb2563 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH BlueZ 3/5] android/hal-pan: Add implementation of .get_local_role
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 2/5] android/hal-pan: Add implementation of .enable Luiz Augusto von Dentz
@ 2013-10-28 12:09 ` Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 4/5] android/hal-pan: Add implementation of .connect Luiz Augusto von Dentz
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-28 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-msg.h | 5 +++++
android/hal-pan.c | 11 ++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 0987eec..350cec1 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -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 */
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 8fb2563..c8dcdec 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -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,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH BlueZ 4/5] android/hal-pan: Add implementation of .connect
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 2/5] android/hal-pan: Add implementation of .enable Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 3/5] android/hal-pan: Add implementation of .get_local_role Luiz Augusto von Dentz
@ 2013-10-28 12:09 ` Luiz Augusto von Dentz
2013-10-28 12:09 ` [PATCH BlueZ 5/5] android/hal-pan: Add implementation of .disconnect Luiz Augusto von Dentz
2013-10-28 12:43 ` [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Johan Hedberg
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-28 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-msg.h | 7 +++++++
android/hal-pan.c | 11 ++++++++---
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 350cec1..65f60dc 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -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 */
diff --git a/android/hal-pan.c b/android/hal-pan.c
index c8dcdec..3e23eb5 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH BlueZ 5/5] android/hal-pan: Add implementation of .disconnect
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
` (2 preceding siblings ...)
2013-10-28 12:09 ` [PATCH BlueZ 4/5] android/hal-pan: Add implementation of .connect Luiz Augusto von Dentz
@ 2013-10-28 12:09 ` Luiz Augusto von Dentz
2013-10-28 12:43 ` [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Johan Hedberg
4 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2013-10-28 12:09 UTC (permalink / raw)
To: linux-bluetooth
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
android/hal-msg.h | 5 +++++
android/hal-pan.c | 8 +++++---
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/android/hal-msg.h b/android/hal-msg.h
index 65f60dc..bba031c 100644
--- a/android/hal-msg.h
+++ b/android/hal-msg.h
@@ -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 */
diff --git a/android/hal-pan.c b/android/hal-pan.c
index 3e23eb5..cacc6c0 100644
--- a/android/hal-pan.c
+++ b/android/hal-pan.c
@@ -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)
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init
2013-10-28 12:09 [PATCH BlueZ 1/5] android/hal-pan: Add implementation of .init Luiz Augusto von Dentz
` (3 preceding siblings ...)
2013-10-28 12:09 ` [PATCH BlueZ 5/5] android/hal-pan: Add implementation of .disconnect Luiz Augusto von Dentz
@ 2013-10-28 12:43 ` Johan Hedberg
4 siblings, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2013-10-28 12:43 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
Hi Luiz,
On Mon, Oct 28, 2013, Luiz Augusto von Dentz wrote:
> ---
> android/hal-pan.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
All five patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 6+ messages in thread