node-insim
Version:
An InSim library for NodeJS with TypeScript support
97 lines (96 loc) • 4.26 kB
JavaScript
;
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.TargetToConnectionType = exports.IS_TTC = void 0;
var decorators_1 = require("../decorators");
var base_1 = require("./base");
var enums_1 = require("./enums");
/**
* General purpose 8 byte packet (Target To Connection)
*
* To request an {@link IS_AXM} for a connection's layout editor selection send this
* {@link IS_TTC}:
*
* - ReqI: non-zero (returned in the reply)
* - SubT: {@link TTC_SEL} (request an {@link IS_AXM} for the current selection)
* - UCID: connection (0 = local / non-zero = guest)
*/
var IS_TTC = /** @class */ (function (_super) {
__extends(IS_TTC, _super);
function IS_TTC(data) {
var _this = _super.call(this) || this;
_this.Size = 8;
_this.Type = enums_1.PacketType.ISP_TTC;
/** 0 unless it is an info request or a reply to an info request */
_this.ReqI = 0;
/** Subtype */
_this.SubT = 0;
/** Connection's unique id (0 = local) */
_this.UCID = 0;
/** May be used in various ways depending on SubT */
_this.B1 = 0;
/** May be used in various ways depending on SubT */
_this.B2 = 0;
/** May be used in various ways depending on SubT */
_this.B3 = 0;
_this.initialize(data);
return _this;
}
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "Size", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "Type", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "ReqI", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "SubT", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "UCID", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "B1", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "B2", void 0);
__decorate([
(0, decorators_1.byte)()
], IS_TTC.prototype, "B3", void 0);
return IS_TTC;
}(base_1.SendablePacket));
exports.IS_TTC = IS_TTC;
var TargetToConnectionType;
(function (TargetToConnectionType) {
/** Not used */
TargetToConnectionType[TargetToConnectionType["TTC_NONE"] = 0] = "TTC_NONE";
/** Info request: send {@link IS_AXM} for a layout editor selection */
TargetToConnectionType[TargetToConnectionType["TTC_SEL"] = 1] = "TTC_SEL";
/** Info request: send {@link IS_AXM} every time the selection changes */
TargetToConnectionType[TargetToConnectionType["TTC_SEL_START"] = 2] = "TTC_SEL_START";
/** Instruction: switch off {@link IS_AXM} requested by {@link TTC_SEL_START} */
TargetToConnectionType[TargetToConnectionType["TTC_SEL_STOP"] = 3] = "TTC_SEL_STOP";
})(TargetToConnectionType || (exports.TargetToConnectionType = TargetToConnectionType = {}));