void I2CFlexel::getDate(byte *date) { beginCommand(I2C_FLEXEL_COMMAND_GET_DATE); endCommand(); requestBytes(4); readBytes(date, 4); }
void I2CFlexel::getTimeAndDate(byte* timeAndDate) { beginCommand(I2C_FLEXEL_COMMAND_GET_TIME_AND_DATE); endCommand(); requestBytes(7); readBytes(timeAndDate, 7); }
void RideFileCommand::startLUW(QString name) { luw = new LUWCommand(this, name, ride); inLUW = true; beginCommand(false, luw); }
void QgsComposerItem::mouseReleaseEvent( QGraphicsSceneMouseEvent * event ) { if ( mItemPositionLocked ) { return; } //delete frame rectangle if ( mBoundingResizeRectangle ) { scene()->removeItem( mBoundingResizeRectangle ); delete mBoundingResizeRectangle; mBoundingResizeRectangle = 0; } QPointF mouseMoveStopPoint = event->lastScenePos(); double diffX = mouseMoveStopPoint.x() - mMouseMoveStartPos.x(); double diffY = mouseMoveStopPoint.y() - mMouseMoveStartPos.y(); //it was only a click if ( qAbs( diffX ) < std::numeric_limits<double>::min() && qAbs( diffY ) < std::numeric_limits<double>::min() ) { return; } beginCommand( tr( "Change item position" ) ); changeItemRectangle( mouseMoveStopPoint, mMouseMoveStartPos, this, diffX, diffY, this ); endCommand(); //reset default action mCurrentMouseMoveAction = QgsComposerItem::MoveItem; setCursor( Qt::ArrowCursor ); }
void ASIOConnection::refresh(Milliseconds timeout, RefreshCallback cb) { auto op = _impl.get(); _refreshCallback = std::move(cb); // Actually timeout refreshes setTimeout(timeout, [this]() { asio::post(_global->_impl->_io_service, [this] { _impl->connection().stream().cancel(); }); }); // Our pings are isMaster's auto beginStatus = op->beginCommand(makeIsMasterRequest(this), NetworkInterfaceASIO::AsyncCommand::CommandType::kRPC, _hostAndPort); if (!beginStatus.isOK()) { auto cb = std::move(_refreshCallback); cb(this, beginStatus); return; } _global->_impl->_asyncRunCommand( op, [this, op](std::error_code ec, size_t bytes) { cancelTimeout(); auto cb = std::move(_refreshCallback); if (ec) return cb(this, Status(ErrorCodes::HostUnreachable, ec.message())); cb(this, Status::OK()); }); }
void I2CFlexel::getTime(byte* time) { beginCommand(I2C_FLEXEL_COMMAND_GET_TIME); endCommand(); requestBytes(3); readBytes(time, 3); }
void I2CFlexel::loadLcdCustomCharacters(byte addr, byte *bitmap) { beginCommand(I2C_FLEXEL_COMMAND_LOAD_LCD_CUSTOM_CHARACTERS); sendCommandParameter(addr); sendCommandParameters(bitmap, I2C_FLEXEL_LCD_CHAR_ROWS_COUNT); endCommand(); }
byte I2CFlexel::readKey(byte command) { beginCommand(command); endCommand(); requestByte(); return readByte(); }
void TestCommandReader::parse() { while (!isEmpty()) { IComposerClient::Command command; uint16_t length; ASSERT_TRUE(beginCommand(&command, &length)); switch (command) { case IComposerClient::Command::SET_ERROR: { ASSERT_EQ(2, length); auto loc = read(); auto err = readSigned(); GTEST_FAIL() << "unexpected error " << err << " at location " << loc; } break; case IComposerClient::Command::SELECT_DISPLAY: case IComposerClient::Command::SET_CHANGED_COMPOSITION_TYPES: case IComposerClient::Command::SET_DISPLAY_REQUESTS: case IComposerClient::Command::SET_PRESENT_FENCE: case IComposerClient::Command::SET_RELEASE_FENCES: break; default: GTEST_FAIL() << "unexpected return command " << std::hex << static_cast<int>(command); break; } endCommand(); } }
void I2CFlexel::setPwmForDcMotor(byte motorAndPosition, byte pwmValue) { beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_DC_MOTOR); sendCommandParameter(motorAndPosition); sendCommandParameter(pwmValue); endCommand(); }
void I2CFlexel::setPwmForHighPowerPin(byte pin, byte pwmValue) { beginCommand(I2C_FLEXEL_COMMAND_SET_PWM_FOR_HIGH_POWER_PIN); sendCommandParameter(pin); sendCommandParameter(pwmValue); endCommand(); }
byte I2CFlexel::getFirmwareVersion() { beginCommand(I2C_FLEXEL_COMMAND_GET_FIRMWARE_VERSION); endCommand(); requestByte(); return readByte(); }
void I2CFlexel::printStringOnLcd(const char *str, uint8_t length) { beginCommand(I2C_FLEXEL_COMMAND_PRINT_STRING_ON_LCD); sendCommandParameter(length); sendCommandParameters( (byte*) str, length); endCommand(); }
void I2CFlexel::setLcdCursorPosition(byte row, byte column) { beginCommand(I2C_FLEXEL_COMMAND_SET_LCD_CURSOR_POSITION); sendCommandParameter(min(I2C_FLEXEL_LCD_MAX_ROWS_COUNT - 1, row)); sendCommandParameter(min(I2C_FLEXEL_LCD_MAX_COLS_COUNT - 1, column)); endCommand(); }
void I2CFlexel::setTime(byte sec, byte min, byte hour) { beginCommand(I2C_FLEXEL_COMMAND_SET_TIME); sendCommandParameter(sec); sendCommandParameter(min); sendCommandParameter(hour); endCommand(); }
void I2CFlexel::getAnalogInputValue(byte pin, byte* analog) { beginCommand(I2C_FLEXEL_COMMAND_GET_ANALOG_INPUT_VALUE); sendCommandParameter(pin); endCommand(); requestBytes(2); readBytes(analog, 2); }
void I2CFlexel::setServoMotorPosition(byte pin, byte msb, byte lsb) { beginCommand(I2C_FLEXEL_COMMAND_SET_SERVO_MOTOR_POSITION); sendCommandParameter(pin); sendCommandParameter(msb); sendCommandParameter(lsb); endCommand(); }
void I2CFlexel::setDate(byte wday, byte day, byte month, byte year) { beginCommand(I2C_FLEXEL_COMMAND_SET_DATE); sendCommandParameter(wday); sendCommandParameter(day); sendCommandParameter(month); sendCommandParameter(year); endCommand(); }
void RideFileCommand::undoCommand() { if (stackptr > 0) { stackptr--; beginCommand(true, stack[stackptr]); // signal stack[stackptr]->undoCommand(); endCommand(true, stack[stackptr]); // signal } }
void I2CFlexel::setTimeAndDate(byte sec, byte min, byte hour, byte wday, byte day, byte month, byte year) { beginCommand(I2C_FLEXEL_COMMAND_SET_TIME_AND_DATE); sendCommandParameter(sec); sendCommandParameter(min); sendCommandParameter(hour); sendCommandParameter(wday); sendCommandParameter(day); sendCommandParameter(month); sendCommandParameter(year); endCommand(); }
void RideFileCommand::redoCommand() { if (stackptr < stack.count()) { beginCommand(false, stack[stackptr]); // signal stack[stackptr]->doCommand(); stack[stackptr]->docount++; stackptr++; // increment before end to keep in sync in case // it is queried 'after' the command is executed // i.e. within a slot connected to this signal endCommand(false, stack[stackptr-1]); // signal } }
void ASIOConnection::refresh(Milliseconds timeout, RefreshCallback cb) { _impl->strand().dispatch([this, timeout, cb] { auto op = _impl.get(); // We clear state transitions because we're re-running a portion of the asio state machine // without entering in startCommand (which would call this for us). op->clearStateTransitions(); _refreshCallback = std::move(cb); // Actually timeout refreshes setTimeout(timeout, [this] { _impl->connection().stream().cancel(); }); // Our pings are isMaster's auto beginStatus = op->beginCommand(makeIsMasterRequest(this), NetworkInterfaceASIO::AsyncCommand::CommandType::kRPC, _hostAndPort); if (!beginStatus.isOK()) { auto cb = std::move(_refreshCallback); cb(this, beginStatus); return; } // If we fail during refresh, the _onFinish function of the AsyncOp will get called. As such // we // need to intercept those calls so we can capture them. This will get cleared out when we // fill // in the real onFinish in startCommand. op->setOnFinish([this](StatusWith<RemoteCommandResponse> failedResponse) { invariant(!failedResponse.isOK()); auto cb = std::move(_refreshCallback); cb(this, failedResponse.getStatus()); }); op->_inRefresh = true; _global->_impl->_asyncRunCommand(op, [this, op](std::error_code ec, size_t bytes) { cancelTimeout(); auto cb = std::move(_refreshCallback); if (ec) return cb(this, Status(ErrorCodes::HostUnreachable, ec.message())); op->_inRefresh = false; cb(this, Status::OK()); }); }); }
void RideFileCommand::doCommand(RideCommand *cmd, bool noexec) { // we must add to the LUW, but also must // execute immediately since state data // is collected by each command as it is // created. if (inLUW) { luw->addCommand(cmd); beginCommand(false, cmd); cmd->doCommand(); // luw must be executed as added!!! cmd->docount++; endCommand(false, cmd); return; } // place onto stack if (stack.count()) { // wipe away commands we can no longer redo for (int i=stackptr; i<stack.count(); i++) delete stack.at(i); stack.remove(stackptr, stack.count() - stackptr); } stack.append(cmd); stackptr++; if (noexec == false) { beginCommand(false, cmd); // signal cmd->doCommand(); // execute } cmd->docount++; endCommand(false, cmd); // signal - even if LUW // we changed it! ride->emitModified(); }
void I2CFlexel::turnOffBlinkingCursor() { beginCommand(I2C_FLEXEL_COMMAND_TURN_OFF_BLINKING_CURSOR); endCommand(); }
void RideFileCommand::emitBeginCommand(bool undo, RideCommand *cmd) { emit beginCommand(undo, cmd); }
void I2CFlexel::turnOffDisplay() { beginCommand(I2C_FLEXEL_COMMAND_TURN_OFF_DISPLAY); endCommand(); }
void I2CFlexel::homeCursor() { beginCommand(I2C_FLEXEL_COMMAND_HOME_CURSOR); endCommand(); }
void I2CFlexel::turnOffUnderlineCursor() { beginCommand(I2C_FLEXEL_COMMAND_TURN_OFF_UNDERLINE_CURSOR); endCommand(); }
void I2CFlexel::moveCursorRightOneSpace() { beginCommand(I2C_FLEXEL_COMMAND_MOVE_CURSOR_RIGHT_ONE_SPACE); endCommand(); }
void I2CFlexel::clearLcdScreen() { beginCommand(I2C_FLEXEL_COMMAND_CLEAR_LCD_SCREEN); endCommand(); }