Bug 1205253: Use enum constants for Bluetooth Core module, r=btian
authorThomas Zimmermann <tdz@users.sourceforge.net>
Thu, 17 Sep 2015 10:08:47 +0200
changeset 295697 5ef884a2b02234c54e64e3f2a1427b067dcdc732
parent 295696 691a54f38d8416af86177910ad1cf44381390fe1
child 295698 2b23ccfe78d8925760497a552fa461b0bc9a6bab
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbtian
bugs1205253
milestone43.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 1205253: Use enum constants for Bluetooth Core module, r=btian
dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.cpp
dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.h
dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
--- a/dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.cpp
@@ -52,64 +52,72 @@ BluetoothDaemonCoreModule::HandleSvc(con
 // Commands
 //
 
 nsresult
 BluetoothDaemonCoreModule::EnableCmd(BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x01, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_ENABLE,
+                        0));
 
   nsresult rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::DisableCmd(BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x02, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_DISABLE,
+                        0));
 
   nsresult rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
   BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x03, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ADAPTER_PROPERTIES,
+                        0));
 
   nsresult rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
                                                  BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x04, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ADAPTER_PROPERTY,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<const nsAString, BluetoothPropertyType>(aName), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -120,17 +128,19 @@ BluetoothDaemonCoreModule::GetAdapterPro
 }
 
 nsresult
 BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
   const BluetoothNamedValue& aProperty, BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x05, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_ADAPTER_PROPERTY,
+                        0));
 
   nsresult rv = PackPDU(aProperty, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
@@ -140,17 +150,19 @@ BluetoothDaemonCoreModule::SetAdapterPro
 }
 
 nsresult
 BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
   const nsAString& aRemoteAddr, BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x06, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTIES,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -163,17 +175,19 @@ BluetoothDaemonCoreModule::GetRemoteDevi
 nsresult
 BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
   const nsAString& aRemoteAddr,
   const nsAString& aName,
   BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x07, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTY,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
     PackConversion<nsAString, BluetoothPropertyType>(aName), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
@@ -187,17 +201,19 @@ BluetoothDaemonCoreModule::GetRemoteDevi
 nsresult
 BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
   const nsAString& aRemoteAddr,
   const BluetoothNamedValue& aProperty,
   BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x08, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_SET_REMOTE_DEVICE_PROPERTY,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
     aProperty, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
@@ -210,17 +226,19 @@ BluetoothDaemonCoreModule::SetRemoteDevi
 
 nsresult
 BluetoothDaemonCoreModule::GetRemoteServiceRecordCmd(
   const nsAString& aRemoteAddr, const uint8_t aUuid[16],
   BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x09, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_SERVICE_RECORD,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aRemoteAddr),
     PackArray<uint8_t>(aUuid, 16), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
@@ -232,17 +250,18 @@ BluetoothDaemonCoreModule::GetRemoteServ
 }
 
 nsresult
 BluetoothDaemonCoreModule::GetRemoteServicesCmd(
   const nsAString& aRemoteAddr, BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0a, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_SERVICES, 0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aRemoteAddr), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -252,49 +271,55 @@ BluetoothDaemonCoreModule::GetRemoteServ
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::StartDiscoveryCmd(BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0b, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_START_DISCOVERY,
+                        0));
 
   nsresult rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::CancelDiscoveryCmd(BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0c, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_CANCEL_DISCOVERY,
+                        0));
 
   nsresult rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
   }
   unused << pdu.forget();
   return rv;
 }
 
 nsresult
 BluetoothDaemonCoreModule::CreateBondCmd(const nsAString& aBdAddr,
                                          BluetoothTransport aTransport,
                                          BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0d, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_CREATE_BOND,
+                        0));
 
 #if ANDROID_VERSION >= 21
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr), aTransport, *pdu);
 #else
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
 #endif
@@ -310,17 +335,19 @@ BluetoothDaemonCoreModule::CreateBondCmd
 }
 
 nsresult
 BluetoothDaemonCoreModule::RemoveBondCmd(const nsAString& aBdAddr,
                                          BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0e, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_REMOVE_BOND,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -331,17 +358,19 @@ BluetoothDaemonCoreModule::RemoveBondCmd
 }
 
 nsresult
 BluetoothDaemonCoreModule::CancelBondCmd(const nsAString& aBdAddr,
                                          BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x0f, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_CANCEL_BOND,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -353,17 +382,19 @@ BluetoothDaemonCoreModule::CancelBondCmd
 
 nsresult
 BluetoothDaemonCoreModule::PinReplyCmd(const nsAString& aBdAddr, bool aAccept,
                                        const nsAString& aPinCode,
                                        BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x10, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_PIN_REPLY,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr),
     aAccept,
     PackConversion<nsAString, BluetoothPinCode>(aPinCode), *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
@@ -378,17 +409,19 @@ BluetoothDaemonCoreModule::PinReplyCmd(c
 nsresult
 BluetoothDaemonCoreModule::SspReplyCmd(const nsAString& aBdAddr,
                                        BluetoothSspVariant aVariant,
                                        bool aAccept, uint32_t aPasskey,
                                        BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x11, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_SSP_REPLY,
+                        0));
 
   nsresult rv = PackPDU(
     PackConversion<nsAString, BluetoothAddress>(aBdAddr),
     aVariant, aAccept, aPasskey, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
@@ -400,17 +433,19 @@ BluetoothDaemonCoreModule::SspReplyCmd(c
 }
 
 nsresult
 BluetoothDaemonCoreModule::DutModeConfigureCmd(bool aEnable,
                                                BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x12, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_DUT_MODE_CONFIGURE,
+                        0));
 
   nsresult rv = PackPDU(aEnable, *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
     return rv;
@@ -421,17 +456,19 @@ BluetoothDaemonCoreModule::DutModeConfig
 
 nsresult
 BluetoothDaemonCoreModule::DutModeSendCmd(uint16_t aOpcode,
                                           uint8_t* aBuf, uint8_t aLen,
                                           BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x13, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_DUT_MODE_SEND,
+                        0));
 
   nsresult rv = PackPDU(aOpcode, aLen, PackArray<uint8_t>(aBuf, aLen),
                         *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -443,17 +480,19 @@ BluetoothDaemonCoreModule::DutModeSendCm
 
 nsresult
 BluetoothDaemonCoreModule::LeTestModeCmd(uint16_t aOpcode,
                                          uint8_t* aBuf, uint8_t aLen,
                                          BluetoothResultHandler* aRes)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
-  nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x01, 0x14, 0));
+  nsAutoPtr<DaemonSocketPDU> pdu(
+    new DaemonSocketPDU(SERVICE_ID, OPCODE_LE_TEST_MODE,
+                        0));
 
   nsresult rv = PackPDU(aOpcode, aLen, PackArray<uint8_t>(aBuf, aLen),
                         *pdu);
   if (NS_FAILED(rv)) {
     return rv;
   }
   rv = Send(pdu, aRes);
   if (NS_FAILED(rv)) {
@@ -677,37 +716,58 @@ void
 BluetoothDaemonCoreModule::HandleRsp(
   const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU,
   DaemonSocketResultHandler* aRes)
 {
   static void (BluetoothDaemonCoreModule::* const HandleRsp[])(
     const DaemonSocketPDUHeader&,
     DaemonSocketPDU&,
     BluetoothResultHandler*) = {
-    [0x00] = &BluetoothDaemonCoreModule::ErrorRsp,
-    [0x01] = &BluetoothDaemonCoreModule::EnableRsp,
-    [0x02] = &BluetoothDaemonCoreModule::DisableRsp,
-    [0x03] = &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp,
-    [0x04] = &BluetoothDaemonCoreModule::GetAdapterPropertyRsp,
-    [0x05] = &BluetoothDaemonCoreModule::SetAdapterPropertyRsp,
-    [0x06] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp,
-    [0x07] = &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp,
-    [0x08] = &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp,
-    [0x09] = &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp,
-    [0x0a] = &BluetoothDaemonCoreModule::GetRemoteServicesRsp,
-    [0x0b] = &BluetoothDaemonCoreModule::StartDiscoveryRsp,
-    [0x0c] = &BluetoothDaemonCoreModule::CancelDiscoveryRsp,
-    [0x0d] = &BluetoothDaemonCoreModule::CreateBondRsp,
-    [0x0e] = &BluetoothDaemonCoreModule::RemoveBondRsp,
-    [0x0f] = &BluetoothDaemonCoreModule::CancelBondRsp,
-    [0x10] = &BluetoothDaemonCoreModule::PinReplyRsp,
-    [0x11] = &BluetoothDaemonCoreModule::SspReplyRsp,
-    [0x12] = &BluetoothDaemonCoreModule::DutModeConfigureRsp,
-    [0x13] = &BluetoothDaemonCoreModule::DutModeSendRsp,
-    [0x14] = &BluetoothDaemonCoreModule::LeTestModeRsp,
+    [OPCODE_ERROR] =
+      &BluetoothDaemonCoreModule::ErrorRsp,
+    [OPCODE_ENABLE] =
+      &BluetoothDaemonCoreModule::EnableRsp,
+    [OPCODE_DISABLE] =
+      &BluetoothDaemonCoreModule::DisableRsp,
+    [OPCODE_GET_ADAPTER_PROPERTIES] =
+      &BluetoothDaemonCoreModule::GetAdapterPropertiesRsp,
+    [OPCODE_GET_ADAPTER_PROPERTY] =
+      &BluetoothDaemonCoreModule::GetAdapterPropertyRsp,
+    [OPCODE_SET_ADAPTER_PROPERTY] =
+      &BluetoothDaemonCoreModule::SetAdapterPropertyRsp,
+    [OPCODE_GET_REMOTE_DEVICE_PROPERTIES] =
+      &BluetoothDaemonCoreModule::GetRemoteDevicePropertiesRsp,
+    [OPCODE_GET_REMOTE_DEVICE_PROPERTY] =
+      &BluetoothDaemonCoreModule::GetRemoteDevicePropertyRsp,
+    [OPCODE_SET_REMOTE_DEVICE_PROPERTY] =
+      &BluetoothDaemonCoreModule::SetRemoteDevicePropertyRsp,
+    [OPCODE_GET_REMOTE_SERVICE_RECORD] =
+      &BluetoothDaemonCoreModule::GetRemoteServiceRecordRsp,
+    [OPCODE_GET_REMOTE_SERVICES] =
+      &BluetoothDaemonCoreModule::GetRemoteServicesRsp,
+    [OPCODE_START_DISCOVERY] =
+      &BluetoothDaemonCoreModule::StartDiscoveryRsp,
+    [OPCODE_CANCEL_DISCOVERY] =
+      &BluetoothDaemonCoreModule::CancelDiscoveryRsp,
+    [OPCODE_CREATE_BOND] =
+      &BluetoothDaemonCoreModule::CreateBondRsp,
+    [OPCODE_REMOVE_BOND] =
+      &BluetoothDaemonCoreModule::RemoveBondRsp,
+    [OPCODE_CANCEL_BOND] =
+      &BluetoothDaemonCoreModule::CancelBondRsp,
+    [OPCODE_PIN_REPLY] =
+      &BluetoothDaemonCoreModule::PinReplyRsp,
+    [OPCODE_SSP_REPLY] =
+      &BluetoothDaemonCoreModule::SspReplyRsp,
+    [OPCODE_DUT_MODE_CONFIGURE] =
+      &BluetoothDaemonCoreModule::DutModeConfigureRsp,
+    [OPCODE_DUT_MODE_SEND] =
+      &BluetoothDaemonCoreModule::DutModeSendRsp,
+    [OPCODE_LE_TEST_MODE] =
+      &BluetoothDaemonCoreModule::LeTestModeRsp,
   };
 
   MOZ_ASSERT(!NS_IsMainThread());
 
   if (NS_WARN_IF(!(aHeader.mOpcode < MOZ_ARRAY_LENGTH(HandleRsp))) ||
       NS_WARN_IF(!HandleRsp[aHeader.mOpcode])) {
     return;
   }
--- a/dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.h
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonCoreInterface.h
@@ -15,16 +15,54 @@ BEGIN_BLUETOOTH_NAMESPACE
 
 using mozilla::ipc::DaemonSocketPDU;
 using mozilla::ipc::DaemonSocketPDUHeader;
 using mozilla::ipc::DaemonSocketResultHandler;
 
 class BluetoothDaemonCoreModule
 {
 public:
+  enum {
+    SERVICE_ID = 0x01
+  };
+
+  enum {
+    OPCODE_ERROR = 0x00,
+    OPCODE_ENABLE = 0x01,
+    OPCODE_DISABLE = 0x02,
+    OPCODE_GET_ADAPTER_PROPERTIES = 0x03,
+    OPCODE_GET_ADAPTER_PROPERTY = 0x04,
+    OPCODE_SET_ADAPTER_PROPERTY = 0x05,
+    OPCODE_GET_REMOTE_DEVICE_PROPERTIES = 0x06,
+    OPCODE_GET_REMOTE_DEVICE_PROPERTY = 0x07,
+    OPCODE_SET_REMOTE_DEVICE_PROPERTY = 0x08,
+    OPCODE_GET_REMOTE_SERVICE_RECORD = 0x09,
+    OPCODE_GET_REMOTE_SERVICES = 0x0a,
+    OPCODE_START_DISCOVERY = 0x0b,
+    OPCODE_CANCEL_DISCOVERY = 0x0c,
+    OPCODE_CREATE_BOND = 0x0d,
+    OPCODE_REMOVE_BOND = 0x0e,
+    OPCODE_CANCEL_BOND = 0x0f,
+    OPCODE_PIN_REPLY = 0x10,
+    OPCODE_SSP_REPLY = 0x11,
+    OPCODE_DUT_MODE_CONFIGURE = 0x12,
+    OPCODE_DUT_MODE_SEND = 0x13,
+    OPCODE_LE_TEST_MODE = 0x14,
+    OPCODE_ADAPTER_STATE_CHANGED_NTF = 0x81,
+    OPCODE_ADAPTER_PROPERTIES_NTF = 0x82,
+    OPCODE_REMOTE_DEVICE_PROPERTIES_NTF = 0x83,
+    OPCODE_DEVICE_FOUND_NTF = 0x84,
+    OPCODE_DISCOVERY_STATE_CHANGED_NTF = 0x85,
+    OPCODE_PIN_REQUEST_NTF = 0x86,
+    OPCODE_SSP_REQUEST_NTF = 0x87,
+    OPCODE_BOND_STATE_CHANGED_NTF = 0x88,
+    OPCODE_ACL_STATE_CHANGED_NTF = 0x89,
+    OPCODE_DUT_MODE_RECV_NTF = 0x8a,
+    OPCODE_LE_TEST_MODE_NTF = 0x8b
+  };
 
   static const int MAX_NUM_CLIENTS;
 
   virtual nsresult Send(DaemonSocketPDU* aPDU,
                         DaemonSocketResultHandler* aRes) = 0;
 
   void SetNotificationHandler(
     BluetoothNotificationHandler* aNotificationHandler);
--- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
+++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp
@@ -249,17 +249,18 @@ BluetoothDaemonProtocol::HandleGattSvc(
 void
 BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU)
 {
   static void (BluetoothDaemonProtocol::* const HandleSvc[])(
     const DaemonSocketPDUHeader&, DaemonSocketPDU&,
     DaemonSocketResultHandler*) = {
     [BluetoothDaemonSetupModule::SERVICE_ID] =
       &BluetoothDaemonProtocol::HandleSetupSvc,
-    [0x01] = &BluetoothDaemonProtocol::HandleCoreSvc,
+    [BluetoothDaemonCoreModule::SERVICE_ID] =
+      &BluetoothDaemonProtocol::HandleCoreSvc,
     [0x02] = &BluetoothDaemonProtocol::HandleSocketSvc,
     [0x03] = nullptr, // HID host
     [0x04] = nullptr, // PAN
     [BluetoothDaemonHandsfreeModule::SERVICE_ID] =
       &BluetoothDaemonProtocol::HandleHandsfreeSvc,
     [BluetoothDaemonA2dpModule::SERVICE_ID] =
       &BluetoothDaemonProtocol::HandleA2dpSvc,
     [0x07] = nullptr, // Health