Details | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 969 | runge | 1 | /*************************************************************************** |
| 2 | * Copyright (C) November 28, 2008 by Mattias Runge * |
||
| 3 | * mattias@runge.se * |
||
| 4 | * canmessage.h * |
||
| 5 | * * |
||
| 6 | * This program is free software; you can redistribute it and/or modify * |
||
| 7 | * it under the terms of the GNU General Public License as published by * |
||
| 8 | * the Free Software Foundation; either version 2 of the License, or * |
||
| 9 | * (at your option) any later version. * |
||
| 10 | * * |
||
| 11 | * This program is distributed in the hope that it will be useful, * |
||
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
||
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
||
| 14 | * GNU General Public License for more details. * |
||
| 15 | * * |
||
| 16 | * You should have received a copy of the GNU General Public License * |
||
| 17 | * along with this program; if not, write to the * |
||
| 18 | * Free Software Foundation, Inc., * |
||
| 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * |
||
| 20 | ***************************************************************************/ |
||
| 21 | |||
| 22 | #ifndef _CANMESSAGE_H |
||
| 23 | #define _CANMESSAGE_H |
||
| 24 | |||
| 25 | using namespace std; |
||
| 26 | |||
| 27 | #include <string> |
||
| 28 | #include <map> |
||
| 997 | runge | 29 | #include <stdexcept> |
| 969 | runge | 30 | |
| 31 | #include "canmessageexception.h" |
||
| 32 | #include "canidtranslator.h" |
||
| 33 | #include "canvariable.h" |
||
| 34 | #include "../Tools/tools.h" |
||
| 35 | |||
| 36 | class CanMessage |
||
| 37 | { |
||
| 38 | public: |
||
| 986 | runge | 39 | CanMessage() { myIsUnknown = false; myModuleId = 0; }; |
| 969 | runge | 40 | CanMessage(string raw) { setRaw(raw); }; |
| 41 | |||
| 42 | void setRaw(string rawHex); |
||
| 43 | string getRaw(); |
||
| 44 | |||
| 45 | bool isUnknown() { return myIsUnknown; }; |
||
| 46 | |||
| 47 | string getClassName() { return myClassName; }; |
||
| 48 | void setClassName(string className) { myClassName = className; }; ///FIXME: Check if data is valid |
||
| 49 | |||
| 50 | string getDirectionFlag() { return myDirectionFlag; }; |
||
| 51 | void setDirectionFlag(string directionFlag) { myDirectionFlag = directionFlag; }; ///FIXME: Check if data is valid |
||
| 52 | |||
| 53 | string getModuleName() { return myModuleName; }; |
||
| 54 | void setModuleName(string moduleName) { myModuleName = moduleName; }; ///FIXME: Check if data is valid |
||
| 55 | |||
| 56 | unsigned int getModuleId() { return myModuleId; }; |
||
| 57 | void setModuleId(unsigned int moduleId) { myModuleId = moduleId; }; |
||
| 58 | |||
| 59 | string getCommandName() { return myCommandName; }; |
||
| 60 | void setCommandName(string commandName) { myCommandName = commandName; }; ///FIXME: Check if data is valid |
||
| 61 | |||
| 62 | map<string, CanVariable>& getData() { return myData; }; |
||
| 63 | string getJSONData(); |
||
| 991 | runge | 64 | void setData(map<string, CanVariable> data); |
| 997 | runge | 65 | |
| 66 | string toString(); |
||
| 969 | runge | 67 | |
| 68 | private: |
||
| 999 | runge | 69 | string myRawHex; |
| 969 | runge | 70 | bool myIsUnknown; |
| 71 | string myClassName; |
||
| 72 | string myDirectionFlag; |
||
| 73 | string myModuleName; |
||
| 74 | unsigned int myModuleId; |
||
| 75 | string myCommandName; |
||
| 76 | map<string, CanVariable> myData; |
||
| 77 | }; |
||
| 78 | |||
| 79 | #endif /* _CANMESSAGE_H */ |
||
| 80 |