Esempio n. 1
0
void ProviderTestBasic::GetUint(IDvInvocation& aInvocation, IDvInvocationResponseUint& aValueUint)
{
    aInvocation.StartResponse();
    TUint val;
    GetPropertyVarUint(val);
    aValueUint.Write(val);
    aInvocation.EndResponse();
}
void DviProviderSubscriptionLongPoll::Renew(IDvInvocation& aInvocation, const Brx& aSid, TUint aRequestedDuration, IDvInvocationResponseUint& aDuration)
{
    DviSubscription* subscription = iDvStack.SubscriptionManager().Find(aSid);
    if (subscription == NULL) {
        aInvocation.Error(kErrorCodeBadSubscription, kErrorDescBadSubscription);
    }
    TUint timeout = aRequestedDuration;
    if (timeout > kTimeoutLongPollSecs) {
        timeout = kTimeoutLongPollSecs;
    }
    subscription->Renew(timeout);
    aInvocation.StartResponse();
    aDuration.Write(timeout);
    aInvocation.EndResponse();
}
void DviProviderSubscriptionLongPoll::Subscribe(IDvInvocation& aInvocation, const Brx& aClientId, const Brx& aUdn, const Brx& aService, TUint aRequestedDuration,
                                                IDvInvocationResponseString& aSid, IDvInvocationResponseUint& aDuration)
{
    if (aRequestedDuration > kTimeoutLongPollSecs) {
        aRequestedDuration = kTimeoutLongPollSecs;
    }

    DviDevice* device = iDvStack.DeviceMap().Find(aUdn);
    if (device == NULL) {
        aInvocation.Error(kErrorCodeBadDevice, kErrorDescBadDevice);
    }
    DviService* service = NULL;
    const TUint serviceCount = device->ServiceCount();
    for (TUint i=0; i<serviceCount; i++) {
        DviService* s = &device->Service(i);
        if (s->ServiceType().PathUpnp() == aService) {
            service = s;
            break;
        }
    }
    if (service == NULL) {
        aInvocation.Error(kErrorCodeBadService, kErrorDescBadService);
    }
    Brh sid;
    device->CreateSid(sid);
    TUint timeout = aRequestedDuration;
    DviSubscription* subscription = new DviSubscription(iDvStack, *device, iPropertyUpdateCollection, NULL, sid, timeout);

    aInvocation.StartResponse();
    aSid.Write(subscription->Sid());
    aSid.WriteFlush();
    aDuration.Write(timeout);
    aInvocation.EndResponse();

    // Start subscription, prompting availability of the first update (covering all state variables)
    iPropertyUpdateCollection.AddSubscription(aClientId, subscription);
    iDvStack.SubscriptionManager().AddSubscription(*subscription);
    service->AddSubscription(subscription);
}
Esempio n. 4
0
void ProviderTestBasic::Increment(IDvInvocation& aInvocation, TUint aValue, IDvInvocationResponseUint& aResult)
{
    aInvocation.StartResponse();
    aResult.Write(++aValue);
    aInvocation.EndResponse();
}