本文整理汇总了C++中setTimeout函数的典型用法代码示例。如果您正苦于以下问题:C++ setTimeout函数的具体用法?C++ setTimeout怎么用?C++ setTimeout使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setTimeout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPortName
/*!
\fn Win_QextSerialPort::Win_QextSerialPort(const QString & name, const PortSettings& settings)
Constructs a port with specified name and settings.
*/
Win_QextSerialPort::Win_QextSerialPort(const QString & name, const PortSettings& settings, QextSerialBase::QueryMode mode)
{
m_WinHandle=INVALID_HANDLE_VALUE;
setPortName(name);
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setStopBits(settings.StopBits);
setParity(settings.Parity);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
init();
}
示例2: handleRead
/// Handle completion of a read operation.
void handleRead( const boost::system::error_code& e, std::size_t bytesTransferred )
{
setTimeout( 0 );
if ( !e ) {
LOG_TRACE << "Read " << bytesTransferred << " bytes from " << identifier();
m_connHandler->networkInput( m_readBuffer, bytesTransferred );
}
else {
LOG_TRACE << "Read error: " << e.message();
signalError( e );
}
nextOperation();
}
示例3: handleShutdown
/// Handle connection shutdown
void handleShutdown()
{
setTimeout( 0 );
if ( socket().lowest_layer().is_open() ) {
boost::system::error_code ignored_ec;
socket().lowest_layer().shutdown( boost::asio::ip::tcp::socket::shutdown_both, ignored_ec );
socket().lowest_layer().close();
LOG_DEBUG << "Connection to " << identifier() << " closed";
}
else {
LOG_DEBUG << "Connection to " << identifier() << " already closed";
}
}
示例4: QextSerialBase
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
Constructs a port with default name and specified settings.
*/
Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings, QextSerialBase::QueryMode mode)
: QextSerialBase()
{
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
init();
}
示例5: QextSerialBase
/*!
\fn Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
Constructs a port with default name and specified settings.
*/
Posix_QextSerialPort::Posix_QextSerialPort(const PortSettings& settings)
: QextSerialBase()
{
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
Posix_File=new QFile();
setTimeout(settings.Timeout_Millisec);
init();
}
示例6: QIODevice
/*!
Constructs a port with default name and specified settings.
*/
QextSerialPort::QextSerialPort(const PortSettings & settings, QextSerialPort::QueryMode mode)
: QIODevice()
{
construct();
setBaudRate(settings.BaudRate);
setDataBits(settings.DataBits);
setParity(settings.Parity);
setStopBits(settings.StopBits);
setFlowControl(settings.FlowControl);
setTimeout(settings.Timeout_Millisec);
setQueryMode(mode);
platformSpecificInit();
}
示例7: port
/*!
* initPort() - initialization of com port.
*/
void TEDisplayEpson::initPort()
{
TSerialPort *p = port();
if ( !p ) return;
if (!isOpen())
open();
p->setFlowControl(FLOW_OFF);
setPortBaudRate(m_baudRate);
p->setDataBits(DATA_8);
p->setParity(PAR_NONE);
p->setStopBits(STOP_1);
setTimeout(100);
};
示例8: rfid_set
void ICACHE_FLASH_ATTR rfid_set(uint8 freq, uint8 led) {
char command[10];
if (freq < 10) {
os_sprintf(command, "mc%d0\r", freq);
uart_write_str(command);
#if RFID_DEBUG
debug("RFID: %s\n", command);
#endif
}
setTimeout(rfid_set_led, led, 10);
}
示例9: finger_start_read
LOCAL void ICACHE_FLASH_ATTR finger_start_read() {
LOCAL uint32 finger_read_timer = 0;
if (device_get_uart() != UART_FINGER) {
#if FINGER_DEBUG
debug("FINGER: %s\n", DEVICE_NOT_FOUND);
#endif
return;
}
finger_current_buff = 0;
clearTimeout(finger_read_timer);
finger_read_timer = setTimeout(finger_gen_img, finger_read, FINGER_TIMEOUT);
}
示例10: PPositionOurGoalKick
inline PPositionOurGoalKick(const BeliefState& state)
: Play(state)
{
name = "PositionOurGoalKick";
assert(HomeTeam::SIZE == 5);
setTimeout(100, 1);
PositionPlay = PLAYTYPE_YES;
AttackPlay = PLAYTYPE_NO;
Tactic::Param param;
Vector2D<int> finalPoint ;
/* for goalie */
roleList[0].push_back(std::make_pair(Tactic::GoalieOur, param));
/*Vector2D<int> dpointg(ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*1.2),state.ballPos.y);
param.PositionP.x = ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*1.2) ;
param.PositionP.y = state.ballPos.y;
param.PositionP.finalSlope = 0;
param.PositionP.align = false ;
roleList[0].push_back(std::make_pair(Tactic::Position,param));
*//* Role 1 - Defender 1*/
Vector2D<int> dpoint0(ForwardX(-HALF_FIELD_MAXX + GOAL_DEPTH + BOT_RADIUS*9),-1*(OUR_GOAL_MAXY + 2*BOT_RADIUS));
finalPoint = position_our_bot(&state,dpoint0,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0 ;
roleList[1].push_back(std::make_pair(Tactic::Position,param));
// Role 2
Vector2D<int> dpoint(ForwardX(-HALF_FIELD_MAXX/2),HALF_FIELD_MAXY/2);
finalPoint = position_our_bot(&state,dpoint,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[2].push_back(std::make_pair(Tactic::Position, param));
//Role 3
Vector2D<int> dpoint1(ForwardX(-CENTER_CIRCLE_DIAMETER/2),HALF_FIELD_MAXY/4);
finalPoint = position_our_bot(&state,dpoint1,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[3].push_back(std::make_pair(Tactic::Position, param));
//Role 4
Vector2D<int> dpoint2(ForwardX(HALF_FIELD_MAXX/6),-HALF_FIELD_MAXY/2);
finalPoint = position_our_bot(&state,dpoint2,0);
param.PositionP.x = finalPoint.x ; param.PositionP.y = finalPoint.y ;
param.PositionP.finalSlope = 0;
roleList[4].push_back(std::make_pair(Tactic::Position, param));
computeMaxTacticTransits();
}
示例11: Packet
VotePacket::VotePacket( uint32 ip, uint16 port, int32 rank,
bool direct)
: Packet( MAX_VOTE_LENGTH,
VOTE_PRIO,
PACKETTYPE_VOTE,
ip, port, 0, 0)
{
int packetPosition = HEADER_SIZE;
incWriteLong( packetPosition, rank );
incWriteLong( packetPosition, direct );
// 5 seconds timeout.
setTimeout( 5 );
setLength(packetPosition);
}
示例12: File
Socket::Socket(int sockfd, int type, const char *address /* = NULL */,
int port /* = 0 */)
: File(true), m_port(port), m_type(type), m_error(0), m_eof(false),
m_timeout(0), m_timedOut(false), m_bytesSent(0) {
if (address) m_address = address;
m_fd = sockfd;
struct timeval tv;
tv.tv_sec = RuntimeOption::SocketDefaultTimeout;
tv.tv_usec = 0;
setsockopt(m_fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv));
setsockopt(m_fd, SOL_SOCKET, SO_SNDTIMEO, &tv, sizeof(tv));
setTimeout(tv);
}
示例13: cancel
void Timer::start(TimeMs timeout, Qt::TimerType type, Repeat repeat) {
cancel();
_type = type;
setRepeat(repeat);
_adjusted = false;
setTimeout(timeout);
_timerId = startTimer(_timeout, _type);
if (_timerId) {
_next = getms(true) + _timeout;
} else {
_next = 0;
}
}
示例14: setTimeout
void
StopAndWaitRC::doWakeup(Port<Data>)
{
if (sendNowData &&
getPortConnector< Port<Data> >()->hasAcceptor(activeCompound))
{
setTimeout(resendTimeout);
getPortConnector< Port<Data> >()->getAcceptor(activeCompound)->sendData(activeCompound->copy());
sendNowData = false;
}
getReceptor()->wakeup();
}
示例15: settings
/*!
\fn Posix_QextSerialPort::construct(void)
Common constructor function, called by all versions of
Posix_QextSerialPort::Posix_QextSerialPort(). Sets up default port settings (115200 8N1
Hardware flow control where supported, otherwise no flow control, and 500 ms timeout).
*/
void Posix_QextSerialPort::construct(void) {
QextSerialBase::construct();
#ifdef NOQFILE
m_fdFile=-1;
#else
Posix_File=new QFile();
#endif
setBaudRate(BAUD115200);
setDataBits(DATA_8);
setStopBits(STOP_1);
setParity(PAR_NONE);
setFlowControl(FLOW_HARDWARE);
setTimeout(0, 500);
}