[PATCH 5/8] android/bluetooth: Add stubs for get device properties command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This adds per property stubs.
---
 android/bluetooth.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 119 insertions(+), 2 deletions(-)

diff --git a/android/bluetooth.c b/android/bluetooth.c
index 879cf8d..4b17f60 100644
--- a/android/bluetooth.c
+++ b/android/bluetooth.c
@@ -2229,6 +2229,78 @@ static void handle_get_adapter_props_cmd(const void *buf, uint16_t len)
 							HAL_STATUS_SUCCESS);
 }
 
+static uint8_t get_device_uuids(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_class(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_type(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_service_rec(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_friendly_name(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_rssi(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_version_info(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
+static uint8_t get_device_timestamp(struct device *dev)
+{
+	DBG("Not implemented");
+
+	/* TODO */
+
+	return HAL_STATUS_FAILED;
+}
+
 static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
 {
 	/* TODO */
@@ -2239,10 +2311,55 @@ static void handle_get_remote_device_props_cmd(const void *buf, uint16_t len)
 
 static void handle_get_remote_device_prop_cmd(const void *buf, uint16_t len)
 {
-	/* TODO */
+	const struct hal_cmd_get_remote_device_prop *cmd = buf;
+	uint8_t status;
+	bdaddr_t addr;
+	GSList *l;
 
+	android2bdaddr(cmd->bdaddr, &addr);
+
+	l = g_slist_find_custom(devices, &addr, bdaddr_cmp);
+	if (!l) {
+		status = HAL_STATUS_INVALID;
+		goto failed;
+	}
+
+	switch (cmd->type) {
+	case HAL_PROP_DEVICE_NAME:
+		status = get_device_name(l->data);
+		break;
+	case HAL_PROP_DEVICE_UUIDS:
+		status = get_device_uuids(l->data);
+		break;
+	case HAL_PROP_DEVICE_CLASS:
+		status = get_device_class(l->data);
+		break;
+	case HAL_PROP_DEVICE_TYPE:
+		status = get_device_type(l->data);
+		break;
+	case HAL_PROP_DEVICE_SERVICE_REC:
+		status = get_device_service_rec(l->data);
+		break;
+	case HAL_PROP_DEVICE_FRIENDLY_NAME:
+		status = get_device_friendly_name(l->data);
+		break;
+	case HAL_PROP_DEVICE_RSSI:
+		status = get_device_rssi(l->data);
+		break;
+	case HAL_PROP_DEVICE_VERSION_INFO:
+		status = get_device_version_info(l->data);
+		break;
+	case HAL_PROP_DEVICE_TIMESTAMP:
+		status = get_device_timestamp(l->data);
+		break;
+	default:
+		status = HAL_STATUS_FAILED;
+		break;
+	}
+
+failed:
 	ipc_send_rsp(HAL_SERVICE_ID_BLUETOOTH, HAL_OP_GET_REMOTE_DEVICE_PROP,
-							HAL_STATUS_FAILED);
+								status);
 }
 
 static void handle_set_remote_device_prop_cmd(const void *buf, uint16_t len)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux