当前位置: 首页>>代码示例>>C++>>正文


C++ CpiSubscription::SetSid方法代码示例

本文整理汇总了C++中CpiSubscription::SetSid方法的典型用法代码示例。如果您正苦于以下问题:C++ CpiSubscription::SetSid方法的具体用法?C++ CpiSubscription::SetSid怎么用?C++ CpiSubscription::SetSid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CpiSubscription的用法示例。


在下文中一共展示了CpiSubscription::SetSid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Subscribe

TUint CpiDeviceDv::Subscribe(CpiSubscription& aSubscription, const OpenHome::Uri& /*aSubscriber*/)
{
    Brh sid;
    iDeviceDv.CreateSid(sid);
    Brn tmp(sid);
    Brh transfer(tmp);
    aSubscription.SetSid(transfer);
    TUint durationSecs = iDeviceCp->GetCpStack().Env().InitParams()->SubscriptionDurationSecs();
    DviSubscription* subscriptionDv = new DviSubscription(iDeviceDv.GetDvStack(), iDeviceDv, *this, NULL, sid);
    subscriptionDv->AddRef(); // guard against subscription expiring before client tries to renew or unsubscribe
    iDeviceDv.GetDvStack().SubscriptionManager().AddSubscription(*subscriptionDv);
    subscriptionDv->SetDuration(durationSecs);

    iLock.Wait();
    if (iSubscriptions.size() == 0) {
        iShutdownSem.Wait(); // consume shutdown signal now the map is non-empty
    }
    Brn sid2(subscriptionDv->Sid());
    Subscription* subscription = new Subscription(aSubscription, subscriptionDv);
    iSubscriptions.insert(std::pair<Brn,Subscription*>(sid2, subscription));
    iDeviceCp->AddRef();
    iLock.Signal();

    DviService* service = iDeviceDv.ServiceReference(aSubscription.ServiceType());
    ASSERT(service != NULL);
    service->AddSubscription(subscriptionDv);
    service->RemoveRef();

    return durationSecs;
}
开发者ID:Montellese,项目名称:ohNet,代码行数:30,代码来源:CpiDeviceDv.cpp

示例2: Subscribe

TUint CpiDeviceLpec::Subscribe(CpiSubscription& aSubscription, const OpenHome::Uri& /*aSubscriber*/)
{
    Semaphore sem("CLS2", 0);
    SubscriptionResponse resp(sem);
    AutoMutex a(iLock);
    iResponseHandler = &resp;
    iWriteBuffer->Write(Lpec::kMethodSubscribe);
    iWriteBuffer->Write(' ');
    iWriteBuffer->Write(iLpecName);
    iWriteBuffer->Write('/');
    iWriteBuffer->Write(aSubscription.ServiceType().Name());
    iWriteBuffer->Write(Lpec::kMsgTerminator);
    iWriteBuffer->WriteFlush();

    sem.Wait();
    Bws<128> sid(iDevice->Udn());
    sid.Append('-');
    sid.Append(resp.SidFragment());
    Brh sid2(sid);
    aSubscription.SetSid(sid2);

    iResponseHandler = NULL;
    return UINT_MAX; // subscription never expires so report the longest possible duration
}
开发者ID:Jacik,项目名称:ohNet,代码行数:24,代码来源:CpiDeviceLpec.cpp


注:本文中的CpiSubscription::SetSid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。