Rev 986 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 986 | runge | 1 | |
| 2 | function CanNMTMessage(className, commandName, data) |
||
| 3 | { |
||
| 4 | this.myClassName = className; |
||
| 5 | this.myCommandName = commandName; |
||
| 6 | |||
| 7 | if (!data) |
||
| 8 | data = new Array(); |
||
| 9 | |||
| 10 | this.myData = data; |
||
| 11 | } |
||
| 12 | |||
| 13 | CanNMTMessage.prototype.myClassName = null; |
||
| 14 | CanNMTMessage.prototype.myCommandName = null; |
||
| 15 | CanNMTMessage.prototype.myData = null; |
||
| 16 | |||
| 17 | CanNMTMessage.prototype.setClassName = function(className) |
||
| 18 | { |
||
| 19 | this.myClassName = className; |
||
| 20 | } |
||
| 21 | |||
| 22 | CanNMTMessage.prototype.getClassName = function() |
||
| 23 | { |
||
| 24 | return this.myClassName; |
||
| 25 | } |
||
| 26 | |||
| 27 | CanNMTMessage.prototype.setCommandName = function(commandName) |
||
| 28 | { |
||
| 29 | this.myCommandName = commandName; |
||
| 30 | } |
||
| 31 | |||
| 32 | CanNMTMessage.prototype.getCommandName = function() |
||
| 33 | { |
||
| 34 | return this.myCommandName; |
||
| 35 | } |
||
| 36 | |||
| 37 | CanNMTMessage.prototype.setData = function(name, value) |
||
| 38 | { |
||
| 39 | this.myData[name] = value; |
||
| 40 | } |
||
| 41 | |||
| 42 | CanNMTMessage.prototype.getData = function(name) |
||
| 43 | { |
||
| 44 | return this.myData[name]; |
||
| 45 | } |
||
| 46 | |||
| 47 | CanNMTMessage.prototype.getDataString = function() |
||
| 48 | { |
||
| 49 | var str = ""; |
||
| 50 | |||
| 51 | for (var key in this.myData) |
||
| 52 | { |
||
| 53 | str += key + ":" + this.myData[key] + ","; |
||
| 54 | } |
||
| 55 | |||
| 56 | return str.rtrim(","); |
||
| 57 | } |
||
| 58 | |||
| 1008 | runge | 59 | CanNMTMessage.prototype.send = function() |
| 60 | { |
||
| 61 | sendCanNMTMessage( this.getClassName(), |
||
| 62 | this.getCommandName(), |
||
| 63 | this.getDataString()); |
||
| 64 | } |
||
| 65 | |||
| 986 | runge | 66 | CanNMTMessage.prototype.toString = function() |
| 67 | { |
||
| 68 | return "[CanNMTMessage] " + this.getClassName() + ", " + |
||
| 69 | this.getCommandName() + ", " + |
||
| 70 | this.getDataString(); |
||
| 71 | |||
| 72 | } |