本文整理汇总了C++中setEvent函数的典型用法代码示例。如果您正苦于以下问题:C++ setEvent函数的具体用法?C++ setEvent怎么用?C++ setEvent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setEvent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setEvent
void CSerialDummy::transmitByte(Bit8u val, bool first) {
if(first) setEvent(SERIAL_THR_EVENT, bytetime/10);
else setEvent(SERIAL_TX_EVENT, bytetime);
#ifdef CHECKIT_TESTPLUG
loopbackdata=val;
#endif
}
示例2: setEvent
void CNullModem::transmitByte (Bit8u val, bool first) {
// transmit it later in THR_Event
if (first) setEvent(SERIAL_THR_EVENT, bytetime/8);
else setEvent(SERIAL_TX_EVENT, bytetime);
// disable 0xff escaping when transparent mode is enabled
if (!transparent && (val==0xff)) WriteChar(0xff);
WriteChar(val);
}
示例3: setEvent
void eEventDisplay::setList(const ePtrList<EITEvent> &e)
{
delete eventlist;
delete events;
eventlist=new ePtrList<EITEvent>(e);
events=new ePtrList<EITEvent>::iterator(*eventlist);
if (*events != eventlist->end())
setEvent(**events);
else
setEvent(0);
}
示例4: WriteFile
void CDirectSerial::transmitByte (Bit8u val, bool first) {
// mean bug: with break = 1, WriteFile will never return.
if((LCR&LCR_BREAK_MASK) == 0) {
DWORD bytesWritten = 0;
WriteFile (hCom, &val, 1, &bytesWritten, NULL);
if (bytesWritten != 1)
LOG_MSG ("Serial%d: COM port error: write failed!", idnumber);
}
if(first) setEvent(SERIAL_THR_EVENT, bytetime/8);
else setEvent(SERIAL_TX_EVENT, bytetime);
}
示例5: setEvent
void CSerialLog::transmitByte(Bit8u val, bool first) {
if(first) setEvent(SERIAL_THR_EVENT, bytetime/10);
else setEvent(SERIAL_TX_EVENT, bytetime);
if (val == '\n' || val == '\r')
log_emit();
else {
log_line += (char)val;
if (log_line.length() >= 256) log_emit();
}
}
示例6: if
void Erik::in_sp1() {
//TODO: check STATE_WATER
if (state&STATE_FALL) setState(STATE_ACT_1);
if (state&STATE_ACT_2) {
} else if (state&STATE_ACT_1) {
setState(STATE_ACT_2);
addSpeed(jump2);
setEvent(new CAnimEvent(this,DE_JUMP,0,ESTATE_ABORT,au_jump,(state&STATE_LEFT) ? anim_erik_jump2_left : anim_erik_jump2_right));
} else {
setState(STATE_ACT_1);
addSpeed(jump);
setEvent(new CAnimEvent(this,DE_JUMP,0,ESTATE_ABORT,NULL,(state&STATE_LEFT) ? anim_erik_jump_left : anim_erik_jump_right));
}
}
示例7: LOG_MSG
bool CNullModem::ServerConnect() {
// check if a connection is available.
clientsocket=serversocket->Accept();
if (!clientsocket) return false;
Bit8u peeripbuf[16];
clientsocket->GetRemoteAddressString(peeripbuf);
LOG_MSG("Serial%d: A client (%s) has connected.",(int)COMNUMBER,peeripbuf);
#if SERIAL_DEBUG
log_ser(dbg_aux,"Nullmodem: A client (%s) has connected.", peeripbuf);
#endif
/* FIXME: It would be nice if the SDL net library had a bind() call to bind only to a specific interface.
* Or maybe it does... what am I missing? */
if (!nonlocal && strcmp((char*)peeripbuf,"127.0.0.1") != 0) {
LOG_MSG("Serial%d: Non-localhost client (%s) dropped by nonlocal:0 policy. To accept connections from network, set nonlocal:1",(int)COMNUMBER,peeripbuf);
delete clientsocket;
clientsocket = NULL;
return false;
}
clientsocket->SetSendBufferSize(256);
rx_state=N_RX_IDLE;
setEvent(SERIAL_POLLING_EVENT, 1);
// we don't accept further connections
delete serversocket;
serversocket=0;
// transmit the line status
setRTSDTR(getRTS(), getDTR());
if (transparent) setCD(true);
return true;
}
示例8: handleEvent
void handleEvent(THREAD_ARG *arg)
{
BYTE i=0;
struct event_base* base = event_base_new();
if (!base)
{
fprintf(stderr, "Could not initialize libevent!\n");
exit(1);
}
eventarg.base = base;
eventarg.UART0_fd = openUart("uart0");
eventarg.CAN0_fd = openCAN("can0");
eventarg.output_socket = NULL;
eventarg.GUIPipe_fd = arg->GUIPipe_fd;
eventarg.CTRLPipe_fd = arg->CTRLPipe_fd;
eventarg.UARTPipe_fd = arg->UARTPipe_fd;
eventarg.lock = arg->lock;
eventarg.cond = arg->cond;
setEvent(base);
for(i=0; i<MAX_CHANNEL; i++)
{
eventarg.timer_arg[i].channel = i+1;
eventarg.timer_arg[i].channelTimer = event_new(base, -1, EV_TIMEOUT,
cbChannelTimer, (void*)(&eventarg.timer_arg[i]));
}
event_base_dispatch(base);
}
示例9: XMLReader
void MainWindow::setFileName(QString fileName){
XMLReader * xMlReader = new XMLReader(fileName);
bool ok = true;
eventList = xMlReader->readFile(&ok);
if (!ok){
eventName.clear();
ui->labelUpper->setText("<font color='red'>Error reading file " + fileName + "</font>" );
ui->labelMiddle->setText("<font color='red'>Check if the file exists and if the program has read acces</font>");
ui->labelLower->setText("<font color='red'>The file might also be damaged or contain XML errors</font");
return;
}
if (eventList.length() == 0){
ui->labelUpper->setText("<font color ='red'>Error: empty or incorrectly formatted XML file " + fileName + ".</font>");
return;
}
QSignalMapper * signalMapper = new QSignalMapper(this);
connect(signalMapper,SIGNAL(mapped(int)),this,SLOT(setEventSlot(int)));
for (int i = 0; i < eventList.length();i++){
actions.append(ui->menuEvents->addAction(eventList.at(i)->getName()));
actions.at(i)->setCheckable(true);
signalMapper->setMapping(actions.at(i),i);
connect(actions.at(i),SIGNAL(triggered()),signalMapper,SLOT(map()));
}
currentEventIndex = 0;
setEvent();
actions.at(currentEventIndex)->setChecked(true);
connect(timer,SIGNAL(timeout()),this,SLOT(eventTimerSlot()));
}
示例10: fabs
void
ObjectView::MouseUp(BPoint point)
{
if (fTrackingInfo.isTracking) {
//spin the teapot on release, TODO: use a marching sum and divide by time
if (fTrackingInfo.buttons == B_PRIMARY_MOUSE_BUTTON
&& fTrackingInfo.pickedObject != NULL
&& (fabs(fTrackingInfo.lastDx) > 1.0f
|| fabs(fTrackingInfo.lastDy) > 1.0f) ) {
fTrackingInfo.pickedObject->Spin(0.5f * fTrackingInfo.lastDy, 0.5f * fTrackingInfo.lastDx);
setEvent(drawEvent);
}
//stop tracking
fTrackingInfo.isTracking = false;
fTrackingInfo.buttons = 0;
fTrackingInfo.pickedObject = NULL;
fTrackingInfo.lastX = 0.0f;
fTrackingInfo.lastY = 0.0f;
fTrackingInfo.lastDx = 0.0f;
fTrackingInfo.lastDy = 0.0f;
BCursor grabCursor(B_CURSOR_ID_GRAB);
SetViewCursor(&grabCursor);
}
}
示例11: CFifo
CSerialModem::CSerialModem(Bitu id, CommandLine* cmd):CSerial(id, cmd) {
InstallationSuccessful=false;
connected=false;
rqueue=new CFifo(MODEM_BUFFER_QUEUE_SIZE);
tqueue=new CFifo(MODEM_BUFFER_QUEUE_SIZE);
// Default to direct null modem connection. Telnet mode interprets IAC codes
telnetmode = false;
// Initialize the sockets and setup the listening port
listenport = 23;
waitingclientsocket=0;
clientsocket = 0;
serversocket = 0;
getBituSubstring("listenport:", &listenport, cmd);
// TODO: Fix dialtones if requested
//mhd.chan=MIXER_AddChannel((MIXER_MixHandler)this->MODEM_CallBack,8000,"MODEM");
//MIXER_Enable(mhd.chan,false);
//MIXER_SetMode(mhd.chan,MIXER_16MONO);
CSerial::Init_Registers();
Reset(); // reset calls EnterIdleState
setEvent(SERIAL_POLLING_EVENT,1);
InstallationSuccessful=true;
}
示例12: setEvent
void
ObjectView::MouseMoved(BPoint point, uint32 transit, const BMessage *msg)
{
if (fTrackingInfo.isTracking && fTrackingInfo.pickedObject != NULL) {
float dx = point.x - fTrackingInfo.lastX;
float dy = point.y - fTrackingInfo.lastY;
fTrackingInfo.lastX = point.x;
fTrackingInfo.lastY = point.y;
if (fTrackingInfo.buttons == B_PRIMARY_MOUSE_BUTTON) {
fTrackingInfo.pickedObject->Spin(0.0f, 0.0f);
fTrackingInfo.pickedObject->RotateWorldSpace(dx,dy);
fTrackingInfo.lastDx = dx;
fTrackingInfo.lastDy = dy;
setEvent(drawEvent);
} else if (fTrackingInfo.buttons == B_SECONDARY_MOUSE_BUTTON) {
float xinc = (dx * 2 * displayScale / Bounds().Width());
float yinc = (-dy * 2 * displayScale / Bounds().Height());
float zinc = 0;
if (fPersp) {
zinc = yinc * (fTrackingInfo.pickedObject->z / displayScale);
xinc *= -(fTrackingInfo.pickedObject->z * 4 / zRatio);
yinc *= -(fTrackingInfo.pickedObject->z * 4 / zRatio);
}
fTrackingInfo.pickedObject->x += xinc;
if (modifiers() & B_SHIFT_KEY)
fTrackingInfo.pickedObject->z += zinc;
else
fTrackingInfo.pickedObject->y += yinc;
fForceRedraw = true;
setEvent(drawEvent);
}
} else {
void* object = fObjects.ItemAt(ObjectAtPoint(point));
BCursor cursor(object != NULL
? B_CURSOR_ID_GRAB : B_CURSOR_ID_SYSTEM_DEFAULT);
SetViewCursor(&cursor);
}
}
示例13: disableMaster_
void Channel2::setNr2(unsigned data) {
if (envelopeUnit_.nr2Change(data))
disableMaster_();
else
staticOutputTest_(cycleCounter_);
setEvent();
}
示例14: eProgress
void eEventDisplay::init_eEventDisplay(const ePtrList<EITEvent>* e)
{
eventlist=0;
events=0;
scrollbar = new eProgress(this);
scrollbar->setName("scrollbar");
scrollbar->setStart(0);
scrollbar->setPerc(100);
descr = new eWidget(this);
descr->setName("epg_description");
eventTime = new eLabel(this);
eventTime->setName("time");
eventDate = new eLabel(this);
eventDate->setName("date");
channel = new eLabel(this);
channel->setName("channel");
timer_icon = new eLabel(this);
timer_icon->setName("timer_icon");
eSkin *skin=eSkin::getActive();
if (skin->build(this, "eventview"))
eFatal("skin load of \"eventview\" failed");
long_description=new eLabel(descr);
long_description->setFlags(RS_WRAP);
// try to recalc long description label... ( no broken text lines.. )
float lineheight=fontRenderClass::getInstance()->getLineHeight( long_description->getFont() );
int lines = (int)(descr->getSize().height() / lineheight);
pageHeight = (int)(lines * lineheight);
descr->resize( eSize( descr->getSize().width(), pageHeight+(int)(lineheight/6)));
long_description->resize(eSize(descr->getSize().width(), pageHeight*16));
#ifndef DISABLE_FILE
addActionToHelpList( &i_epgSelectorActions->addDVRTimerEvent );
#endif
#ifndef DISABLE_NETWORK
addActionToHelpList( &i_epgSelectorActions->addNGRABTimerEvent );
#endif
addActionToHelpList( &i_epgSelectorActions->addSwitchTimerEvent );
addActionToHelpList( &i_epgSelectorActions->removeTimerEvent );
addActionToHelpList( &i_enigmaEventViewActions->close );
if (e)
setList(*e);
else if (evt)
setEvent(evt);
addActionMap( &i_enigmaEventViewActions->map );
addActionMap( &i_epgSelectorActions->map );
setHelpID(11);
}
示例15: setEvent
void Channel2::reset() {
// cycleCounter >> 12 & 7 represents the frame sequencer position.
cycleCounter_ &= 0xFFF;
cycleCounter_ += ~(cycleCounter_ + 2) << 1 & 0x1000;
dutyUnit_.reset();
envelopeUnit_.reset();
setEvent();
}