mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1211948: Introduce |enum BluetoothSetupServiceId|, r=brsun
This commit is contained in:
parent
14cb40220b
commit
94e0daba44
@ -281,8 +281,9 @@ BluetoothDaemonA2dpInterface::Init(
|
||||
res = nullptr;
|
||||
}
|
||||
|
||||
nsresult rv = mModule->RegisterModule(BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
0x00, BluetoothDaemonA2dpModule::MAX_NUM_CLIENTS, res);
|
||||
nsresult rv = mModule->RegisterModule(
|
||||
SETUP_SERVICE_ID_A2DP, 0x00, BluetoothDaemonA2dpModule::MAX_NUM_CLIENTS,
|
||||
res);
|
||||
if (NS_FAILED(rv) && aRes) {
|
||||
DispatchError(aRes, rv);
|
||||
}
|
||||
@ -333,7 +334,7 @@ BluetoothDaemonA2dpInterface::Cleanup(
|
||||
BluetoothA2dpResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = mModule->UnregisterModule(
|
||||
BluetoothDaemonA2dpModule::SERVICE_ID,
|
||||
SETUP_SERVICE_ID_A2DP,
|
||||
new CleanupResultHandler(mModule, aRes));
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(aRes, rv);
|
||||
|
@ -35,11 +35,11 @@ public:
|
||||
virtual nsresult Send(DaemonSocketPDU* aPDU,
|
||||
DaemonSocketResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
virtual nsresult RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult UnregisterModule(uint8_t aId,
|
||||
virtual nsresult UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
void SetNotificationHandler(
|
||||
|
@ -854,8 +854,8 @@ BluetoothDaemonAvrcpInterface::Init(
|
||||
}
|
||||
|
||||
nsresult rv = mModule->RegisterModule(
|
||||
BluetoothDaemonAvrcpModule::SERVICE_ID,
|
||||
BluetoothDaemonAvrcpModule::MAX_NUM_CLIENTS, 0x00, res);
|
||||
SETUP_SERVICE_ID_AVRCP, 0x00, BluetoothDaemonAvrcpModule::MAX_NUM_CLIENTS,
|
||||
res);
|
||||
|
||||
if (NS_FAILED(rv) && aRes) {
|
||||
DispatchError(aRes, rv);
|
||||
@ -909,8 +909,7 @@ BluetoothDaemonAvrcpInterface::Cleanup(
|
||||
MOZ_ASSERT(mModule);
|
||||
|
||||
nsresult rv = mModule->UnregisterModule(
|
||||
BluetoothDaemonAvrcpModule::SERVICE_ID,
|
||||
new CleanupResultHandler(mModule, aRes));
|
||||
SETUP_SERVICE_ID_AVRCP, new CleanupResultHandler(mModule, aRes));
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(aRes, rv);
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ public:
|
||||
virtual nsresult Send(DaemonSocketPDU* aPDU,
|
||||
DaemonSocketResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
virtual nsresult RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult UnregisterModule(uint8_t aId,
|
||||
virtual nsresult UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
void SetNotificationHandler(
|
||||
|
@ -2057,8 +2057,8 @@ BluetoothDaemonGattInterface::Init(
|
||||
}
|
||||
|
||||
nsresult rv = mModule->RegisterModule(
|
||||
BluetoothDaemonGattModule::SERVICE_ID, 0x00,
|
||||
BluetoothDaemonGattModule::MAX_NUM_CLIENTS, res);
|
||||
SETUP_SERVICE_ID_GATT, 0x00, BluetoothDaemonGattModule::MAX_NUM_CLIENTS,
|
||||
res);
|
||||
|
||||
if (NS_FAILED(rv) && aRes) {
|
||||
DispatchError(aRes, rv);
|
||||
@ -2110,8 +2110,7 @@ BluetoothDaemonGattInterface::Cleanup(
|
||||
BluetoothGattResultHandler* aRes)
|
||||
{
|
||||
nsresult rv = mModule->UnregisterModule(
|
||||
BluetoothDaemonGattModule::SERVICE_ID,
|
||||
new CleanupResultHandler(mModule, aRes));
|
||||
SETUP_SERVICE_ID_GATT, new CleanupResultHandler(mModule, aRes));
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(aRes, rv);
|
||||
}
|
||||
|
@ -69,11 +69,11 @@ public:
|
||||
virtual nsresult Send(DaemonSocketPDU* aPDU,
|
||||
DaemonSocketResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
virtual nsresult RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult UnregisterModule(uint8_t aId,
|
||||
virtual nsresult UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
void SetNotificationHandler(
|
||||
|
@ -1456,8 +1456,7 @@ BluetoothDaemonHandsfreeInterface::Init(
|
||||
}
|
||||
|
||||
nsresult rv = mModule->RegisterModule(
|
||||
BluetoothDaemonHandsfreeModule::SERVICE_ID, MODE_NARROWBAND_SPEECH,
|
||||
aMaxNumClients, res);
|
||||
SETUP_SERVICE_ID_HANDSFREE, MODE_NARROWBAND_SPEECH, aMaxNumClients, res);
|
||||
|
||||
if (NS_FAILED(rv) && aRes) {
|
||||
DispatchError(aRes, rv);
|
||||
@ -1480,7 +1479,6 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BT_LOGR("%s:%d", __func__, __LINE__);
|
||||
if (mRes) {
|
||||
mRes->OnError(aStatus);
|
||||
}
|
||||
@ -1490,7 +1488,6 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BT_LOGR("%s:%d", __func__, __LINE__);
|
||||
// Clear notification handler _after_ module has been
|
||||
// unregistered. While unregistering the module, we might
|
||||
// still receive notifications.
|
||||
@ -1510,11 +1507,9 @@ void
|
||||
BluetoothDaemonHandsfreeInterface::Cleanup(
|
||||
BluetoothHandsfreeResultHandler* aRes)
|
||||
{
|
||||
BT_LOGR("%s:%d", __func__, __LINE__);
|
||||
nsresult rv = mModule->UnregisterModule(
|
||||
BluetoothDaemonHandsfreeModule::SERVICE_ID,
|
||||
new CleanupResultHandler(mModule, aRes));
|
||||
BT_LOGR("%s:%d", __func__, __LINE__);
|
||||
SETUP_SERVICE_ID_HANDSFREE, new CleanupResultHandler(mModule, aRes));
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(aRes, rv);
|
||||
}
|
||||
|
@ -46,11 +46,11 @@ public:
|
||||
virtual nsresult Send(DaemonSocketPDU* aPDU,
|
||||
DaemonSocketResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
virtual nsresult RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual nsresult UnregisterModule(uint8_t aId,
|
||||
virtual nsresult UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
void SetNotificationHandler(
|
||||
|
@ -841,6 +841,35 @@ Convert(BluetoothScanMode aIn, int32_t& aOut)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(BluetoothSetupServiceId aIn, uint8_t& aOut)
|
||||
{
|
||||
static const uint8_t sServiceId[] = {
|
||||
[SETUP_SERVICE_ID_SETUP] = 0x00,
|
||||
[SETUP_SERVICE_ID_CORE] = 0x01,
|
||||
[SETUP_SERVICE_ID_SOCKET] = 0x02,
|
||||
[SETUP_SERVICE_ID_HID] = 0x03,
|
||||
[SETUP_SERVICE_ID_PAN] = 0x04,
|
||||
[SETUP_SERVICE_ID_HANDSFREE] = 0x05,
|
||||
[SETUP_SERVICE_ID_A2DP] = 0x06,
|
||||
[SETUP_SERVICE_ID_HEALTH] = 0x07,
|
||||
[SETUP_SERVICE_ID_AVRCP] = 0x08,
|
||||
[SETUP_SERVICE_ID_GATT] = 0x09,
|
||||
[SETUP_SERVICE_ID_HANDSFREE_CLIENT] = 0x0a,
|
||||
[SETUP_SERVICE_ID_MAP_CLIENT] = 0x0b,
|
||||
[SETUP_SERVICE_ID_AVRCP_CONTROLLER] = 0x0c,
|
||||
[SETUP_SERVICE_ID_A2DP_SINK] = 0x0d
|
||||
};
|
||||
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
|
||||
aIn >= MOZ_ARRAY_LENGTH(sServiceId),
|
||||
BluetoothServiceSetupId, uint8_t)) {
|
||||
aOut = 0; // silences compiler warning
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
aOut = sServiceId[aIn];
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Convert(BluetoothSspVariant aIn, uint8_t& aOut)
|
||||
{
|
||||
@ -1267,6 +1296,12 @@ PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU)
|
||||
return PackPDU(PackConversion<BluetoothScanMode, int32_t>(aIn), aPDU);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PackPDU(BluetoothSetupServiceId aIn, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
return PackPDU(PackConversion<BluetoothSetupServiceId, uint8_t>(aIn), aPDU);
|
||||
}
|
||||
|
||||
nsresult
|
||||
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU)
|
||||
{
|
||||
|
@ -230,6 +230,9 @@ Convert(BluetoothPropertyType aIn, uint8_t& aOut);
|
||||
nsresult
|
||||
Convert(BluetoothScanMode aIn, uint8_t& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(BluetoothSetupServiceId aIn, uint8_t& aOut);
|
||||
|
||||
nsresult
|
||||
Convert(BluetoothSocketType aIn, uint8_t& aOut);
|
||||
|
||||
@ -329,6 +332,9 @@ PackPDU(BluetoothPropertyType aIn, DaemonSocketPDU& aPDU);
|
||||
nsresult
|
||||
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU);
|
||||
|
||||
nsresult
|
||||
PackPDU(BluetoothSetupServiceId aIn, DaemonSocketPDU& aPDU);
|
||||
|
||||
nsresult
|
||||
PackPDU(BluetoothSocketType aIn, DaemonSocketPDU& aPDU);
|
||||
|
||||
|
@ -95,10 +95,11 @@ public:
|
||||
|
||||
void SetConnection(DaemonSocket* aConnection);
|
||||
|
||||
nsresult RegisterModule(uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients,
|
||||
nsresult RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) override;
|
||||
|
||||
nsresult UnregisterModule(uint8_t aId,
|
||||
nsresult UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) override;
|
||||
|
||||
// Outgoing PDUs
|
||||
@ -154,8 +155,8 @@ BluetoothDaemonProtocol::SetConnection(DaemonSocket* aConnection)
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonProtocol::RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
BluetoothDaemonProtocol::RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
return BluetoothDaemonSetupModule::RegisterModuleCmd(aId, aMode,
|
||||
@ -163,7 +164,7 @@ BluetoothDaemonProtocol::RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
}
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonProtocol::UnregisterModule(uint8_t aId,
|
||||
BluetoothDaemonProtocol::UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
return BluetoothDaemonSetupModule::UnregisterModuleCmd(aId, aRes);
|
||||
@ -422,7 +423,9 @@ public:
|
||||
if (!mRegisteredSocketModule) {
|
||||
mRegisteredSocketModule = true;
|
||||
// Init, step 5: Register Socket module
|
||||
mInterface->mProtocol->RegisterModuleCmd(0x02, 0x00,
|
||||
mInterface->mProtocol->RegisterModuleCmd(
|
||||
SETUP_SERVICE_ID_SOCKET,
|
||||
0x00,
|
||||
BluetoothDaemonSocketModule::MAX_NUM_CLIENTS, this);
|
||||
} else if (mRes) {
|
||||
// Init, step 6: Signal success to caller
|
||||
@ -556,7 +559,7 @@ private:
|
||||
if (!mUnregisteredCoreModule) {
|
||||
mUnregisteredCoreModule = true;
|
||||
// Cleanup, step 2: Unregister Core module
|
||||
mInterface->mProtocol->UnregisterModuleCmd(0x01, this);
|
||||
mInterface->mProtocol->UnregisterModuleCmd(SETUP_SERVICE_ID_CORE, this);
|
||||
} else {
|
||||
// Cleanup, step 3: Close command channel
|
||||
mInterface->mCmdChannel->Close();
|
||||
@ -600,7 +603,7 @@ BluetoothDaemonInterface::Cleanup(BluetoothResultHandler* aRes)
|
||||
|
||||
// Cleanup, step 1: Unregister Socket module
|
||||
nsresult rv = mProtocol->UnregisterModuleCmd(
|
||||
0x02, new CleanupResultHandler(this));
|
||||
SETUP_SERVICE_ID_SOCKET, new CleanupResultHandler(this));
|
||||
if (NS_FAILED(rv)) {
|
||||
DispatchError(aRes, rv);
|
||||
return;
|
||||
@ -1014,7 +1017,9 @@ BluetoothDaemonInterface::OnConnectSuccess(int aIndex)
|
||||
|
||||
// Init, step 4: Register Core module
|
||||
nsresult rv = mProtocol->RegisterModuleCmd(
|
||||
0x01, 0x00, BluetoothDaemonCoreModule::MAX_NUM_CLIENTS,
|
||||
SETUP_SERVICE_ID_CORE,
|
||||
0x00,
|
||||
BluetoothDaemonCoreModule::MAX_NUM_CLIENTS,
|
||||
new InitResultHandler(this, res));
|
||||
if (NS_FAILED(rv) && res) {
|
||||
DispatchError(res, STATUS_FAIL);
|
||||
|
@ -56,7 +56,7 @@ BluetoothDaemonSetupModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonSetupModule::RegisterModuleCmd(
|
||||
uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupServiceId aId, uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
@ -83,7 +83,7 @@ BluetoothDaemonSetupModule::RegisterModuleCmd(
|
||||
|
||||
nsresult
|
||||
BluetoothDaemonSetupModule::UnregisterModuleCmd(
|
||||
uint8_t aId, BluetoothSetupResultHandler* aRes)
|
||||
BluetoothSetupServiceId aId, BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -183,7 +183,7 @@ BluetoothDaemonSetupInterface::~BluetoothDaemonSetupInterface()
|
||||
|
||||
void
|
||||
BluetoothDaemonSetupInterface::RegisterModule(
|
||||
uint8_t aId, uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupServiceId aId, uint8_t aMode, uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
@ -196,7 +196,7 @@ BluetoothDaemonSetupInterface::RegisterModule(
|
||||
|
||||
void
|
||||
BluetoothDaemonSetupInterface::UnregisterModule(
|
||||
uint8_t aId,
|
||||
BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
|
@ -37,11 +37,11 @@ public:
|
||||
// Commands
|
||||
//
|
||||
|
||||
nsresult RegisterModuleCmd(uint8_t aId, uint8_t aMode,
|
||||
nsresult RegisterModuleCmd(BluetoothSetupServiceId aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes);
|
||||
|
||||
nsresult UnregisterModuleCmd(uint8_t aId,
|
||||
nsresult UnregisterModuleCmd(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes);
|
||||
|
||||
nsresult ConfigurationCmd(const BluetoothConfigurationParameter* aParam,
|
||||
@ -93,11 +93,11 @@ public:
|
||||
BluetoothDaemonSetupInterface(BluetoothDaemonSetupModule* aModule);
|
||||
~BluetoothDaemonSetupInterface();
|
||||
|
||||
void RegisterModule(uint8_t aId, uint8_t aMode,
|
||||
void RegisterModule(BluetoothSetupServiceId aId, uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) override;
|
||||
|
||||
void UnregisterModule(uint8_t aId,
|
||||
void UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) override;
|
||||
|
||||
void Configuration(const BluetoothConfigurationParameter* aParam,
|
||||
|
@ -326,6 +326,23 @@ enum BluetoothBondState {
|
||||
BOND_STATE_BONDED
|
||||
};
|
||||
|
||||
enum BluetoothSetupServiceId {
|
||||
SETUP_SERVICE_ID_SETUP,
|
||||
SETUP_SERVICE_ID_CORE,
|
||||
SETUP_SERVICE_ID_SOCKET,
|
||||
SETUP_SERVICE_ID_HID,
|
||||
SETUP_SERVICE_ID_PAN,
|
||||
SETUP_SERVICE_ID_HANDSFREE,
|
||||
SETUP_SERVICE_ID_A2DP,
|
||||
SETUP_SERVICE_ID_HEALTH,
|
||||
SETUP_SERVICE_ID_AVRCP,
|
||||
SETUP_SERVICE_ID_GATT,
|
||||
SETUP_SERVICE_ID_HANDSFREE_CLIENT,
|
||||
SETUP_SERVICE_ID_MAP_CLIENT,
|
||||
SETUP_SERVICE_ID_AVRCP_CONTROLLER,
|
||||
SETUP_SERVICE_ID_A2DP_SINK
|
||||
};
|
||||
|
||||
/* Physical transport for GATT connections to remote dual-mode devices */
|
||||
enum BluetoothTransport {
|
||||
TRANSPORT_AUTO, /* No preference of physical transport */
|
||||
|
@ -33,12 +33,12 @@ protected:
|
||||
class BluetoothSetupInterface
|
||||
{
|
||||
public:
|
||||
virtual void RegisterModule(uint8_t aId,
|
||||
virtual void RegisterModule(BluetoothSetupServiceId aId,
|
||||
uint8_t aMode,
|
||||
uint32_t aMaxNumClients,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual void UnregisterModule(uint8_t aId,
|
||||
virtual void UnregisterModule(BluetoothSetupServiceId aId,
|
||||
BluetoothSetupResultHandler* aRes) = 0;
|
||||
|
||||
virtual void Configuration(const BluetoothConfigurationParameter* aParam,
|
||||
|
Loading…
Reference in New Issue
Block a user