• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ reportEvent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: flush

/*------------------------------------------------------------------------------
 *  Flush the data from the encoder
 *----------------------------------------------------------------------------*/
void
LameLibEncoder :: flush ( void )
                                                            throw ( Exception )
{
    if ( !isOpen() ) {
        return;
    }

    // data chunk size estimate according to lame documentation
    unsigned int    mp3Size = 7200;
    unsigned char * mp3Buf  = new unsigned char[mp3Size];
    int             ret;

    ret = lame_encode_flush( lameGlobalFlags, mp3Buf, mp3Size );

    unsigned int    written = sink->write( mp3Buf, ret);
    delete[] mp3Buf;

    // just let go data that could not be written
    if ( written < (unsigned int) ret ) {
        reportEvent( 2,
                     "couldn't write all from encoder to underlying sink",
                     ret - written);
    }

    sink->flush();
}
开发者ID:bryangrim,项目名称:darkice,代码行数:30,代码来源:LameLibEncoder.cpp


示例17: DBG

void AmDtmfDetector::registerKeyReleased(int event, Dtmf::EventSource source,
                                         const struct timeval& start,
                                         const struct timeval& stop,
					 bool has_eventid, unsigned int event_id)
{
  // Old event has not been sent yet
  // push out it now
  if ((m_eventPending && m_currentEvent != event) ||
      (m_eventPending && has_eventid && m_current_eventid_i && (event_id != m_current_eventid))) {
#ifdef EXCESSIVE_DTMF_DEBUGINFO
    DBG("event differs - reportEvent()\n");
#endif
    reportEvent();
  }

  m_eventPending = true;
  m_currentEvent = event;
  if (has_eventid) {
    m_current_eventid_i = true;
    m_current_eventid = event_id;
  }

  if(timercmp(&start,&stop,<)){
    memcpy(&m_startTime, &start, sizeof(struct timeval));
    memcpy(&m_lastReportTime, &stop, sizeof(struct timeval));
  }
  else {
开发者ID:Chocolatbuddha,项目名称:sems,代码行数:27,代码来源:AmDtmfDetector.cpp


示例18: onFullScanResult

static void onFullScanResult(wifi_request_id id, wifi_scan_result *result) {

    JNIEnv *env = NULL;
    mVM->AttachCurrentThread(&env, NULL);

    ALOGD("onFullScanResult called, vm = %p, obj = %p, env = %p", mVM, mCls, env);

    jobject scanResult = createScanResult(env, result);

    ALOGD("Creating a byte array of length %d", result->ie_length);

    jbyteArray elements = env->NewByteArray(result->ie_length);
    if (elements == NULL) {
        ALOGE("Error in allocating array");
        return;
    }

    ALOGE("Setting byte array");

    jbyte *bytes = (jbyte *)&(result->ie_data[0]);
    env->SetByteArrayRegion(elements, 0, result->ie_length, bytes);

    ALOGE("Returning result");

    reportEvent(env, mCls, "onFullScanResult", "(ILandroid/net/wifi/ScanResult;[B)V", id,
            scanResult, elements);

    env->DeleteLocalRef(scanResult);
    env->DeleteLocalRef(elements);
}
开发者ID:XperiaZProject,项目名称:frameworks_opt_net_wifi,代码行数:30,代码来源:com_android_server_wifi_WifiNative.cpp


示例19: state_Off

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

	reportEvent(this, eEvent);

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

		rc = drvMain_Start(this->hDrvMain, pwrState_FwInitDone, this, pwrState_DrvMainStarted, this);

		/* if failed to start the driver, revert back to this state */
		if (TI_NOK == rc)
		{
			this->fCurrentState = state_Off;
		}

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

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


示例20: open

/*------------------------------------------------------------------------------
 *  Open the source and all the sinks if needed
 *  Create the sink threads
 *----------------------------------------------------------------------------*/
bool
MultiThreadedConnector :: open ( void )                     throw ( Exception )
{
    unsigned int        i;
    size_t              st;

    if ( !Connector::open() ) {
        return false;
    }

    running = true;

    pthread_attr_init( &threadAttr);
    pthread_attr_getstacksize(&threadAttr, &st);
    if (st < 128 * 1024) {
        reportEvent( 5, "MultiThreadedConnector :: open, stack size ",
                        (long)st);
        st = 128 * 1024;
        pthread_attr_setstacksize(&threadAttr, st);
    }
    pthread_attr_setdetachstate( &threadAttr, PTHREAD_CREATE_JOINABLE);

    threads = new ThreadData[numSinks];
    for ( i = 0; i < numSinks; ++i ) {
        ThreadData    * threadData = threads + i;

        threadData->connector = this;
        threadData->ixSink    = i;
        threadData->accepting = true;
        threadData->isDone    = true;
        if ( pthread_create( &(threadData->thread),
                             &threadAttr,
                             ThreadData::threadFunction,
                             threadData ) ) {
            break;
        }
    }

    // if could not create all, delete the ones created
    if ( i < numSinks ) {
        unsigned int    j;

        // signal to stop for all running threads
        pthread_mutex_lock( &mutexProduce);
        running = false;
        pthread_cond_broadcast( &condProduce);
        pthread_mutex_unlock( &mutexProduce);

        for ( j = 0; j < i; ++j ) {
            pthread_join( threads[j].thread, 0);
        }

        delete[] threads;
        threads = 0;

        return false;
    }

    return true;
}
开发者ID:TinyGame,项目名称:raspbaby,代码行数:64,代码来源:MultiThreadedConnector.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ reportToList函数代码示例发布时间:2022-05-30
下一篇:
C++ reportError函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap