TimeoutCommand::TimeoutCommand(Command *command, WebPageManager *manager, QObject *parent) : Command(parent) { m_command = command; m_manager = manager; m_timer = new QTimer(this); m_timer->setSingleShot(true); connect(m_timer, SIGNAL(timeout()), this, SLOT(commandTimeout())); connect(m_manager, SIGNAL(loadStarted()), this, SLOT(pageLoadingFromCommand())); }
KangarooStatus KangarooChannel::get(KangarooGetType type, KangarooGetFlags flags) { KangarooTimeout timeout(commandTimeout()); KangarooStatus initialStatus; if (getInitialSequenceCodeIfNecessary(timeout, initialStatus)) { return initialStatus; } return getSpecial(type, flags, timeout); }
KangarooChannel::KangarooChannel(KangarooSerial& serial, char name, byte address) : _serial(serial), _name(), _address(address), _echoCode(), _monitorCode(), _monitoredSequenceCode(), _monitoredSequenceCodeIsReady() { // Simplified Serial autocapitalizes, but Packet Serial does not. So, we do it here. // If the compiler does LTO this should constant fold to use no code space. if (name >= 'a' && name <= 'z') { name += 'A' - 'a'; } if ((name >= 'A' && name <= 'Z') || (name >= '0' && name <= '9')) { _name = name; } commandRetryInterval(KANGAROO_DEFAULT_COMMAND_RETRY_INTERVAL); commandTimeout (KANGAROO_DEFAULT_COMMAND_TIMEOUT ); streaming(false); }
KangarooMonitor KangarooChannel::set(KangarooCommand command, KangarooCommandWriter& contents, KangarooMoveFlags moveFlags, KangarooGetType getType) { KangarooMonitor monitor(this, ++_monitorCode); if (streaming()) { setNoReply(command, contents, moveFlags); // Motions from other commands cannot be tracked through. } else { KangarooTimeout timeout(commandTimeout()); moveFlags = (KangarooMoveFlags)(moveFlags | KANGAROO_MOVE_SEQUENCE_CODE); // Invalidate the older command monitor and set up a new one. if (!getInitialSequenceCodeIfNecessary(timeout, _monitoredGetResult)) { // If we have a proper initial sequence code, send the command. _monitoredGetType = getType; _monitoredGetFlags = (KangarooGetFlags)moveFlags; _monitoredSequenceCode = nextCode(_monitoredSequenceCode); do { setNoReply(command, contents, moveFlags); } // Make sure the packet was received correctly -- proper sequence code and the like. If not, we'll resend. while (!updateMonitoredResult(timeout, false)); } } return monitor; }
void QWurthScanner::commandTimeOut() { emit commandTimeout(currentCommand.type); startSendPackets(); }