mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1195608 - [cleanup] Fix too long lines and revise some comments under dom/bluetooth, r=joliu
This commit is contained in:
parent
36bccbfaba
commit
11a73236d5
@ -146,14 +146,16 @@ BluetoothHidManager::Disconnect(BluetoothProfileController* aController)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mConnected) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -210,7 +212,8 @@ void
|
||||
BluetoothHidManager::HandleInputPropertyChanged(const BluetoothSignal& aSignal)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
MOZ_ASSERT(aSignal.value().type() ==
|
||||
BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
|
||||
const InfallibleTArray<BluetoothNamedValue>& arr =
|
||||
aSignal.value().get_ArrayOfBluetoothNamedValue();
|
||||
|
@ -481,7 +481,8 @@ public:
|
||||
const BluetoothAvrcpNotificationParam& aParam,
|
||||
BluetoothAvrcpResultHandler* aRes) = 0;
|
||||
|
||||
virtual void SetVolume(uint8_t aVolume, BluetoothAvrcpResultHandler* aRes) = 0;
|
||||
virtual void SetVolume(uint8_t aVolume,
|
||||
BluetoothAvrcpResultHandler* aRes) = 0;
|
||||
|
||||
protected:
|
||||
BluetoothAvrcpInterface();
|
||||
@ -1073,7 +1074,8 @@ public:
|
||||
virtual void DiscoveryStateChangedNotification(bool aState) { }
|
||||
|
||||
virtual void PinRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
const nsAString& aBdName, uint32_t aCod) { }
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod) { }
|
||||
virtual void SspRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod,
|
||||
|
@ -50,12 +50,12 @@ public:
|
||||
virtual void OnUpdateSdpRecords(const nsAString& aDeviceAddress) = 0;
|
||||
|
||||
/**
|
||||
* Returns the address of the connected device.
|
||||
* Return the address of the connected device.
|
||||
*/
|
||||
virtual void GetAddress(nsAString& aDeviceAddress) = 0;
|
||||
|
||||
/**
|
||||
* Returns true if the profile is connected.
|
||||
* Return true if the profile is connected.
|
||||
*/
|
||||
virtual bool IsConnected() = 0;
|
||||
|
||||
@ -84,7 +84,7 @@ public:
|
||||
virtual void Reset() = 0;
|
||||
|
||||
/**
|
||||
* Returns string of profile name.
|
||||
* Return string of profile name.
|
||||
*/
|
||||
virtual void GetName(nsACString& aName) = 0;
|
||||
};
|
||||
@ -103,7 +103,7 @@ public: \
|
||||
BluetoothProfileController* aController) override; \
|
||||
virtual void Disconnect(BluetoothProfileController* aController) override; \
|
||||
virtual void OnConnect(const nsAString& aErrorStr) override; \
|
||||
virtual void OnDisconnect(const nsAString& AErrorStr) override; \
|
||||
virtual void OnDisconnect(const nsAString& aErrorStr) override; \
|
||||
virtual void Reset() override;
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -561,14 +561,16 @@ BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mA2dpConnected) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -580,7 +582,8 @@ BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
|
||||
if (!sBtA2dpInterface) {
|
||||
BT_LOGR("sBluetoothA2dpInterface is null");
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1011,8 +1014,8 @@ BluetoothA2dpManager::GetArtist(nsAString& aArtist)
|
||||
*/
|
||||
|
||||
void
|
||||
BluetoothA2dpManager::ConnectionStateNotification(BluetoothA2dpConnectionState aState,
|
||||
const nsAString& aBdAddr)
|
||||
BluetoothA2dpManager::ConnectionStateNotification(
|
||||
BluetoothA2dpConnectionState aState, const nsAString& aBdAddr)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -2521,7 +2521,8 @@ BluetoothDaemonGattClientInterface::Listen(
|
||||
/* Clear the attribute cache for a given device*/
|
||||
void
|
||||
BluetoothDaemonGattClientInterface::Refresh(
|
||||
int aClientIf, const nsAString& aBdAddr, BluetoothGattClientResultHandler* aRes)
|
||||
int aClientIf, const nsAString& aBdAddr,
|
||||
BluetoothGattClientResultHandler* aRes)
|
||||
{
|
||||
MOZ_ASSERT(mModule);
|
||||
|
||||
|
@ -40,8 +40,8 @@ BluetoothDaemonHandsfreeModule::Send(DaemonSocketPDU* aPDU,
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothDaemonHandsfreeModule::HandleSvc(const DaemonSocketPDUHeader& aHeader,
|
||||
DaemonSocketPDU& aPDU, void* aUserData)
|
||||
BluetoothDaemonHandsfreeModule::HandleSvc(
|
||||
const DaemonSocketPDUHeader& aHeader, DaemonSocketPDU& aPDU, void* aUserData)
|
||||
{
|
||||
static void (BluetoothDaemonHandsfreeModule::* const HandleOp[])(
|
||||
const DaemonSocketPDUHeader&, DaemonSocketPDU&, void*) = {
|
||||
|
@ -1173,7 +1173,8 @@ BluetoothGattManager::WriteCharacteristicValue(
|
||||
return;
|
||||
}
|
||||
|
||||
client->mWriteCharacteristicState.Assign(aWriteType, aValue, false, aRunnable);
|
||||
client->mWriteCharacteristicState.Assign(
|
||||
aWriteType, aValue, false, aRunnable);
|
||||
|
||||
/**
|
||||
* First, write the characteristic value through an unauthenticated physical
|
||||
|
@ -1639,9 +1639,8 @@ BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState)
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothServiceBluedroid::PinRequestNotification(const nsAString& aRemoteBdAddr,
|
||||
const nsAString& aBdName,
|
||||
uint32_t aCod)
|
||||
BluetoothServiceBluedroid::PinRequestNotification(
|
||||
const nsAString& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
|
@ -794,7 +794,8 @@ BluetoothAdapter::GetConnectedDevices(uint16_t aServiceUuid, ErrorResult& aRv)
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothAdapter::GetPairedDevices(nsTArray<nsRefPtr<BluetoothDevice> >& aDevices)
|
||||
BluetoothAdapter::GetPairedDevices(
|
||||
nsTArray<nsRefPtr<BluetoothDevice> >& aDevices)
|
||||
{
|
||||
for (uint32_t i = 0; i < mDevices.Length(); ++i) {
|
||||
if (mDevices[i]->Paired()) {
|
||||
@ -1332,7 +1333,8 @@ BluetoothAdapter::SendFile(const nsAString& aDeviceAddress,
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::StopSendingFile(const nsAString& aDeviceAddress, ErrorResult& aRv)
|
||||
BluetoothAdapter::StopSendingFile(
|
||||
const nsAString& aDeviceAddress, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
@ -1532,7 +1534,8 @@ BluetoothAdapter::ToggleCalls(ErrorResult& aRv)
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorResult& aRv)
|
||||
BluetoothAdapter::SendMediaMetaData(
|
||||
const MediaMetaData& aMediaMetaData, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
@ -1561,7 +1564,8 @@ BluetoothAdapter::SendMediaMetaData(const MediaMetaData& aMediaMetaData, ErrorRe
|
||||
}
|
||||
|
||||
already_AddRefed<DOMRequest>
|
||||
BluetoothAdapter::SendMediaPlayStatus(const MediaPlayStatus& aMediaPlayStatus, ErrorResult& aRv)
|
||||
BluetoothAdapter::SendMediaPlayStatus(
|
||||
const MediaPlayStatus& aMediaPlayStatus, ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = GetOwner();
|
||||
if (!win) {
|
||||
|
@ -314,6 +314,8 @@ private:
|
||||
* Convert string to BluetoothAdapterAttribute.
|
||||
*
|
||||
* @param aString [in] String to convert
|
||||
*
|
||||
* @return the adapter attribute converted from |aString|
|
||||
*/
|
||||
BluetoothAdapterAttribute
|
||||
ConvertStringToAdapterAttribute(const nsAString& aString);
|
||||
@ -323,14 +325,16 @@ private:
|
||||
*
|
||||
* @param aType [in] Adapter property to check
|
||||
* @param aValue [in] New value of the adapter property
|
||||
*
|
||||
* @return true if the adapter property has changed; false otherwise
|
||||
*/
|
||||
bool IsAdapterAttributeChanged(BluetoothAdapterAttribute aType,
|
||||
const BluetoothValue& aValue);
|
||||
|
||||
/**
|
||||
* Check whether this adapter is owned by Bluetooth certified app.
|
||||
* Check whether this adapter belongs to Bluetooth certified app.
|
||||
*
|
||||
* @return a boolean value to indicate whether it's owned by Bluetooth app.
|
||||
* @return true if this adapter belongs to Bluetooth app; false otherwise
|
||||
*/
|
||||
bool IsBluetoothCertifiedApp();
|
||||
|
||||
|
@ -126,6 +126,8 @@ private:
|
||||
* Convert uint32_t to BluetoothDeviceType.
|
||||
*
|
||||
* @param aValue [in] uint32_t to convert
|
||||
*
|
||||
* @return the device type converted from |aValue|
|
||||
*/
|
||||
BluetoothDeviceType ConvertUint32ToDeviceType(const uint32_t aValue);
|
||||
|
||||
@ -133,6 +135,8 @@ private:
|
||||
* Convert string to BluetoothDeviceAttribute.
|
||||
*
|
||||
* @param aString [in] String to convert
|
||||
*
|
||||
* @return the device attribute converted from |aString|
|
||||
*/
|
||||
BluetoothDeviceAttribute
|
||||
ConvertStringToDeviceAttribute(const nsAString& aString);
|
||||
@ -142,6 +146,8 @@ private:
|
||||
*
|
||||
* @param aType [in] Device property to check
|
||||
* @param aValue [in] New value of the device property
|
||||
*
|
||||
* @return true is the device attribute has changed; false otherwise
|
||||
*/
|
||||
bool IsDeviceAttributeChanged(BluetoothDeviceAttribute aType,
|
||||
const BluetoothValue& aValue);
|
||||
@ -152,7 +158,7 @@ private:
|
||||
* Parse 'Advertising Data Type' from an inquiry response and set name, UUIDs
|
||||
* and COD if they exist in ADV data.
|
||||
*
|
||||
* @param aAdvData [in] advertising data which provided by the LeScan result.
|
||||
* @param aAdvData [in] advertising data from LeScan result.
|
||||
*/
|
||||
void UpdatePropertiesFromAdvData(const nsTArray<uint8_t>& aAdvData);
|
||||
|
||||
|
@ -95,7 +95,7 @@ BluetoothDiscoveryHandle::DispatchLeDeviceEvent(BluetoothDevice* aLeDevice,
|
||||
|
||||
bool hasUuidsFilter = !mServiceUuids.IsEmpty();
|
||||
bool noAdvertisingUuid = remoteUuids.IsEmpty();
|
||||
// If a LE device doesn't advertise its service UUIDs, it can't possibly pass
|
||||
// If an LE device doesn't advertise its service UUIDs, it can't possibly pass
|
||||
// the UUIDs filter.
|
||||
if (hasUuidsFilter && noAdvertisingUuid) {
|
||||
return;
|
||||
@ -104,7 +104,7 @@ BluetoothDiscoveryHandle::DispatchLeDeviceEvent(BluetoothDevice* aLeDevice,
|
||||
// The web API startLeScan() makes the device's adapter start seeking for
|
||||
// remote LE devices advertising given service UUIDs.
|
||||
// Since current Bluetooth stack can't filter the results of LeScan by UUIDs,
|
||||
// gecko has to filter the results and dispach what API asked for.
|
||||
// gecko has to filter the results and dispatch what API asked for.
|
||||
bool matched = false;
|
||||
for (size_t index = 0; index < remoteUuids.Length(); ++index) {
|
||||
if (mServiceUuids.Contains(remoteUuids[index])) {
|
||||
@ -113,8 +113,8 @@ BluetoothDiscoveryHandle::DispatchLeDeviceEvent(BluetoothDevice* aLeDevice,
|
||||
}
|
||||
}
|
||||
|
||||
// Dispach 'devicefound 'event only if
|
||||
// - the service UUIDs in the scan record matchs the given UUIDs.
|
||||
// Dispatch 'devicefound' event only if
|
||||
// - the service UUID in the scan record matches one of the given UUIDs.
|
||||
// - the given UUIDs is empty.
|
||||
if (matched || mServiceUuids.IsEmpty()) {
|
||||
nsRefPtr<BluetoothLeDeviceEvent> event =
|
||||
|
@ -302,7 +302,8 @@ BluetoothGatt::HandleCharacteristicsDiscovered(const BluetoothValue& aValue)
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
MOZ_ASSERT(values.Length() == 2); // ServiceId, Characteristics
|
||||
MOZ_ASSERT(values[0].name().EqualsLiteral("serviceId"));
|
||||
MOZ_ASSERT(values[0].value().type() == BluetoothValue::TBluetoothGattServiceId);
|
||||
MOZ_ASSERT(values[0].value().type() ==
|
||||
BluetoothValue::TBluetoothGattServiceId);
|
||||
MOZ_ASSERT(values[1].name().EqualsLiteral("characteristics"));
|
||||
MOZ_ASSERT(values[1].value().type() ==
|
||||
BluetoothValue::TArrayOfBluetoothGattCharAttribute);
|
||||
@ -325,11 +326,13 @@ BluetoothGatt::HandleDescriptorsDiscovered(const BluetoothValue& aValue)
|
||||
aValue.get_ArrayOfBluetoothNamedValue();
|
||||
MOZ_ASSERT(values.Length() == 3); // ServiceId, CharacteristicId, Descriptors
|
||||
MOZ_ASSERT(values[0].name().EqualsLiteral("serviceId"));
|
||||
MOZ_ASSERT(values[0].value().type() == BluetoothValue::TBluetoothGattServiceId);
|
||||
MOZ_ASSERT(values[0].value().type() ==
|
||||
BluetoothValue::TBluetoothGattServiceId);
|
||||
MOZ_ASSERT(values[1].name().EqualsLiteral("characteristicId"));
|
||||
MOZ_ASSERT(values[1].value().type() == BluetoothValue::TBluetoothGattId);
|
||||
MOZ_ASSERT(values[2].name().EqualsLiteral("descriptors"));
|
||||
MOZ_ASSERT(values[2].value().type() == BluetoothValue::TArrayOfBluetoothGattId);
|
||||
MOZ_ASSERT(values[2].value().type() ==
|
||||
BluetoothValue::TArrayOfBluetoothGattId);
|
||||
|
||||
size_t index = mServices.IndexOf(
|
||||
values[0].value().get_BluetoothGattServiceId());
|
||||
|
@ -142,7 +142,7 @@ private:
|
||||
|
||||
/**
|
||||
* The value of a GATT characteristic has changed. In the mean time, the
|
||||
* cached value of this GATT characteristic has already been updated. An
|
||||
* cached value of this GATT characteristic has already been updated. A
|
||||
* 'characteristicchanged' event will be fired by this function.
|
||||
*
|
||||
* @param aValue [in] BluetoothValue which contains an array of
|
||||
|
@ -188,12 +188,14 @@ BluetoothGattCharacteristic::GetProperties(
|
||||
{
|
||||
aProperties.mBroadcast = mProperties & GATT_CHAR_PROP_BIT_BROADCAST;
|
||||
aProperties.mRead = mProperties & GATT_CHAR_PROP_BIT_READ;
|
||||
aProperties.mWriteNoResponse = mProperties & GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE;
|
||||
aProperties.mWriteNoResponse =
|
||||
mProperties & GATT_CHAR_PROP_BIT_WRITE_NO_RESPONSE;
|
||||
aProperties.mWrite = mProperties & GATT_CHAR_PROP_BIT_WRITE;
|
||||
aProperties.mNotify = mProperties & GATT_CHAR_PROP_BIT_NOTIFY;
|
||||
aProperties.mIndicate = mProperties & GATT_CHAR_PROP_BIT_INDICATE;
|
||||
aProperties.mSignedWrite = mProperties & GATT_CHAR_PROP_BIT_SIGNED_WRITE;
|
||||
aProperties.mExtendedProps = mProperties & GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES;
|
||||
aProperties.mExtendedProps =
|
||||
mProperties & GATT_CHAR_PROP_BIT_EXTENDED_PROPERTIES;
|
||||
}
|
||||
|
||||
class ReadValueTask final : public BluetoothReplyRunnable
|
||||
|
@ -38,7 +38,8 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(BluetoothLeDeviceEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(Event)
|
||||
|
||||
BluetoothLeDeviceEvent::BluetoothLeDeviceEvent(mozilla::dom::EventTarget* aOwner)
|
||||
BluetoothLeDeviceEvent::BluetoothLeDeviceEvent(
|
||||
mozilla::dom::EventTarget* aOwner)
|
||||
: Event(aOwner, nullptr, nullptr)
|
||||
{
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
@ -301,7 +301,8 @@ RemoveAllSignalHandlers(const nsAString& aKey,
|
||||
nsAutoPtr<BluetoothSignalObserverList>& aData,
|
||||
void* aUserArg)
|
||||
{
|
||||
BluetoothSignalObserver* handler = static_cast<BluetoothSignalObserver*>(aUserArg);
|
||||
BluetoothSignalObserver* handler =
|
||||
static_cast<BluetoothSignalObserver*>(aUserArg);
|
||||
aData->RemoveObserver(handler);
|
||||
// We shouldn't have duplicate instances in the ObserverList, but there's
|
||||
// no appropriate way to do duplication check while registering, so
|
||||
@ -320,13 +321,15 @@ BluetoothService::UnregisterAllSignalHandlers(BluetoothSignalObserver* aHandler)
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothService::DistributeSignal(const nsAString& aName, const nsAString& aPath)
|
||||
BluetoothService::DistributeSignal(const nsAString& aName,
|
||||
const nsAString& aPath)
|
||||
{
|
||||
DistributeSignal(aName, aPath, BluetoothValue(true));
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothService::DistributeSignal(const nsAString& aName, const nsAString& aPath,
|
||||
BluetoothService::DistributeSignal(const nsAString& aName,
|
||||
const nsAString& aPath,
|
||||
const BluetoothValue& aValue)
|
||||
{
|
||||
BluetoothSignal signal(nsString(aName), nsString(aPath), aValue);
|
||||
|
@ -184,14 +184,16 @@ BluetoothA2dpManager::Disconnect(BluetoothProfileController* aController)
|
||||
BluetoothService* bs = BluetoothService::Get();
|
||||
if (!bs) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_NO_AVAILABLE_RESOURCE));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mA2dpConnected) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -262,7 +264,8 @@ void
|
||||
BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
MOZ_ASSERT(aSignal.value().type() ==
|
||||
BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
|
||||
const nsString& address = aSignal.path();
|
||||
/**
|
||||
|
@ -378,7 +378,8 @@ static StaticAutoPtr<Monitor> sStopBluetoothMonitor;
|
||||
// Protects against bug 969447.
|
||||
static StaticAutoPtr<Monitor> sGetPropertyMonitor;
|
||||
|
||||
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
|
||||
typedef void (*UnpackFunc)(DBusMessage*, DBusError*,
|
||||
BluetoothValue&, nsAString&);
|
||||
typedef bool (*FilterFunc)(const BluetoothValue&);
|
||||
|
||||
static void
|
||||
@ -400,7 +401,8 @@ DispatchToBtThread(nsIRunnable* aRunnable)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!sBluetoothThread) {
|
||||
sBluetoothThread = new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
|
||||
sBluetoothThread =
|
||||
new LazyIdleThread(BT_LAZY_THREAD_TIMEOUT_MS,
|
||||
NS_LITERAL_CSTRING("BluetoothDBusService"),
|
||||
LazyIdleThread::ManualShutdown);
|
||||
ClearOnShutdown(&sBluetoothThread);
|
||||
@ -589,7 +591,8 @@ public:
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(mSignal.name().EqualsLiteral("PropertyChanged"));
|
||||
MOZ_ASSERT(mSignal.value().type() == BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
MOZ_ASSERT(mSignal.value().type() ==
|
||||
BluetoothValue::TArrayOfBluetoothNamedValue);
|
||||
|
||||
// Replace object path with device address
|
||||
nsString address = GetAddressFromObjectPath(mSignal.path());
|
||||
@ -733,7 +736,7 @@ RunDBusCallback(DBusMessage* aMsg, void* aBluetoothReplyRunnable,
|
||||
MOZ_ASSERT(!NS_IsMainThread()); // I/O thread
|
||||
#endif
|
||||
nsRefPtr<BluetoothReplyRunnable> replyRunnable =
|
||||
dont_AddRef(static_cast< BluetoothReplyRunnable* >(aBluetoothReplyRunnable));
|
||||
dont_AddRef(static_cast<BluetoothReplyRunnable*>(aBluetoothReplyRunnable));
|
||||
|
||||
MOZ_ASSERT(replyRunnable, "Callback reply runnable is null!");
|
||||
|
||||
@ -1472,7 +1475,8 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
|
||||
// Do not send a notification to upper layer, too annoying.
|
||||
return DBUS_HANDLER_RESULT_HANDLED;
|
||||
} else if (dbus_message_is_method_call(msg, DBUS_AGENT_IFACE, "RequestPairingConsent")) {
|
||||
} else if (dbus_message_is_method_call(msg, DBUS_AGENT_IFACE,
|
||||
"RequestPairingConsent")) {
|
||||
// Directly SetPairingconfirmation for RequestPairingConsent here
|
||||
if (!dbus_message_get_args(msg, nullptr,
|
||||
DBUS_TYPE_OBJECT_PATH, &objectPath,
|
||||
@ -1481,7 +1485,8 @@ AgentEventFilter(DBusConnection *conn, DBusMessage *msg, void *data)
|
||||
goto handle_error;
|
||||
}
|
||||
|
||||
nsString address = GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
nsString address =
|
||||
GetAddressFromObjectPath(NS_ConvertUTF8toUTF16(objectPath));
|
||||
sPairingReqTable->Put(address, msg);
|
||||
Task* task = new SetPairingConfirmationTask(address, true, nullptr);
|
||||
DispatchToDBusThread(task);
|
||||
@ -2093,12 +2098,13 @@ public:
|
||||
/* Normally we'll receive the signal 'AdapterAdded' with the adapter object
|
||||
* path from the DBus daemon during start up. So, there's no need to query
|
||||
* the object path of default adapter here. However, if we restart from a
|
||||
* crash, the default adapter might already be available, so we ask the daemon
|
||||
* explicitly here.
|
||||
* crash, the default adapter might already be available, so we ask the
|
||||
* daemon explicitly here.
|
||||
*/
|
||||
if (sAdapterPath.IsEmpty()) {
|
||||
bool success = sDBusConnection->SendWithReply(OnDefaultAdapterReply, nullptr,
|
||||
1000, BLUEZ_DBUS_BASE_IFC, "/",
|
||||
bool success = sDBusConnection->SendWithReply(OnDefaultAdapterReply,
|
||||
nullptr, 1000,
|
||||
BLUEZ_DBUS_BASE_IFC, "/",
|
||||
DBUS_MANAGER_IFACE,
|
||||
"DefaultAdapter",
|
||||
DBUS_TYPE_INVALID);
|
||||
@ -2483,7 +2489,8 @@ OnSendDiscoveryMessageReply(DBusMessage *aReply, void *aData)
|
||||
}
|
||||
|
||||
nsRefPtr<BluetoothReplyRunnable> runnable =
|
||||
dont_AddRef<BluetoothReplyRunnable>(static_cast<BluetoothReplyRunnable*>(aData));
|
||||
dont_AddRef<BluetoothReplyRunnable>(
|
||||
static_cast<BluetoothReplyRunnable*>(aData));
|
||||
|
||||
DispatchBluetoothReply(runnable.get(), BluetoothValue(true), errorStr);
|
||||
}
|
||||
@ -2823,8 +2830,8 @@ private:
|
||||
};
|
||||
|
||||
nsresult
|
||||
BluetoothDBusService::GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable)
|
||||
BluetoothDBusService::GetConnectedDevicePropertiesInternal(
|
||||
uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
@ -3534,8 +3541,8 @@ private:
|
||||
class OnGetServiceChannelReplyHandler : public DBusReplyHandler
|
||||
{
|
||||
public:
|
||||
OnGetServiceChannelReplyHandler(const nsAString& aDeviceAddress,
|
||||
const nsAString& aServiceUUID,
|
||||
OnGetServiceChannelReplyHandler(
|
||||
const nsAString& aDeviceAddress, const nsAString& aServiceUUID,
|
||||
BluetoothProfileManagerBase* aBluetoothProfileManager)
|
||||
: mDeviceAddress(aDeviceAddress),
|
||||
mServiceUUID(aServiceUUID),
|
||||
@ -3559,9 +3566,8 @@ public:
|
||||
channel = dbus_returns_int32(aReply);
|
||||
}
|
||||
|
||||
nsRefPtr<nsRunnable> r = new OnGetServiceChannelRunnable(mDeviceAddress,
|
||||
mServiceUUID,
|
||||
channel,
|
||||
nsRefPtr<nsRunnable> r =
|
||||
new OnGetServiceChannelRunnable(mDeviceAddress, mServiceUUID, channel,
|
||||
mBluetoothProfileManager);
|
||||
nsresult rv = NS_DispatchToMainThread(r);
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
@ -3877,8 +3883,8 @@ public:
|
||||
|
||||
// We currently don't support genre field in music player.
|
||||
// In order to send media metadata through AVRCP, we set genre to an empty
|
||||
// string to match the BlueZ method "UpdateMetaData" with signature "sssssss",
|
||||
// which takes genre field as the last parameter.
|
||||
// string to match the BlueZ method "UpdateMetaData" with signature
|
||||
// "sssssss", which takes genre field as the last parameter.
|
||||
nsCString tempGenre = EmptyCString();
|
||||
nsCString tempMediaNumber = EmptyCString();
|
||||
nsCString tempTotalMediaCount = EmptyCString();
|
||||
|
@ -55,8 +55,8 @@ public:
|
||||
GetAdaptersInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
GetConnectedDevicePropertiesInternal(
|
||||
uint16_t aServiceUuid, BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses,
|
||||
@ -66,9 +66,11 @@ public:
|
||||
FetchUuidsInternal(const nsAString& aDeviceAddress,
|
||||
BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
virtual void
|
||||
StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual void StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
virtual void
|
||||
StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) override;
|
||||
|
||||
virtual nsresult
|
||||
SetProperty(BluetoothObjectType aType,
|
||||
|
@ -590,7 +590,8 @@ BluetoothHfpManager::HandleVolumeChanged(nsISupports* aSubject)
|
||||
// {"key":"volumeup", "value":10}
|
||||
// {"key":"volumedown", "value":2}
|
||||
|
||||
RootedDictionary<dom::SettingChangeNotification> setting(nsContentUtils::RootingCx());
|
||||
RootedDictionary<dom::SettingChangeNotification>
|
||||
setting(nsContentUtils::RootingCx());
|
||||
|
||||
if (!WrappedJSToDictionary(aSubject, setting)) {
|
||||
return;
|
||||
@ -843,7 +844,8 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||
if (!atCommandValues[0].EqualsLiteral("3") ||
|
||||
!atCommandValues[1].EqualsLiteral("0")) {
|
||||
if (mCMEE) {
|
||||
SendCommand(RESPONSE_CME_ERROR, BluetoothCmeError::OPERATION_NOT_SUPPORTED);
|
||||
SendCommand(RESPONSE_CME_ERROR,
|
||||
BluetoothCmeError::OPERATION_NOT_SUPPORTED);
|
||||
} else {
|
||||
SendLine("ERROR");
|
||||
}
|
||||
@ -1225,7 +1227,8 @@ BluetoothHfpManager::Disconnect(BluetoothProfileController* aController)
|
||||
|
||||
if (!mSocket) {
|
||||
if (aController) {
|
||||
aController->NotifyCompletion(NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
aController->NotifyCompletion(
|
||||
NS_LITERAL_STRING(ERR_ALREADY_DISCONNECTED));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -1507,8 +1510,10 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||
case nsITelephonyService::CALL_STATE_HELD:
|
||||
switch (prevCallState) {
|
||||
case nsITelephonyService::CALL_STATE_CONNECTED: {
|
||||
uint32_t numActive = GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
|
||||
uint32_t numHeld = GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
|
||||
uint32_t numActive =
|
||||
GetNumberOfCalls(nsITelephonyService::CALL_STATE_CONNECTED);
|
||||
uint32_t numHeld =
|
||||
GetNumberOfCalls(nsITelephonyService::CALL_STATE_HELD);
|
||||
uint32_t numConCalls = GetNumberOfConCalls();
|
||||
|
||||
/**
|
||||
@ -1530,20 +1535,24 @@ BluetoothHfpManager::HandleCallStateChanged(uint32_t aCallIndex,
|
||||
if (!aIsConference) {
|
||||
if (numActive + numHeld == 1) {
|
||||
// A single active call is put on hold.
|
||||
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_NOACTIVE;
|
||||
sCINDItems[CINDType::CALLHELD].value =
|
||||
CallHeldState::ONHOLD_NOACTIVE;
|
||||
} else {
|
||||
// An active call is placed on hold or active/held calls swapped.
|
||||
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
|
||||
sCINDItems[CINDType::CALLHELD].value =
|
||||
CallHeldState::ONHOLD_ACTIVE;
|
||||
}
|
||||
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
|
||||
} else if (GetNumberOfConCalls(nsITelephonyService::CALL_STATE_HELD)
|
||||
== numConCalls) {
|
||||
if (numActive + numHeld == numConCalls) {
|
||||
// An active conference call is put on hold.
|
||||
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_NOACTIVE;
|
||||
sCINDItems[CINDType::CALLHELD].value =
|
||||
CallHeldState::ONHOLD_NOACTIVE;
|
||||
} else {
|
||||
// Active calls are placed on hold or active/held calls swapped.
|
||||
sCINDItems[CINDType::CALLHELD].value = CallHeldState::ONHOLD_ACTIVE;
|
||||
sCINDItems[CINDType::CALLHELD].value =
|
||||
CallHeldState::ONHOLD_ACTIVE;
|
||||
}
|
||||
SendCommand(RESPONSE_CIEV, CINDType::CALLHELD);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user