本文整理汇总了C++中setTimer函数的典型用法代码示例。如果您正苦于以下问题:C++ setTimer函数的具体用法?C++ setTimer怎么用?C++ setTimer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimer函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
}
}
示例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;
}
示例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();
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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();
}
示例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();
}
示例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;
}
示例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();
});
}