void BluetoothService::RegisterBluetoothSignalHandler( const nsAString& aNodeName, BluetoothSignalObserver* aHandler) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aHandler); BT_LOGD("[S] %s: %s", __FUNCTION__, NS_ConvertUTF16toUTF8(aNodeName).get()); BluetoothSignalObserverList* ol; if (!mBluetoothSignalObserverTable.Get(aNodeName, &ol)) { ol = new BluetoothSignalObserverList(); mBluetoothSignalObserverTable.Put(aNodeName, ol); } ol->AddObserver(aHandler); // Distribute pending pairing requests when pairing listener has been added // to signal observer table. if (XRE_IsParentProcess() && !mPendingPairReqSignals.IsEmpty() && aNodeName.EqualsLiteral(KEY_PAIRING_LISTENER)) { for (uint32_t i = 0; i < mPendingPairReqSignals.Length(); ++i) { DistributeSignal(mPendingPairReqSignals[i]); } mPendingPairReqSignals.Clear(); } }
nsresult BluetoothService::RegisterBluetoothSignalHandler(const nsAString& aNodeName, BluetoothSignalObserver* aHandler) { MOZ_ASSERT(NS_IsMainThread()); BluetoothSignalObserverList* ol; if (!mBluetoothSignalObserverTable.Get(aNodeName, &ol)) { ol = new BluetoothSignalObserverList(); mBluetoothSignalObserverTable.Put(aNodeName, ol); } ol->AddObserver(aHandler); return NS_OK; }
void BluetoothService::RegisterBluetoothSignalHandler( const nsAString& aNodeName, BluetoothSignalObserver* aHandler) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aHandler); BT_LOG("[S] %s: %s", __FUNCTION__, NS_ConvertUTF16toUTF8(aNodeName).get()); BluetoothSignalObserverList* ol; if (!mBluetoothSignalObserverTable.Get(aNodeName, &ol)) { ol = new BluetoothSignalObserverList(); mBluetoothSignalObserverTable.Put(aNodeName, ol); } ol->AddObserver(aHandler); }