void behaviourController(void) { behaviour_cruise(); behaviour_escape(); if(escape.state != IDLE) moveCommand(&escape); else if(cruise.state != IDLE) moveCommand(&cruise); else moveCommand(&STOP); }
void MainPanel::pressButtonSlot(int button) { switch(button) { case CommandButtons::BUTTON_VIEW: viewCommand(); break; case CommandButtons::BUTTON_EDIT: editCommand(); break; case CommandButtons::BUTTON_COPY: copyCommand(); break; case CommandButtons::BUTTON_MOVE: moveCommand(); break; case CommandButtons::BUTTON_MK_DIR: mkdirCommand(); break; case CommandButtons::BUTTON_DELETE: deleteCommand(); break; case CommandButtons::BUTTON_EXIT: exitCommand(); break; } }
/** * The behaviourController task controls the subsumption architechture. * It implements the priority levels of the different behaviours. * * */ void behaviourController(void) { // Call all the behaviour tasks: wifi_Control(); // Execute the commands depending on priority levels: if(checkLowBattery.state != IDLE) // Highest priority - 2 { //writeString("Priority 2\n"); }else if(wifiControl.state != IDLE) // Priority - 1 { moveCommand(&wifiControl); } else // Lowest priority - 0 { //writeString("command STOP\n"); moveCommand(&STOP); // Default command - do nothing! } }
bool ServerInterface::SendMove(enum Tetromino::Move move, int pieceId, zmq::socket_t& commandSocket) const { std::string const* moveCommandS = m_factory.CreateMoveMessage(move, pieceId); zmq::message_t moveCommand (moveCommandS->size()); memcpy(static_cast<void*>(moveCommand.data()), moveCommandS->data(), moveCommandS->size()); delete moveCommandS; commandSocket.send(moveCommand); zmq::message_t reply; commandSocket.recv(&reply); std::string replyS (static_cast<char const*>(reply.data()), reply.size()); return m_factory.ParseMoveReply(replyS); }
//----------------------------------------------------------------------------- // Function: DesignLabel::mouseReleaseEvent() //----------------------------------------------------------------------------- void StickyNote::mouseReleaseEvent(QGraphicsSceneMouseEvent * event) { QGraphicsItemGroup::mouseReleaseEvent(event); if (positionChanged()) { StickyNoteMoveCommand* moveCommand(new StickyNoteMoveCommand(this, oldPos_)); emit modified(moveCommand); } else if (hitsAssociationButton(event->pos())) { emit beginAssociation(this); } }
// robosolver <size> <pos> move <from> <direction> // robosolver <size> <pos> to <from> <to> // robosolver <size> <pos> find <color> // robosolver <size> <pos> solve <to> int main(int argc, const char** argv) { N = atoi(argv[1]); field f = parse(strdup(argv[2])); if (strcmp("move", argv[3]) == 0) { moveCommand(f, atoi(argv[4]), atoi(argv[5])); } else if (strcmp("to", argv[3]) == 0) { toCommand(f, atoi(argv[4]), atoi(argv[5])); } else if (strcmp("find", argv[3]) == 0) { findCommand(f, atoi(argv[4])); } else if (strcmp("solve", argv[3]) == 0) { solveCommand(f, atoi(argv[4])); } return 0; }
void MainPanel::keyPressEvent(QKeyEvent* event) { if(event == NULL) return QWidget::keyPressEvent(event); switch(event->key()) { case Qt::Key_Left: case Qt::Key_Right: m_line->setFocus(); break; case Qt::Key_F3: viewCommand(); break; case Qt::Key_F4: editCommand(); break; case Qt::Key_F5: copyCommand(); break; case Qt::Key_F6: moveCommand(); break; case Qt::Key_F7: mkdirCommand(); break; case Qt::Key_F8: deleteCommand(); break; } if(event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) m_line->setFocus(); }