mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1114515 - Part 2: Add BluetoothUuid, BluetoothGattId[], BluetoothGattServiceId[] into bluetooth ipc protocol. r=btian
This commit is contained in:
parent
0ec268e86f
commit
43a35386b1
@ -285,6 +285,16 @@ enum BluetoothSspVariant {
|
||||
|
||||
struct BluetoothUuid {
|
||||
uint8_t mUuid[16];
|
||||
|
||||
bool operator==(const BluetoothUuid& aOther) const
|
||||
{
|
||||
for (uint8_t i = 0; i < sizeof(mUuid); i++) {
|
||||
if (mUuid[i] != aOther.mUuid[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct BluetoothServiceRecord {
|
||||
@ -547,11 +557,21 @@ struct BluetoothGattAdvData {
|
||||
struct BluetoothGattId {
|
||||
BluetoothUuid mUuid;
|
||||
uint8_t mInstanceId;
|
||||
|
||||
bool operator==(const BluetoothGattId& aOther) const
|
||||
{
|
||||
return mUuid == aOther.mUuid && mInstanceId == aOther.mInstanceId;
|
||||
}
|
||||
};
|
||||
|
||||
struct BluetoothGattServiceId {
|
||||
BluetoothGattId mId;
|
||||
uint8_t mIsPrimary;
|
||||
|
||||
bool operator==(const BluetoothGattServiceId& aOther) const
|
||||
{
|
||||
return mId == aOther.mId && mIsPrimary == aOther.mIsPrimary;
|
||||
}
|
||||
};
|
||||
|
||||
struct BluetoothGattReadParam {
|
||||
|
@ -28,6 +28,73 @@ struct ParamTraits<mozilla::dom::bluetooth::BluetoothStatus>
|
||||
mozilla::dom::bluetooth::STATUS_RMT_DEV_DOWN>
|
||||
{ };
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothUuid>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::BluetoothUuid paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
WriteParam(aMsg, aParam.mUuid[i]);
|
||||
}
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
for (uint8_t i = 0; i < 16; i++) {
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mUuid[i]))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattId>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::BluetoothGattId paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mUuid);
|
||||
WriteParam(aMsg, aParam.mInstanceId);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mUuid)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mInstanceId))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct ParamTraits<mozilla::dom::bluetooth::BluetoothGattServiceId>
|
||||
{
|
||||
typedef mozilla::dom::bluetooth::BluetoothGattServiceId paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mId);
|
||||
WriteParam(aMsg, aParam.mIsPrimary);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
if (!ReadParam(aMsg, aIter, &(aResult->mId)) ||
|
||||
!ReadParam(aMsg, aIter, &(aResult->mIsPrimary))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
} // namespace IPC
|
||||
|
||||
#endif // mozilla_dom_bluetooth_ipc_bluetoothmessageutils_h__
|
||||
|
@ -4,7 +4,12 @@
|
||||
* 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/. */
|
||||
|
||||
using mozilla::dom::bluetooth::BluetoothStatus from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothGattId
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothGattServiceId
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
using mozilla::dom::bluetooth::BluetoothStatus
|
||||
from "mozilla/dom/bluetooth/BluetoothCommon.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -23,6 +28,8 @@ union BluetoothValue
|
||||
nsString[];
|
||||
uint8_t[];
|
||||
BluetoothNamedValue[];
|
||||
BluetoothGattId[];
|
||||
BluetoothGattServiceId[];
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user