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


C++ DeviceList::Count方法代码示例

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


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

示例1: TestSubscription

void TestSubscription(CpStack& aCpStack)
{
    gSubscriptionCount = 0; // reset this here in case we're run multiple times via TestShell
    Debug::SetLevel(Debug::kNone);
    Environment& env = aCpStack.Env();
    DeviceList* deviceList = new DeviceList(env);
    FunctorCpDevice added = MakeFunctorCpDevice(*deviceList, &DeviceList::Added);
    FunctorCpDevice removed = MakeFunctorCpDevice(*deviceList, &DeviceList::Removed);
    const Brn domainName("upnp.org");
    const Brn serviceType("ConnectionManager");
#if 1
    const TUint ver = 1;
    CpDeviceListUpnpServiceType* list =
                new CpDeviceListUpnpServiceType(aCpStack, domainName, serviceType, ver, added, removed);
#else
    const Brn uuid("896659847466-a4badbeaacbc-737837");
    CpDeviceListUpnpUuid* list = new CpDeviceListUpnpUuid(aCpStack, uuid, added, removed);
#endif
    Blocker* blocker = new Blocker(env);
    blocker->Wait(env.InitParams().MsearchTimeSecs());
    delete blocker;
    deviceList->Stop();

    TUint startTime = Os::TimeInMs(env.OsCtx());
    deviceList->Poll();

    const TUint count = deviceList->Count();
    Print("\n%u subscriptions on %u devices (avg %u) in %u seconds\n",
                        gSubscriptionCount, count, (count==0? 0 : gSubscriptionCount/count), (Os::TimeInMs(env.OsCtx())-startTime+500)/1000);

    delete list;
    delete deviceList;
}
开发者ID:ACDN,项目名称:ohNet,代码行数:33,代码来源:TestSubscription.cpp

示例2: OhNetTestRunner

extern "C" void OhNetTestRunner(OhNetHandleInitParams aInitParams)
{
    OhNetLibraryInitialise(aInitParams);
    OhNetLibraryStartCp();
//    Debug::SetLevel(Debug::kService);

    DeviceList* deviceList = new DeviceList;
    HandleCpDeviceList dlh = CpDeviceListCreateUpnpServiceType("upnp.org", "ConnectionManager", 1,
                                                               added, deviceList, removed, deviceList);
    Blocker* blocker = new Blocker;
    blocker->Wait(OhNetInitParamsMsearchTimeSecs(aInitParams));
    delete blocker;
    deviceList->Stop();

    deviceList->InvokeSync();

    Print("\n\n");
    const TUint count = deviceList->Count();
    TUint startTime = Os::TimeInMs();
    deviceList->PollInvoke();
    Print("\n%u actions invoked on %u devices (avg %u) in %u seconds\n\n",
                        gActionCount, count, (count==0? 0 : gActionCount/count), (Os::TimeInMs()-startTime+500)/1000);

    startTime = Os::TimeInMs();
    deviceList->PollSubscribe();
    Print("\n%u subscriptions on %u devices (avg %u) in %u seconds\n",
                        gSubscriptionCount, count, (count==0? 0 : gSubscriptionCount/count), (Os::TimeInMs()-startTime+500)/1000);

    CpDeviceListDestroy(dlh);
    delete deviceList;

    OhNetLibraryClose();
}
开发者ID:wifigeek,项目名称:ohNet,代码行数:33,代码来源:TestProxyC.cpp

示例3: domainName

void OpenHome::TestFramework::Runner::Main(TInt /*aArgc*/, TChar* /*aArgv*/[], InitialisationParams* aInitParams)
{
    FunctorAsync dummy;
    /* Set an empty handler for errors to avoid test output being swamped by expected
       errors from invocations we interrupt at the end of each device's 1s timeslice */
    aInitParams->SetAsyncErrorHandler(dummy);
    UpnpLibrary::Initialise(aInitParams);
    std::vector<NetworkAdapter*>* subnetList = UpnpLibrary::CreateSubnetList();
    TIpAddress subnet = (*subnetList)[0]->Subnet();
    UpnpLibrary::DestroySubnetList(subnetList);
    UpnpLibrary::StartCp(subnet);

    Debug::SetLevel(Debug::kNone);
    DeviceList* deviceList = new DeviceList;
    FunctorCpDeviceCpp added = MakeFunctorCpDeviceCpp(*deviceList, &DeviceList::Added);
    FunctorCpDeviceCpp removed = MakeFunctorCpDeviceCpp(*deviceList, &DeviceList::Removed);
    std::string domainName("upnp.org");
    std::string serviceType("ConnectionManager");
#if 1
    const TUint ver = 1;
    CpDeviceListCppUpnpServiceType* list =
                new CpDeviceListCppUpnpServiceType(domainName, serviceType, ver, added, removed);
#else
    const std::string uuid("896659847466-8000600fe800-737837");
    CpDeviceListCppUpnpUuid* list = new CpDeviceListCppUpnpUuid(uuid, added, removed);
#endif
    Blocker* blocker = new Blocker(*gEnv);
    blocker->Wait(aInitParams->MsearchTimeSecs());
    delete blocker;
    deviceList->Stop();

    TUint startTime = Os::TimeInMs(gEnv->OsCtx());
    deviceList->TestSync();
    deviceList->Poll();

    const TUint count = deviceList->Count();
    Print("\n%u actions invoked on %u devices (avg %u) in %u seconds\n",
                        gActionCount, count, (count==0? 0 : gActionCount/count), (Os::TimeInMs(gEnv->OsCtx())-startTime+500)/1000);

    delete list;
    delete deviceList;

    UpnpLibrary::Close();
}
开发者ID:DoomHammer,项目名称:ohNet,代码行数:44,代码来源:TestInvocationStd.cpp


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