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


C++ CAmSocketHandler::start_listenting方法代码示例

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


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

示例1: run_service

void* run_service(void*)
{
	CAmSocketHandler socketHandler;
	CAmTestCAPIWrapper wrapper(&socketHandler);
	CAmCommandSenderCAPI plugin(&wrapper);
	env->mpPlugin = &plugin;
	env->mSocketHandlerService = &socketHandler;
	MockIAmCommandReceive mock;
	env->mpCommandReceive = &mock;
    if(plugin.startupInterface(env->mpCommandReceive)!=E_OK)
	{
		logError("CommandSendInterface can't start!");
	}
    else
    {
    	ON_CALL(*env->mpCommandReceive, getListMainSources(_)).WillByDefault(Return(E_OK));
    	ON_CALL(*env->mpCommandReceive, getListMainSinks(_)).WillByDefault(Return(E_OK));
    	ON_CALL(*env->mpCommandReceive, getListMainSourceSoundProperties(_,_)).WillByDefault(Return(E_OK));

    	EXPECT_CALL(*env->mpCommandReceive,confirmCommandReady(10,_));
    	plugin.setCommandReady(10);
    	socketHandler.start_listenting();

    	EXPECT_CALL(*env->mpCommandReceive,confirmCommandRundown(10,_));
    	plugin.setCommandRundown(10);
    	plugin.tearDownInterface(env->mpCommandReceive);
    }

//Cleanup
    env->mpPlugin = NULL;
    env->mpCommandReceive = NULL;
    env->mSocketHandlerClient = NULL;

    return (NULL);
}
开发者ID:Pelagicore,项目名称:AudioManager,代码行数:35,代码来源:CAmCommandSenderCAPITest.cpp

示例2:

TEST_F(CAmRoutingReceiverAsync,setDomainState)
{
    am_domainID_t domainID = 1;
    am_DomainState_e state = DS_INDEPENDENT_RUNDOWN;

    EXPECT_CALL(pReceiveInterface,hookDomainStateChange(_,DS_INDEPENDENT_RUNDOWN)).Times(1);

    ASSERT_EQ(E_OK, pRouter->setDomainState(domainID,state));
    pSocketHandler.start_listenting();
}
开发者ID:Airtau,项目名称:genivi,代码行数:10,代码来源:CAmRoutingReceiverAsync.cpp

示例3: SetUp

void CAmEnvironment::SetUp()
{
    logInfo("RoutingSendInterface Test started ");

    std::vector<int> domainIDs;
    domainIDs.push_back(0);
    domainIDs.push_back(1);

    EXPECT_CALL(pReceiveInterface,getSocketHandler(_)).WillOnce(DoAll(SetArgReferee<0>(&pSocketHandler), Return(E_OK)));
    EXPECT_CALL(pReceiveInterface,registerDomain(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleDomainRegister));
    EXPECT_CALL(pReceiveInterface,registerSource(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleSourceRegister));
    EXPECT_CALL(pReceiveInterface,registerSink(_,_)).WillRepeatedly(Invoke(CAmEnvironment::handleSinkRegister));
    EXPECT_CALL(pReceiveInterface,confirmRoutingReady(_)).Times(1);

    IAmRoutingSend* (*createFunc)();
    void* tempLibHandle = NULL;
    std::string libname("../plugins/routing/libPluginRoutingInterfaceAsync.so");
    createFunc = getCreateFunction<IAmRoutingSend*()>(libname, tempLibHandle);

    if (!createFunc)
    {
        logError("RoutingSendInterface Test Entry point of RoutingPlugin not found");
        exit(1);
    }

    pRouter = createFunc();

    if (!pRouter)
    {
        logError("RoutingSendInterface Test RoutingPlugin initialization failed. Entry Function not callable");
        exit(1);
    }

    pRouter->startupInterface(&pReceiveInterface);
    pRouter->setRoutingReady(10);

    timespec t;
    t.tv_nsec = 500000000;
    t.tv_sec = 1;

    sh_timerHandle_t handle;

    //lets use a timeout so the test will finish
    pSocketHandler.addTimer(t, &ptimerCallback, handle, (void*) NULL);
    pSocketHandler.start_listenting();

}
开发者ID:Airtau,项目名称:genivi,代码行数:47,代码来源:CAmRoutingReceiverAsync.cpp

示例4: sleep

TEST_F(CAmRoutingReceiverAsync,connectAbort)
{

    am_Handle_s handle;
    handle.handle = 1;
    handle.handleType = H_CONNECT;

    am_connectionID_t connectionID = 4;
    am_sourceID_t sourceID = 2;
    am_sinkID_t sinkID = 1;
    am_ConnectionFormat_e format = CF_GENIVI_ANALOG;

    EXPECT_CALL(pReceiveInterface,ackConnect(_,connectionID,E_ABORTED)).Times(1);
    ASSERT_EQ(E_OK, pRouter->asyncConnect(handle,connectionID,sourceID,sinkID,format));
    sleep(0.5);
    ASSERT_EQ(E_OK, pRouter->asyncAbort(handle));
    pSocketHandler.start_listenting();
}
开发者ID:Airtau,项目名称:genivi,代码行数:18,代码来源:CAmRoutingReceiverAsync.cpp

示例5: ackSinkVolumeTick

TEST_F(CAmRoutingReceiverAsync,setSinkVolumeAbort)
{

    am_Handle_s handle;
    handle.handle = 1;
    handle.handleType = H_SETSINKVOLUME;

    am_sinkID_t sinkID = 2;
    am_volume_t volume = 25;
    am_RampType_e ramp = RAMP_GENIVI_DIRECT;
    am_time_t myTime = 25;

    EXPECT_CALL(pReceiveInterface, ackSinkVolumeTick(_,sinkID,_));
    EXPECT_CALL(pReceiveInterface,ackSetSinkVolumeChange(_,AllOf(Ne(volume),Ne(0)),E_ABORTED)).Times(1);

    ASSERT_EQ(E_OK, pRouter->asyncSetSinkVolume(handle,sinkID,volume,ramp,myTime));
    sleep(0.5);
    ASSERT_EQ(E_OK, pRouter->asyncAbort(handle));
    pSocketHandler.start_listenting();
}
开发者ID:Airtau,项目名称:genivi,代码行数:20,代码来源:CAmRoutingReceiverAsync.cpp

示例6: run_client

void* run_client(void*)
{
	CAmSocketHandler socketHandler;
	CAmTestCAPIWrapper wrapper(&socketHandler);
	env->mSocketHandlerClient = &socketHandler;
	std::shared_ptr<CommonAPI::Factory> factory = wrapper.factory();
	env->mProxy = factory->buildProxy<org::genivi::am::CommandControlProxy>(CAmCommandSenderCAPI::COMMAND_SENDER_SERVICE);
	env->mProxy->getProxyStatusEvent().subscribe(std::bind(&CAmTestsEnvironment::onServiceStatusEvent,env,std::placeholders::_1));

	pthread_mutex_lock(&mutexSer);
	env->mIsProxyInitilized = true;
	pthread_mutex_unlock(&mutexSer);
	pthread_cond_signal(&condSer);

	socketHandler.start_listenting();

//Cleanup
    env->mProxy.reset();
    env->mSocketHandlerClient = NULL;

    return (NULL);
}
开发者ID:Pelagicore,项目名称:AudioManager,代码行数:22,代码来源:CAmCommandSenderCAPITest.cpp

示例7: run_the_loop

void* run_the_loop(void* wrapper)
{
    CAmSocketHandler* wrap = (CAmSocketHandler*) wrapper;
    wrap->start_listenting();
    return (NULL);
}
开发者ID:Pelagicore,项目名称:AudioManager,代码行数:6,代码来源:CAmCommandSenderDbusTest.cpp

示例8: mainProgram

void mainProgram()
{
    //Instantiate all classes. Keep in same order !
    CAmSocketHandler iSocketHandler;

#ifdef WITH_CAPI_WRAPPER
    //We instantiate a singleton with the current socket handler, which loads the common-api runtime.
    CAmCommonAPIWrapper *pCAPIWrapper = CAmCommonAPIWrapper::instantiateOnce(&iSocketHandler);
    CAmCommonAPIWrapper iDBusWrapper = *pCAPIWrapper;
#ifdef WITH_NSM
    CAmNodeStateCommunicatorCAPI iNodeStateCommunicator(&iDBusWrapper);
#endif /*WITH_NSM*/
#endif /*WITH_CAPI_WRAPPER */

#ifdef WITH_DBUS_WRAPPER
    CAmDbusWrapper iDBusWrapper(&iSocketHandler,dbusWrapperType);
#ifdef WITH_NSM
    CAmNodeStateCommunicatorDBus iNodeStateCommunicator(&iDBusWrapper);
#endif /*WITH_NSM*/
#endif /*WITH_DBUS_WRAPPER */

#ifdef WITH_SYSTEMD_WATCHDOG
    CAmWatchdog iWatchdog(&iSocketHandler);
#endif /*WITH_SYSTEMD_WATCHDOG*/

#ifdef WITH_DATABASE_STORAGE
    CAmDatabaseHandlerSQLite iDatabaseHandler(databasePath);
#else
    CAmDatabaseHandlerMap iDatabaseHandler;
#endif /*WITH_DATABASE_STORAGE*/
    IAmDatabaseHandler *pDatabaseHandler = dynamic_cast<IAmDatabaseHandler*>( &iDatabaseHandler );

    CAmRoutingSender iRoutingSender(listRoutingPluginDirs, iSocketHandler);
    CAmCommandSender iCommandSender(listCommandPluginDirs);
    CAmControlSender iControlSender(controllerPlugin,&iSocketHandler);
    CAmRouter iRouter(pDatabaseHandler, &iControlSender);

#ifdef WITH_DBUS_WRAPPER
    CAmCommandReceiver iCommandReceiver(pDatabaseHandler, &iControlSender, &iSocketHandler, &iDBusWrapper);
    CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler, &iRoutingSender, &iControlSender, &iSocketHandler, &iDBusWrapper);
#else /*WITH_DBUS_WRAPPER*/
	    CAmCommandReceiver iCommandReceiver(pDatabaseHandler,&iControlSender,&iSocketHandler);
	    CAmRoutingReceiver iRoutingReceiver(pDatabaseHandler,&iRoutingSender,&iControlSender,&iSocketHandler);
#endif /*WITH_DBUS_WRAPPER*/

#ifdef WITH_NSM
	CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter, &iNodeStateCommunicator);
	iNodeStateCommunicator.registerControlSender(&iControlSender);
#else /*WITH_NSM*/
	CAmControlReceiver iControlReceiver(pDatabaseHandler,&iRoutingSender,&iCommandSender,&iSocketHandler, &iRouter);
#endif /*WITH_NSM*/

#ifdef WITH_TELNET
    CAmTelnetServer iTelnetServer(&iSocketHandler, &iCommandSender, &iCommandReceiver, &iRoutingSender, &iRoutingReceiver, &iControlSender, &iControlReceiver, pDatabaseHandler, &iRouter, telnetport, maxConnections);
    CAmDatabaseObserver iObserver(&iCommandSender, &iRoutingSender, &iSocketHandler, &iTelnetServer);
#else /*WITH_TELNET*/
    CAmDatabaseObserver iObserver(&iCommandSender,&iRoutingSender, &iSocketHandler);
#endif

    iDatabaseHandler.registerObserver(&iObserver);

    //startup all the Plugins and Interfaces
    iControlSender.startupController(&iControlReceiver);
    iCommandSender.startupInterfaces(&iCommandReceiver);
    iRoutingSender.startupInterfaces(&iRoutingReceiver);

    //when the routingInterface is done, all plugins are loaded:
    iControlSender.setControllerReady();

#ifdef WITH_SYSTEMD_WATCHDOG
    iWatchdog.startWatchdog();
#endif /*WITH_SYSTEMD_WATCHDOG*/

    //start the mainloop here....
    iSocketHandler.start_listenting();
}
开发者ID:Pelagicore,项目名称:AudioManager,代码行数:76,代码来源:main.cpp


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