diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp index f1a1b9f9f019..a9933d475fa4 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonInterface.cpp @@ -256,7 +256,8 @@ BluetoothDaemonProtocol::Handle(DaemonSocketPDU& aPDU) &BluetoothDaemonProtocol::HandleSetupSvc, [BluetoothDaemonCoreModule::SERVICE_ID] = &BluetoothDaemonProtocol::HandleCoreSvc, - [0x02] = &BluetoothDaemonProtocol::HandleSocketSvc, + [BluetoothDaemonSocketModule::SERVICE_ID] = + &BluetoothDaemonProtocol::HandleSocketSvc, [0x03] = nullptr, // HID host [0x04] = nullptr, // PAN [BluetoothDaemonHandsfreeModule::SERVICE_ID] = diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp index 15afca216c57..397fcfd7c4a4 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.cpp @@ -32,7 +32,9 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType, { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new DaemonSocketPDU(0x02, 0x01, 0)); + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_LISTEN, + 0)); nsresult rv = PackPDU( aType, @@ -61,7 +63,9 @@ BluetoothDaemonSocketModule::ConnectCmd(const nsAString& aBdAddr, { MOZ_ASSERT(NS_IsMainThread()); - nsAutoPtr pdu(new DaemonSocketPDU(0x02, 0x02, 0)); + nsAutoPtr pdu( + new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT, + 0)); nsresult rv = PackPDU( PackConversion(aBdAddr), @@ -166,9 +170,9 @@ BluetoothDaemonSocketModule::HandleSvc(const DaemonSocketPDUHeader& aHeader, const DaemonSocketPDUHeader&, DaemonSocketPDU&, BluetoothSocketResultHandler*) = { - [0x00] = &BluetoothDaemonSocketModule::ErrorRsp, - [0x01] = &BluetoothDaemonSocketModule::ListenRsp, - [0x02] = &BluetoothDaemonSocketModule::ConnectRsp + [OPCODE_ERROR] = &BluetoothDaemonSocketModule::ErrorRsp, + [OPCODE_LISTEN] = &BluetoothDaemonSocketModule::ListenRsp, + [OPCODE_CONNECT] = &BluetoothDaemonSocketModule::ConnectRsp }; if (NS_WARN_IF(MOZ_ARRAY_LENGTH(HandleRsp) <= aHeader.mOpcode) || diff --git a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h index 506883bbd43b..79c23b5bd7a3 100644 --- a/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h +++ b/dom/bluetooth/bluedroid/BluetoothDaemonSocketInterface.h @@ -20,6 +20,16 @@ using mozilla::ipc::DaemonSocketResultHandler; class BluetoothDaemonSocketModule { public: + enum { + SERVICE_ID = 0x02 + }; + + enum { + OPCODE_ERROR = 0x00, + OPCODE_LISTEN = 0x01, + OPCODE_CONNECT = 0x02 + }; + static const int MAX_NUM_CLIENTS; virtual nsresult Send(DaemonSocketPDU* aPDU,