本文整理汇总了C++中DviDevice::SetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ DviDevice::SetAttribute方法的具体用法?C++ DviDevice::SetAttribute怎么用?C++ DviDevice::SetAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DviDevice
的用法示例。
在下文中一共展示了DviDevice::SetAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Test
void SuiteAlive::Test()
{
Environment& env = iDvStack.Env();
Blocker* blocker = new Blocker(env);
CpListenerBasic* listener = new CpListenerBasic;
NetworkAdapter* nif = env.NetworkAdapterList().CurrentAdapter(kAdapterCookie);
SsdpListenerMulticast* listenerMulticast = new SsdpListenerMulticast(env, nif->Address());
nif->RemoveRef(kAdapterCookie);
TInt listenerId = listenerMulticast->AddNotifyHandler(listener);
listenerMulticast->Start();
DviDevice* device = new DviDeviceStandard(iDvStack, gNameDevice1);
device->SetAttribute("Upnp.Domain", "a.b.c");
device->SetAttribute("Upnp.Type", "type1");
device->SetAttribute("Upnp.Version", "1");
AddService(device, new DviService(iDvStack, "a.b.c", "service1", 1));
AddService(device, new DviService(iDvStack, "a.b.c", "service2", 1));
device->SetEnabled();
blocker->Wait(1);
/* we expect 5 messages but linux sometimes reports multicast messages from
all subnets to listeners on any single subnet so just check that we've
received a multiple of 5 messages */
TEST(listener->TotalAlives() > 0);
TEST(listener->TotalAlives() == listener->TotalByeByes());
TEST(listener->TotalAlives() % 5 == 0);
TUint byebyes = listener->TotalByeByes();
Functor disabled = MakeFunctor(*this, &SuiteAlive::Disabled);
device->SetDisabled(disabled);
iSem.Wait();
blocker->Wait(1); /* semaphore being signalled implies that the device has been
disabled. We may require some extra time to receive the
multicast byebye confirming this */
TEST(listener->TotalByeByes() > byebyes);
TEST(listener->TotalByeByes() % 5 == 0);
TUint alives = listener->TotalAlives();
byebyes = listener->TotalByeByes();
device->SetEnabled();
blocker->Wait(1);
TEST(listener->TotalAlives() > alives);
TEST(listener->TotalAlives() - alives == listener->TotalByeByes() - byebyes);
TEST(listener->TotalAlives() % 5 == 0);
// Control point doesn't process ssdp:update notifications
// check that updates are basically working by counting the extra alive messages instead
alives = listener->TotalAlives();
device->SetAttribute("Upnp.TestUpdate", "1");
blocker->Wait(1);
TEST(listener->TotalAlives() > alives);
TEST(listener->TotalAlives() % 5 == 0);
device->Destroy();
listenerMulticast->RemoveNotifyHandler(listenerId);
delete listenerMulticast;
delete listener;
delete blocker;
}