Bluetooth: implement first two Sanity checks
Check that the DUT has a Bluetooth adapter, and check that the Bluetooth
adapter address is not garbage.
BUG=chromium:256771
TEST=run_remote_tests
Change-Id: I0b87bf25ea103591c8eab2884e519a32c82f6c72
Reviewed-on: https://gerrit.chromium.org/gerrit/64003
Reviewed-by: Simran Basi <sbasi@chromium.org>
Commit-Queue: Scott James Remnant <keybuk@chromium.org>
Tested-by: Scott James Remnant <keybuk@chromium.org>
diff --git a/server/cros/bluetooth/bluetooth_client.py b/server/cros/bluetooth/bluetooth_client.py
index 38d8a9b..063f624 100644
--- a/server/cros/bluetooth/bluetooth_client.py
+++ b/server/cros/bluetooth/bluetooth_client.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import json
from autotest_lib.client.cros import constants
from autotest_lib.server import autotest
@@ -57,6 +58,11 @@
return self._proxy.reset_off()
+ def has_adapter(self):
+ """@return True if an adapter is present, False if not."""
+ return self._proxy.has_adapter()
+
+
def set_powered(self, powered):
"""Set the adapter power state.
@@ -90,6 +96,28 @@
return self._proxy.set_pairable(pairable)
+ def get_adapter_properties(self):
+ """Read the adapter properties from the Bluetooth Daemon.
+
+ @return the properties as a JSON-encoded dictionary on success,
+ the value False otherwise.
+
+ """
+ return json.loads(self._proxy.get_adapter_properties())
+
+
+ def read_info(self):
+ """Read the adapter information from the Kernel.
+
+ @return the information as a JSON-encoded tuple of:
+ ( address, bluetooth_version, manufacturer_id,
+ supported_settings, current_settings, class_of_device,
+ name, short_name )
+
+ """
+ return json.loads(self._proxy.read_info())
+
+
def close(self):
"""Tear down state associated with the client."""
# Leave the adapter powered off, but don't do a full reset.