Target.h
Go to the documentation of this file.
00001 /*
00002         Aseba - an event-based framework for distributed robot control
00003         Copyright (C) 2007--2012:
00004                 Stephane Magnenat <stephane at magnenat dot net>
00005                 (http://stephane.magnenat.net)
00006                 and other contributors, see authors.txt for details
00007         
00008         This program is free software: you can redistribute it and/or modify
00009         it under the terms of the GNU Lesser General Public License as published
00010         by the Free Software Foundation, version 3 of the License.
00011         
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU Lesser General Public License for more details.
00016         
00017         You should have received a copy of the GNU Lesser General Public License
00018         along with this program. If not, see <http://www.gnu.org/licenses/>.
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         /*public slots:
00098                 virtual void connect() = 0;*/
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                 // variables
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                 // execution
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                 // breakpoints
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 }; // Aseba
00174 
00175 #endif


aseba
Author(s): Stéphane Magnenat
autogenerated on Sun Oct 5 2014 23:46:39