Esempio n. 1
0
void DeviceListTI::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs() > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceListTI::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    Brh source;
    Brh sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.Bytes() == 0) {
        ASSERT(iExpectedSink.Bytes() == 0);
    }
    else {
        if (iExpectedSink.Bytes() == 0) {
            sink.TransferTo(iExpectedSink);
        }
        else {
            ASSERT(sink == iExpectedSink);
        }
    }
    iLock.Signal();
}
Esempio n. 2
0
void TestStack::Push(TChar aChar)
{
    iLock.Wait();
    ASSERT(iCount < kMaxStackEntries);
    iStack[iCount++] = aChar;
    iLock.Signal();
}
Esempio n. 3
0
void CpDevices::Validate(std::vector<const char*>& aExpectedUdns)
{
    iLock.Wait();
    TBool wait = (aExpectedUdns.size() > iList.size());
    iTargetCount = (TUint)aExpectedUdns.size();
    iLock.Signal();
    if (wait) {
        try {
            iSem.Wait(30 * 1000);
        }
        catch (Timeout&) {
            Print("ERROR: Failed to detect sufficient devices\n");
        }
    }
    if (aExpectedUdns.size() != iList.size()) {
        Print("ERROR: expected %u devices, found %u\n", aExpectedUdns.size(), iList.size());
        ASSERTS();
    }
    while (aExpectedUdns.size() > 0) {
        Brn expected(aExpectedUdns[0]);
        TBool found = false;
        for (TUint i=0; i<iList.size(); i++) {
            if (expected == iList[i]->Udn()) {
                Brh friendlyName;
                iList[i]->GetAttribute("Upnp.FriendlyName", friendlyName);
                ASSERT(friendlyName == expected);
                aExpectedUdns.erase(aExpectedUdns.begin());
                found = true;
                break;
            }
        }
        ASSERT(found);
    }
    ASSERT(aExpectedUdns.size() == 0);
}
Esempio n. 4
0
void SuiteMulticast::Receiver()
{
    iPortLock.Wait();
    SocketUdpMulticast recv(0, Endpoint(iPort, kMulticastAddress));
    iPort = recv.Port();
    iPortLock.Signal();

    iSender.Signal(); // signal ready to begin receiving

    Bwh buf(kBufBytes);
    Brn exp = iExp.Split(4);
    while(1) {
        recv.Receive(buf);
        TUint num = *((TUint32*)buf.Ptr());
        if(num == kQuit) {
            break;
        }
        Brn exp2 = exp.Split(0, num);
        Brn buf2 = buf.Split(4);
        TEST(buf2 == exp2);
        iSender.Signal();
    }

    iSender.Signal();
}
Esempio n. 5
0
void DeviceList::GetProtocolInfoComplete(IAsync& aAsync)
{
    if (Os::TimeInMs(gEnv->OsCtx()) > iStopTimeMs) {
        return;
    }
    FunctorAsync callback = MakeFunctorAsync(*this, &DeviceList::GetProtocolInfoComplete);
    iConnMgr->BeginGetProtocolInfo(callback);

    std::string source;
    std::string sink;
    iConnMgr->EndGetProtocolInfo(aAsync, source, sink); // throws if invocation failed
    iLock.Wait();
    gActionCount++;
    if (sink.length() == 0) {
        ASSERT(iExpectedSink.length() == 0);
    }
    else {
        if (iExpectedSink.length() == 0) {
            iExpectedSink.assign(sink);
        }
        else {
            //ASSERT(sink.compare(iExpectedSink) == 0);
            // can't use the above assertion.  aVia Media Renderer sometimes responds with two copies of its supported protocols
        }
    }
    iLock.Signal();
}
Esempio n. 6
0
void CpDevices::Added(CpDevice& aDevice)
{
    iLock.Wait();
    const Brx& udn = aDevice.Udn();
    if (udn == gNameDevice1 || udn == gNameDevice1_1 || udn == gNameDevice1_2 || udn == gNameDevice2) {
        iList.push_back(&aDevice);
        aDevice.AddRef();
    }
    iLock.Signal();
}
Esempio n. 7
0
void CpDevices::Added(CpDeviceCpp& aDevice)
{
    iLock.Wait();
    if (iList.size() == 0 && aDevice.Udn() == iTargetUdn) {
        iList.push_back(&aDevice);
        aDevice.AddRef();
        iAddedSem.Signal();
    }
    iLock.Signal();
}
Esempio n. 8
0
TBool CpListenerBasic::LogRemove(const Brx& aUuid)
{
    if (aUuid == SuiteAlive::gNameDevice1) {
        iLock.Wait();
        iTotalByeByes++;
        iLock.Signal();
        return true;
    }
    return false;
}
Esempio n. 9
0
TBool TestStack::Pop(TChar aChar)
{
    TBool matches;
    iLock.Wait();
    ASSERT(iCount != 0);
    iCount--;
    matches = (aChar==iStack[iCount]);
    iLock.Signal();
    return matches;
}
Esempio n. 10
0
void CpDevices::Clear()
{
    iLock.Wait();
    const TUint count = (TUint)iList.size();
    for (TUint i=0; i<count; i++) {
        iList[i]->RemoveRef();
    }
    iList.clear();
    iLock.Signal();
}
Esempio n. 11
0
void CpDevices::Added(CpDevice& aDevice)
{
    iLock.Wait();
    const Brx& udn = aDevice.Udn();
    if (udn == gNameDevice1 || udn == gNameDevice1_1 || udn == gNameDevice1_2 || udn == gNameDevice2) {
        iList.push_back(&aDevice);
        aDevice.AddRef();
    }
    if ((TUint)iList.size() == iTargetCount) {
        iSem.Signal();
    }
    iLock.Signal();
}
Esempio n. 12
0
void DeviceListLogger::PrintDeviceInfo(const char* aPrologue, const CpDevice& aDevice)
{
    iLock.Wait();
    Print("%s\n    udn = ", aPrologue);
    Print(aDevice.Udn());
    Print("\n    location = ");
    Brh val;
    aDevice.GetAttribute("Upnp.Location", val);
    Print(val);
    Print("\n    name = ");
    aDevice.GetAttribute("Upnp.FriendlyName", val);
    Print(val);
    Print("\n");
    iLock.Signal();
}
Esempio n. 13
0
void CpDevices::Removed(CpDevice& aDevice)
{
    /* A device sends out byebye messages before alives after being enabled.
    (This is required for many buggy control points which don't spot a change of location otherwise.)
    Its possible that the last of these byebyes may get interleaved with the first msearch responses,
    leading to a device being added, removed, then added again.
    Accept that this is possible and cope with devices being removed. */
    iLock.Wait();
    const Brx& udn = aDevice.Udn();
    for (TUint i=0; i<iList.size(); i++) {
        if (iList[i]->Udn() == udn) {
            iList[i]->RemoveRef();
            iList.erase(iList.begin() + i);
            break;
        }
    }
    iLock.Signal();
}
Esempio n. 14
0
void CpListenerMsearch::Reset()
{
    iLock.Wait();
    iTotal = 0;
    iRoot = 0;
    iUdn = 0;
    iDevice = 0;
    iService = 0;
    iUdnsReceived = 0;
    
    free(iDev1Type);
    iDev1Type = NULL;
    free(iDev2Type);
    iDev2Type = NULL;
    free(iDev21Type);
    iDev21Type = NULL;
    for (TUint i=0; i<iServices.size(); i++) {
        free(iServices[i]);
    }
    iServices.clear();
    iLock.Signal();
}
Esempio n. 15
0
void CpProxyAvOpenhomeOrgSender1C::SetPropertyMetadataChanged(Functor& aFunctor)
{
    iLock.Wait();
    iMetadataChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 16
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertyDurationChanged(Functor& aFunctor)
{
    iLock.Wait();
    iDurationChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 17
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertyDetailsCountChanged(Functor& aFunctor)
{
    iLock.Wait();
    iDetailsCountChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 18
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertyBitDepthChanged(Functor& aFunctor)
{
    iLock.Wait();
    iBitDepthChanged = aFunctor;
    iLock.Signal();
}
void CpProxyLinnCoUkExaktInputs1C::SetPropertyAssociationsChanged(Functor& aFunctor)
{
    iLock.Wait();
    iAssociationsChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 20
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertySampleRateChanged(Functor& aFunctor)
{
    iLock.Wait();
    iSampleRateChanged = aFunctor;
    iLock.Signal();
}
void CpProxyUpnpOrgSwitchPower1C::SetPropertyStatusChanged(Functor& aFunctor)
{
    iLock.Wait();
    iStatusChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 22
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertyMetatextChanged(Functor& aFunctor)
{
    iLock.Wait();
    iMetatextChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 23
0
void CpProxyAvOpenhomeOrgInfo1C::SetPropertyCodecNameChanged(Functor& aFunctor)
{
    iLock.Wait();
    iCodecNameChanged = aFunctor;
    iLock.Signal();
}
void CpProxyAvOpenhomeOrgExakt2C::SetPropertyConnectionStatusChanged(Functor& aFunctor)
{
    iLock.Wait();
    iConnectionStatusChanged = aFunctor;
    iLock.Signal();
}
void CpProxyAvOpenhomeOrgExakt2C::SetPropertyVersionChanged(Functor& aFunctor)
{
    iLock.Wait();
    iVersionChanged = aFunctor;
    iLock.Signal();
}
void CpProxyAvOpenhomeOrgExakt2C::SetPropertyDeviceListChanged(Functor& aFunctor)
{
    iLock.Wait();
    iDeviceListChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 27
0
void CpProxyUpnpOrgConnectionManager1C::SetPropertySinkProtocolInfoChanged(Functor& aFunctor)
{
    iLock.Wait();
    iSinkProtocolInfoChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 28
0
void CpProxyAvOpenhomeOrgSender1C::SetPropertyAttributesChanged(Functor& aFunctor)
{
    iLock.Wait();
    iAttributesChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 29
0
void CpProxyUpnpOrgConnectionManager1C::SetPropertyCurrentConnectionIDsChanged(Functor& aFunctor)
{
    iLock.Wait();
    iCurrentConnectionIDsChanged = aFunctor;
    iLock.Signal();
}
Esempio n. 30
0
void CpProxyAvOpenhomeOrgSender1C::SetPropertyPresentationUrlChanged(Functor& aFunctor)
{
    iLock.Wait();
    iPresentationUrlChanged = aFunctor;
    iLock.Signal();
}