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


C++ DviDevice::SetEnabled方法代码示例

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


在下文中一共展示了DviDevice::SetEnabled方法的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;
}
开发者ID:Jacik,项目名称:ohNet,代码行数:58,代码来源:TestDviDiscovery.cpp


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