node-insim
Version:
An InSim library for NodeJS with TypeScript support
95 lines (94 loc) • 3.13 kB
JavaScript
import { __decorate } from "tslib";
import { byte } from '../decorators';
import { SendablePacket } from './base';
import { ObjectIndex, PacketType } from './enums';
/**
* Object COntrol - currently used for switching start lights
*/
export class IS_OCO extends SendablePacket {
constructor(data) {
super();
this.Size = 8;
this.Type = PacketType.ISP_OCO;
this.ReqI = 0;
this.Zero = 0;
this.OCOAction = OCOAction.OCO_ZERO;
/** Specifies which lights you want to override **/
this.Index = 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);
}
}
__decorate([
byte()
], IS_OCO.prototype, "Size", void 0);
__decorate([
byte()
], IS_OCO.prototype, "Type", void 0);
__decorate([
byte()
], IS_OCO.prototype, "ReqI", void 0);
__decorate([
byte()
], IS_OCO.prototype, "Zero", void 0);
__decorate([
byte()
], IS_OCO.prototype, "OCOAction", void 0);
__decorate([
byte()
], IS_OCO.prototype, "Index", void 0);
__decorate([
byte()
], IS_OCO.prototype, "Identifier", void 0);
__decorate([
byte()
], IS_OCO.prototype, "Data", void 0);
export 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 || (OCOAction = {}));
export var OCOAutocrossStartLights;
(function (OCOAutocrossStartLights) {
OCOAutocrossStartLights[OCOAutocrossStartLights["RED"] = 1] = "RED";
OCOAutocrossStartLights[OCOAutocrossStartLights["AMBER"] = 2] = "AMBER";
OCOAutocrossStartLights[OCOAutocrossStartLights["GREEN"] = 8] = "GREEN";
})(OCOAutocrossStartLights || (OCOAutocrossStartLights = {}));
export 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 || (OCOMainLights = {}));