зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1209085: Replace simple init ops by |UnpackInitOp| in Bluetooth Core backend, r=joliu
This commit is contained in:
Родитель
ec9f010e9f
Коммит
9c1afc7d89
|
@ -945,201 +945,40 @@ BluetoothDaemonCoreModule::DiscoveryStateChangedNtf(
|
|||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for PinRequestNotification
|
||||
class BluetoothDaemonCoreModule::PinRequestInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
PinRequestInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
|
||||
uint32_t& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote name */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read CoD */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::PinRequestNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
PinRequestNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::PinRequestNotification,
|
||||
PinRequestInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for SspRequestNotification
|
||||
class BluetoothDaemonCoreModule::SspRequestInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
SspRequestInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
|
||||
uint32_t& aArg3, BluetoothSspVariant& aArg4,
|
||||
uint32_t& aArg5) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read remote address */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote name */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read CoD */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read pairing variant */
|
||||
rv = UnpackPDU(pdu, aArg4);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read passkey */
|
||||
rv = UnpackPDU(pdu, aArg5);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::SspRequestNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
SspRequestNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::SspRequestNotification,
|
||||
SspRequestInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for BondStateChangedNotification
|
||||
class BluetoothDaemonCoreModule::BondStateChangedInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
BondStateChangedInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
BluetoothBondState& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read status */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read bond state */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::BondStateChangedNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
BondStateChangedNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::BondStateChangedNotification,
|
||||
BondStateChangedInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for AclStateChangedNotification
|
||||
class BluetoothDaemonCoreModule::AclStateChangedInitOp final
|
||||
: private PDUInitOp
|
||||
{
|
||||
public:
|
||||
AclStateChangedInitOp(DaemonSocketPDU& aPDU)
|
||||
: PDUInitOp(aPDU)
|
||||
{ }
|
||||
|
||||
nsresult
|
||||
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
|
||||
BluetoothAclState& aArg3) const
|
||||
{
|
||||
DaemonSocketPDU& pdu = GetPDU();
|
||||
|
||||
/* Read status */
|
||||
nsresult rv = UnpackPDU(pdu, aArg1);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read remote address */
|
||||
rv = UnpackPDU(pdu, aArg2);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* Read ACL state */
|
||||
rv = UnpackPDU(pdu, aArg3);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
WarnAboutTrailingData();
|
||||
return NS_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void
|
||||
BluetoothDaemonCoreModule::AclStateChangedNtf(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
AclStateChangedNotification::Dispatch(
|
||||
&BluetoothNotificationHandler::AclStateChangedNotification,
|
||||
AclStateChangedInitOp(aPDU));
|
||||
UnpackPDUInitOp(aPDU));
|
||||
}
|
||||
|
||||
// Init operator class for DutModeRecvNotification
|
||||
|
|
|
@ -298,14 +298,10 @@ private:
|
|||
NotificationHandlerWrapper, void, BluetoothStatus, uint16_t>
|
||||
LeTestModeNotification;
|
||||
|
||||
class AclStateChangedInitOp;
|
||||
class AdapterPropertiesInitOp;
|
||||
class BondStateChangedInitOp;
|
||||
class DeviceFoundInitOp;
|
||||
class DutModeRecvInitOp;
|
||||
class PinRequestInitOp;
|
||||
class RemoteDevicePropertiesInitOp;
|
||||
class SspRequestInitOp;
|
||||
|
||||
void AdapterStateChangedNtf(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU);
|
||||
|
|
Загрузка…
Ссылка в новой задаче