UNPKG

node-insim

Version:

An InSim library for NodeJS with TypeScript support

124 lines (123 loc) 5.19 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; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.OCO_INDEX_MAIN = exports.OCOMainLights = exports.OCOAutocrossStartLights = exports.OCOAction = exports.IS_OCO = void 0; var decorators_1 = require("../decorators"); var base_1 = require("./base"); var enums_1 = require("./enums"); /** * Object COntrol - currently used for switching start lights */ var IS_OCO = /** @class */ (function (_super) { __extends(IS_OCO, _super); function IS_OCO(data) { var _this = _super.call(this) || this; _this.Size = 8; _this.Type = enums_1.PacketType.ISP_OCO; _this.ReqI = 0; _this.Zero = 0; _this.OCOAction = OCOAction.OCO_ZERO; /** Specifies which lights you want to override **/ _this.Index = enums_1.ObjectIndex.AXO_NULL; /** * Identify particular start lights objects (0 to 63 or 255 = all) * * Identifier byte can be used to override groups of temporary start lights. * It refers to the temporary lights identifier (0 to 63) seen in the layout editor. */ _this.Identifier = 0; /** * Specifies particular bulbs using the low 4 bits * * Bulb bit values for the currently available lights: * * {@link OCO_INDEX_MAIN} * * - bit 0 (1): red1 * - bit 1 (2): red2 * - bit 2 (4): red3 * - bit 3 (8): green * * {@link AXO_START_LIGHTS} * * - bit 0 (1): red * - bit 1 (2): amber * - bit 3 (8): green */ _this.Data = 0; _this.initialize(data); return _this; } __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Size", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Type", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "ReqI", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Zero", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "OCOAction", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Index", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Identifier", void 0); __decorate([ (0, decorators_1.byte)() ], IS_OCO.prototype, "Data", void 0); return IS_OCO; }(base_1.SendablePacket)); exports.IS_OCO = IS_OCO; var OCOAction; (function (OCOAction) { /** Reserved */ OCOAction[OCOAction["OCO_ZERO"] = 0] = "OCO_ZERO"; /** Give up control of all lights */ OCOAction[OCOAction["OCO_LIGHTS_RESET"] = 4] = "OCO_LIGHTS_RESET"; /** Use Data byte to set the bulbs */ OCOAction[OCOAction["OCO_LIGHTS_SET"] = 5] = "OCO_LIGHTS_SET"; /** Give up control of the specified lights */ OCOAction[OCOAction["OCO_LIGHTS_UNSET"] = 6] = "OCO_LIGHTS_UNSET"; })(OCOAction || (exports.OCOAction = OCOAction = {})); var OCOAutocrossStartLights; (function (OCOAutocrossStartLights) { OCOAutocrossStartLights[OCOAutocrossStartLights["RED"] = 1] = "RED"; OCOAutocrossStartLights[OCOAutocrossStartLights["AMBER"] = 2] = "AMBER"; OCOAutocrossStartLights[OCOAutocrossStartLights["GREEN"] = 8] = "GREEN"; })(OCOAutocrossStartLights || (exports.OCOAutocrossStartLights = OCOAutocrossStartLights = {})); var OCOMainLights; (function (OCOMainLights) { OCOMainLights[OCOMainLights["RED_1"] = 1] = "RED_1"; OCOMainLights[OCOMainLights["RED_2"] = 2] = "RED_2"; OCOMainLights[OCOMainLights["RED_3"] = 4] = "RED_3"; OCOMainLights[OCOMainLights["GREEN"] = 8] = "GREEN"; })(OCOMainLights || (exports.OCOMainLights = OCOMainLights = {})); /** Special value to override the main start light system */ exports.OCO_INDEX_MAIN = 240;