Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef TARGET_H
00022 #define TARGET_H
00023
00024 #include <QObject>
00025 #include <valarray>
00026 #include "../compiler/compiler.h"
00027
00028 namespace Aseba
00029 {
00032
00033 struct TargetDescription;
00034
00036 class Target: public QObject
00037 {
00038 Q_OBJECT
00039
00040 public:
00042 enum ExecutionMode
00043 {
00045 EXECUTION_STOP,
00047 EXECUTION_RUN,
00049 EXECUTION_STEP_BY_STEP,
00051 EXECUTION_UNKNOWN,
00052 };
00053
00054 signals:
00056 void nodeConnected(unsigned node);
00058 void nodeDisconnected(unsigned node);
00060 void networkDisconnected();
00061
00063 void userEvent(unsigned id, const VariablesDataVector data);
00065 void userEventsDropped(unsigned amount);
00066
00068 void arrayAccessOutOfBounds(unsigned node, unsigned line, unsigned size, unsigned index);
00070 void divisionByZero(unsigned node, unsigned line);
00072 void eventExecutionKilled(unsigned node, unsigned line);
00074 void nodeSpecificError(unsigned node, unsigned line, const QString& message);
00075
00077 void executionPosChanged(unsigned node, unsigned line);
00079 void executionModeChanged(unsigned node, Target::ExecutionMode mode);
00081 void variablesMemoryEstimatedDirty(unsigned node);
00082
00084 void variablesMemoryChanged(unsigned node, unsigned start, const VariablesDataVector &variables);
00085
00087 void breakpointSetResult(unsigned node, unsigned line, bool success);
00088
00090 void bootloaderAck(unsigned errorCode, unsigned errorAddress);
00091
00092 public:
00094 virtual ~Target() { }
00095
00096
00098
00099
00100 public:
00102 virtual QString getLanguage() const = 0;
00103
00105 const QString getName(unsigned node) const;
00106
00108 virtual const TargetDescription * const getDescription(unsigned node) const = 0;
00109
00111 virtual void broadcastGetDescription() = 0;
00112
00114 virtual void uploadBytecode(unsigned node, const BytecodeVector &bytecode) = 0;
00115
00117 virtual void writeBytecode(unsigned node) = 0;
00118
00120 virtual void reboot(unsigned node) = 0;
00121
00123 virtual void sendEvent(unsigned id, const VariablesDataVector &data) = 0;
00124
00125
00126
00128 virtual void setVariables(unsigned node, unsigned start, const VariablesDataVector &data) = 0;
00129
00131 virtual void getVariables(unsigned node, unsigned start, unsigned length) = 0;
00132
00133
00134
00136 virtual void reset(unsigned node) = 0;
00137
00139 virtual void run(unsigned node) = 0;
00140
00142 virtual void pause(unsigned node) = 0;
00143
00145 virtual void next(unsigned node) = 0;
00146
00148 virtual void stop(unsigned node) = 0;
00149
00150
00151
00153 virtual void setBreakpoint(unsigned node, unsigned line) = 0;
00154
00156 virtual void clearBreakpoint(unsigned node, unsigned line) = 0;
00157
00159 virtual void clearBreakpoints(unsigned node) = 0;
00160
00161 protected:
00162 friend class ThymioBootloaderDialog;
00163 friend class ThymioVisualProgramming;
00164
00166 virtual void blockWrite() = 0;
00167
00169 virtual void unblockWrite() = 0;
00170 };
00171
00173 };
00174
00175 #endif