本文整理汇总了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;
}
示例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
}