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


C++ reportEvent函数代码示例

本文整理汇总了C++中reportEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ reportEvent函数的具体用法?C++ reportEvent怎么用?C++ reportEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: TEST_F

TEST_F(SwitchInputMapperTest, testProcessInput) {
    MockInputReportDefinition reportDef;
    MockInputDeviceNode deviceNode;
    deviceNode.addSwitch(SW_LID);

    EXPECT_CALL(reportDef, addCollection(_, _));
    EXPECT_CALL(reportDef, declareUsages(_, _, _));

    mMapper->configureInputReport(&deviceNode, &reportDef);

    MockInputReport report;
    EXPECT_CALL(reportDef, allocateReport())
    .WillOnce(Return(&report));

    {
        // Test two switch events in order
        InSequence s;
        EXPECT_CALL(report, setBoolUsage(INPUT_COLLECTION_ID_SWITCH, INPUT_USAGE_SWITCH_LID, 1, 0));
        EXPECT_CALL(report, reportEvent(_));
        EXPECT_CALL(report, setBoolUsage(INPUT_COLLECTION_ID_SWITCH, INPUT_USAGE_SWITCH_LID, 0, 0));
        EXPECT_CALL(report, reportEvent(_));
    }

    InputEvent events[] = {
        {0, EV_SW, SW_LID, 1},
        {1, EV_SYN, SYN_REPORT, 0},
        {2, EV_SW, SW_LID, 0},
        {3, EV_SYN, SYN_REPORT, 0},
    };
    for (auto e : events) {
        mMapper->process(e);
    }
}
开发者ID:android,项目名称:platform_hardware_libhardware,代码行数:33,代码来源:SwitchInputMapper_test.cpp

示例2: threadFunction

/*------------------------------------------------------------------------------
 *  The thread function
 *----------------------------------------------------------------------------*/
void *
MultiThreadedConnector :: ThreadData :: threadFunction( void  * param )
{
    struct sched_param  sched;
    int sched_type;
    ThreadData     * threadData = (ThreadData*) param;
    
    pthread_getschedparam( threadData->thread, &sched_type, &sched );

    reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, was (thread, priority, type): ",
        param,
	sched.sched_priority,
        sched_type == SCHED_FIFO ? "SCHED_FIFO" :
            sched_type == SCHED_RR ? "SCHED_RR" :
            sched_type == SCHED_OTHER ? "SCHED_OTHER" :
            "INVALID"
    );

    sched.sched_priority = 1;
    pthread_setschedparam( threadData->thread, SCHED_FIFO, &sched);

    pthread_getschedparam( threadData->thread, &sched_type, &sched );
    reportEvent( 5, "MultiThreadedConnector :: ThreadData :: threadFunction, now is (thread, priority, type): ",
        param,
	sched.sched_priority,
        sched_type == SCHED_FIFO ? "SCHED_FIFO" :
            sched_type == SCHED_RR ? "SCHED_RR" :
            sched_type == SCHED_OTHER ? "SCHED_OTHER" :
            "INVALID"
    );

    threadData->connector->sinkThread( threadData->ixSink);

    return 0;
}
开发者ID:bryangrim,项目名称:darkice,代码行数:38,代码来源:MultiThreadedConnector.cpp

示例3: cut

/*------------------------------------------------------------------------------
 *  Tell each sink to cut what they are doing, and start again.
 *----------------------------------------------------------------------------*/
void
DarkIce :: cut ( void )                             throw ()
{
    reportEvent( 5, "cutting");

    encConnector->cut();

    reportEvent( 5, "cutting ends");
}
开发者ID:TinyGame,项目名称:raspbaby,代码行数:12,代码来源:DarkIce.cpp

示例4: run

/*------------------------------------------------------------------------------
 *  Run
 *----------------------------------------------------------------------------*/
int
DarkIce :: run ( void )                             throw ( Exception )
{
    reportEvent( 3, "encoding");
    setRealTimeScheduling();
    encode();
    setOriginalScheduling();
    reportEvent( 3, "encoding ends");

    return 0;
}
开发者ID:bryangrim,项目名称:darkice,代码行数:14,代码来源:DarkIce.cpp

示例5: setRealTimeScheduling

/*------------------------------------------------------------------------------
 *  Set POSIX real-time scheduling
 *----------------------------------------------------------------------------*/
void
DarkIce :: setRealTimeScheduling ( void )               throw ( Exception )
{
// Only if the OS has the POSIX real-time scheduling functions implemented.
#if defined( HAVE_SCHED_GETSCHEDULER ) && defined( HAVE_SCHED_GETPARAM )
    int                 high_priority;
    struct sched_param  param;

    /* store the old scheduling parameters */
    if ( (origSchedPolicy = sched_getscheduler(0)) == -1 ) {
        throw Exception( __FILE__, __LINE__, "sched_getscheduler", errno);
    }

    if ( sched_getparam( 0, &param) == -1 ) {
        throw Exception( __FILE__, __LINE__, "sched_getparam", errno);
    }
    origSchedPriority = param.sched_priority;
    
    /* set SCHED_FIFO with max - 1 priority or user configured value */
    if ( (high_priority = sched_get_priority_max(SCHED_FIFO)) == -1 ) {
        throw Exception(__FILE__,__LINE__,"sched_get_priority_max",errno);
    }
    reportEvent( 8, "scheduler high priority", high_priority);

    if (realTimeSchedPriority > high_priority) {
        param.sched_priority = high_priority - 1;
    } else {
        param.sched_priority = realTimeSchedPriority;
    }

    if ( sched_setscheduler( 0, SCHED_FIFO, &param) == -1 ) {
        reportEvent( 1,
                     "Could not set POSIX real-time scheduling, "
                     "this may cause recording skips.\n"
                     "Try to run darkice as the super-user.");
    } else {
        /* ask the new priortiy and report it */
        if ( sched_getparam( 0, &param) == -1 ) {
            throw Exception( __FILE__, __LINE__, "sched_getparam", errno);
        }

        reportEvent( 1,
                     "Using POSIX real-time scheduling, priority",
                     param.sched_priority );
    }
#else
    reportEvent( 1, "POSIX scheduling not supported on this system, "
                    "this may cause recording skips");
#endif // HAVE_SCHED_GETSCHEDULER && HAVE_SCHED_GETPARAM
}
开发者ID:TinyGame,项目名称:raspbaby,代码行数:53,代码来源:DarkIce.cpp

示例6: setRealTimeScheduling

/*------------------------------------------------------------------------------
 *  Set POSIX real-time scheduling, if super-user
 *----------------------------------------------------------------------------*/
void
DarkIce :: setRealTimeScheduling ( void )               throw ( Exception )
{
    uid_t   euid;

    euid = geteuid();

    if ( euid == 0 ) {
        int                 high_priority;
        struct sched_param  param;

        /* store the old scheduling parameters */
        if ( (origSchedPolicy = sched_getscheduler(0)) == -1 ) {
            throw Exception( __FILE__, __LINE__, "sched_getscheduler", errno);
        }

        if ( sched_getparam( 0, &param) == -1 ) {
            throw Exception( __FILE__, __LINE__, "sched_getparam", errno);
        }
        origSchedPriority = param.sched_priority;
        
        /* set SCHED_FIFO with max - 1 priority */
        if ( (high_priority = sched_get_priority_max(SCHED_FIFO)) == -1 ) {
            throw Exception(__FILE__,__LINE__,"sched_get_priority_max",errno);
        }
        reportEvent( 8, "scheduler high priority", high_priority);

        param.sched_priority = high_priority - 1;

        if ( sched_setscheduler( 0, SCHED_FIFO, &param) == -1 ) {
            throw Exception( __FILE__, __LINE__, "sched_setscheduler", errno);
        }

        /* ask the new priortiy and report it */
        if ( sched_getparam( 0, &param) == -1 ) {
            throw Exception( __FILE__, __LINE__, "sched_getparam", errno);
        }

        reportEvent( 1,
                     "Using POSIX real-time scheduling, priority",
                     param.sched_priority );
    } else {
        reportEvent( 1,
        "Not running as super-user, unable to use POSIX real-time scheduling" );
        reportEvent( 1,
        "It is recommended that you run this program as super-user");
    }
}
开发者ID:bryangrim,项目名称:darkice,代码行数:51,代码来源:DarkIce.cpp

示例7: open

/*------------------------------------------------------------------------------
 *  Open the audio source
 *----------------------------------------------------------------------------*/
bool
SerialUlaw :: open ( void )                       throw ( Exception )
{
    struct termios    ts;

    if ( isOpen() ) {
        return false;
    }

    switch ( getBitsPerSample() ) {
        case 16:
            break;

        default:
            return false;
    }

    if (getChannel() != 1) {
        reportEvent(3, "Only mono input supported for Serial ULaw");
        return false;
    }
    if (getSampleRate() != 8000) {
        reportEvent(3, "Only 8000 Hz sample rate supported for Serial ULaw");
        return false;
    }

    if ( (fileDescriptor = ::open( fileName, O_RDONLY)) == -1 ) {
        fileDescriptor = 0;
        return false;
    }

    if(tcgetattr(fileDescriptor, &ts) < 0) {
        close();
        throw Exception( __FILE__, __LINE__, "can't get tty settings");
    }

    cfsetispeed(&ts, B115200);
    cfmakeraw(&ts);
    ts.c_cflag |= CLOCAL;
    if(tcsetattr(fileDescriptor, TCSANOW, &ts) < 0) {
        close();
        throw Exception( __FILE__, __LINE__, "can't set tty settings");
    }

    tcflush(fileDescriptor, TCIFLUSH);

    return true;
}
开发者ID:gusrc,项目名称:darkice,代码行数:51,代码来源:SerialUlaw.cpp

示例8: state_WaitFwInit

static TI_STATUS state_WaitFwInit(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_FW_INIT_DONE:
		this->fCurrentState = state_WaitDrvStart;

		wlanDrvIf_UpdateDriverState(this->hOs, DRV_STATE_RUNNING);

		/* transition is now complete */
		notifyTransitionComplete(this, TI_FALSE);
		rc = TI_OK;

		break;
	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:26,代码来源:pwrState.c

示例9: open

/*------------------------------------------------------------------------------
 *  Open the connection
 *----------------------------------------------------------------------------*/
bool
CastSink :: open ( void )                       throw ( Exception )
{
    if ( isOpen() ) {
        return false;
    }

    if ( !getSink()->open() ) {
        return false;
    }

    if ( !sendLogin() ) {
        close();
        return false;
    }

    if ( streamDump != 0 ) {
        if ( !streamDump->isOpen() ) {
            if ( !streamDump->open() ) {
                reportEvent( 2, "can't open stream dump");
            }
        }
    }
    
    return true;
}
开发者ID:MicroPyramid,项目名称:RaspIce,代码行数:29,代码来源:CastSink.cpp

示例10: vorbisBlocksOut

/*------------------------------------------------------------------------------
 *  Send pending Vorbis blocks to the underlying stream
 *----------------------------------------------------------------------------*/
void
VorbisLibEncoder :: vorbisBlocksOut ( void )                throw ()
{
    while ( 1 == vorbis_analysis_blockout( &vorbisDspState, &vorbisBlock) ) {
        ogg_packet      oggPacket;
        ogg_page        oggPage;

        vorbis_analysis( &vorbisBlock, &oggPacket);
#ifdef VORBIS_LIB_RC3
        vorbis_bitrate_addblock( &vorbisBlock);

        while ( vorbis_bitrate_flushpacket( &vorbisDspState, &oggPacket) ) {
#endif

            ogg_stream_packetin( &oggStreamState, &oggPacket);

            while ( ogg_stream_pageout( &oggStreamState, &oggPage) ) {
                int    written;
                
                written  = sink->write( oggPage.header, oggPage.header_len);
                written += sink->write( oggPage.body, oggPage.body_len);

                if ( written < oggPage.header_len + oggPage.body_len ) {
                    // just let go data that could not be written
                    reportEvent( 2,
                           "couldn't write full vorbis data to underlying sink",
                           oggPage.header_len + oggPage.body_len - written);
                }
            }
#ifdef VORBIS_LIB_RC3
        }
#endif
    }
}
开发者ID:bryangrim,项目名称:darkice,代码行数:37,代码来源:VorbisLibEncoder.cpp

示例11: state_WaitSmeStop

static TI_STATUS state_WaitSmeStop(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_SME_STOPPED:
		this->fCurrentState = state_Sleep;

		if (this->tCurrentTransition.bContinueToOff)
		{
			this->tCurrentTransition.bContinueToOff = TI_FALSE;
			rc = this->fCurrentState(this, PWRSTATE_EVNT_OFF);
		}
		else
		{
			/* transition is now complete */
			TWD_CompleteSuspend(this->hTWD);
			notifyTransitionComplete(this, TI_FALSE);
			rc = TI_OK;
		}

		break;

	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:34,代码来源:pwrState.c

示例12: state_LowOn

static TI_STATUS state_LowOn(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_ON:
		this->fCurrentState = state_FullOn;

		powerMgr_Resume(this->hPowerMgr);
		scanCncn_Resume(this->hScanCncn);
		measurementMgr_Resume(this->hMeasurementMgr);

		/* transition is now complete */
		notifyTransitionComplete(this, TI_FALSE);
		rc = TI_OK;

		break;

	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:29,代码来源:pwrState.c

示例13: state_WaitScanStopDueToSleepOff

static TI_STATUS state_WaitScanStopDueToSleepOff(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_SCANCNCN_STOPPED:
	{
		this->fCurrentState = state_WaitSmeStop;

		sme_Stop(this->hSme);

		rc = TI_PENDING;

		break;
	}
	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:26,代码来源:pwrState.c

示例14: state_WaitScanStopDueToDoze

static TI_STATUS state_WaitScanStopDueToDoze(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_SCANCNCN_STOPPED:
	{
		this->fCurrentState = state_WaitDoze;

		tmr_StartTimer(this->hDozeTimer, pwrState_DozeTimeout, this, this->tConfig.uDozeTimeout, TI_FALSE);
		rc = powerMgr_Suspend(this->hPowerMgr, &this->tConfig, pwrState_DozeDone, this);

		break;
	}
	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:25,代码来源:pwrState.c

示例15: state_WaitDrvStop

static TI_STATUS state_WaitDrvStop(TI_HANDLE hPwrState, EPwrStateSmEvent eEvent)
{
	TPwrState *this = (TPwrState*) hPwrState;
	TI_STATUS rc;

	reportEvent(this, eEvent);

	switch (eEvent)
	{
	case PWRSTATE_EVNT_DRVMAIN_STOPPED:
		this->fCurrentState = state_Off;

		wlanDrvIf_UpdateDriverState(this->hOs, DRV_STATE_STOPPED);

		/* transition is now complete */
		TWD_CompleteSuspend(this->hTWD);
		notifyTransitionComplete(this, TI_FALSE);
		rc = TI_OK;

		break;
	default:
		handleUnexpectedEvent(this, eEvent);
		rc = TI_NOK;
	}

	return rc;
}
开发者ID:chambejp,项目名称:hardware,代码行数:27,代码来源:pwrState.c


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