Adding missing instructions to load missing Apache2 modules for Fidelius to work!
[iotcloud.git] / version1 / src / js / iotjs / src / lastmessage.js
1 'use strict';
2
3 var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
4
5 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
7 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
8
9 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
10
11 var LastMessage = function (_Entry) {
12         _inherits(LastMessage, _Entry);
13
14         function LastMessage(slot, _machineid, _seqnum) {
15                 _classCallCheck(this, LastMessage);
16
17                 var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(LastMessage).call(this, slot));
18
19                 _this.machineid = _machineid;
20                 _this.seqnum = _seqnum;
21                 return _this;
22         }
23
24         _createClass(LastMessage, [{
25                 key: 'getMachineID',
26                 value: function getMachineID() {
27                         return this.machineid;
28                 }
29         }, {
30                 key: 'getSequenceNumber',
31                 value: function getSequenceNumber() {
32                         return this.seqnum;
33                 }
34         }, {
35                 key: 'decode',
36                 value: function decode(slot, bb) {
37                         //slot and bb are instancesof Slot and ByteBuffer
38                         if (!(slot instanceof Slot && bb instanceof ByteBuffer)) {
39                                 throw new Error('Problem with the Arguments');
40                         }
41                         var machineid = bb.readByte();
42                         var seqnum = bb.readByte();
43                         return new LastMessage(slot, machineid, seqnum);
44                 }
45         }, {
46                 key: 'encode',
47                 value: function encode(bb) {
48                         bb.writeByte(Entry.TypeLastMessage);
49                         bb.writeByte(this.machineid);
50                         bb.writeByte(this.seqnum);
51                 }
52         }, {
53                 key: 'getSize',
54                 value: function getSize() {
55                         return 2 * (1 + 1);
56                 }
57         }, {
58                 key: 'getType',
59                 value: function getType() {
60                         return Entry.TypeLastMessage;
61                 }
62         }, {
63                 key: 'getCopy',
64                 value: function getCopy(s) {
65                         if (!(s instanceof Slot)) {
66                                 throw new Error('Argument must be a slot object');
67                         }
68                         return new LastMessage(s, this.machineid, this.seqnum);
69                 }
70         }]);
71
72         return LastMessage;
73 }(Entry);