本文整理汇总了C++中setTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ setTimer函数的具体用法?C++ setTimer怎么用?C++ setTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: SpawnBGObject
void BattlegroundRV::StartingEventOpenDoors()
{
// Buff respawn
SpawnBGObject(BG_RV_OBJECT_BUFF_1, 90);
SpawnBGObject(BG_RV_OBJECT_BUFF_2, 90);
// Elevators
DoorOpen(BG_RV_OBJECT_ELEVATOR_1);
DoorOpen(BG_RV_OBJECT_ELEVATOR_2);
setState(BG_RV_STATE_OPEN_FENCES);
setTimer(BG_RV_FIRST_TIMER);
}
开发者ID:Bes666,项目名称:TrilliumEMU,代码行数:12,代码来源:BattlegroundRV.cpp
示例2: main
int main(void)
{
uint8_t src_packet[128] = {0x05, 0x30, 0x00, 0x00, 0x0A};
uint8_t rcvd_msg[128] = {0};
uint8_t rcvd_payload[128] = {0};
uint8_t rcvd_length;
uint8_t rcvd_payloadLength;
uint8_t rcvd_rssi;
uint8_t Type;
uint16_t Addr;
uint8_t radio_channel;
uint16_t radio_panID;
Type = Type_Light;
Addr = 0x0001;
radio_channel = 18;
radio_panID = 0x00AA;
Initial(Addr, Type, radio_channel, radio_panID);
setTimer(1,RETRANSMIT_PERIOD,UNIT_MS);
while(1){
// Periodically send the msg
if(checkTimer(1)){
RF_Tx(0xFFFF,src_packet,5);
}
// When received some packet
if(RF_Rx(rcvd_msg, &rcvd_length, &rcvd_rssi)){
getPayloadLength(&rcvd_payloadLength, rcvd_msg);
getPayload(rcvd_payload, rcvd_msg, rcvd_payloadLength);
// Check 1)header, 2)sequence number, 3)isACK field
if(rcvd_payload[0]==0x05 && rcvd_payload[1]==0x30 &&
rcvd_payload[2]==src_packet[2] && rcvd_payload[3]==1){
src_packet[2]++;
// Change the payload here
}
}
if(src_packet[2]==0x14)
break;
}
while(1){
if(checkTimer(1)){
setGPIO(1,1);
}
}
}
开发者ID:ntujoseph,项目名称:AODV,代码行数:53,代码来源:main.c
示例3: sa_Sensor_mark_start
EXTERN_C gboolean sa_Sensor_mark_start(sa_Sensor_mark* self, GError** error)
{
if (!sa_Sensor_mark_is_active(self)) {
//logt("START MARK");
if (!log_db_log_mark(self->log, "start", error)) // begin mark
return FALSE;
if (!setTimer(self, error))
return FALSE;
}
return TRUE;
}
开发者ID:contextlogger,项目名称:contextlogger2,代码行数:12,代码来源:sa_sensor_mark.c
示例4: lk_eventlock
// ----------------------------------------------------------------------
void
EventInputQueue::push_KeyboardSpecialEventCallback(OSObject* target,
unsigned int eventType,
unsigned int flags,
unsigned int key,
unsigned int flavor,
UInt64 guid,
bool repeat,
AbsoluteTime ts,
OSObject* sender,
void* refcon)
{
IOLockWrapper::ScopedLock lk_eventlock(CommonData::getEventLock());
if (! lk_eventlock) return;
IOLockWrapper::ScopedLock lk(timer_.getlock());
if (! lk) return;
// ------------------------------------------------------------
Params_KeyboardSpecialEventCallback::auto_ptr ptr(Params_KeyboardSpecialEventCallback::alloc(EventType(eventType), Flags(flags), ConsumerKeyCode(key),
flavor, guid, repeat));
if (! ptr) return;
Params_KeyboardSpecialEventCallback& params = *ptr;
// ------------------------------------------------------------
DeviceVendor deviceVendor(0);
DeviceProduct deviceProduct(0);
{
IOLockWrapper::ScopedLock lk_device(ListHookedKeyboard::instance().getListLock());
if (! lk_device) return;
IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
if (! device) return;
ListHookedConsumer::Item* item = static_cast<ListHookedConsumer::Item*>(ListHookedConsumer::instance().get_nolock(device));
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
deviceVendor = item->getVendor();
deviceProduct = item->getProduct();
}
// ------------------------------------------------------------
// Because we handle the key repeat ourself, drop the key repeat by hardware.
if (repeat) return;
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = false;
bool updateWorkspaceData = params.ex_iskeydown;
enqueue_(params, retainFlagStatusTemporaryCount, updateWorkspaceData, deviceVendor, deviceProduct);
setTimer();
}
开发者ID:benburkert,项目名称:dvorax0r,代码行数:53,代码来源:EventInputQueue.cpp
示例5: EventType
// ----------------------------------------------------------------------
void EventInputQueue::push_KeyboardSpecialEventCallback(OSObject* target,
unsigned int eventType,
unsigned int flags,
unsigned int key,
unsigned int flavor,
UInt64 guid,
bool repeat,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_KeyboardSpecialEventCallback::log(true, EventType(eventType), Flags(flags), ConsumerKeyCode(key), flavor, guid, repeat);
// ------------------------------------------------------------
Params_KeyboardSpecialEventCallback params(EventType(eventType),
Flags(flags),
ConsumerKeyCode(key),
flavor, guid, repeat);
// ------------------------------------------------------------
IOHIKeyboard* device = OSDynamicCast(IOHIKeyboard, sender);
if (!device) return;
ListHookedConsumer::Item* item = static_cast<ListHookedConsumer::Item*>(ListHookedConsumer::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
// Device Hacks
// Drop events if "Disable an internal keyboard while external keyboards are connected" is enabled.
if (Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_disable_internal_keyboard_if_external_keyboard_exsits)) {
if (item->isInternalDevice() &&
ListHookedKeyboard::instance().isExternalDevicesConnected()) {
return;
}
}
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
// Because we handle the key repeat ourself, drop the key repeat by hardware.
if (repeat) return;
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = false;
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
setTimer();
}
开发者ID:piaowenjie,项目名称:Karabiner,代码行数:53,代码来源:EventInputQueue.cpp
示例6: broadcast_fc8300_drv_if_set_channel
int broadcast_fc8300_drv_if_set_channel(struct broadcast_dmb_set_ch_info *udata)
{
signed long frequency = 214714; /*tmm*/
int ret;
#ifndef BBM_I2C_TSIF
fci_irq_disable();
#endif
setTimer();
if(OnAir == 0 || udata == NULL) {
print_log(NULL, "[1seg] broadcast_drv_if_set_channel error [!OnAir]\n");
return ERROR;
}
/* uhf 1segment */
currentSelectedChannel = udata->channel;
if(udata->segment == 13) {
currentBroadCast = UHF_13SEG;
} else {
currentBroadCast = UHF_1SEG;
}
#ifdef CONFIG_LGE_BROADCAST_BRAZIL_FREQ
if(udata->channel<14 || udata->channel>69) {
print_log(NULL, "[1seg] channel information error\n");
return ERROR;
}
frequency = frequencyTable[udata->channel-14];
#else
if(udata->channel<13 || udata->channel>62) {
print_log(NULL, "[1seg] channel information error\n");
return ERROR;
}
frequency = frequencyTable[udata->channel-13];
#endif
/* Scan mode(udata->mode==1) & need lock check */
#ifndef BBM_I2C_TSIF
fci_irq_enable();
#endif
ret = tunerbb_drv_fc8300_set_channel(frequency, udata->mode, udata->subchannel);
//broadcast_fci_ringbuffer_flush();
if(ret)
return ERROR;
print_log(NULL, "[fc8300] channel channel : %d, %d, %d, scan OK\n", udata->channel, udata->mode, udata->subchannel);
return OK;
}
开发者ID:engine95,项目名称:navelC-990,代码行数:52,代码来源:broadcast_fc8300_drv_if.c
示例7: renewIP
static int renewIP()
{
setTimer(0); /* 取消定时器 */
printf(_(">> 正在获取IP...\n"));
system(dhcpScript);
printf(_(">> 操作结束。\n"));
dhcpMode += 3; /* 标记为已获取,123变为456,5不需再认证*/
if (fillHeader() == -1)
exit(EXIT_FAILURE);
if (dhcpMode == 5)
return switchState(ID_ECHO);
return switchState(ID_START);
}
开发者ID:fafa-npu,项目名称:mentohust-with-free,代码行数:13,代码来源:mystate.c
示例8: QWidget
Clock::Clock(QWidget* parent)
: QWidget(parent), m_timer(0) {
setTimer(Tanglet);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
m_update = new QTimer(this);
m_update->setInterval(1000);
connect(m_update, SIGNAL(timeout()), this, SLOT(updateTime()));
QFont f = font();
f.setBold(true);
setFont(f);
}
开发者ID:chtitux,项目名称:tanglet,代码行数:13,代码来源:clock.cpp
示例9: OVR_DEBUG_LOG
void LatencyTest::BeginTest()
{
if (State == State_WaitingForButton)
{
// Set color to black and wait a while.
RenderColor = CALIBRATE_BLACK;
State = State_WaitingForSettlePreCalibrationColorBlack;
OVR_DEBUG_LOG(("State_WaitingForButton -> State_WaitingForSettlePreCalibrationColorBlack."));
setTimer(TIME_TO_WAIT_FOR_SETTLE_PRE_CALIBRATION);
}
}
开发者ID:imclab,项目名称:max_oculus,代码行数:13,代码来源:Util_LatencyTest.cpp
示例10: setKeyListener
void setKeyListener(char key, ObjectHeader* obj, char cmd) {
static char initialized;
if(!initialized) {
initialized = 1;
setTimer(&keysObj, _MSG_KEYBOARD_TIMER, TIMER_PERIODIC, _MSG_KEYBOARD_TIMER_PERIOD);
}
if(key >= MAX_KEYS)
return;
keys[key].obj = obj;
keys[key].cmd = cmd;
}
开发者ID:kvv1,项目名称:kvvmaps,代码行数:13,代码来源:keyboard.c
示例11: spi_sync
int spi_sync()
{
uint32_t timer;
setTimer(&timer);
while(1)
{
if(spi_checkIdle())
return 1;
if (getTimer(timer)>500000) // timeout .5 seconds
return 0;
}
}
开发者ID:UIKit0,项目名称:pixy,代码行数:13,代码来源:spi.cpp
示例12: params
void EventInputQueue::push_ScrollWheelEventCallback(OSObject* target,
short deltaAxis1,
short deltaAxis2,
short deltaAxis3,
IOFixed fixedDelta1,
IOFixed fixedDelta2,
IOFixed fixedDelta3,
SInt32 pointDelta1,
SInt32 pointDelta2,
SInt32 pointDelta3,
SInt32 options,
AbsoluteTime ts,
OSObject* sender,
void* refcon) {
GlobalLock::ScopedLock lk;
if (!lk) return;
Params_ScrollWheelEventCallback::log(true,
deltaAxis1,
deltaAxis2,
deltaAxis3,
fixedDelta1,
fixedDelta2,
fixedDelta3,
pointDelta1,
pointDelta2,
pointDelta3,
options);
// ------------------------------------------------------------
Params_ScrollWheelEventCallback params(deltaAxis1, deltaAxis2, deltaAxis3,
fixedDelta1, fixedDelta2, fixedDelta3,
pointDelta1, pointDelta2, pointDelta3,
options);
// ------------------------------------------------------------
IOHIPointing* device = OSDynamicCast(IOHIPointing, sender);
if (!device) return;
ListHookedPointing::Item* item = static_cast<ListHookedPointing::Item*>(ListHookedPointing::instance().get(device));
if (!item) return;
// ------------------------------------------------------------
CommonData::setcurrent_ts(ts);
// ------------------------------------------------------------
bool retainFlagStatusTemporaryCount = Config::get_essential_config(BRIDGE_ESSENTIAL_CONFIG_INDEX_general_lazy_modifiers_with_mouse_event);
enqueue_(params, retainFlagStatusTemporaryCount, item->getDeviceIdentifier());
setTimer();
}
开发者ID:piaowenjie,项目名称:Karabiner,代码行数:51,代码来源:EventInputQueue.cpp
示例13: utInit
/* ****************************************************************************
*
* utInit - unit test init
*
*/
void utInit(void)
{
#ifdef UT_DEBUG
++noOfInits;
printf("**************** IN utInit (%d inits, %d exits)\n", noOfInits, noOfExits);
#endif
notifierMock = new NotifierMock();
if (notifierMock == NULL)
{
fprintf(stderr, "error allocating NotifierMock: %s\n", strerror(errno));
exit(1);
}
setNotifier(notifierMock);
timerMock = new TimerMock();
if (timerMock == NULL)
{
fprintf(stderr, "error allocating TimerMock: %s\n", strerror(errno));
exit(1);
}
ON_CALL(*timerMock, getCurrentTime()).WillByDefault(Return(1360232700));
setTimer(timerMock);
startTime = getCurrentTime();
statisticsTime = getCurrentTime();
setupDatabase();
#ifdef UT_DEBUG
printf("**************** FROM utInit (%d inits, %d exits)\n", noOfInits, noOfExits);
#endif
//
// URI parameters used for unit testing
// Default mime type for notifications: application/xml
//
uriParams[URI_PARAM_NOTIFY_FORMAT] = "XML";
uriParams[URI_PARAM_PAGINATION_OFFSET] = DEFAULT_PAGINATION_OFFSET;
uriParams[URI_PARAM_PAGINATION_LIMIT] = DEFAULT_PAGINATION_LIMIT;
uriParams[URI_PARAM_PAGINATION_DETAILS] = DEFAULT_PAGINATION_DETAILS;
uriParams[URI_PARAM_NOT_EXIST] = ""; // FIXME P7: we need this to implement "restriction-based" filters
//
// Resetting servicePathVector
//
servicePathVector.clear();
// Init subs cache (this initialization is overriden in test that use csubs)
mongoSubCacheInit();
}
开发者ID:NozomiNetworks,项目名称:fiware-orion,代码行数:56,代码来源:unittest.cpp
示例14: atkTackle
// ATTACK FUNCTIONS =============================================================================== //
void atkTackle(avatar *agent, int targetX, int targetY)
{
float angle;
float trigX, trigY;
angle = atan((targetY - agent->coordY)/(targetX - agent->coordX)) * (-1);
trigX = cos(angle);
trigY = sin(angle);
if(targetX > agent->coordX){
if(trigX < 0)
trigX *= (-1);
} else if(targetX < agent->coordX){
if(trigX > 0)
trigX *= (-1);
}
if(targetY > agent->coordY){
if(trigY < 0)
trigY *= (-1);
} else if(targetY < agent->coordY){
if(trigY > 0)
trigY *= (-1);
}
agent->acX = 0;
agent->acY = 0;
phAddAc(&agent->acX, TACKLE_SPEED*trigX, 1, agent->weight, 1, TACKLE_SPEED);
phAddAc(&agent->acY, TACKLE_SPEED*trigY, 1, agent->weight, 1, TACKLE_SPEED);
setTimer(&agent->timeFlame.time, agent->delay[ATCK_MELEE]);
setTimer(&agent->cantouch.time, agent->delay[ATCK_MELEE]);
agent->timeElement.time = agent->delay[ATCK_MELEE];
return;
}
开发者ID:fspacheco,项目名称:derDurchfall,代码行数:39,代码来源:durchfallEngine.c
示例15: while
void App::setTimer()
{
gtkTimer.expires_from_now(boost::posix_time::milliseconds(1));
gtkTimer.async_wait([&](const boost::system::error_code &ec)
{
if (ec) return;
while (gtkMain.events_pending())
gtkMain.iteration(false);
setTimer();
});
}
开发者ID:chilabot,项目名称:chila,代码行数:14,代码来源:App.cpp
示例16: Mtorz
Mtorz() {
setBackground(osapal[8]);
setBounds(200, 64, 14 * 8 + 12, 4 * 16 + 28);
setTitle("M t . o r z 0");
label1 = new Label(
" orz\n"
" orz orz\n"
" orz orz orz\n"
"orz orz orz orz");
label1->setBounds(20, 8, 12 * 8, 3 * 16);
label1->setBackground(osapal[8]);
add(label1);
setTimer(500);
}
开发者ID:Hiroyuki-Nagata,项目名称:mona,代码行数:14,代码来源:mtorz.cpp
示例17: my_Timer_Interrupt
void my_Timer_Interrupt() {
/*TODO:
* Get current time T
* Move everything with waketime before T from TimerQueue to ReadyQueue
* Get next item in TimerQueue
* Reset Timer
*/
PrintState();
ReadyQueue_Lock("Timer Interrupt");
TimerQueue_Lock("Timer Interrupt");
currentTimer = 0;
INT32 time = 0;
time = my_GET_TIME_OF_DAY();
debug(GREY, "Timer Queue, Current Time: %d", time);
debug(YELLOW, "Timer Queue Lock in interrupt");
if (!TimerQueueHead->Next) {
debug(RED, "Bug in Timer Queue\n");
} else {
INT32 currentTime = my_GET_TIME_OF_DAY();
if (TimerQueueHead->Next != NULL) {
debug(GREY, "Timer Queue Item: %d, waketime %d",
TimerQueueHead->Next->PCB->PID,
TimerQueueHead->Next->WakeTime);
} else {
debug(RED, "Timer Item is NULL");
}
while (TimerQueueHead->Next != NULL
&& TimerQueueHead->Next->WakeTime < currentTime) {
//move it to the ready Q
TimerQueueItem * temp = TimerQueue_Pop();
debug(GREEN, "Move PID %d from Timer Q to Ready Q", temp->PCB->PID);
if (temp != NULL) {
ReadyQueue_Add(temp->PCB);
Printer("Ready", temp->PCB->PID, FALSE);
}
}
}
if (TimerQueueHead->Next != NULL) {
//reset Timer
currentTimer = TimerQueueHead->Next->WakeTime;
setTimer(TimerQueueHead->Next->WakeTime - time);
debug(YELLOW, "reset timer to %d", currentTimer,
TimerQueueHead->Next->WakeTime - time);
}
TimerQueue_Unlock("Timer Interrupt");
ReadyQueue_Unlock("Timer Interrupt");
}
开发者ID:zhshr,项目名称:CS502,代码行数:50,代码来源:Utils.c
示例18: vitalDemage
void vitalDemage(circle *vital, avatar *enemy)
{
float distance;
distance = sqrt(pow((vital->coordX - enemy->coordX),2) + pow((vital->coordY - enemy->coordY),2));
if((distance < vital->radius + enemy->radius)&&(vital->timeDemage.flag))
{
vital->life-=10;
if(vital->life <= 0)
vital->life = 0;
setTimer(&vital->timeDemage.time, 100);
}
}
开发者ID:fspacheco,项目名称:derDurchfall,代码行数:14,代码来源:durchfallEngine.c
示例19: repaint
void GridFrame::update() {
float tmp = (float)15/19;
currentTetrimono->fall(25);
repaint();
if(!hasLost)
setTimer(1000*tmp/(currentGame->getLevel() + tmp));
else
setTimer(75);
if (currentTetrimono->isOnFloor()) {
if (currentTetrimono->getUpperBound() <= 0) {
hasLost = true;
return;
}
currentGame->scoreManage();
delete currentTetrimono; // on désaloue la mémoire du tétrimono sur le sol
currentTetrimono = new Tetrimono(nextTetrimonoNumber, grid);
int i = rand() % 7;
nextTetrimonoNumber = i;
emit updateNextBlock(i);
}
QWidget::update();
}
开发者ID:wrousseau,项目名称:tatris,代码行数:23,代码来源:GridFrame.cpp
示例20: eeprom_write_byte
uint8_t eeprom_write_byte(uint8_t *index, uint8_t val) {
if (((uint32_t)index) >= sizeof(flash_backing))
return 1;
if (flash_state == STATE_EMPTY)
memcpy(flash_backing, (const void *)&flash_area, sizeof(flash_backing));
flash_backing[(uint32_t)index] = val;
flash_state = STATE_DIRTY;
setTimer(&my_timer, MS2ST(30), eeprom_flush, NULL);
return 0;
}
开发者ID:xobs,项目名称:arduino-esplanade,代码行数:14,代码来源:EEPROM.c
注:本文中的setTimer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论