Bug 1006309 - Patch 3/4: Query adapters list from bluetooth backend, r=echou
authorBen Tian <btian@mozilla.com>
Thu, 29 May 2014 17:16:20 +0800
changeset 186105 cda3f53079c34e51332f428b6d2b9fa16aba27ab
parent 186104 81da11356628f8dfa2f24119828c9827eb7bd07c
child 186106 5183b3c511ef93238e5c7977863cd783edac62f5
push id26878
push userryanvm@gmail.com
push dateMon, 02 Jun 2014 21:09:02 +0000
treeherdermozilla-central@240184726d04 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersechou
bugs1006309
milestone32.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1006309 - Patch 3/4: Query adapters list from bluetooth backend, r=echou
dom/bluetooth2/BluetoothManager.cpp
dom/bluetooth2/BluetoothReplyRunnable.cpp
dom/bluetooth2/BluetoothReplyRunnable.h
dom/bluetooth2/BluetoothService.cpp
dom/bluetooth2/BluetoothService.h
dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.h
dom/bluetooth2/bluez/BluetoothDBusService.cpp
dom/bluetooth2/bluez/BluetoothDBusService.h
dom/bluetooth2/ipc/BluetoothParent.cpp
dom/bluetooth2/ipc/BluetoothParent.h
dom/bluetooth2/ipc/BluetoothServiceChildProcess.cpp
dom/bluetooth2/ipc/BluetoothServiceChildProcess.h
dom/bluetooth2/ipc/PBluetooth.ipdl
--- a/dom/bluetooth2/BluetoothManager.cpp
+++ b/dom/bluetooth2/BluetoothManager.cpp
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "base/basictypes.h"
 #include "BluetoothManager.h"
 #include "BluetoothCommon.h"
 #include "BluetoothAdapter.h"
 #include "BluetoothService.h"
+#include "BluetoothReplyRunnable.h"
 
 #include "mozilla/dom/bluetooth/BluetoothTypes.h"
 #include "mozilla/dom/BluetoothManager2Binding.h"
 #include "mozilla/Services.h"
 #include "nsContentUtils.h"
 #include "nsDOMClassInfo.h"
 #include "nsIPermissionManager.h"
 #include "nsThreadUtils.h"
@@ -24,24 +25,87 @@ USING_BLUETOOTH_NAMESPACE
 
 // QueryInterface implementation for BluetoothManager
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BluetoothManager)
 NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
 
 NS_IMPL_ADDREF_INHERITED(BluetoothManager, DOMEventTargetHelper)
 NS_IMPL_RELEASE_INHERITED(BluetoothManager, DOMEventTargetHelper)
 
+class GetAdaptersTask : public BluetoothReplyRunnable
+{
+ public:
+  GetAdaptersTask(BluetoothManager* aManager)
+    : BluetoothReplyRunnable(nullptr)
+    , mManager(aManager)
+  { }
+
+  bool
+  ParseSuccessfulReply(JS::MutableHandle<JS::Value> aValue)
+  {
+    /**
+     * Unwrap BluetoothReply.BluetoothReplySuccess.BluetoothValue =
+     *   BluetoothNamedValue[]
+     *     |
+     *     |__ BluetoothNamedValue =
+     *     |     {"Adapter", BluetoothValue = BluetoothNamedValue[]}
+     *     |
+     *     |__ BluetoothNamedValue =
+     *     |     {"Adapter", BluetoothValue = BluetoothNamedValue[]}
+     *     ...
+     */
+
+    // Extract the array of all adapters' properties
+    const BluetoothValue& adaptersProperties =
+      mReply->get_BluetoothReplySuccess().value();
+    NS_ENSURE_TRUE(adaptersProperties.type() ==
+                   BluetoothValue::TArrayOfBluetoothNamedValue, false);
+
+    const InfallibleTArray<BluetoothNamedValue>& adaptersPropertiesArray =
+      adaptersProperties.get_ArrayOfBluetoothNamedValue();
+
+    // Append a BluetoothAdapter into adapters array for each properties array
+    uint32_t numAdapters = adaptersPropertiesArray.Length();
+    for (uint32_t i = 0; i < numAdapters; i++) {
+      MOZ_ASSERT(adaptersPropertiesArray[i].name().EqualsLiteral("Adapter"));
+
+      const BluetoothValue& properties = adaptersPropertiesArray[i].value();
+      mManager->AppendAdapter(properties);
+    }
+
+    aValue.setUndefined();
+    return true;
+  }
+
+  void
+  ReleaseMembers()
+  {
+    BluetoothReplyRunnable::ReleaseMembers();
+    mManager = nullptr;
+  }
+
+private:
+  nsRefPtr<BluetoothManager> mManager;
+};
+
 BluetoothManager::BluetoothManager(nsPIDOMWindow *aWindow)
   : DOMEventTargetHelper(aWindow)
   , mDefaultAdapterIndex(-1)
 {
   MOZ_ASSERT(aWindow);
   MOZ_ASSERT(IsDOMBinding());
 
   ListenToBluetoothSignal(true);
+
+  // Query adapters list from bluetooth backend
+  BluetoothService* bs = BluetoothService::Get();
+  NS_ENSURE_TRUE_VOID(bs);
+
+  nsRefPtr<BluetoothReplyRunnable> result = new GetAdaptersTask(this);
+  NS_ENSURE_SUCCESS_VOID(bs->GetAdaptersInternal(result));
 }
 
 BluetoothManager::~BluetoothManager()
 {
   ListenToBluetoothSignal(false);
 }
 
 void
--- a/dom/bluetooth2/BluetoothReplyRunnable.cpp
+++ b/dom/bluetooth2/BluetoothReplyRunnable.cpp
@@ -29,40 +29,43 @@ BluetoothReplyRunnable::ReleaseMembers()
 }
 
 BluetoothReplyRunnable::~BluetoothReplyRunnable()
 {}
 
 nsresult
 BluetoothReplyRunnable::FireReply(JS::Handle<JS::Value> aVal)
 {
+  NS_ENSURE_TRUE(mDOMRequest, NS_OK);
+
   nsCOMPtr<nsIDOMRequestService> rs =
     do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
   NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
 
   return mReply->type() == BluetoothReply::TBluetoothReplySuccess ?
     rs->FireSuccessAsync(mDOMRequest, aVal) :
     rs->FireErrorAsync(mDOMRequest, mReply->get_BluetoothReplyError().error());
 }
 
 nsresult
 BluetoothReplyRunnable::FireErrorString()
 {
+  NS_ENSURE_TRUE(mDOMRequest, NS_OK);
+
   nsCOMPtr<nsIDOMRequestService> rs =
     do_GetService("@mozilla.org/dom/dom-request-service;1");
   NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
 
   return rs->FireErrorAsync(mDOMRequest, mErrorString);
 }
 
 NS_IMETHODIMP
 BluetoothReplyRunnable::Run()
 {
   MOZ_ASSERT(NS_IsMainThread());
-  MOZ_ASSERT(mDOMRequest);
   MOZ_ASSERT(mReply);
 
   nsresult rv;
 
   AutoSafeJSContext cx;
   JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
 
   if (mReply->type() != BluetoothReply::TBluetoothReplySuccess) {
--- a/dom/bluetooth2/BluetoothReplyRunnable.h
+++ b/dom/bluetooth2/BluetoothReplyRunnable.h
@@ -43,16 +43,20 @@ protected:
   // header. We assume we'll only be running this once and it should die on
   // scope out of Run() anyways.
   nsAutoPtr<BluetoothReply> mReply;
 
 private:
   nsresult FireReply(JS::Handle<JS::Value> aVal);
   nsresult FireErrorString();
 
+  /**
+   * mDOMRequest is nullptr for internal IPC that require no DOMRequest,
+   * e.g., GetAdaptersTask triggered by BluetoothManager
+   */
   nsCOMPtr<nsIDOMDOMRequest> mDOMRequest;
   nsString mErrorString;
 };
 
 class BluetoothVoidReplyRunnable : public BluetoothReplyRunnable
 {
 public:
   BluetoothVoidReplyRunnable(nsIDOMDOMRequest* aReq);
--- a/dom/bluetooth2/BluetoothService.cpp
+++ b/dom/bluetooth2/BluetoothService.cpp
@@ -370,21 +370,18 @@ BluetoothService::DistributeSignal(const
     return;
   } else if (aSignal.path().EqualsLiteral(KEY_REMOTE_AGENT)) {
     Notify(aSignal);
     return;
   }
 
   BluetoothSignalObserverList* ol;
   if (!mBluetoothSignalObserverTable.Get(aSignal.path(), &ol)) {
-#if DEBUG
-    nsAutoCString msg("No observer registered for path ");
-    msg.Append(NS_ConvertUTF16toUTF8(aSignal.path()));
-    BT_WARNING(msg.get());
-#endif
+    BT_WARNING("No observer registered for path %s",
+               NS_ConvertUTF16toUTF8(aSignal.path()).get());
     return;
   }
   MOZ_ASSERT(ol->Length());
   ol->Broadcast(aSignal);
 }
 
 nsresult
 BluetoothService::StartBluetooth(bool aIsStartup)
--- a/dom/bluetooth2/BluetoothService.h
+++ b/dom/bluetooth2/BluetoothService.h
@@ -118,23 +118,23 @@ public:
   static already_AddRefed<BluetoothService>
   FactoryCreate()
   {
     nsRefPtr<BluetoothService> service = Get();
     return service.forget();
   }
 
   /**
-   * Returns the path of the default adapter, implemented via a platform
+   * Returns an array of each adapter's properties, implemented via a platform
    * specific method.
    *
    * @return NS_OK on success, NS_ERROR_FAILURE otherwise
    */
   virtual nsresult
-  GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) = 0;
+  GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Returns the properties of paired devices, implemented via a platform
    * specific method.
    *
    * @return NS_OK on success, NS_ERROR_FAILURE otherwise
    */
   virtual nsresult
--- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.cpp
@@ -803,40 +803,55 @@ BluetoothServiceBluedroid::StopInternal(
     }
     BT_LOGR("Error");
   }
 
   return ret;
 }
 
 nsresult
-BluetoothServiceBluedroid::GetDefaultAdapterPathInternal(
+BluetoothServiceBluedroid::GetAdaptersInternal(
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  BluetoothValue v = InfallibleTArray<BluetoothNamedValue>();
+  /**
+   * Wrap BluetoothValue =
+   *   BluetoothNamedValue[]
+   *     |
+   *     |__ BluetoothNamedValue =
+   *     |     {"Adapter", BluetoothValue = BluetoothNamedValue[]}
+   *     |
+   *     |__ BluetoothNamedValue =
+   *     |     {"Adapter", BluetoothValue = BluetoothNamedValue[]}
+   *     ...
+   */
+  BluetoothValue adaptersProperties = InfallibleTArray<BluetoothNamedValue>();
+  uint32_t numAdapters = 1; // Bluedroid supports single adapter only
 
-  BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
-                        "Address", sAdapterBdAddress);
-
-  BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
-                        "Name", sAdapterBdName);
+  for (uint32_t i = 0; i < numAdapters; i++) {
+    BluetoothValue properties = InfallibleTArray<BluetoothNamedValue>();
 
-  BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
-                        "Discoverable", sAdapterDiscoverable);
-
-  BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
-                        "DiscoverableTimeout", sAdapterDiscoverableTimeout);
+    // TODO: Revise here based on new BluetoothAdapter interface
+    BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
+                          "Address", sAdapterBdAddress);
+    BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
+                          "Name", sAdapterBdName);
+    BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
+                          "Discoverable", sAdapterDiscoverable);
+    BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
+                          "DiscoverableTimeout", sAdapterDiscoverableTimeout);
+    BT_APPEND_NAMED_VALUE(properties.get_ArrayOfBluetoothNamedValue(),
+                          "Devices", sAdapterBondedAddressArray);
 
-  BT_APPEND_NAMED_VALUE(v.get_ArrayOfBluetoothNamedValue(),
-                        "Devices", sAdapterBondedAddressArray);
+    BT_APPEND_NAMED_VALUE(adaptersProperties.get_ArrayOfBluetoothNamedValue(),
+                          "Adapter", properties);
+  }
 
-  DispatchBluetoothReply(aRunnable, v, EmptyString());
-
+  DispatchBluetoothReply(aRunnable, adaptersProperties, EmptyString());
   return NS_OK;
 }
 
 nsresult
 BluetoothServiceBluedroid::GetConnectedDevicePropertiesInternal(
   uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
--- a/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.h
+++ b/dom/bluetooth2/bluedroid/BluetoothServiceBluedroid.h
@@ -20,25 +20,26 @@ public:
   static const bt_interface_t* GetBluetoothInterface();
 
   BluetoothServiceBluedroid();
   ~BluetoothServiceBluedroid();
 
   virtual nsresult StartInternal();
   virtual nsresult StopInternal();
 
-  virtual nsresult GetDefaultAdapterPathInternal(
-                                             BluetoothReplyRunnable* aRunnable);
+  virtual nsresult
+  GetAdaptersInternal(BluetoothReplyRunnable* aRunnable);
 
-  virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aProfileId,
-                                             BluetoothReplyRunnable* aRunnable);
+  virtual nsresult
+  GetConnectedDevicePropertiesInternal(uint16_t aProfileId,
+                                       BluetoothReplyRunnable* aRunnable);
 
-  virtual nsresult GetPairedDevicePropertiesInternal(
-                                     const nsTArray<nsString>& aDeviceAddress,
-                                     BluetoothReplyRunnable* aRunnable);
+  virtual nsresult
+  GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddress,
+                                    BluetoothReplyRunnable* aRunnable);
 
   virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
   virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable);
 
   virtual nsresult
   SetProperty(BluetoothObjectType aType,
               const BluetoothNamedValue& aValue,
               BluetoothReplyRunnable* aRunnable);
--- a/dom/bluetooth2/bluez/BluetoothDBusService.cpp
+++ b/dom/bluetooth2/bluez/BluetoothDBusService.cpp
@@ -2371,21 +2371,24 @@ public:
     unused << handler.forget(); // picked up by callback handler
   }
 
 private:
   nsRefPtr<BluetoothReplyRunnable> mRunnable;
 };
 
 nsresult
-BluetoothDBusService::GetDefaultAdapterPathInternal(
-                                              BluetoothReplyRunnable* aRunnable)
+BluetoothDBusService::GetAdaptersInternal(BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
+  /**
+   * TODO: implement method GetAdaptersInternal for bluez
+   */
+
   if (!IsReady()) {
     NS_NAMED_LITERAL_STRING(errorStr, "Bluetooth service is not ready yet!");
     DispatchBluetoothReply(aRunnable, BluetoothValue(), errorStr);
     return NS_OK;
   }
 
   Task* task = new DefaultAdapterTask(aRunnable);
   DispatchToDBusThread(task);
--- a/dom/bluetooth2/bluez/BluetoothDBusService.h
+++ b/dom/bluetooth2/bluez/BluetoothDBusService.h
@@ -46,25 +46,26 @@ public:
   ~BluetoothDBusService();
 
   bool IsReady();
 
   virtual nsresult StartInternal() MOZ_OVERRIDE;
 
   virtual nsresult StopInternal() MOZ_OVERRIDE;
 
-  virtual nsresult GetDefaultAdapterPathInternal(
-                                             BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+  virtual nsresult
+  GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
-  virtual nsresult GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
-                                             BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+  virtual nsresult
+  GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
+                                       BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
-  virtual nsresult GetPairedDevicePropertiesInternal(
-                                     const nsTArray<nsString>& aDeviceAddresses,
-                                     BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+  virtual nsresult
+  GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
+                                    BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual nsresult StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual nsresult StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual nsresult
   SetProperty(BluetoothObjectType aType,
               const BluetoothNamedValue& aValue,
--- a/dom/bluetooth2/ipc/BluetoothParent.cpp
+++ b/dom/bluetooth2/ipc/BluetoothParent.cpp
@@ -178,18 +178,18 @@ BluetoothParent::RecvPBluetoothRequestCo
 {
   BluetoothRequestParent* actor = static_cast<BluetoothRequestParent*>(aActor);
 
 #ifdef DEBUG
   actor->mRequestType = aRequest.type();
 #endif
 
   switch (aRequest.type()) {
-    case Request::TDefaultAdapterPathRequest:
-      return actor->DoRequest(aRequest.get_DefaultAdapterPathRequest());
+    case Request::TGetAdaptersRequest:
+      return actor->DoRequest(aRequest.get_GetAdaptersRequest());
     case Request::TSetPropertyRequest:
       return actor->DoRequest(aRequest.get_SetPropertyRequest());
     case Request::TStartDiscoveryRequest:
       return actor->DoRequest(aRequest.get_StartDiscoveryRequest());
     case Request::TStopDiscoveryRequest:
       return actor->DoRequest(aRequest.get_StopDiscoveryRequest());
     case Request::TPairRequest:
       return actor->DoRequest(aRequest.get_PairRequest());
@@ -298,22 +298,22 @@ BluetoothRequestParent::RequestComplete(
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mReplyRunnable.IsPending());
 
   mReplyRunnable.Forget();
 }
 
 bool
-BluetoothRequestParent::DoRequest(const DefaultAdapterPathRequest& aRequest)
+BluetoothRequestParent::DoRequest(const GetAdaptersRequest& aRequest)
 {
   MOZ_ASSERT(mService);
-  MOZ_ASSERT(mRequestType == Request::TDefaultAdapterPathRequest);
+  MOZ_ASSERT(mRequestType == Request::TGetAdaptersRequest);
 
-  nsresult rv = mService->GetDefaultAdapterPathInternal(mReplyRunnable.get());
+  nsresult rv = mService->GetAdaptersInternal(mReplyRunnable.get());
   NS_ENSURE_SUCCESS(rv, false);
 
   return true;
 }
 
 bool
 BluetoothRequestParent::DoRequest(const SetPropertyRequest& aRequest)
 {
--- a/dom/bluetooth2/ipc/BluetoothParent.h
+++ b/dom/bluetooth2/ipc/BluetoothParent.h
@@ -121,17 +121,17 @@ protected:
 
   virtual void
   ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
 
   void
   RequestComplete();
 
   bool
-  DoRequest(const DefaultAdapterPathRequest& aRequest);
+  DoRequest(const GetAdaptersRequest& aRequest);
 
   bool
   DoRequest(const SetPropertyRequest& aRequest);
 
   bool
   DoRequest(const GetPropertyRequest& aRequest);
 
   bool
--- a/dom/bluetooth2/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth2/ipc/BluetoothServiceChildProcess.cpp
@@ -91,20 +91,20 @@ BluetoothServiceChildProcess::Unregister
 {
   BluetoothService::UnregisterBluetoothSignalHandler(aNodeName, aHandler);
   if (sBluetoothChild && !IsSignalRegistered(aNodeName)) {
     sBluetoothChild->SendUnregisterSignalHandler(nsString(aNodeName));
   }
 }
 
 nsresult
-BluetoothServiceChildProcess::GetDefaultAdapterPathInternal(
+BluetoothServiceChildProcess::GetAdaptersInternal(
                                               BluetoothReplyRunnable* aRunnable)
 {
-  SendRequest(aRunnable, DefaultAdapterPathRequest());
+  SendRequest(aRunnable, GetAdaptersRequest());
   return NS_OK;
 }
 
 nsresult
 BluetoothServiceChildProcess::GetConnectedDevicePropertiesInternal(
                                               uint16_t aServiceUuid,
                                               BluetoothReplyRunnable* aRunnable)
 {
--- a/dom/bluetooth2/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth2/ipc/BluetoothServiceChildProcess.h
@@ -39,17 +39,17 @@ public:
                                  MOZ_OVERRIDE;
 
   virtual void
   UnregisterBluetoothSignalHandler(const nsAString& aNodeName,
                                    BluetoothSignalObserver* aMsgHandler)
                                    MOZ_OVERRIDE;
 
   virtual nsresult
-  GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
+  GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE;
 
   virtual nsresult
   GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
                                     BluetoothReplyRunnable* aRunnable)
                                     MOZ_OVERRIDE;
 
   virtual nsresult
   GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
--- a/dom/bluetooth2/ipc/PBluetooth.ipdl
+++ b/dom/bluetooth2/ipc/PBluetooth.ipdl
@@ -17,17 +17,17 @@ using mozilla::dom::bluetooth::Bluetooth
 namespace mozilla {
 namespace dom {
 namespace bluetooth {
 
 /**
  * Bluetooth request types.
  */
 
-struct DefaultAdapterPathRequest
+struct GetAdaptersRequest
 { };
 
 struct SetPropertyRequest
 {
   BluetoothObjectType type;
   BluetoothNamedValue value;
 };
 
@@ -160,17 +160,17 @@ struct SendPlayStatusRequest
 {
   int64_t duration;
   int64_t position;
   nsString playStatus;
 };
 
 union Request
 {
-  DefaultAdapterPathRequest;
+  GetAdaptersRequest;
   SetPropertyRequest;
   GetPropertyRequest;
   StartDiscoveryRequest;
   StopDiscoveryRequest;
   PairRequest;
   UnpairRequest;
   SetPinCodeRequest;
   SetPasskeyRequest;