UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

110 lines (109 loc) 4.34 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __read = (this && this.__read) || function (o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IS_CON = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); var structs_1 = require("./structs"); /** * CONtact - between two cars (A and B are sorted by PLID) * * This packet reports contacts between two cars if the closing speed is above 0.25 m/s. * * Set the {@link ISF_CON} flag in the {@link IS_ISI} to receive car contact reports. */ var IS_CON = /** @class */ (function (_super) { __extends(IS_CON, _super); function IS_CON() { var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this; _this.Size = 44; _this.Type = enums_1.PacketType.ISP_CON; _this.ReqI = 0; _this.Zero = 0; /** High 4 bits: reserved / low 12 bits: closing speed (10 = 1 m/s) */ _this.SpClose = 0; _this.SpW = 0; /** Time stamp (ms) */ _this.Time = 0; /** Contact object - car A */ _this.A = new structs_1.CarContact(); /** Contact object - car B */ _this.B = new structs_1.CarContact(); return _this; } __decorate([ (0, decorators_1.byte)() ], IS_CON.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_CON.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_CON.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_CON.prototype, "Zero", void 0); __decorate([ (0, decorators_1.word)() ], IS_CON.prototype, "SpClose", void 0); __decorate([ (0, decorators_1.word)() ], IS_CON.prototype, "SpW", void 0); __decorate([ (0, decorators_1.unsigned)() ], IS_CON.prototype, "Time", void 0); __decorate([ (0, decorators_1.struct)(structs_1.CarContact) ], IS_CON.prototype, "A", void 0); __decorate([ (0, decorators_1.struct)(structs_1.CarContact) ], IS_CON.prototype, "B", void 0); return IS_CON; }(base_1.Packet)); exports.IS_CON = IS_CON;