int deviceTestGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_TEST) { if (fillDeviceArgumentList) { setFunction("test", 2, 1); setArgumentUnsignedHex2(0, "a"); setArgumentUnsignedHex2(1, "b"); setResultUnsignedHex2(0, "result"); } return commandLengthValueForMode(mode, 4, 2); } else if (commandHeader == COMMAND_SIMPLE_TEST) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("simpleTest"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_HEAVY_TEST) { if (fillDeviceArgumentList) { setFunction("heavyTest", 10, 1); setArgumentUnsignedHex2(0, "a"); setArgumentUnsignedHex2(1, "b"); setArgumentUnsignedHex4(2, "c"); setArgumentUnsignedHex4(3, "d"); setArgumentUnsignedHex2(4, "e"); setArgumentSeparator(5); setArgumentUnsignedHex2(6, "f"); setArgumentUnsignedHex4(7, "g"); setArgument(8, DEVICE_ARG_UNSIGNED_HEX_6, "h"); setArgumentUnsignedHex2(9, "i"); setResult(0, DEVICE_ARG_UNSIGNED_HEX_6, "result"); } return commandLengthValueForMode(mode, 29, 6); } // Debug Test else if (commandHeader == COMMAND_DEBUG_TEST) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("debugTest"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_GENERATE_NOTIFY_TEST) { if (fillDeviceArgumentList) { setFunction("generateNotifyTest", 1, 0); setArgumentUnsignedHex2(0, "notifyTestValue"); } return commandLengthValueForMode(mode, 2, 0); } // Handle a notification test else if (mode == DEVICE_MODE_NOTIFY) { if (commandHeader == NOTIFY_TEST) { if (fillDeviceArgumentList) { setNotification("notifyTest", 1); setArgumentUnsignedHex2(0, "notifyArg0"); } return 2; } } return DEVICE_HEADER_NOT_HANDLED; }
int commonBeaconDeviceGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { // Redirection if (commandHeader == COMMAND_REDIRECT_TO_JENNIC) { // same output / input if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("redirectToJennic"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_LOCAL_LIGHT) { if (fillDeviceArgumentList) { setFunction("localLight", 1, 2); setArgumentUnsignedHex2(2, "on/off"); } return commandLengthValueForMode(mode, 2, 0); } else if (commandHeader == COMMAND_SHOW_DATA_FROM_JENNIC) { // both input/output if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("showDataFromJennic"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_RESET_JENNIC) { // both input/output if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("resetJennic"); } return commandLengthValueForMode(mode, 0, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceTest2GetInterface(char commandHeader, int mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_TEST2) { if (fillDeviceArgumentList) { setFunction("test2", 2, 1); setArgumentUnsignedHex2(0, "a"); setArgumentUnsignedHex2(1, "b"); setResultUnsignedHex2(0, "result"); } return commandLengthValueForMode(mode, 4, 2); } else if (commandHeader == COMMAND_INTENSIVE_TEST_DRIVER) { if (fillDeviceArgumentList) { setFunction("testDriverIntensive", 1, 0); setArgumentUnsignedHex4(0, "count"); } return commandLengthValueForMode(mode, 4, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceServoGetInterface(char header, int mode, BOOL fillDeviceArgumentList ) { if (mode == DEVICE_MODE_INPUT) { if (header == COMMAND_SERVO) { if (fillDeviceArgumentList) { setFunction("updateServo", 3); setArgumentUnsignedHex2(0, "ServoIdx"); setArgumentUnsignedHex2(1, "speed"); setArgumentUnsignedHex4(2, "value"); } return 8; } } else if (mode == DEVICE_MODE_OUTPUT) { if (header == COMMAND_SERVO) { if (fillDeviceArgumentList) { setFunctionNoArgument("updateServo"); } return 0; } } return DEVICE_HEADER_NOT_HANDLED; }
int deviceFileGetInterface(char header, DeviceInterfaceMode mode, bool fillDeviceArgumentList){ if (header == COMMAND_CREATE_FILE_SYSTEM) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("Create File System"); } return 0; } else if (header == COMMAND_GET_FREE_SPACE) { if (fillDeviceArgumentList) { setFunction("Get Free Space", 0, 1); setResultUnsignedHex4(0, "result"); } return commandLengthValueForMode(mode, 0, 4); } else if (header == COMMAND_SHOW_LIST_FILE ) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("Show File List"); } return 0; } else if (header == COMMAND_SHOW_CONTENT_FILE) { if (fillDeviceArgumentList) { setFunction("Show File Content", 1, 0); setArgumentUnsignedHex2(0, "fileIndex"); } return commandLengthValueForMode(mode, 2, 0); } else if (header == COMMAND_CREATE_NEW_FILE) { if (fillDeviceArgumentList) { setFunction("Create New File", 1, 0); setArgumentUnsignedHex2(0, "fileIndex"); } return commandLengthValueForMode(mode, 2, 0); } else if (header == COMMAND_DELETE_FILE) { if (fillDeviceArgumentList) { setFunction("Delete File", 1, 0); setArgumentUnsignedHex2(0, "fileIndex"); } return commandLengthValueForMode(mode, 2, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceI2cSlaveDebugGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_I2C_DEBUG_SLAVE_DEBUG) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("i2cDebug"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMANG_I2C_DEBUG_SLAVE_ADDRESS) { if (fillDeviceArgumentList) { setFunction("i2cSlaveAddress", 0, 1); setResultUnsignedHex2(0, "i2cAddress"); } return commandLengthValueForMode(mode, 0, 2); } else if (commandHeader == COMMAND_I2C_DEBUG_SLAVE_ENABLE_DISABLE) { if (fillDeviceArgumentList) { setFunction("enable/disable", 1, 0); setArgumentUnsignedHex2(0, "mode"); } return commandLengthValueForMode(mode, 2, 0); } else if (commandHeader == COMMAND_I2C_DEBUG_SLAVE_SEND_CHAR_I2C_TO_MASTER) { if (fillDeviceArgumentList) { setFunction("sendCharI2cToMaster", 1, 0); setArgumentUnsignedHex2(0, "char"); } return commandLengthValueForMode(mode, 2, 0); } else if (commandHeader == COMMAND_I2C_DEBUG_SLAVE_READ_CHAR_I2C_FROM_MASTER) { if (fillDeviceArgumentList) { setFunction("readCharI2cFromMaster", 0, 1); setResultUnsignedHex2(0, "result"); } return commandLengthValueForMode(mode, 0, 2); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceTestGetInterface(char header, int mode, BOOL fillDeviceArgumentList) { if (header == COMMAND_TEST) { if (mode == DEVICE_MODE_INPUT) { if (fillDeviceArgumentList) { setFunction("test", 2); setArgumentUnsignedHex2(0, "arg1"); setArgumentUnsignedHex2(1, "arg2"); } return 4; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunction("test", 1); setArgumentUnsignedHex2(0, "result"); } return 2; } }// Describe a notification test else if (header == COMMAND_NOTIFY_TEST) { if (mode == DEVICE_MODE_INPUT) { if (fillDeviceArgumentList) { setFunction("notifyTest", 1); setArgumentUnsignedHex2(0, "arg"); } return 2; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunction("notifyTest", 1); setArgumentUnsignedHex2(0, "arg"); } return 2; } } return DEVICE_HEADER_NOT_HANDLED; }
int deviceTofGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_TOF_GET_DISTANCE) { if (fillDeviceArgumentList) { setFunction("TOF Get Distance", 1, 1); setArgumentUnsignedHex2(0, "Tof Index"); setResultUnsignedHex4(0, "distance (mm)"); } return commandLengthValueForMode(mode, 2, 4); } else if (commandHeader == COMMAND_TOF_DEBUG) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("TOF Debug List"); } return commandLengthValueForMode(mode, 0, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceIOExpanderGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_IO_EXPANDER_WRITE_SINGLE_BIT) { if (fillDeviceArgumentList) { setFunction("Write Single Bit", 5, 0); setArgumentUnsignedHex2(0, "IO Expander Index"); setArgumentSeparator(1); setArgumentUnsignedHex2(2, "IO Index"); setArgumentSeparator(3); setArgumentUnsignedChar1(4, "Value (bool)"); } return commandLengthValueForMode(mode, 7, 0); } if (commandHeader == COMMAND_IO_EXPANDER_WRITE_VALUE) { if (fillDeviceArgumentList) { setFunction("Write Value", 3, 0); setArgumentUnsignedHex2(0, "IO Expander Index"); setArgumentSeparator(1); setArgumentUnsignedHex2(2, "Value"); } return commandLengthValueForMode(mode, 5, 0); } else if (commandHeader == COMMAND_IO_EXPANDER_READ_SINGLE_BIT) { if (fillDeviceArgumentList) { setFunction("Read Single Bit", 3, 1); setArgumentUnsignedHex2(0, "IO Expander Index"); setArgumentSeparator(1); setArgumentUnsignedHex2(2, "IO Index"); setResultUnsignedChar1(0, "Value (bool)"); } return commandLengthValueForMode(mode, 5, 1); } else if (commandHeader == COMMAND_IO_EXPANDER_READ_VALUE) { if (fillDeviceArgumentList) { setFunction("Read Value", 1, 1); setArgumentUnsignedHex2(0, "IO Expander Index"); setResultUnsignedHex2(0, "Value"); } return commandLengthValueForMode(mode, 2, 2); } else if (commandHeader == COMMAND_IO_EXPANDER_DEBUG) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("Debug as Table"); } return commandLengthValueForMode(mode, 0, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceDataDispatcherGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_DISPATCHER_LIST) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("showDispatcherList"); } return 0; } else if (commandHeader == COMMAND_PING_DISPATCHER_INDEX) { if (fillDeviceArgumentList) { setFunction("PingDispatcherIndex", 1, 1); setArgumentUnsignedHex2(0, "pingIndex"); setResultUnsignedHex2(0, "pingIndex"); } return commandLengthValueForMode(mode, 2, 2); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceRelayGetInterface(char header, int mode, BOOL fillDeviceArgumentList) { if (mode == DEVICE_MODE_INPUT) { if (header == COMMAND_RELAY) { if (fillDeviceArgumentList) { setFunction("setRelay", 2); setArgumentUnsignedHex2(0, "RelayIdx"); setArgumentUnsignedChar1(1, "Value"); } return 3; } } else if (mode == DEVICE_MODE_OUTPUT){ if (header == COMMAND_RELAY) { if (fillDeviceArgumentList) { setFunctionNoArgument("setRelay"); } return 0; } } return DEVICE_HEADER_NOT_HANDLED; }
int deviceStartMatchGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_MATCH_IS_STARTED) { if (fillDeviceArgumentList) { setFunction("isStarted", 0, 1); setResultUnsignedHex2(0, "value"); } return commandLengthValueForMode(mode, 0, 2); } else if (commandHeader == COMMAND_MATCH_SET_STARTED) { if (fillDeviceArgumentList) { setFunction("setStarted", 1, 0); setArgumentUnsignedHex2(0, "value"); } return commandLengthValueForMode(mode, 2, 0); } if (commandHeader == COMMAND_STEP_BY_STEP) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("stepByStep"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_START_MATCH_GET_INITIAL_POSITION) { if (fillDeviceArgumentList) { setFunction("getInitialPosition", 1, 7); setArgumentUnsignedHex2(0, "side"); setResultUnsignedHex2(0, "side"); setResultSeparator(1); setResultUnsignedHex4(2, "x (mm)"); setResultSeparator(3); setResultUnsignedHex4(4, "y (mm)"); setResultSeparator(5); setResultUnsignedHex4(6, "angle (mm)"); } return commandLengthValueForMode(mode, 2, 17); } else if (commandHeader == COMMAND_START_MATCH_SET_INITIAL_POSITION) { if (fillDeviceArgumentList) { setFunction("setInitialPosition", 7, 0); setArgumentUnsignedHex2(0, "side"); setArgumentSeparator(1); setArgumentUnsignedHex4(2, "x (mm)"); setArgumentSeparator(3); setArgumentUnsignedHex4(4, "y (mm)"); setArgumentSeparator(5); setArgumentUnsignedHex4(6, "angle (mm)"); } return commandLengthValueForMode(mode, 17, 0); } /* if (mode == DEVICE_MODE_OUTPUT) { if (header == COMMAND_NOTIFY_MATCH_STARTED) { if (fillDeviceArgumentList) { deviceArgumentList->functionName = "notifyMatchStarted"; deviceArgumentList->size = 1; deviceArgumentList->args[0].type = DEVICE_ARG_UNSIGNED_CHAR_3; deviceArgumentList->args[0].name = "XyY"; } return commandLengthValueForMode(mode, 0, 0); } } */ return DEVICE_HEADER_NOT_HANDLED; }
int deviceSystemGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { // BoardName if (commandHeader == COMMAND_BOARD_NAME) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("getBoardName"); } return commandLengthValueForMode(mode, 0, 0); } // lastError else if (commandHeader == COMMAND_GET_LAST_ERROR) { if (fillDeviceArgumentList) { setFunction("getLastError", 0, 1); setResultUnsignedHex4(0, "error"); } return commandLengthValueForMode(mode, 0, 4); } if (commandHeader == COMMAND_CLEAR_LAST_ERROR) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("clearLastError"); } return commandLengthValueForMode(mode, 0, 0); } // DeviceList else if (commandHeader == COMMAND_DEVICE_LIST) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("deviceList"); } return commandLengthValueForMode(mode, 0, 0); } // Ping else if (commandHeader == COMMAND_PING) { if (fillDeviceArgumentList) { setFunction("ping", 1, 1); setArgumentUnsignedHex2(0, "pingIndex"); setResultUnsignedHex2(0, "pingIndex"); } return commandLengthValueForMode(mode, 2, 2); } // wait else if (commandHeader == COMMAND_WAIT) { if (fillDeviceArgumentList) { setFunction("wait", 1, 0); setArgumentUnsignedHex4(0, "ms"); } return commandLengthValueForMode(mode, 4, 0); } // usage else if (commandHeader == COMMAND_USAGE) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("usage"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_USAGE_PROBLEM) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("usage (only Problems)"); } return commandLengthValueForMode(mode, 0, 0); } // Usage Specific else if (commandHeader == COMMAND_USAGE_SPECIFIC_DEVICE) { if (fillDeviceArgumentList) { setFunction("usageSpecificDevice", 1, 0); setArgumentUnsignedChar1(0, "deviceHeaderChar"); } return commandLengthValueForMode(mode, 1, 0); } else if (commandHeader == COMMAND_CLS) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("clearScreen"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_RESET) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("reset MicroController"); } return commandLengthValueForMode(mode, 0, 0); } // Notification else if (commandHeader == COMMAND_NOTIFICATION) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("notification"); } return commandLengthValueForMode(mode, 0, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceMotionGetInterface(char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_MOTION_LOAD_DEFAULT_PARAMETERS) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("loadDefaultParameters"); } return commandLengthValueForMode(mode, 0, 0); } // goto else if (commandHeader == COMMAND_MOTION_GOTO_IN_PULSE) { if (fillDeviceArgumentList) { setFunction("gotoPulse", 4, 0); setArgument(0, DEVICE_ARG_SIGNED_HEX_6, "left"); setArgument(1, DEVICE_ARG_SIGNED_HEX_6, "right"); setArgumentUnsignedHex2(2, "a"); setArgumentUnsignedHex2(3, "s"); } return commandLengthValueForMode(mode, 16, 0); }// forward MM else if (commandHeader == COMMAND_MOTION_FORWARD_IN_MM) { if (fillDeviceArgumentList) { setFunction("forwardMM", 1, 0); setArgumentUnsignedHex4(0, "distMM"); } return commandLengthValueForMode(mode, 4, 0); }// backward MM else if (commandHeader == COMMAND_MOTION_BACKWARD_IN_MM) { if (fillDeviceArgumentList) { setFunction("backwardMM", 1, 0); setArgumentUnsignedHex4(0, "distMM"); } return commandLengthValueForMode(mode, 4, 0); }// turn left in degree else if (commandHeader == COMMAND_MOTION_LEFT_IN_DECI_DEGREE) { if (fillDeviceArgumentList) { setFunction("rotLeftDecDeg", 1, 0); setArgumentUnsignedHex4(0, "leftAngleDecDeg"); } return commandLengthValueForMode(mode, 4, 0); }// turn right in degree else if (commandHeader == COMMAND_MOTION_RIGHT_IN_DECI_DEGREE) { if (fillDeviceArgumentList) { setFunction("rotRightDecDeg", 1, 0); setArgumentUnsignedHex4(0, "rightAngleDecDeg"); } return commandLengthValueForMode(mode, 4, 0); }// ONLY ONE WHEEL // turn left (only right in degree else if (commandHeader == COMMAND_MOTION_LEFT_ONE_WHEEL_IN_DECI_DEGREE) { if (fillDeviceArgumentList) { setFunction("rotLeft1WheelDecDeg", 1, 0); setArgumentUnsignedHex4(0, "leftAngleDecDeg"); } return commandLengthValueForMode(mode, 4, 0); }// turn right (only right wheel) in degree else if (commandHeader == COMMAND_MOTION_RIGHT_ONE_WHEEL_IN_DECI_DEGREE) { if (fillDeviceArgumentList) { setFunction("rotRight1WheelDecDeg", 1, 0); setArgumentUnsignedHex4(0, "rightAngleDecDeg"); } return commandLengthValueForMode(mode, 4, 0); } // motion : Cancel else if (commandHeader == COMMAND_MOTION_CANCEL) { // Same INPUT/OUTPUT if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("cancelMot"); } return commandLengthValueForMode(mode, 0, 0); }// motion : Obstacle else if (commandHeader == COMMAND_MOTION_OBSTACLE) { // Same INPUT/OUTPUT if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("motionObstacle"); } return commandLengthValueForMode(mode, 0, 0); }// Calibration else if (commandHeader == COMMAND_SQUARE_CALIBRATION) { if (fillDeviceArgumentList) { setFunction("squareCalib", 3, 0); setArgumentUnsignedHex2(0, "left/right"); setArgumentSeparator(1); setArgumentUnsignedHex4(2, "length"); } return commandLengthValueForMode(mode, 7, 0); }// Parameters else if (commandHeader == COMMAND_GET_MOTION_PARAMETERS) { if (fillDeviceArgumentList) { setFunction("getMotionParam", 1, 2); setArgumentUnsignedHex2(0, "motionType"); setResultUnsignedHex2(0, "a"); setResultUnsignedHex2(1, "s"); } return commandLengthValueForMode(mode, 2, 4); } else if (commandHeader == COMMAND_SET_MOTION_PARAMETERS) { if (fillDeviceArgumentList) { setFunction("setMotionParam", 3, 0); setArgumentUnsignedHex2(0, "motionType"); setArgumentUnsignedHex2(1, "a"); setArgumentUnsignedHex2(2, "s"); } return commandLengthValueForMode(mode, 6, 0); } // MODE REPLACE / ADD else if (commandHeader == COMMAND_MOTION_MODE_ADD) { if(fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("motionModeAdd"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_MOTION_MODE_REPLACE) { if(fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("motionModeReplace"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_MOTION_MODE_GET) { if (fillDeviceArgumentList) { setFunction("motionModeGet", 0, 1); setResultUnsignedChar1(0, "value"); } return commandLengthValueForMode(mode, 0, 1); } // NOTIFICATION if (DEVICE_MODE_NOTIFY == mode) { if (commandHeader == NOTIFY_MOTION_STATUS_REACHED) { if (fillDeviceArgumentList) { fillNotifyResults("notifyReached"); } return 14; } else if (commandHeader == NOTIFY_MOTION_STATUS_FAILED) { if (fillDeviceArgumentList) { fillNotifyResults("notifyFailed"); } return 14; } else if (commandHeader == NOTIFY_MOTION_STATUS_OBSTACLE) { if (fillDeviceArgumentList) { fillNotifyResults("notifyObstacle"); } return 14; } else if (commandHeader == NOTIFY_MOTION_STATUS_MOVING) { if (fillDeviceArgumentList) { fillNotifyResults("notifyMoving"); } return 14; } } return DEVICE_HEADER_NOT_HANDLED; }
int deviceTimerGetInterface(unsigned char commandHeader, DeviceInterfaceMode mode, bool fillDeviceArgumentList) { if (commandHeader == COMMAND_TIMER_LIST) { if (fillDeviceArgumentList) { setFunctionNoArgumentAndNoResult("show Timer List"); } return commandLengthValueForMode(mode, 0, 0); } else if (commandHeader == COMMAND_TIMER_COUNT) { if (fillDeviceArgumentList) { setFunction("timer Count", 0, 1); setResultUnsignedHex2(0, "count"); } return commandLengthValueForMode(mode, 0, 2); } else if (commandHeader == COMMAND_TIMER_READ) { if (fillDeviceArgumentList) { setFunction("timer Read", 1, 13); setArgumentUnsignedHex2(0, "timerIndex"); setResultUnsignedHex2(0, "Index"); setResultSeparator(1); setResultUnsignedHex2(2, "Code"); setResultSeparator(3); setResultUnsignedHex4(4, "Diviser"); setResultSeparator(5); setResultUnsignedHex4(6, "InternalCounter"); setResultSeparator(7); setResultUnsignedHex6(8, "time"); setResultSeparator(9); setResultUnsignedHex6(10, "markTime"); setResultSeparator(11); setResultUnsignedChar1(12, "enabled"); } return commandLengthValueForMode(mode, 2, 31); } else if (commandHeader == COMMAND_TIMER_ENABLE_DISABLE) { if (fillDeviceArgumentList) { setFunction("timer Enable", 3, 0); setArgumentUnsignedHex2(0, "timerIndex"); setArgumentSeparator(1); setArgumentUnsignedChar1(2, "enable/disable"); } return commandLengthValueForMode(mode, 4, 0); } // Mark else if (commandHeader == COMMAND_TIMER_TIME_SINCE_LAST_MARK) { if (fillDeviceArgumentList) { setFunction("time Since Last Mark", 1, 1); setArgumentUnsignedHex2(0, "timerIndex"); setResultUnsignedHex6(0, "mark"); } return commandLengthValueForMode(mode, 2, 6); } else if (commandHeader == COMMAND_TIMER_MARK) { if (fillDeviceArgumentList) { setFunction("mark Timer !", 1, 1); setArgumentUnsignedHex2(0, "timerIndex"); setResultUnsignedHex6(0, "markTime"); } return commandLengthValueForMode(mode, 2, 6); } else if (commandHeader == COMMAND_TIMER_TIMEOUT) { if (fillDeviceArgumentList) { setFunction("timeout check", 3, 3); setArgumentUnsignedHex2(0, "timerIndex"); setArgumentSeparator(1); setArgumentUnsignedHex6(2, "time to check"); setResultUnsignedHex2(0, "timerIndex"); setResultSeparator(1); setResultUnsignedChar1(2, "timeout or not"); } return commandLengthValueForMode(mode, 9, 4); } // Demo else if (commandHeader == COMMAND_TIMER_DEMO) { if (fillDeviceArgumentList) { setFunction("Enable/Disable Timer Demo", 1, 0); setArgumentUnsignedChar1(0, "enable/disable"); } return commandLengthValueForMode(mode, 1, 0); } // wait else if (commandHeader == COMMAND_TIMER_DELAY_WAIT) { if (fillDeviceArgumentList) { setFunction("Timer Delay Wait", 1, 0); setArgumentUnsignedHex4(0, "milli Seconds"); } return commandLengthValueForMode(mode, 4, 0); } return DEVICE_HEADER_NOT_HANDLED; }
int deviceStrategyGetInterface(char header, int mode, BOOL fillDeviceArgumentList) { // Robot opponent position if (header == COMMAND_STRATEGY_SET_OPPONENT_ROBOT_POSITION) { if (mode == DEVICE_MODE_INPUT) { if (fillDeviceArgumentList) { setFunction("setOpponentRobotPos", 3); setArgumentUnsignedHex4(0, "x (mm)"); setArgumentSeparator(1); setArgumentUnsignedHex4(2, "y (mm)"); } return 9; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunctionNoArgument("setOpponentRobotPos"); } return 0; } } // Config else if (header == COMMAND_STRATEGY_SET_CONFIG) { if (mode == DEVICE_MODE_INPUT) { if (fillDeviceArgumentList) { setFunction("setConfig", 1); setArgumentUnsignedHex4(0, "config"); } return 4; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunctionNoArgument("setConfig"); } return 0; } } // Print Gameboard else if (header == COMMAND_STRATEGY_PRINT_GAME_BOARD) { // same input/output if (fillDeviceArgumentList) { setFunctionNoArgument("printGameBoard"); } return 0; } // Next step else if (header == COMMAND_STRATEGY_NEXT_STEP) { if (mode == DEVICE_MODE_INPUT) { // same input/output if (fillDeviceArgumentList) { setFunctionNoArgument("nextStep"); } return 0; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunction("nextStep", 1); setArgumentUnsignedHex2(0, "status"); } return 2; } } // Notify position else if (header == COMMAND_STRATEGY_SET_ROBOT_POSITION) { if (mode == DEVICE_MODE_INPUT) { if (fillDeviceArgumentList) { setFunction("strategySetRobotPosition", 7); setArgumentUnsignedHex2(0, "status"); setArgumentSeparator(1); setArgumentUnsignedHex4(2, "x(mm)"); setArgumentSeparator(3); setArgumentUnsignedHex4(4, "y(mm)"); setArgumentSeparator(5); setArgumentUnsignedHex4(6, "ang(1/10)deg"); } return 17; } else if (mode == DEVICE_MODE_OUTPUT) { if (fillDeviceArgumentList) { setFunctionNoArgument("strategySetRobotPosition"); } return 0; } } return DEVICE_HEADER_NOT_HANDLED; }