mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 1205577: Use enum constants for Bluetooth Socket module, r=btian
This commit is contained in:
parent
5befe35395
commit
4afaf44ef6
@ -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] =
|
||||
|
@ -32,7 +32,9 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsAutoPtr<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x02, 0x01, 0));
|
||||
nsAutoPtr<DaemonSocketPDU> 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<DaemonSocketPDU> pdu(new DaemonSocketPDU(0x02, 0x02, 0));
|
||||
nsAutoPtr<DaemonSocketPDU> pdu(
|
||||
new DaemonSocketPDU(SERVICE_ID, OPCODE_CONNECT,
|
||||
0));
|
||||
|
||||
nsresult rv = PackPDU(
|
||||
PackConversion<nsAString, BluetoothAddress>(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) ||
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user