Bug 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothAddress|, r=joliu
authorThomas Zimmermann <tdz@users.sourceforge.net>
Fri, 13 Nov 2015 15:26:50 +0100
changeset 272649 066863ca1c7b0c01b09a8181196aae09d7d202da
parent 272648 f714df21800062ce4d1da1412f5c8ebe3ea6c079
child 272650 258e6b8d89505a58e6ebb43a17a0318de938d17a
push id29681
push userkwierso@gmail.com
push dateMon, 16 Nov 2015 23:39:08 +0000
treeherdermozilla-central@ffe020f91452 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoliu
bugs1220121
milestone45.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 1220121: Convert IPDL of Bluetooth GATT API to |BluetoothAddress|, r=joliu
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
dom/bluetooth/bluez/BluetoothDBusService.cpp
dom/bluetooth/bluez/BluetoothDBusService.h
dom/bluetooth/common/BluetoothService.h
dom/bluetooth/common/webapi/BluetoothGatt.cpp
dom/bluetooth/common/webapi/BluetoothGattServer.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
dom/bluetooth/ipc/BluetoothServiceChildProcess.h
dom/bluetooth/ipc/PBluetooth.ipdl
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.cpp
@@ -358,60 +358,48 @@ BluetoothServiceBluedroid::StopLeScanInt
   BluetoothUuid scanUuid;
   StringToUuid(aScanUuid, scanUuid);
 
   gatt->StopLeScan(scanUuid, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress deviceAddress;
-  if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
-  gatt->Connect(appUuid, deviceAddress, aRunnable);
+  gatt->Connect(appUuid, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress deviceAddress;
-  if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
-  gatt->Disconnect(appUuid, deviceAddress, aRunnable);
+  gatt->Disconnect(appUuid, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::DiscoverGattServicesInternal(
   const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -473,33 +461,27 @@ BluetoothServiceBluedroid::UnregisterGat
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   gatt->UnregisterClient(aClientIf, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientReadRemoteRssiInternal(
-  int aClientIf, const nsAString& aDeviceAddress,
+  int aClientIf, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
-  BluetoothAddress deviceAddress;
-  if (NS_FAILED(StringToAddress(aDeviceAddress, deviceAddress))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
-  gatt->ReadRemoteRssi(aClientIf, deviceAddress, aRunnable);
+  gatt->ReadRemoteRssi(aClientIf, aDeviceAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattClientReadCharacteristicValueInternal(
   const nsAString& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   BluetoothReplyRunnable* aRunnable)
@@ -584,60 +566,48 @@ BluetoothServiceBluedroid::GattClientWri
 
   gatt->WriteDescriptorValue(appUuid, aServiceId, aCharacteristicId,
                              aDescriptorId, aValue, aRunnable);
 }
 
 // GATT Server
 void
 BluetoothServiceBluedroid::GattServerConnectPeripheralInternal(
-  const nsAString& aAppUuid, const nsAString& aAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress address;
-  if (NS_FAILED(StringToAddress(aAddress, address))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
-  gatt->ConnectPeripheral(appUuid, address, aRunnable);
+  gatt->ConnectPeripheral(appUuid, aAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerDisconnectPeripheralInternal(
-  const nsAString& aAppUuid, const nsAString& aAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress address;
-  if (NS_FAILED(StringToAddress(aAddress, address))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
-  gatt->DisconnectPeripheral(appUuid, address, aRunnable);
+  gatt->DisconnectPeripheral(appUuid, aAddress, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
@@ -801,69 +771,57 @@ BluetoothServiceBluedroid::GattServerSto
   StringToUuid(aAppUuid, appUuid);
 
   gatt->ServerStopService(appUuid, aServiceHandle, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerSendResponseInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress address;
-  if (NS_FAILED(StringToAddress(aAddress, address))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
   gatt->ServerSendResponse(
-    appUuid, address, aStatus, aRequestId, aRsp, aRunnable);
+    appUuid, aAddress, aStatus, aRequestId, aRsp, aRunnable);
 }
 
 void
 BluetoothServiceBluedroid::GattServerSendIndicationInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   ENSURE_BLUETOOTH_IS_READY_VOID(aRunnable);
 
   BluetoothGattManager* gatt = BluetoothGattManager::Get();
   ENSURE_GATT_MGR_IS_READY_VOID(gatt, aRunnable);
 
   BluetoothUuid appUuid;
   StringToUuid(aAppUuid, appUuid);
 
-  BluetoothAddress address;
-  if (NS_FAILED(StringToAddress(aAddress, address))) {
-    DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
-    return;
-  }
-
   gatt->ServerSendIndication(appUuid,
-                             address,
+                             aAddress,
                              aCharacteristicHandle,
                              aConfirm,
                              aValue,
                              aRunnable);
 }
 
 nsresult
 BluetoothServiceBluedroid::GetAdaptersInternal(
--- a/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
+++ b/dom/bluetooth/bluedroid/BluetoothServiceBluedroid.h
@@ -278,22 +278,22 @@ public:
   virtual void StartLeScanInternal(const nsTArray<nsString>& aServiceUuids,
                                    BluetoothReplyRunnable* aRunnable);
 
   virtual void StopLeScanInternal(const nsAString& aScanUuid,
                                   BluetoothReplyRunnable* aRunnable);
 
   virtual void
   ConnectGattClientInternal(const nsAString& aAppUuid,
-                            const nsAString& aDeviceAddress,
+                            const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DisconnectGattClientInternal(const nsAString& aAppUuid,
-                               const nsAString& aDeviceAddress,
+                               const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DiscoverGattServicesInternal(const nsAString& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
@@ -310,17 +310,17 @@ public:
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(
-    int aClientIf, const nsAString& aDeviceAddress,
+    int aClientIf, const BluetoothAddress& aDeviceAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
     const nsAString& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
@@ -349,23 +349,23 @@ public:
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
@@ -415,26 +415,26 @@ public:
   GattServerStopServiceInternal(
     const nsAString& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   //
   // Bluetooth notifications
   //
--- a/dom/bluetooth/bluez/BluetoothDBusService.cpp
+++ b/dom/bluetooth/bluez/BluetoothDBusService.cpp
@@ -4304,24 +4304,24 @@ void
 BluetoothDBusService::StopLeScanInternal(
   const nsAString& aAppUuid,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::DiscoverGattServicesInternal(
   const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
@@ -4344,17 +4344,17 @@ BluetoothDBusService::GattClientStopNoti
 void
 BluetoothDBusService::UnregisterGattClientInternal(
   int aClientIf, BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientReadRemoteRssiInternal(
-  int aClientIf, const nsAString& aDeviceAddress,
+  int aClientIf, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattClientReadCharacteristicValueInternal(
   const nsAString& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
@@ -4516,24 +4516,24 @@ BluetoothDBusService::ReplyToMapSendMess
 void
 BluetoothDBusService::ReplyToMapMessageUpdate(long aMasId, bool aStatus,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerConnectPeripheralInternal(
-  const nsAString& aAppUuid, const nsAString& aAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerDisconnectPeripheralInternal(
-  const nsAString& aAppUuid, const nsAString& aAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
@@ -4601,26 +4601,26 @@ BluetoothDBusService::GattServerStopServ
   const BluetoothAttributeHandle& aServiceHandle,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerSendIndicationInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
 }
 
 void
 BluetoothDBusService::GattServerSendResponseInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
 }
--- a/dom/bluetooth/bluez/BluetoothDBusService.h
+++ b/dom/bluetooth/bluez/BluetoothDBusService.h
@@ -289,22 +289,22 @@ public:
                       BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   StopLeScanInternal(const nsAString& aAppUuid,
                      BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   ConnectGattClientInternal(const nsAString& aAppUuid,
-                            const nsAString& aDeviceAddress,
+                            const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DisconnectGattClientInternal(const nsAString& aAppUuid,
-                               const nsAString& aDeviceAddress,
+                               const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DiscoverGattServicesInternal(const nsAString& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
@@ -321,17 +321,17 @@ public:
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(
-    int aClientIf, const nsAString& aDeviceAddress,
+    int aClientIf, const BluetoothAddress& aDeviceAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
     const nsAString& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
@@ -360,23 +360,23 @@ public:
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
@@ -426,26 +426,26 @@ public:
   GattServerStopServiceInternal(
     const nsAString& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
 private:
   nsresult SendGetPropertyMessage(const nsAString& aPath,
                                   const char* aInterface,
--- a/dom/bluetooth/common/BluetoothService.h
+++ b/dom/bluetooth/common/BluetoothService.h
@@ -437,26 +437,26 @@ public:
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) = 0;
 
   /**
    * Connect to a remote GATT server. (platform specific implementation)
    */
   virtual void
   ConnectGattClientInternal(const nsAString& aAppUuid,
-                            const nsAString& aDeviceAddress,
+                            const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Disconnect GATT client from a remote GATT server.
    * (platform specific implementation)
    */
   virtual void
   DisconnectGattClientInternal(const nsAString& aAppUuid,
-                               const nsAString& aDeviceAddress,
+                               const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Discover GATT services, characteristic, descriptors from a remote GATT
    * server. (platform specific implementation)
    */
   virtual void
   DiscoverGattServicesInternal(const nsAString& aAppUuid,
@@ -489,17 +489,17 @@ public:
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Request RSSI for a remote GATT server. (platform specific implementation)
    */
   virtual void
   GattClientReadRemoteRssiInternal(int aClientIf,
-                                   const nsAString& aDeviceAddress,
+                                   const BluetoothAddress& aDeviceAddress,
                                    BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Read the value of a characteristic on a GATT client.
    * (platform specific implementation)
    */
   virtual void
   GattClientReadCharacteristicValueInternal(
@@ -544,23 +544,23 @@ public:
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerConnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   /**
    * Unregister a GATT server. (platform specific implementation)
    */
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) = 0;
@@ -613,26 +613,26 @@ public:
   GattServerStopServiceInternal(
     const nsAString& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerSendResponseInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   virtual void
   GattServerSendIndicationInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) = 0;
 
   bool
   IsEnabled() const
   {
--- a/dom/bluetooth/common/webapi/BluetoothGatt.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGatt.cpp
@@ -107,27 +107,33 @@ BluetoothGatt::Connect(ErrorResult& aRv)
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Disconnected,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothAddress deviceAddr;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
+    promise,
+    NS_ERROR_DOM_OPERATION_ERR);
+
   if (mAppUuid.IsEmpty()) {
     nsresult rv = GenerateUuid(mAppUuid);
     BT_ENSURE_TRUE_REJECT(NS_SUCCEEDED(rv) && !mAppUuid.IsEmpty(),
                           promise,
                           NS_ERROR_DOM_OPERATION_ERR);
     RegisterBluetoothSignalHandler(mAppUuid, this);
   }
 
   UpdateConnectionState(BluetoothConnectionState::Connecting);
   bs->ConnectGattClientInternal(
-    mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
+    mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGatt::Disconnect(ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
@@ -142,19 +148,25 @@ BluetoothGatt::Disconnect(ErrorResult& a
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Connected,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothAddress deviceAddr;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
+    promise,
+    NS_ERROR_DOM_OPERATION_ERR);
+
   UpdateConnectionState(BluetoothConnectionState::Disconnecting);
   bs->DisconnectGattClientInternal(
-    mAppUuid, mDeviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
+    mAppUuid, deviceAddr, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 class ReadRemoteRssiTask final : public BluetoothReplyRunnable
 {
 public:
   ReadRemoteRssiTask(Promise* aPromise)
@@ -191,18 +203,24 @@ BluetoothGatt::ReadRemoteRssi(ErrorResul
   BT_ENSURE_TRUE_REJECT(
     mConnectionState == BluetoothConnectionState::Connected,
     promise,
     NS_ERROR_DOM_INVALID_STATE_ERR);
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothAddress deviceAddr;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(mDeviceAddr, deviceAddr)),
+    promise,
+    NS_ERROR_DOM_OPERATION_ERR);
+
   bs->GattClientReadRemoteRssiInternal(
-    mClientIf, mDeviceAddr, new ReadRemoteRssiTask(promise));
+    mClientIf, deviceAddr, new ReadRemoteRssiTask(promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGatt::DiscoverServices(ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
--- a/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
+++ b/dom/bluetooth/common/webapi/BluetoothGattServer.cpp
@@ -314,44 +314,56 @@ BluetoothGattServer::Connect(const nsASt
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothAddress address;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(aAddress, address)),
+    promise,
+    NS_ERROR_INVALID_ARG);
+
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerConnectPeripheralInternal(
-    mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
+    mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::Disconnect(const nsAString& aAddress, ErrorResult& aRv)
 {
   nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetParentObject());
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothAddress address;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(aAddress, address)),
+    promise,
+    NS_ERROR_INVALID_ARG);
+
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerDisconnectPeripheralInternal(
-    mAppUuid, aAddress, new BluetoothVoidReplyRunnable(nullptr, promise));
+    mAppUuid, address, new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 class BluetoothGattServer::AddIncludedServiceTask final
   : public BluetoothReplyTaskQueue::SubTask
 {
 public:
@@ -793,27 +805,33 @@ BluetoothGattServer::NotifyCharacteristi
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
 
+  BluetoothAddress address;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(aAddress, address)),
+    promise,
+    NS_ERROR_INVALID_ARG);
+
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   RefPtr<BluetoothGattService> service = aCharacteristic.Service();
   BT_ENSURE_TRUE_REJECT(service, promise, NS_ERROR_NOT_AVAILABLE);
   BT_ENSURE_TRUE_REJECT(mServices.Contains(service),
                         promise,
                         NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerSendIndicationInternal(
-    mAppUuid, aAddress, aCharacteristic.GetCharacteristicHandle(), aConfirm,
+    mAppUuid, address, aCharacteristic.GetCharacteristicHandle(), aConfirm,
     aCharacteristic.GetValue(),
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
 
 already_AddRefed<Promise>
 BluetoothGattServer::SendResponse(const nsAString& aAddress,
@@ -825,16 +843,22 @@ BluetoothGattServer::SendResponse(const 
   if (!global) {
     aRv.Throw(NS_ERROR_FAILURE);
     return nullptr;
   }
 
   RefPtr<Promise> promise = Promise::Create(global, aRv);
   NS_ENSURE_TRUE(!aRv.Failed(), nullptr);
 
+  BluetoothAddress address;
+  BT_ENSURE_TRUE_REJECT(
+    NS_SUCCEEDED(StringToAddress(aAddress, address)),
+    promise,
+    NS_ERROR_INVALID_ARG);
+
   BT_ENSURE_TRUE_REJECT(mValid, promise, NS_ERROR_NOT_AVAILABLE);
 
   RequestData* requestData;
   mRequestMap.Get(aRequestId, &requestData);
   BT_ENSURE_TRUE_REJECT(requestData, promise, NS_ERROR_UNEXPECTED);
 
   BluetoothGattResponse response;
   memset(&response, 0, sizeof(response));
@@ -857,16 +881,16 @@ BluetoothGattServer::SendResponse(const 
     return promise.forget();
   }
 
   BluetoothService* bs = BluetoothService::Get();
   BT_ENSURE_TRUE_REJECT(bs, promise, NS_ERROR_NOT_AVAILABLE);
 
   bs->GattServerSendResponseInternal(
     mAppUuid,
-    aAddress,
+    address,
     aStatus,
     aRequestId,
     response,
     new BluetoothVoidReplyRunnable(nullptr, promise));
 
   return promise.forget();
 }
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.cpp
@@ -545,30 +545,30 @@ BluetoothServiceChildProcess::SendPlaySt
                                              BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
               SendPlayStatusRequest(aDuration, aPosition, aPlayStatus));
 }
 
 void
 BluetoothServiceChildProcess::ConnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, ConnectGattClientRequest(nsString(aAppUuid),
-                                                  nsString(aDeviceAddress)));
+                                                  aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::DisconnectGattClientInternal(
-  const nsAString& aAppUuid, const nsAString& aDeviceAddress,
+  const nsAString& aAppUuid, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    DisconnectGattClientRequest(nsString(aAppUuid), nsString(aDeviceAddress)));
+    DisconnectGattClientRequest(nsString(aAppUuid), aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::DiscoverGattServicesInternal(
   const nsAString& aAppUuid, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
     DiscoverGattServicesRequest(nsString(aAppUuid)));
@@ -596,22 +596,21 @@ void
 BluetoothServiceChildProcess::UnregisterGattClientInternal(
   int aClientIf, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, UnregisterGattClientRequest(aClientIf));
 }
 
 void
 BluetoothServiceChildProcess::GattClientReadRemoteRssiInternal(
-  int aClientIf, const nsAString& aDeviceAddress,
+  int aClientIf, const BluetoothAddress& aDeviceAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-              GattClientReadRemoteRssiRequest(aClientIf,
-                                              nsString(aDeviceAddress)));
+              GattClientReadRemoteRssiRequest(aClientIf, aDeviceAddress));
 }
 
 void
 BluetoothServiceChildProcess::GattClientReadCharacteristicValueInternal(
   const nsAString& aAppUuid,
   const BluetoothGattServiceId& aServiceId,
   const BluetoothGattId& aCharacteristicId,
   BluetoothReplyRunnable* aRunnable)
@@ -669,33 +668,31 @@ BluetoothServiceChildProcess::GattClient
                                           aCharacteristicId,
                                           aDescriptorId,
                                           aValue));
 }
 
 void
 BluetoothServiceChildProcess::GattServerConnectPeripheralInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerConnectPeripheralRequest(nsString(aAppUuid),
-                                       nsString(aAddress)));
+    GattServerConnectPeripheralRequest(nsString(aAppUuid), aAddress));
 }
 
 void
 BluetoothServiceChildProcess::GattServerDisconnectPeripheralInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
-    GattServerDisconnectPeripheralRequest(nsString(aAppUuid),
-                                          nsString(aAddress)));
+    GattServerDisconnectPeripheralRequest(nsString(aAppUuid), aAddress));
 }
 
 void
 BluetoothServiceChildProcess::UnregisterGattServerInternal(
   int aServerIf, BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable, UnregisterGattServerRequest(aServerIf));
 }
@@ -786,39 +783,39 @@ BluetoothServiceChildProcess::GattServer
 {
   SendRequest(aRunnable,
     GattServerStopServiceRequest(nsString(aAppUuid), aServiceHandle));
 }
 
 void
 BluetoothServiceChildProcess::GattServerSendResponseInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   uint16_t aStatus,
   int32_t aRequestId,
   const BluetoothGattResponse& aRsp,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
     GattServerSendResponseRequest(
-      nsString(aAppUuid), nsString(aAddress), aStatus, aRequestId, aRsp));
+      nsString(aAppUuid), aAddress, aStatus, aRequestId, aRsp));
 }
 
 void
 BluetoothServiceChildProcess::GattServerSendIndicationInternal(
   const nsAString& aAppUuid,
-  const nsAString& aAddress,
+  const BluetoothAddress& aAddress,
   const BluetoothAttributeHandle& aCharacteristicHandle,
   bool aConfirm,
   const nsTArray<uint8_t>& aValue,
   BluetoothReplyRunnable* aRunnable)
 {
   SendRequest(aRunnable,
     GattServerSendIndicationRequest(nsString(aAppUuid),
-                                    nsString(aAddress),
+                                    aAddress,
                                     aCharacteristicHandle,
                                     aConfirm,
                                     aValue));
 }
 
 nsresult
 BluetoothServiceChildProcess::HandleStartup()
 {
--- a/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
+++ b/dom/bluetooth/ipc/BluetoothServiceChildProcess.h
@@ -280,22 +280,22 @@ public:
                   const nsAString& aMessage) override;
 
   virtual nsresult
   SendInputMessage(const nsAString& aDeviceAddresses,
                    const nsAString& aMessage) override;
 
   virtual void
   ConnectGattClientInternal(const nsAString& aAppUuid,
-                            const nsAString& aDeviceAddress,
+                            const BluetoothAddress& aDeviceAddress,
                             BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DisconnectGattClientInternal(const nsAString& aAppUuid,
-                               const nsAString& aDeviceAddress,
+                               const BluetoothAddress& aDeviceAddress,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   DiscoverGattServicesInternal(const nsAString& aAppUuid,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientStartNotificationsInternal(
@@ -312,17 +312,17 @@ public:
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattClientInternal(int aClientIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadRemoteRssiInternal(int aClientIf,
-                                   const nsAString& aDeviceAddress,
+                                   const BluetoothAddress& aDeviceAddress,
                                    BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattClientReadCharacteristicValueInternal(
     const nsAString& aAppUuid,
     const BluetoothGattServiceId& aServiceId,
     const BluetoothGattId& aCharacteristicId,
     BluetoothReplyRunnable* aRunnable) override;
@@ -351,23 +351,23 @@ public:
     const BluetoothGattId& aCharacteristicId,
     const BluetoothGattId& aDescriptorId,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerConnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerDisconnectPeripheralInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   UnregisterGattServerInternal(int aServerIf,
                                BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerAddServiceInternal(
@@ -417,26 +417,26 @@ public:
   GattServerStopServiceInternal(
     const nsAString& aAppUuid,
     const BluetoothAttributeHandle& aServiceHandle,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendResponseInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     uint16_t aStatus,
     int32_t aRequestId,
     const BluetoothGattResponse& aRsp,
     BluetoothReplyRunnable* aRunnable) override;
 
   virtual void
   GattServerSendIndicationInternal(
     const nsAString& aAppUuid,
-    const nsAString& aAddress,
+    const BluetoothAddress& aAddress,
     const BluetoothAttributeHandle& aCharacteristicHandle,
     bool aConfirm,
     const nsTArray<uint8_t>& aValue,
     BluetoothReplyRunnable* aRunnable) override;
 
 protected:
   BluetoothServiceChildProcess();
   virtual ~BluetoothServiceChildProcess();
--- a/dom/bluetooth/ipc/PBluetooth.ipdl
+++ b/dom/bluetooth/ipc/PBluetooth.ipdl
@@ -271,23 +271,23 @@ struct SendPlayStatusRequest
   int64_t duration;
   int64_t position;
   ControlPlayStatus playStatus;
 };
 
 struct ConnectGattClientRequest
 {
   nsString appUuid;
-  nsString deviceAddress;
+  BluetoothAddress deviceAddress;
 };
 
 struct DisconnectGattClientRequest
 {
   nsString appUuid;
-  nsString deviceAddress;
+  BluetoothAddress deviceAddress;
 };
 
 struct DiscoverGattServicesRequest
 {
   nsString appUuid;
 };
 
 struct GattClientStartNotificationsRequest
@@ -307,17 +307,17 @@ struct GattClientStopNotificationsReques
 struct UnregisterGattClientRequest
 {
   int clientIf;
 };
 
 struct GattClientReadRemoteRssiRequest
 {
   int clientIf;
-  nsString deviceAddress;
+  BluetoothAddress deviceAddress;
 };
 
 struct GattClientReadCharacteristicValueRequest
 {
   nsString appUuid;
   BluetoothGattServiceId serviceId;
   BluetoothGattId charId;
 };
@@ -346,23 +346,23 @@ struct GattClientWriteDescriptorValueReq
   BluetoothGattId charId;
   BluetoothGattId descId;
   uint8_t[] value;
 };
 
 struct GattServerConnectPeripheralRequest
 {
   nsString appUuid;
-  nsString address;
+  BluetoothAddress address;
 };
 
 struct GattServerDisconnectPeripheralRequest
 {
   nsString appUuid;
-  nsString address;
+  BluetoothAddress address;
 };
 
 struct UnregisterGattServerRequest
 {
   int serverIf;
 };
 
 struct GattServerAddServiceRequest
@@ -413,26 +413,26 @@ struct GattServerStopServiceRequest
 {
   nsString appUuid;
   BluetoothAttributeHandle serviceHandle;
 };
 
 struct GattServerSendResponseRequest
 {
   nsString appUuid;
-  nsString address;
+  BluetoothAddress address;
   uint16_t status;
   int32_t requestId;
   BluetoothGattResponse response;
 };
 
 struct GattServerSendIndicationRequest
 {
   nsString appUuid;
-  nsString address;
+  BluetoothAddress address;
   BluetoothAttributeHandle characteristicHandle;
   bool confirm;
   uint8_t[] value;
 };
 
 union Request
 {
   GetAdaptersRequest;