From 296b9e7d444e983d832b67d1fb533579c1d721c4 Mon Sep 17 00:00:00 2001 From: David Young Date: Sun, 8 May 2022 21:32:13 +0100 Subject: [PATCH] * Fixed button press issue. * Updated Command library * Updated branch to latest `master` --- js/commandController.js | 35 +- js/ui/functionButtons.js | 5 +- ...ds-0.4.0.js => dcc-ex--commands-0.10.0.js} | 320 +++++++++++++++++- js/vendor/dcc-ex--commands-0.10.0.js.map | 7 + js/vendor/dcc-ex--commands-0.4.0.js.map | 7 - 5 files changed, 343 insertions(+), 31 deletions(-) rename js/vendor/{dcc-ex--commands-0.4.0.js => dcc-ex--commands-0.10.0.js} (61%) create mode 100644 js/vendor/dcc-ex--commands-0.10.0.js.map delete mode 100644 js/vendor/dcc-ex--commands-0.4.0.js.map diff --git a/js/commandController.js b/js/commandController.js index 1bf3c51..919daa6 100644 --- a/js/commandController.js +++ b/js/commandController.js @@ -95,22 +95,25 @@ async function readLoop() { } function writeToStream(...lines) { - // Stops data being written to nonexistent port if using emulator - let stream = emulatorClass - if (port) { - stream = outputStream.getWriter(); - } - - lines.forEach((line) => { - if (line == "\x03" || line == "echo(false);") { - - } else { - displayLog('[SEND]'+line.toString()); - } - const packet = `<${line}>\n`; - stream.write(packet) - console.log(packet) - }); + const commandLines = lines.map(line => `<${line}>\n`) + writeRawToStream(...commandLines) +} + +function writeRawToStream(...lines) { + let stream = emulatorClass + if (port) { + stream = outputStream.getWriter(); + } + + lines.forEach((line) => { + if (line == "\x03" || line == "echo(false);") { + + } else { + displayLog('[SEND]'+line.toString()); + } + stream.write(line) + console.log(line) + }); } // Transformer for the Web Serial API. Data comes in as a stream so we diff --git a/js/ui/functionButtons.js b/js/ui/functionButtons.js index e4db753..ee7389e 100644 --- a/js/ui/functionButtons.js +++ b/js/ui/functionButtons.js @@ -1,5 +1,4 @@ -import {cabCommand} from "../vendor/dcc-ex--commands-v0.3.0.js" - +import {cabCommand} from "../vendor/dcc-ex--commands-0.10.0.js" function sendCabCommand(fn, value) { setFunCurrentVal(fn, value); @@ -16,7 +15,7 @@ function generateFnCommand(funcName, btnPressed) { } function toggleButtonState(previousBtnState, buttonElement) { - const newBtnState = !previousBtnState + const newBtnState = previousBtnState === 'false' buttonElement.ariaPressed = newBtnState buttonElement.setAttribute("aria-pressed", newBtnState) // Firefox support https://developer.mozilla.org/en-US/docs/Web/API/Element/ariaPressed return newBtnState; diff --git a/js/vendor/dcc-ex--commands-0.4.0.js b/js/vendor/dcc-ex--commands-0.10.0.js similarity index 61% rename from js/vendor/dcc-ex--commands-0.4.0.js rename to js/vendor/dcc-ex--commands-0.10.0.js index ec76647..585a4cb 100644 --- a/js/vendor/dcc-ex--commands-0.4.0.js +++ b/js/vendor/dcc-ex--commands-0.10.0.js @@ -1,8 +1,29 @@ +// src/types/FunctionButtons.ts +var FunctionButtonKind = /* @__PURE__ */ ((FunctionButtonKind2) => { + FunctionButtonKind2["TOGGLE"] = "toggle"; + FunctionButtonKind2["PRESS"] = "press"; + return FunctionButtonKind2; +})(FunctionButtonKind || {}); + // src/types/index.ts +var Enabled = /* @__PURE__ */ ((Enabled2) => { + Enabled2["OFF"] = "OFF"; + Enabled2["ON"] = "ON"; + return Enabled2; +})(Enabled || {}); var ParserStatus = /* @__PURE__ */ ((ParserStatus2) => { ParserStatus2["SUCCESS"] = "success"; return ParserStatus2; })(ParserStatus || {}); +var FunctionName = /* @__PURE__ */ ((FunctionName2) => { + FunctionName2["EEPROMS_ERASE"] = "eraseParser"; + FunctionName2["EEPROMS_STORE"] = "storeParser"; + FunctionName2["LOCO"] = "locoParser"; + FunctionName2["POWER"] = "powerParser"; + FunctionName2["ROSTER_ITEM"] = "rosterItemParser"; + FunctionName2["THROTTLE"] = "throttleParser"; + return FunctionName2; +})(FunctionName || {}); // src/utils/makeCommand.ts var makeCommand = (instruction) => { @@ -45,9 +66,18 @@ function isControlCharacters(char) { function removeControlCharacters(command) { return command.split("").filter((char) => !isControlCharacters(char)).join(""); } +function splitBySpaceOrQuote(cleanedParams) { + const parts = cleanedParams.match(/\w+|"[^"]+"/g); + return parts ?? []; +} +function getStrings(cleanedParams) { + return splitBySpaceOrQuote(cleanedParams).map((part) => { + return part.replaceAll('"', ""); + }); +} function parseCommand(command) { const cleanedParams = removeControlCharacters(command); - const [key, ...attributes] = cleanedParams.split(" "); + const [key, ...attributes] = getStrings(cleanedParams); return { key, attributes @@ -296,6 +326,79 @@ var storeCommand = () => makeCommand(storeCommandKey); var eraseCommandKey = "e"; var eraseCommand = () => makeCommand(eraseCommandKey); +// src/commands/exRails/exRailFreeBlockCommand.ts +var exRailFreeBlockCommand = ({ blockId }) => { + const constant = "/ FREE"; + const attributes = [ + constant, + blockId + ]; + return makeCommandFromAttributes(attributes); +}; + +// src/commands/exRails/exRailKillTaskCommand.ts +var exRailKillTaskCommand = ({ taskId }) => { + const constant = "/ KILL"; + const attributes = [ + constant, + taskId + ]; + return makeCommandFromAttributes(attributes); +}; + +// src/commands/exRails/exRailLatchSensorCommand.ts +var exRailLatchSensorCommand = ({ sensorId }) => { + const constant = "/ LATCH"; + const attributes = [ + constant, + sensorId + ]; + return makeCommandFromAttributes(attributes); +}; + +// src/commands/exRails/exRailPauseCommand.ts +var exRailPauseCommand = () => makeCommand("/ PAUSE"); + +// src/commands/exRails/exRailReserveBlockCommand.ts +var exRailReserveBlockCommand = ({ blockId }) => { + const constant = "/ RESERVE"; + const attributes = [ + constant, + blockId + ]; + return makeCommandFromAttributes(attributes); +}; + +// src/commands/exRails/exRailResumeCommand.ts +var exRailResumeCommand = () => makeCommand("/ RESUME"); + +// src/commands/exRails/exRailRoutesCommand.ts +var exRailRoutesCommand = () => makeCommand("/ ROUTES"); + +// src/commands/exRails/exRailStartTaskCommand.ts +var exRailStartTaskCommand = ({ address, taskId }) => { + const constant = "/ START"; + const attributes = [ + constant, + address, + taskId + ]; + return makeCommandFromAttributes(attributes); +}; + +// src/commands/exRails/exRailTasksCommand.ts +var exRailTasksCommand = () => makeCommand("/"); + +// src/commands/exRails/exRailUnlatchSensorCommand.ts +var exRailUnlatchSensorCommand = ({ sensorId }) => { + const constant = "/ UNLATCH"; + const attributes = [ + constant, + sensorId + ]; + return makeCommandFromAttributes(attributes); +}; + // src/commands/powers/powerCommand.ts var Track = /* @__PURE__ */ ((Track2) => { Track2["MAIN"] = "MAIN"; @@ -311,6 +414,12 @@ var powerCommand = ({ power, track }) => { return makeCommandFromAttributes(attributes); }; +// src/commands/rosters/rosterCommand.ts +var rosterSendKey = "J"; +var rosterCommand = ({ cabId } = {}) => { + return makeCommandFromAttributes([rosterSendKey, cabId]); +}; + // src/commands/sensors/defineSensorCommand.ts var defineSensorCommandKey = "S"; var defineSensorCommand = ({ sensor, pin, pullUp }) => { @@ -465,32 +574,49 @@ var ParserKeyError = class extends Error { this.name = "ParserKeyError"; } }; +var ParserAttributeError = class extends Error { + constructor(attribute, value, msg) { + const message = `${attribute} set to ${value}. ${msg}`; + super(message); + this.name = "ParserAttributeError"; + } +}; // src/parsers/eeproms/eraseParser.ts var eraseParserKey = "0"; -var eraseParser = ({ key }) => { +var parseFromCommand = ({ key }) => { if (key !== eraseParserKey) { throw new ParserKeyError("eraseParser", key); } return { key: eraseParserKey, + parser: FunctionName.EEPROMS_ERASE, status: ParserStatus.SUCCESS, params: {} }; }; +var eraseParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand(commandParams); +}; // src/parsers/eeproms/storeParser.ts var storeParserKey = "e"; -var storeParser = ({ key, attributes }) => { +var parseFromCommand2 = ({ key, attributes }) => { if (key !== storeParserKey) { throw new ParserKeyError("storeParser", key); } return { key: storeParserKey, + parser: FunctionName.EEPROMS_STORE, status: ParserStatus.SUCCESS, params: {} }; }; +var storeParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand2(commandParams); +}; // src/parsers/powers/powerParser.ts var ReturnTrack = /* @__PURE__ */ ((ReturnTrack2) => { @@ -501,7 +627,7 @@ var ReturnTrack = /* @__PURE__ */ ((ReturnTrack2) => { return ReturnTrack2; })(ReturnTrack || {}); var powerParserKey = "p"; -var powerParser = ({ key: potentialKey, attributes }) => { +var parseFromCommand3 = ({ key: potentialKey, attributes }) => { const [key, power] = potentialKey.split(""); if (!isPowerCommand(key, power)) { throw new ParserKeyError("powerParser", key); @@ -512,6 +638,7 @@ var powerParser = ({ key: potentialKey, attributes }) => { } return { key: powerParserKey, + parser: FunctionName.POWER, status: ParserStatus.SUCCESS, params: { power: parseInt(power), @@ -522,8 +649,172 @@ var powerParser = ({ key: potentialKey, attributes }) => { function isPowerCommand(key, power) { return key === powerParserKey && ["0", "1"].includes(power); } +var powerParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand3(commandParams); +}; + +// src/parsers/throttles/throttleParser.ts +var throttleParserKey = "T"; +var isValidDirection = (direction) => !Object.values(Direction).includes(direction); +var parseFromCommand4 = ({ key, attributes }) => { + const [register, speed, directionString] = attributes; + if (key !== throttleParserKey) { + throw new ParserKeyError("throttleParser", key); + } + const direction = parseInt(directionString); + if (isValidDirection(direction)) { + throw new ParserAttributeError("direction", direction, `it must be one of ${Object.values(Direction).join(" | ")}`); + } + return { + key: throttleParserKey, + parser: FunctionName.THROTTLE, + status: ParserStatus.SUCCESS, + params: { + register: parseInt(register), + speed: parseInt(speed), + direction + } + }; +}; +var throttleParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand4(commandParams); +}; + +// src/parsers/throttles/locoParser.ts +function parseSpeedAndDirection(speedValue) { + const direction = speedValue - 128 >= 0 ? Direction.FORWARD : Direction.REVERSE; + const normalisedSpeed = speedValue - 128 >= 0 ? speedValue - 128 : speedValue; + let speed; + switch (normalisedSpeed) { + case 0: { + speed = 0; + break; + } + case 1: { + speed = -1; + break; + } + default: { + speed = normalisedSpeed - 1; + } + } + return { + speed, + direction + }; +} +var parseFunctionButtons = (functionButtonValue) => { + const values = functionButtonValue.toString(2).split("").reverse().map((value) => parseInt(value)); + const numOfFunctions = 29; + return Array.from(Array(numOfFunctions)).reduce((acc, currentValue, index) => { + acc[index] = { + value: values[index] ?? 0 + }; + return acc; + }, {}); +}; +var locoParserKey = "l"; +var parseFromCommand5 = ({ key, attributes }) => { + const [cabIdValue, registerValue, speedValue, functionButtonsValue] = attributes; + if (key !== locoParserKey) { + throw new ParserKeyError("locoParser", key); + } + const { speed, direction } = parseSpeedAndDirection(parseInt(speedValue)); + const functionButtons = parseFunctionButtons(parseInt(functionButtonsValue)); + return { + key: locoParserKey, + parser: FunctionName.LOCO, + status: ParserStatus.SUCCESS, + params: { + register: parseInt(registerValue), + speed, + direction, + cabId: parseInt(cabIdValue), + functionButtons + } + }; +}; +var locoParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand5(commandParams); +}; + +// src/parsers/rosters/rosterItemParser.ts +var rosterItemParserKey = "j"; +var functionButtonsParser = (param = null) => { + if (param === null) { + return {}; + } + const buttons = param.split("/"); + return buttons.reduce((accum, button, index) => { + const [display, isPress] = button.split(/(\*)/).reverse(); + const kind = isPress == null && !isPress ? FunctionButtonKind.TOGGLE : FunctionButtonKind.PRESS; + accum[index] = { + display, + kind + }; + return accum; + }, {}); +}; +var parseFromCommand6 = ({ key, attributes }) => { + const [cabId, display, rawFunctionButtons] = attributes; + if (key !== rosterItemParserKey) { + throw new ParserKeyError("rosterItemParser", key); + } + const functionButtons = functionButtonsParser(rawFunctionButtons); + return { + key: rosterItemParserKey, + parser: FunctionName.ROSTER_ITEM, + status: ParserStatus.SUCCESS, + params: { + cabId: parseInt(cabId), + display, + functionButtons + } + }; +}; +var rosterItemParser = (command) => { + const commandParams = parseCommand(command); + return parseFromCommand6(commandParams); +}; + +// src/parsers/genericParser.ts +var createParser = (parsers) => { + return { + parse: async (command) => { + const results = parsers.map(async (parser) => { + return await new Promise((resolve, reject) => { + try { + const result = parser(command); + resolve(result); + } catch (e) { + reject(e); + } + }); + }); + return await Promise.any(results); + } + }; +}; +var genericParser = () => { + const allParsers = [ + eraseParser, + locoParser, + powerParser, + rosterItemParser, + storeParser, + throttleParser + ]; + return createParser(allParsers); +}; export { Direction, + Enabled, + FunctionButtonKind, + FunctionName, + ParserAttributeError, ParserKeyError, ParserStatus, ReturnTrack, @@ -532,6 +823,7 @@ export { TurnoutState, accessoryCommand, cabCommand, + createParser, defineDCCTurnoutCommand, defineSensorCommand, defineServoTurnoutCommand, @@ -548,26 +840,44 @@ export { eraseCommand, eraseParser, eraseParserKey, + exRailFreeBlockCommand, + exRailKillTaskCommand, + exRailLatchSensorCommand, + exRailPauseCommand, + exRailReserveBlockCommand, + exRailResumeCommand, + exRailRoutesCommand, + exRailStartTaskCommand, + exRailTasksCommand, + exRailUnlatchSensorCommand, forgetAllCabsCommand, forgetCabCommand, + genericParser, isControlCharacters, listSensorsCommand, listSensorsStatusCommand, listTurnoutsCommand, + locoParser, makeCommand, makeCommandFromAttributes, parseAddress, parseCommand, + parseFromCommand3 as parseFromCommand, + parseFunctionButtons, + parseSpeedAndDirection, powerCommand, powerParser, powerParserKey, readAddressProgrammingCommand, readCVByteProgrammingCommand, removeControlCharacters, + rosterCommand, + rosterItemParser, storeCommand, storeParser, storeParserKey, throttleCommand, + throttleParser, turnoutCommand, verifyCVBitProgrammingCommand, verifyCVByteProgrammingCommand, @@ -577,4 +887,4 @@ export { writeCVByteMainCommand, writeCVByteProgrammingCommand }; -//# sourceMappingURL=dcc-ex--commands-0.4.0.js.map +//# sourceMappingURL=dcc-ex--commands-0.10.0.js.map diff --git a/js/vendor/dcc-ex--commands-0.10.0.js.map b/js/vendor/dcc-ex--commands-0.10.0.js.map new file mode 100644 index 0000000..2a63002 --- /dev/null +++ b/js/vendor/dcc-ex--commands-0.10.0.js.map @@ -0,0 +1,7 @@ +{ + "version": 3, + "sources": ["../src/types/FunctionButtons.ts", "../src/types/index.ts", "../src/utils/makeCommand.ts", "../src/utils/parseAddress.ts", "../src/utils/parseCommand.ts", "../src/commands/accessories/accessoryCommand.ts", "../src/commands/cabs/cabCommand.ts", "../src/commands/cabs/forgetCabCommand.ts", "../src/commands/cabs/forgetAllCabsCommand.ts", "../src/commands/decoders/writeCVByteMainCommand.ts", "../src/commands/decoders/writeCVBitMainCommand.ts", "../src/commands/decoders/writeAddressProgrammingCommand.ts", "../src/commands/decoders/writeCVByteProgrammingCommand.ts", "../src/commands/decoders/writeCVBitProgrammingCommand.ts", "../src/commands/decoders/readCVByteProgrammingCommand.ts", "../src/commands/decoders/readAddressProgrammingCommand.ts", "../src/commands/decoders/verifyCVByteProgrammingCommand.ts", "../src/commands/decoders/verifyCVBitProgrammingCommand.ts", "../src/commands/diagnostics/diagnosticCabsCommand.ts", "../src/commands/diagnostics/diagnosticRAMCommand.ts", "../src/commands/diagnostics/diagnosticAckCommand.ts", "../src/commands/diagnostics/diagnosticParserCommand.ts", "../src/commands/diagnostics/diagnosticWiFiCommand.ts", "../src/commands/diagnostics/diagnosticWiThrottleCommand.ts", "../src/commands/eeproms/storeCommand.ts", "../src/commands/eeproms/eraseCommand.ts", "../src/commands/exRails/exRailFreeBlockCommand.ts", "../src/commands/exRails/exRailKillTaskCommand.ts", "../src/commands/exRails/exRailLatchSensorCommand.ts", "../src/commands/exRails/exRailPauseCommand.ts", "../src/commands/exRails/exRailReserveBlockCommand.ts", "../src/commands/exRails/exRailResumeCommand.ts", "../src/commands/exRails/exRailRoutesCommand.ts", "../src/commands/exRails/exRailStartTaskCommand.ts", "../src/commands/exRails/exRailTasksCommand.ts", "../src/commands/exRails/exRailUnlatchSensorCommand.ts", "../src/commands/powers/powerCommand.ts", "../src/commands/rosters/rosterCommand.ts", "../src/commands/sensors/defineSensorCommand.ts", "../src/commands/sensors/deleteSensorCommand.ts", "../src/commands/sensors/listSensorsCommand.ts", "../src/commands/sensors/listSensorsStatusCommand.ts", "../src/commands/throttles/throttleCommand.ts", "../src/commands/throttles/emergencyStopCommand.ts", "../src/commands/turnouts/turnoutCommand.ts", "../src/commands/turnouts/defineDCCTurnoutCommand.ts", "../src/commands/turnouts/defineServoTurnoutCommand.ts", "../src/commands/turnouts/defineVPINTurnoutCommand.ts", "../src/commands/turnouts/deleteTurnoutCommand.ts", "../src/commands/turnouts/listTurnoutsCommand.ts", "../src/parsers/errors/parserKeyError.ts", "../src/parsers/eeproms/eraseParser.ts", "../src/parsers/eeproms/storeParser.ts", "../src/parsers/powers/powerParser.ts", "../src/parsers/throttles/throttleParser.ts", "../src/parsers/throttles/locoParser.ts", "../src/parsers/rosters/rosterItemParser.ts", "../src/parsers/genericParser.ts"], + "sourcesContent": ["import { BitValue } from './index.js'\n\nexport enum FunctionButtonKind {\n TOGGLE = 'toggle',\n PRESS = 'press'\n}\n\nexport interface FunctionButton {\n value: BitValue\n display: string\n kind: FunctionButtonKind\n}\n\nexport interface FunctionButtons {\n [name: number]: T\n}\n", "export * from './FunctionButtons.js'\n\nexport type BitValue = 0 | 1\nexport type Active = BitValue\n\nexport enum Enabled {\n OFF = 'OFF',\n ON = 'ON'\n}\n\nexport enum ParserStatus {\n SUCCESS = 'success'\n}\n\nexport enum FunctionName {\n EEPROMS_ERASE = 'eraseParser',\n EEPROMS_STORE = 'storeParser',\n LOCO = 'locoParser',\n POWER = 'powerParser',\n ROSTER_ITEM = 'rosterItemParser',\n THROTTLE = 'throttleParser',\n}\n\nexport interface ParserResult {\n key: string\n parser: FunctionName\n status: ParserStatus\n params: T\n}\n", "export const makeCommand = (instruction: string): string => {\n return `<${instruction}>`\n}\n\nexport const makeCommandFromAttributes = (attributes: Array): string => {\n const str = attributes\n .map(attribute => {\n if (typeof attribute === 'number') {\n return attribute.toString()\n }\n\n return attribute\n })\n .filter(attribute => !isBlank(attribute))\n .join(' ')\n return makeCommand(str)\n}\n\nfunction isBlank (param: string | undefined | null): boolean {\n if (typeof param === 'string') {\n return param.trim() === ''\n }\n return true\n}\n", "export interface DualCoilAddress {\n primaryAddress: number | null\n subAddress: number | null\n}\n\nexport interface LinearAddress {\n linearAddress: number | null\n}\n\nexport type Address = LinearAddress & DualCoilAddress\nexport type ParseAddressParams = number | DualCoilAddress\n\nexport const parseAddress = (address: ParseAddressParams): Address => {\n let linearAddress = null\n let primaryAddress = null\n let subAddress = null\n\n if (typeof (address) === 'number') {\n linearAddress = address\n } else {\n primaryAddress = address.primaryAddress\n subAddress = address.subAddress\n }\n return { linearAddress, primaryAddress, subAddress }\n}\n", "export function isControlCharacters (char: string): boolean {\n return ['<', '>'].includes(char)\n}\n\nexport function removeControlCharacters (command: string): string {\n return command.split('')\n .filter(char => !isControlCharacters(char))\n .join('')\n}\n\nexport interface Command {\n attributes: string[]\n key: string\n}\n\n/**\n * Regex example https://rubular.com/r/qy9A4gVz8ieDCQ\n * Split string by space and/or by quoted string\n */\nfunction splitBySpaceOrQuote (cleanedParams: string): string[] {\n const parts = cleanedParams.match(/\\w+|\"[^\"]+\"/g)\n return parts ?? []\n}\n\nfunction getStrings (cleanedParams: string): string[] {\n return splitBySpaceOrQuote(cleanedParams).map((part) => {\n return part.replaceAll('\"', '')\n })\n}\n\nexport function parseCommand (command: string): Command {\n const cleanedParams = removeControlCharacters(command)\n const [key, ...attributes] = getStrings(cleanedParams)\n return {\n key,\n attributes\n }\n}\n", "import { makeCommandFromAttributes, parseAddress, ParseAddressParams } from '../../utils/index.js'\nimport { Active } from '../../types/index.js'\n\nexport interface AccessoryCommandParams {\n address: ParseAddressParams\n active: Active\n}\n\nconst accessorySendKey = 'a'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#accessory-decoder-commands\n */\nexport const accessoryCommand: (params: AccessoryCommandParams) => string = ({ address, active }) => {\n const { linearAddress, primaryAddress, subAddress } = parseAddress(address)\n\n const addressSend = linearAddress ?? [primaryAddress, subAddress].join(' ')\n\n const attributes = [\n accessorySendKey,\n addressSend,\n active\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface CabCommandParams {\n cab: number\n func: number\n value: BitValue\n}\n\nconst cabSendKey = 'F'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#cab-functions\n */\nexport const cabCommand: (params: CabCommandParams) => string = ({ cab, func, value }) => {\n const attributes = [\n cabSendKey,\n cab,\n func,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nconst forgetCabCommandKey = '-'\n\nexport interface ForgerCabCommandParams {\n cab: number\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const forgetCabCommand: (params: ForgerCabCommandParams) => string = ({ cab }) => {\n const attributes = [\n forgetCabCommandKey,\n cab\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst forgetAllCabsCommandKey = '-'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const forgetAllCabsCommand: () => string = () => {\n return makeCommand(forgetAllCabsCommandKey)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface WriteCVByteMainCommandParams {\n cab: number\n cv: number\n value: number\n}\n\nconst writeMainDecoderByteKey = 'w'\n\n/**\n * WRITE CV BYTE TO ENGINE DECODER ON MAIN TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-byte-to-engine-decoder-on-main-track\n */\nexport const writeCVByteMainCommand: (params: WriteCVByteMainCommandParams) => string = ({ cab, cv, value }) => {\n const attributes = [\n writeMainDecoderByteKey,\n cab,\n cv,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface WriteCVBitMainCommandParams {\n cab: number\n cv: number\n bit: number\n value: BitValue\n}\n\nconst writeMainDecoderBitKey = 'b'\n\n/**\n * WRITE CV BIT TO ENGINE DECODER ON MAIN TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-bit-to-engine-decoder-on-main-track\n */\nexport const writeCVBitMainCommand: (params: WriteCVBitMainCommandParams) => string = function ({ cab, cv, bit, value }) {\n const attributes = [\n writeMainDecoderBitKey,\n cab,\n cv,\n bit,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface WriteAddressProgrammingCommandParams {\n address: number\n}\n\nconst writeDecoderAddressKey = 'W'\n\n/**\n * WRITE LOCO ADDRESS TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-loco-address-to-engine-decoder-on-programming-track\n */\nexport const writeAddressProgrammingCommand: (params: WriteAddressProgrammingCommandParams) => string = ({ address }) => {\n const attributes = [\n writeDecoderAddressKey,\n address\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface WriteCVByteProgrammingCommandParams {\n cv: number\n value: number\n callbackNum: number\n callbackSub: number\n}\n\nconst writeProgrammingDecoderByteKey = 'W'\n\n/**\n * WRITE CV BYTE TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-byte-to-engine-decoder-on-programming-track\n */\nexport const writeCVByteProgrammingCommand: (params: WriteCVByteProgrammingCommandParams) => string = ({\n cv,\n value,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n writeProgrammingDecoderByteKey,\n cv,\n value,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface WriteCVBitProgrammingCommandParams {\n cv: number\n bit: number\n value: BitValue\n callbackNum: number\n callbackSub: number\n}\n\nconst writeProgrammingDecoderBitKey = 'B'\n\n/**\n * WRITE CV BIT TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-bit-to-engine-decoder-on-programming-track\n */\nexport const writeCVBitProgrammingCommand: (params: WriteCVBitProgrammingCommandParams) => string = ({\n cv,\n bit,\n value,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n writeProgrammingDecoderBitKey,\n cv,\n bit,\n value,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ReadCVByteProgrammingCommandParams {\n cv: number\n callbackNum: number\n callbackSub: number\n}\n\nconst readProgrammingDecoderByteKey = 'R'\n\n/**\n * READ CONFIGURATION VARIABLE BYTE FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#read-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const readCVByteProgrammingCommand: (params: ReadCVByteProgrammingCommandParams) => string = ({\n cv,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n readProgrammingDecoderByteKey,\n cv,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst readProgrammingDecoderAddressKey = 'R'\n\n/**\n * Read Engine address\n * https://dcc-ex.com/reference/software/command-reference.html#read-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const readAddressProgrammingCommand: () => string = () => makeCommand(readProgrammingDecoderAddressKey)\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface VerifyCVByteProgrammingCommandParams {\n cv: number\n byteValue: number\n}\n\nconst verifyProgrammingDecoderByteKey = 'V'\n\n/**\n * VERIFY CONFIGURATION VARIABLE BYTE FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#verify-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const verifyCVByteProgrammingCommand: (params: VerifyCVByteProgrammingCommandParams) => string = ({\n cv,\n byteValue\n}) => {\n const attributes = [\n verifyProgrammingDecoderByteKey,\n cv,\n byteValue\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\nimport { BitValue } from '../../types/index.js'\n\nexport interface VerifyCVBitProgrammingCommandParams {\n cv: number\n bit: number\n bitValue: BitValue\n}\n\nconst verifyProgrammingDecoderBitKey = 'V'\n\n/**\n * VERIFY CONFIGURATION VARIABLE BIT FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#verify-configuration-variable-bit-from-engine-decoder-on-programming-track\n */\nexport const verifyCVBitProgrammingCommand: (params: VerifyCVBitProgrammingCommandParams) => string = ({\n cv,\n bit,\n bitValue\n}) => {\n const attributes = [\n verifyProgrammingDecoderBitKey,\n cv,\n bit,\n bitValue\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nconst diagnosticCabsCommandKey = 'D'\n\n/**\n * Shows cab numbers and speed in reminder table.\n * https://dcc-ex.com/reference/software/command-reference.html#diagnostics\n * @returns {string|null|{readonly returnString: null, readonly sendString: string, constant: string, returnsKey: null, key: string}}\n */\nexport const diagnosticCabsCommand: () => string = () => {\n const constant = 'CABS'\n\n const attributes = [\n diagnosticCabsCommandKey,\n constant\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nconst diagnosticRAMCommandKey = 'D'\n\n/**\n * Shows remaining RAM\n * https://dcc-ex.com/reference/software/command-reference.html#diagnostics\n */\nexport const diagnosticRAMCommand: () => string = () => {\n const constant = 'RAM'\n const attributes = [\n diagnosticRAMCommandKey,\n constant\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DiagnosticAckCommandParams {\n enable: Active\n}\n\nconst diagnosticAckCommandKey = 'D'\n\n/**\n * Enables/Disables ACK diagnostics\n */\nexport const diagnosticAckCommand: (params: DiagnosticAckCommandParams) => string = ({ enable }) => {\n const constant = 'ACK'\n const attributes = [\n diagnosticAckCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DiagnosticParserCommandParams {\n enable: Active\n}\n\nconst diagnosticParserCommandKey = 'D'\n\n/**\n * Enables/Disables Command Parser diagnostics\n */\nexport const diagnosticParserCommand: (params: DiagnosticParserCommandParams) => string = ({ enable }) => {\n const constant = 'CMD'\n const attributes = [\n diagnosticParserCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DiagnosticWiFiCommandParams {\n enable: Active\n}\n\nconst diagnosticWiFiCommandKey = 'D'\n\n/**\n * Enables/Disables Wifi diagnostics\n */\nexport const diagnosticWiFiCommand: (params: DiagnosticWiFiCommandParams) => string = ({ enable }) => {\n const constant = 'WIFI'\n const attributes = [\n diagnosticWiFiCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DiagnosticWiThrottleCommandParams {\n enable: Active\n}\n\nconst diagnosticWiThrottleCommandKey = 'D'\n\n/**\n * Enables/Disables Withrottle diagnostics\n */\nexport const diagnosticWiThrottleCommand: (params: DiagnosticWiThrottleCommandParams) => string = ({ enable }) => {\n const constant = 'WIT'\n const attributes = [\n diagnosticWiThrottleCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst storeCommandKey = 'E'\n\n/**\n * Stores unsaved changes in EEPROM\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const storeCommand: () => string = () => makeCommand(storeCommandKey)\n", "import { makeCommand } from '../../utils/index.js'\n\nconst eraseCommandKey = 'e'\n\n/**\n * ERASE everything; (turnouts, sensors, and outputs)\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const eraseCommand: () => string = () => makeCommand(eraseCommandKey)\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailFreeBlockCommandParams {\n blockId: number\n}\n\n/**\n * Manually frees a virtual track Block\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailFreeBlockCommand: (params: ExRailFreeBlockCommandParams) => string = ({ blockId }) => {\n const constant = '/ FREE'\n const attributes = [\n constant,\n blockId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailKillTaskCommandParams { taskId: number }\n\n/**\n * Kills a currently running script task by ID (use to list task IDs)\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailKillTaskCommand: (params: ExRailKillTaskCommandParams) => string = ({ taskId }) => {\n const constant = '/ KILL'\n const attributes = [\n constant,\n taskId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailLatchSensorCommandParams {\n sensorId: number\n}\n\n/**\n * Lock sensor ON, preventing external influence\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailLatchSensorCommand: (params: ExRailLatchSensorCommandParams) => string = ({ sensorId }) => {\n const constant = '/ LATCH'\n const attributes = [\n constant,\n sensorId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\n/**\n * Pauses all automation - all locos E-STOP\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailPauseCommand: () => string = () => makeCommand('/ PAUSE')\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailReserveBlockCommandParams {\n blockId: number\n}\n\n/**\n * Manually reserves a virtual track Block\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailReserveBlockCommand: (params: ExRailReserveBlockCommandParams) => string = ({ blockId }) => {\n const constant = '/ RESERVE'\n const attributes = [\n constant,\n blockId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\n/**\n * Resumes all automation - all locos are restarted at the speed when paused\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailResumeCommand: () => string = () => makeCommand('/ RESUME')\n", "import { makeCommand } from '../../utils/index.js'\n\n/**\n * Displays EX-RAIL running task information\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailRoutesCommand: () => string = () => makeCommand('/ ROUTES')\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailStartTaskCommandParams { address: number, taskId: number }\n\n/**\n * Starts a new task to send a loco onto a Route, or activate a non-loco Animation or Sequence\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailStartTaskCommand: (params: ExRailStartTaskCommandParams) => string = ({ address, taskId }) => {\n const constant = '/ START'\n const attributes = [\n constant,\n address,\n taskId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\n/**\n * Returns the Routes & Automations control list in WiThrottle format. JMRI integration only!\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailTasksCommand: () => string = () => makeCommand('/')\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface ExRailUnlatchSensorCommandParams {\n sensorId: number\n}\n\n/**\n * Unlock sensor, returning to current external state\n * https://dcc-ex.com/automation/EX-RAIL-summary.html#diagnostics-control\n */\nexport const exRailUnlatchSensorCommand: (params: ExRailUnlatchSensorCommandParams) => string = ({ sensorId }) => {\n const constant = '/ UNLATCH'\n const attributes = [\n constant,\n sensorId\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport enum Track {\n MAIN = 'MAIN',\n PROG = 'PROG',\n JOIN = 'JOIN'\n}\n\nexport interface PowerCommandParams {\n power: Active\n track?: Track\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#track-power-commands\n */\nexport const powerCommand: (params: PowerCommandParams) => string = ({ power, track }) => {\n const attributes = [\n power,\n track\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\ninterface RosterCommandParams {\n cabId?: number\n}\n\nconst rosterSendKey = 'J'\n\nexport const rosterCommand: (params?: RosterCommandParams) => string = ({ cabId } = {}) => {\n return makeCommandFromAttributes([rosterSendKey, cabId])\n}\n", "import { BitValue } from '../../types/index.js'\nimport { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DefineSensorCommandParams {\n sensor: number\n pin: number\n pullUp: BitValue\n}\n\nconst defineSensorCommandKey = 'S'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#sensors-inputs\n */\nexport const defineSensorCommand: (params: DefineSensorCommandParams) => string = ({ sensor, pin, pullUp }) => {\n const attributes = [\n defineSensorCommandKey,\n sensor,\n pin,\n pullUp\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface SensorCommandParams {\n sensor: number\n}\n\nconst deleteSensorCommandKey = 'S'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#sensors-inputs\n */\nexport const deleteSensorCommand: (params: SensorCommandParams) => string = ({ sensor }) => {\n const attributes = [\n deleteSensorCommandKey,\n sensor\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst listSensorsCommandKey = 'S'\n\nexport const listSensorsCommand: () => string = () => makeCommand(listSensorsCommandKey)\n", "import { makeCommand } from '../../utils/index.js'\n\nconst listSensorsStatusCommandKey = 'Q'\n\nexport const listSensorsStatusCommand: () => string = () => makeCommand(listSensorsStatusCommandKey)\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport enum Direction {\n REVERSE = 0,\n FORWARD = 1\n}\n\nexport type Speed = -1 | number\n\nexport interface ThrottleCommandParams {\n cab: number\n speed: Speed\n direction: Direction\n}\n\nconst throttleCommandKey = 't'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const throttleCommand: (params: ThrottleCommandParams) => string = ({ cab, speed, direction }) => {\n const legacyAttribute = 1\n const attributes = [\n throttleCommandKey,\n legacyAttribute,\n cab,\n speed,\n direction\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst emergencyStopCommandKey = '!'\n\n/**\n * Stops all locos on the track but leaves power on\n */\nexport const emergencyStopCommand: () => string = () => {\n return makeCommand(emergencyStopCommandKey)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport enum TurnoutState {\n CLOSED = 0,\n THROWN = 1\n}\n\nexport interface TurnoutCommandParams {\n turnout: number\n thrown: TurnoutState\n}\n\nconst turnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#controlling-a-defined-turnout\n */\nexport const turnoutCommand: (params: TurnoutCommandParams) => string = ({ turnout, thrown }) => {\n const attributes = [\n turnoutCommandKey,\n turnout,\n thrown\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes, parseAddress, ParseAddressParams } from '../../utils/index.js'\n\nconst defineDCCTurnoutCommandKey = 'T'\n\nexport interface DefineDCCTurnoutCommandParams {\n turnout: number\n address: ParseAddressParams\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineDCCTurnoutCommand: (params: DefineDCCTurnoutCommandParams) => string = function ({\n turnout,\n address\n}) {\n const constant = 'DCC'\n const { linearAddress, primaryAddress, subAddress } = parseAddress(address)\n const addressSend = linearAddress ?? [primaryAddress, subAddress].join(' ')\n const attributes = [\n defineDCCTurnoutCommandKey,\n turnout,\n constant,\n addressSend\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport enum TransitionProfile {\n IMMEDIATE = 0,\n FAST = 1,\n MEDIUM = 2,\n SLOW = 3,\n BOUNCE = 4\n}\n\nexport interface DefineServoTurnoutCommandParams {\n turnout: number\n pin: number\n thrownPosition: number\n closedPosition: number\n profile: TransitionProfile\n}\n\nconst defineServoTurnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineServoTurnoutCommand: (params: DefineServoTurnoutCommandParams) => string = ({\n turnout,\n pin,\n thrownPosition,\n closedPosition,\n profile\n}) => {\n const constant = 'SERVO'\n const attributes = [\n defineServoTurnoutCommandKey,\n turnout,\n constant,\n pin,\n thrownPosition,\n closedPosition,\n profile\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nexport interface DefineVPINTurnoutCommandParams {\n turnout: number\n pin: number\n}\n\nconst defineVPINTurnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineVPINTurnoutCommand: (params: DefineVPINTurnoutCommandParams) => string = ({ turnout, pin }) => {\n const constant = 'VPIN'\n const attributes = [\n defineVPINTurnoutCommandKey,\n turnout,\n constant,\n pin\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils/index.js'\n\nconst deleteTurnoutCommandKey = 'T'\n\ninterface DeleteTurnoutCommandParams {\n turnout: number\n}\n\n/**\n *\n * @param {number} turnout\n * @returns {{readonly returnString: string, readonly sendString: string, turnout, returnsKey: string, key: string}|string}\n */\nexport const deleteTurnoutCommand: (params: DeleteTurnoutCommandParams) => string = ({ turnout }) => {\n const attributes = [\n deleteTurnoutCommandKey,\n turnout\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils/index.js'\n\nconst listTurnoutsCommandKey = 'T'\n\n/**\n *\n * @returns {string|{readonly returnString: string, readonly sendString: string, returnsKey: string, key: string}}\n */\nexport const listTurnoutsCommand: () => string = () => makeCommand(listTurnoutsCommandKey)\n", "export class ParserKeyError extends Error {\n constructor (parser: string, key: string) {\n const message = `${parser} can not parse the key '${key}'`\n super(message)\n this.name = 'ParserKeyError'\n }\n}\n\nexport class ParserAttributeError extends Error {\n constructor (attribute: string, value: string | number, msg: string) {\n const message = `${attribute} set to ${value}. ${msg}`\n super(message)\n this.name = 'ParserAttributeError'\n }\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport { ParserKeyError } from '../errors/index.js'\nimport { FunctionName, ParserResult, ParserStatus } from '../../types/index.js'\n\nexport type EraseParams = object\nexport type EraseResult = ParserResult\nexport const eraseParserKey = '0'\n\nconst parseFromCommand: (params: Command) => EraseResult = ({ key }) => {\n if (key !== eraseParserKey) {\n throw new ParserKeyError('eraseParser', key)\n }\n\n return {\n key: eraseParserKey,\n parser: FunctionName.EEPROMS_ERASE,\n status: ParserStatus.SUCCESS,\n params: {}\n }\n}\n\nexport const eraseParser: (command: string) => EraseResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport { ParserKeyError } from '../errors/index.js'\nimport { FunctionName, ParserResult, ParserStatus } from '../../types/index.js'\n\nexport type StoreParams = object\nexport type StoreResult = ParserResult\nexport const storeParserKey = 'e'\n\nconst parseFromCommand: (params: Command) => StoreResult = ({ key, attributes }) => {\n if (key !== storeParserKey) {\n throw new ParserKeyError('storeParser', key)\n }\n\n return {\n key: storeParserKey,\n parser: FunctionName.EEPROMS_STORE,\n status: ParserStatus.SUCCESS,\n params: {}\n }\n}\n\nexport const storeParser: (command: string) => StoreResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport { ParserKeyError } from '../errors/index.js'\nimport { FunctionName, ParserResult, ParserStatus } from '../../types/index.js'\n\nexport enum ReturnTrack {\n ALL = 'ALL',\n MAIN = 'MAIN',\n PROG = 'PROG',\n JOIN = 'JOIN'\n}\nexport interface PowerParams {\n power: number\n track: ReturnTrack\n}\nexport type PowerResult = ParserResult\nexport const powerParserKey = 'p'\n\nexport const parseFromCommand: (params: Command) => PowerResult = ({ key: potentialKey, attributes }) => {\n const [key, power] = potentialKey.split('')\n\n if (!isPowerCommand(key, power)) {\n throw new ParserKeyError('powerParser', key)\n }\n\n let [track] = attributes\n\n if (!Object.values(ReturnTrack).includes(track as ReturnTrack)) {\n track = ReturnTrack.ALL\n }\n\n return {\n key: powerParserKey,\n parser: FunctionName.POWER,\n status: ParserStatus.SUCCESS,\n params: {\n power: parseInt(power),\n track: track as ReturnTrack\n }\n }\n}\n\nfunction isPowerCommand (key: string, power: string): boolean {\n return key === powerParserKey && ['0', '1'].includes(power)\n}\n\nexport const powerParser: (command: string) => PowerResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport { ParserAttributeError, ParserKeyError } from '../errors/index.js'\nimport { FunctionName, ParserResult, ParserStatus } from '../../types/index.js'\nimport { Direction, Speed } from '../../commands/index.js'\n\nexport interface ThrottleParams {\n register: number\n speed: Speed\n direction: Direction\n}\nexport type ThrottleResult = ParserResult\nconst throttleParserKey = 'T'\n\nconst isValidDirection = (direction: number): boolean => !Object.values(Direction).includes(direction as Direction)\n\nconst parseFromCommand: (params: Command) => ThrottleResult = ({ key, attributes }) => {\n const [register, speed, directionString] = attributes\n\n if (key !== throttleParserKey) {\n throw new ParserKeyError('throttleParser', key)\n }\n\n const direction = parseInt(directionString)\n\n if (isValidDirection(direction)) {\n throw new ParserAttributeError('direction', direction, `it must be one of ${Object.values(Direction).join(' | ')}`)\n }\n\n return {\n key: throttleParserKey,\n parser: FunctionName.THROTTLE,\n status: ParserStatus.SUCCESS,\n params: {\n register: parseInt(register),\n speed: parseInt(speed),\n direction: direction as Direction\n }\n }\n}\n\nexport const throttleParser: (command: string) => ThrottleResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport { ParserKeyError } from '../errors/index.js'\nimport { BitValue, FunctionButton, FunctionButtons, FunctionName, ParserResult, ParserStatus } from '../../types/index.js'\nimport { Direction, Speed } from '../../commands/index.js'\nimport { ThrottleParams } from './throttleParser.js'\n\ntype LocoFunctionButtons = FunctionButtons\ntype LocoFunctionButton = Pick\n\nexport interface LocoParams extends ThrottleParams {\n cabId: number\n functionButtons: LocoFunctionButtons\n}\n\nexport type LocoResult = ParserResult\n\nexport function parseSpeedAndDirection (speedValue: number): { speed: Speed, direction: Direction } {\n const direction = (speedValue - 128 >= 0) ? Direction.FORWARD : Direction.REVERSE\n const normalisedSpeed = (speedValue - 128 >= 0) ? speedValue - 128 : speedValue\n\n let speed\n switch (normalisedSpeed) {\n case 0: {\n speed = 0\n break\n }\n case 1: {\n speed = -1\n break\n }\n default: {\n speed = normalisedSpeed - 1\n }\n }\n\n return {\n speed,\n direction\n }\n}\n\nexport const parseFunctionButtons = (functionButtonValue: number): LocoFunctionButtons => {\n const values = functionButtonValue.toString(2).split('').reverse().map(value => parseInt(value))\n\n const numOfFunctions = 29\n return Array.from(Array(numOfFunctions))\n .reduce((acc, currentValue, index) => {\n acc[index] = {\n value: values[index] as BitValue ?? 0\n }\n return acc\n }, {})\n}\n\nconst locoParserKey = 'l'\n\nconst parseFromCommand: (params: Command) => LocoResult = ({ key, attributes }) => {\n const [cabIdValue, registerValue, speedValue, functionButtonsValue] = attributes\n\n if (key !== locoParserKey) {\n throw new ParserKeyError('locoParser', key)\n }\n\n const { speed, direction } = parseSpeedAndDirection(parseInt(speedValue))\n const functionButtons = parseFunctionButtons(parseInt(functionButtonsValue))\n\n return {\n key: locoParserKey,\n parser: FunctionName.LOCO,\n status: ParserStatus.SUCCESS,\n params: {\n register: parseInt(registerValue),\n speed,\n direction,\n cabId: parseInt(cabIdValue),\n functionButtons\n }\n }\n}\n\nexport const locoParser: (command: string) => LocoResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { Command, parseCommand } from '../../utils/index.js'\nimport {\n FunctionButton,\n FunctionButtonKind,\n FunctionButtons,\n FunctionName,\n ParserResult,\n ParserStatus\n} from '../../types/index.js'\nimport { ParserKeyError } from '../errors/index.js'\n\ntype RosterFunctionButton = Pick\ntype RosterFunctionButtons = FunctionButtons\ninterface RosterItemParams {\n cabId: number\n display: string\n functionButtons: RosterFunctionButtons\n}\n\nexport type RosterItemResult = ParserResult\nconst rosterItemParserKey = 'j'\n\nconst functionButtonsParser = (param: string | null = null): RosterFunctionButtons => {\n if (param === null) {\n return {}\n }\n\n const buttons = param.split('/')\n\n return buttons.reduce((accum, button, index) => {\n const [display, isPress] = button.split(/(\\*)/).reverse()\n const kind = (isPress == null && !isPress) ? FunctionButtonKind.TOGGLE : FunctionButtonKind.PRESS\n accum[index] = {\n display,\n kind\n }\n return accum\n }, {})\n}\n\nconst parseFromCommand: (params: Command) => RosterItemResult = ({ key, attributes }) => {\n const [cabId, display, rawFunctionButtons] = attributes\n\n if (key !== rosterItemParserKey) {\n throw new ParserKeyError('rosterItemParser', key)\n }\n\n const functionButtons = functionButtonsParser(rawFunctionButtons)\n\n return {\n key: rosterItemParserKey,\n parser: FunctionName.ROSTER_ITEM,\n status: ParserStatus.SUCCESS,\n params: {\n cabId: parseInt(cabId),\n display,\n functionButtons\n }\n }\n}\n\nexport const rosterItemParser: (command: string) => RosterItemResult = (command) => {\n const commandParams = parseCommand(command)\n return parseFromCommand(commandParams)\n}\n", "import { ParserResult } from '../types/index.js'\nimport { rosterItemParser } from './rosters/index.js'\nimport { eraseParser, storeParser } from './eeproms/index.js'\nimport { powerParser } from './powers/index.js'\nimport { locoParser, throttleParser } from './throttles/index.js'\n\ntype ParserFunction = (command: string) => ParserResult\ntype ParseResult = (command: string) => Promise>\ninterface Parser {\n parse: ParseResult\n}\ntype CreateParser = (parsers: ParserFunction[]) => Parser\ntype GenericParser = () => Parser\n\nexport const createParser: CreateParser = (parsers) => {\n return {\n parse: async (command: string) => {\n const results = parsers.map(async parser => {\n return await new Promise>((resolve, reject) => {\n try {\n const result = parser(command)\n resolve(result)\n } catch (e) {\n reject(e)\n }\n })\n })\n\n return await Promise.any(results)\n }\n }\n}\n\nexport const genericParser: GenericParser = () => {\n const allParsers: ParserFunction[] = [\n eraseParser,\n locoParser,\n powerParser,\n rosterItemParser,\n storeParser,\n throttleParser\n ]\n\n return createParser(allParsers)\n}\n"], + "mappings": ";AAEO,IAAK,qBAAL,kBAAK,wBAAL;AACL,kCAAS;AACT,iCAAQ;AAFE;AAAA;;;ACGL,IAAK,UAAL,kBAAK,aAAL;AACL,oBAAM;AACN,mBAAK;AAFK;AAAA;AAKL,IAAK,eAAL,kBAAK,kBAAL;AACL,6BAAU;AADA;AAAA;AAIL,IAAK,eAAL,kBAAK,kBAAL;AACL,mCAAgB;AAChB,mCAAgB;AAChB,0BAAO;AACP,2BAAQ;AACR,iCAAc;AACd,8BAAW;AAND;AAAA;;;ACdL,IAAM,cAAc,CAAC,gBAAgC;AAC1D,SAAO,IAAI;AAAA;AAGN,IAAM,4BAA4B,CAAC,eAAkE;AAC1G,QAAM,MAAM,WACT,IAAI,eAAa;AAChB,QAAI,OAAO,cAAc,UAAU;AACjC,aAAO,UAAU;AAAA;AAGnB,WAAO;AAAA,KAER,OAAO,eAAa,CAAC,QAAQ,YAC7B,KAAK;AACR,SAAO,YAAY;AAAA;AAGrB,iBAAkB,OAA2C;AAC3D,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,MAAM,WAAW;AAAA;AAE1B,SAAO;AAAA;;;ACVF,IAAM,eAAe,CAAC,YAAyC;AACpE,MAAI,gBAAgB;AACpB,MAAI,iBAAiB;AACrB,MAAI,aAAa;AAEjB,MAAI,OAAQ,YAAa,UAAU;AACjC,oBAAgB;AAAA,SACX;AACL,qBAAiB,QAAQ;AACzB,iBAAa,QAAQ;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,qBAAqB;AAC/B,UAAM,IAAI,eAAe,oBAAoB;AAAA;AAG/C,QAAM,kBAAkB,sBAAsB;AAE9C,SAAO;AAAA,IACL,KAAK;AAAA,IACL,QAAQ,aAAa;AAAA,IACrB,QAAQ,aAAa;AAAA,IACrB,QAAQ;AAAA,MACN,OAAO,SAAS;AAAA,MAChB;AAAA,MACA;AAAA;AAAA;AAAA;AAKC,IAAM,mBAA0D,CAAC,YAAY;AAClF,QAAM,gBAAgB,aAAa;AACnC,SAAO,kBAAiB;AAAA;;;ACjDnB,IAAM,eAA6B,CAAC,YAAY;AACrD,SAAO;AAAA,IACL,OAAO,OAAO,YAAoB;AAChC,YAAM,UAAU,QAAQ,IAAI,OAAM,WAAU;AAC1C,eAAO,MAAM,IAAI,QAA2B,CAAC,SAAS,WAAW;AAC/D,cAAI;AACF,kBAAM,SAAS,OAAO;AACtB,oBAAQ;AAAA,mBACD,GAAP;AACA,mBAAO;AAAA;AAAA;AAAA;AAKb,aAAO,MAAM,QAAQ,IAAI;AAAA;AAAA;AAAA;AAKxB,IAAM,gBAA+B,MAAM;AAChD,QAAM,aAA+B;AAAA,IACnC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA;AAGF,SAAO,aAAa;AAAA;", + "names": [] +} diff --git a/js/vendor/dcc-ex--commands-0.4.0.js.map b/js/vendor/dcc-ex--commands-0.4.0.js.map deleted file mode 100644 index 9229110..0000000 --- a/js/vendor/dcc-ex--commands-0.4.0.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../src/types/index.ts", "../src/utils/makeCommand.ts", "../src/utils/parseAddress.ts", "../src/utils/parseCommand.ts", "../src/commands/accessories/accessoryCommand.ts", "../src/commands/cabs/cabCommand.ts", "../src/commands/cabs/forgetCabCommand.ts", "../src/commands/cabs/forgetAllCabsCommand.ts", "../src/commands/decoders/writeCVByteMainCommand.ts", "../src/commands/decoders/writeCVBitMainCommand.ts", "../src/commands/decoders/writeAddressProgrammingCommand.ts", "../src/commands/decoders/writeCVByteProgrammingCommand.ts", "../src/commands/decoders/writeCVBitProgrammingCommand.ts", "../src/commands/decoders/readCVByteProgrammingCommand.ts", "../src/commands/decoders/readAddressProgrammingCommand.ts", "../src/commands/decoders/verifyCVByteProgrammingCommand.ts", "../src/commands/decoders/verifyCVBitProgrammingCommand.ts", "../src/commands/diagnostics/diagnosticCabsCommand.ts", "../src/commands/diagnostics/diagnosticRAMCommand.ts", "../src/commands/diagnostics/diagnosticAckCommand.ts", "../src/commands/diagnostics/diagnosticParserCommand.ts", "../src/commands/diagnostics/diagnosticWiFiCommand.ts", "../src/commands/diagnostics/diagnosticWiThrottleCommand.ts", "../src/commands/eeproms/storeCommand.ts", "../src/commands/eeproms/eraseCommand.ts", "../src/commands/powers/powerCommand.ts", "../src/commands/sensors/defineSensorCommand.ts", "../src/commands/sensors/deleteSensorCommand.ts", "../src/commands/sensors/listSensorsCommand.ts", "../src/commands/sensors/listSensorsStatusCommand.ts", "../src/commands/throttles/throttleCommand.ts", "../src/commands/throttles/emergencyStopCommand.ts", "../src/commands/turnouts/turnoutCommand.ts", "../src/commands/turnouts/defineDCCTurnoutCommand.ts", "../src/commands/turnouts/defineServoTurnoutCommand.ts", "../src/commands/turnouts/defineVPINTurnoutCommand.ts", "../src/commands/turnouts/deleteTurnoutCommand.ts", "../src/commands/turnouts/listTurnoutsCommand.ts", "../src/parsers/errors/parserKeyError.ts", "../src/parsers/eeproms/eraseParser.ts", "../src/parsers/eeproms/storeParser.ts", "../src/parsers/powers/powerParser.ts"], - "sourcesContent": ["export type BitValue = 0 | 1\nexport type Active = BitValue\n\nexport enum ParserStatus {\n SUCCESS = 'success'\n}\n\nexport interface ParserResult {\n key: string\n status: ParserStatus\n params: T\n}\n", "export const makeCommand = (instruction: string): string => {\n return `<${instruction}>`\n}\n\nexport const makeCommandFromAttributes = (attributes: Array): string => {\n const str = attributes\n .map(attribute => {\n if (typeof attribute === 'number') {\n return attribute.toString()\n }\n\n return attribute\n })\n .filter(attribute => !isBlank(attribute))\n .join(' ')\n return makeCommand(str)\n}\n\nfunction isBlank (param: string | undefined | null): boolean {\n if (typeof param === 'string') {\n return param.trim() === ''\n }\n return true\n}\n", "export interface DualCoilAddress {\n primaryAddress: number | null\n subAddress: number | null\n}\n\nexport interface LinearAddress {\n linearAddress: number | null\n}\n\nexport type Address = LinearAddress & DualCoilAddress\nexport type ParseAddressParams = number | DualCoilAddress\n\nexport const parseAddress = (address: ParseAddressParams): Address => {\n let linearAddress = null\n let primaryAddress = null\n let subAddress = null\n\n if (typeof (address) === 'number') {\n linearAddress = address\n } else {\n primaryAddress = address.primaryAddress\n subAddress = address.subAddress\n }\n return { linearAddress, primaryAddress, subAddress }\n}\n", "export function isControlCharacters (char: string): boolean {\n return ['<', '>'].includes(char)\n}\n\nexport function removeControlCharacters (command: string): string {\n return command.split('')\n .filter(char => !isControlCharacters(char))\n .join('')\n}\n\nexport interface Command {\n attributes: string[]\n key: string\n}\n\nexport function parseCommand (command: string): Command {\n const cleanedParams = removeControlCharacters(command)\n const [key, ...attributes] = cleanedParams.split(' ')\n return {\n key,\n attributes\n }\n}\n", "import { makeCommandFromAttributes, parseAddress, ParseAddressParams } from '../../utils'\nimport { Active } from '../../types'\n\nexport interface AccessoryCommandParams {\n address: ParseAddressParams\n active: Active\n}\n\nconst accessorySendKey = 'a'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#accessory-decoder-commands\n */\nexport const accessoryCommand: (params: AccessoryCommandParams) => string = ({ address, active }) => {\n const { linearAddress, primaryAddress, subAddress } = parseAddress(address)\n\n const addressSend = linearAddress ?? [primaryAddress, subAddress].join(' ')\n\n const attributes = [\n accessorySendKey,\n addressSend,\n active\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface CabCommandParams {\n cab: number\n func: number\n value: BitValue\n}\n\nconst cabSendKey = 'F'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#cab-functions\n */\nexport const cabCommand: (params: CabCommandParams) => string = ({ cab, func, value }) => {\n const attributes = [\n cabSendKey,\n cab,\n func,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nconst forgetCabCommandKey = '-'\n\nexport interface ForgerCabCommandParams {\n cab: number\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const forgetCabCommand: (params: ForgerCabCommandParams) => string = ({ cab }) => {\n const attributes = [\n forgetCabCommandKey,\n cab\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst forgetAllCabsCommandKey = '-'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const forgetAllCabsCommand: () => string = () => {\n return makeCommand(forgetAllCabsCommandKey)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface WriteCVByteMainCommandParams {\n cab: number\n cv: number\n value: number\n}\n\nconst writeMainDecoderByteKey = 'w'\n\n/**\n * WRITE CV BYTE TO ENGINE DECODER ON MAIN TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-byte-to-engine-decoder-on-main-track\n */\nexport const writeCVByteMainCommand: (params: WriteCVByteMainCommandParams) => string = ({ cab, cv, value }) => {\n const attributes = [\n writeMainDecoderByteKey,\n cab,\n cv,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface WriteCVBitMainCommandParams {\n cab: number\n cv: number\n bit: number\n value: BitValue\n}\n\nconst writeMainDecoderBitKey = 'b'\n\n/**\n * WRITE CV BIT TO ENGINE DECODER ON MAIN TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-bit-to-engine-decoder-on-main-track\n */\nexport const writeCVBitMainCommand: (params: WriteCVBitMainCommandParams) => string = function ({ cab, cv, bit, value }) {\n const attributes = [\n writeMainDecoderBitKey,\n cab,\n cv,\n bit,\n value\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface WriteAddressProgrammingCommandParams {\n address: number\n}\n\nconst writeDecoderAddressKey = 'W'\n\n/**\n * WRITE LOCO ADDRESS TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-loco-address-to-engine-decoder-on-programming-track\n */\nexport const writeAddressProgrammingCommand: (params: WriteAddressProgrammingCommandParams) => string = ({ address }) => {\n const attributes = [\n writeDecoderAddressKey,\n address\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface WriteCVByteProgrammingCommandParams {\n cv: number\n value: number\n callbackNum: number\n callbackSub: number\n}\n\nconst writeProgrammingDecoderByteKey = 'W'\n\n/**\n * WRITE CV BYTE TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-byte-to-engine-decoder-on-programming-track\n */\nexport const writeCVByteProgrammingCommand: (params: WriteCVByteProgrammingCommandParams) => string = ({\n cv,\n value,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n writeProgrammingDecoderByteKey,\n cv,\n value,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface WriteCVBitProgrammingCommandParams {\n cv: number\n bit: number\n value: BitValue\n callbackNum: number\n callbackSub: number\n}\n\nconst writeProgrammingDecoderBitKey = 'B'\n\n/**\n * WRITE CV BIT TO ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#write-cv-bit-to-engine-decoder-on-programming-track\n */\nexport const writeCVBitProgrammingCommand: (params: WriteCVBitProgrammingCommandParams) => string = ({\n cv,\n bit,\n value,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n writeProgrammingDecoderBitKey,\n cv,\n bit,\n value,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface ReadCVByteProgrammingCommandParams {\n cv: number\n callbackNum: number\n callbackSub: number\n}\n\nconst readProgrammingDecoderByteKey = 'R'\n\n/**\n * READ CONFIGURATION VARIABLE BYTE FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#read-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const readCVByteProgrammingCommand: (params: ReadCVByteProgrammingCommandParams) => string = ({\n cv,\n callbackNum,\n callbackSub\n}) => {\n const attributes = [\n readProgrammingDecoderByteKey,\n cv,\n callbackNum,\n callbackSub\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst readProgrammingDecoderAddressKey = 'R'\n\n/**\n * Read Engine address\n * https://dcc-ex.com/reference/software/command-reference.html#read-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const readAddressProgrammingCommand: () => string = () => makeCommand(readProgrammingDecoderAddressKey)\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface VerifyCVByteProgrammingCommandParams {\n cv: number\n byteValue: number\n}\n\nconst verifyProgrammingDecoderByteKey = 'V'\n\n/**\n * VERIFY CONFIGURATION VARIABLE BYTE FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#verify-configuration-variable-byte-from-engine-decoder-on-programming-track\n */\nexport const verifyCVByteProgrammingCommand: (params: VerifyCVByteProgrammingCommandParams) => string = ({\n cv,\n byteValue\n}) => {\n const attributes = [\n verifyProgrammingDecoderByteKey,\n cv,\n byteValue\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\nimport { BitValue } from '../../types'\n\nexport interface VerifyCVBitProgrammingCommandParams {\n cv: number\n bit: number\n bitValue: BitValue\n}\n\nconst verifyProgrammingDecoderBitKey = 'V'\n\n/**\n * VERIFY CONFIGURATION VARIABLE BIT FROM ENGINE DECODER ON PROGRAMMING TRACK\n * https://dcc-ex.com/reference/software/command-reference.html#verify-configuration-variable-bit-from-engine-decoder-on-programming-track\n */\nexport const verifyCVBitProgrammingCommand: (params: VerifyCVBitProgrammingCommandParams) => string = ({\n cv,\n bit,\n bitValue\n}) => {\n const attributes = [\n verifyProgrammingDecoderBitKey,\n cv,\n bit,\n bitValue\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nconst diagnosticCabsCommandKey = 'D'\n\n/**\n * Shows cab numbers and speed in reminder table.\n * https://dcc-ex.com/reference/software/command-reference.html#diagnostics\n * @returns {string|null|{readonly returnString: null, readonly sendString: string, constant: string, returnsKey: null, key: string}}\n */\nexport const diagnosticCabsCommand: () => string = () => {\n const constant = 'CABS'\n\n const attributes = [\n diagnosticCabsCommandKey,\n constant\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nconst diagnosticRAMCommandKey = 'D'\n\n/**\n * Shows remaining RAM\n * https://dcc-ex.com/reference/software/command-reference.html#diagnostics\n */\nexport const diagnosticRAMCommand: () => string = () => {\n const constant = 'RAM'\n const attributes = [\n diagnosticRAMCommandKey,\n constant\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface DiagnosticAckCommandParams {\n enable: Active\n}\n\nconst diagnosticAckCommandKey = 'D'\n\n/**\n * Enables/Disables ACK diagnostics\n */\nexport const diagnosticAckCommand: (params: DiagnosticAckCommandParams) => string = ({ enable }) => {\n const constant = 'ACK'\n const attributes = [\n diagnosticAckCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface DiagnosticParserCommandParams {\n enable: Active\n}\n\nconst diagnosticParserCommandKey = 'D'\n\n/**\n * Enables/Disables Command Parser diagnostics\n */\nexport const diagnosticParserCommand: (params: DiagnosticParserCommandParams) => string = ({ enable }) => {\n const constant = 'CMD'\n const attributes = [\n diagnosticParserCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface DiagnosticWiFiCommandParams {\n enable: Active\n}\n\nconst diagnosticWiFiCommandKey = 'D'\n\n/**\n * Enables/Disables Wifi diagnostics\n */\nexport const diagnosticWiFiCommand: (params: DiagnosticWiFiCommandParams) => string = ({ enable }) => {\n const constant = 'WIFI'\n const attributes = [\n diagnosticWiFiCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { Active } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface DiagnosticWiThrottleCommandParams {\n enable: Active\n}\n\nconst diagnosticWiThrottleCommandKey = 'D'\n\n/**\n * Enables/Disables Withrottle diagnostics\n */\nexport const diagnosticWiThrottleCommand: (params: DiagnosticWiThrottleCommandParams) => string = ({ enable }) => {\n const constant = 'WIT'\n const attributes = [\n diagnosticWiThrottleCommandKey,\n constant,\n enable\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst storeCommandKey = 'E'\n\n/**\n * Stores unsaved changes in EEPROM\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const storeCommand: () => string = () => makeCommand(storeCommandKey)\n", "import { makeCommand } from '../../utils'\n\nconst eraseCommandKey = 'e'\n\n/**\n * ERASE everything; (turnouts, sensors, and outputs)\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const eraseCommand: () => string = () => makeCommand(eraseCommandKey)\n", "import { Active } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport enum Track {\n MAIN = 'MAIN',\n PROG = 'PROG',\n JOIN = 'JOIN'\n}\n\nexport interface PowerCommandParams {\n power: Active\n track?: Track\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#track-power-commands\n */\nexport const powerCommand: (params: PowerCommandParams) => string = ({ power, track }) => {\n const attributes = [\n power,\n track\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { BitValue } from '../../types'\nimport { makeCommandFromAttributes } from '../../utils'\n\nexport interface DefineSensorCommandParams {\n sensor: number\n pin: number\n pullUp: BitValue\n}\n\nconst defineSensorCommandKey = 'S'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#sensors-inputs\n */\nexport const defineSensorCommand: (params: DefineSensorCommandParams) => string = ({ sensor, pin, pullUp }) => {\n const attributes = [\n defineSensorCommandKey,\n sensor,\n pin,\n pullUp\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface SensorCommandParams {\n sensor: number\n}\n\nconst deleteSensorCommandKey = 'S'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#sensors-inputs\n */\nexport const deleteSensorCommand: (params: SensorCommandParams) => string = ({ sensor }) => {\n const attributes = [\n deleteSensorCommandKey,\n sensor\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst listSensorsCommandKey = 'S'\n\nexport const listSensorsCommand: () => string = () => makeCommand(listSensorsCommandKey)\n", "import { makeCommand } from '../../utils'\n\nconst listSensorsStatusCommandKey = 'Q'\n\nexport const listSensorsStatusCommand: () => string = () => makeCommand(listSensorsStatusCommandKey)\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport enum Direction {\n REVERSE = 0,\n FORWARD = 1\n}\n\nexport type Speed = -1 | number\n\nexport interface ThrottleCommandParams {\n cab: number\n speed: Speed\n direction: Direction\n}\n\nconst throttleCommandKey = 't'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#engine-decoder-cab-operation-commands\n */\nexport const throttleCommand: (params: ThrottleCommandParams) => string = ({ cab, speed, direction }) => {\n const legacyAttribute = 1\n const attributes = [\n throttleCommandKey,\n legacyAttribute,\n cab,\n speed,\n direction\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst emergencyStopCommandKey = '!'\n\n/**\n * Stops all locos on the track but leaves power on\n */\nexport const emergencyStopCommand: () => string = () => {\n return makeCommand(emergencyStopCommandKey)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport enum TurnoutState {\n CLOSED = 0,\n THROWN = 1\n}\n\nexport interface TurnoutCommandParams {\n turnout: number\n thrown: TurnoutState\n}\n\nconst turnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#controlling-a-defined-turnout\n */\nexport const turnoutCommand: (params: TurnoutCommandParams) => string = ({ turnout, thrown }) => {\n const attributes = [\n turnoutCommandKey,\n turnout,\n thrown\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes, parseAddress } from '../../utils'\nimport { ParseAddressParams } from '../../utils/parseAddress'\n\nconst defineDCCTurnoutCommandKey = 'T'\n\nexport interface DefineDCCTurnoutCommandParams {\n turnout: number\n address: ParseAddressParams\n}\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineDCCTurnoutCommand: (params: DefineDCCTurnoutCommandParams) => string = function ({\n turnout,\n address\n}) {\n const constant = 'DCC'\n const { linearAddress, primaryAddress, subAddress } = parseAddress(address)\n const addressSend = linearAddress ?? [primaryAddress, subAddress].join(' ')\n const attributes = [\n defineDCCTurnoutCommandKey,\n turnout,\n constant,\n addressSend\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport enum TransitionProfile {\n IMMEDIATE = 0,\n FAST = 1,\n MEDIUM = 2,\n SLOW = 3,\n BOUNCE = 4\n}\n\nexport interface DefineServoTurnoutCommandParams {\n turnout: number\n pin: number\n thrownPosition: number\n closedPosition: number\n profile: TransitionProfile\n}\n\nconst defineServoTurnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineServoTurnoutCommand: (params: DefineServoTurnoutCommandParams) => string = ({\n turnout,\n pin,\n thrownPosition,\n closedPosition,\n profile\n}) => {\n const constant = 'SERVO'\n const attributes = [\n defineServoTurnoutCommandKey,\n turnout,\n constant,\n pin,\n thrownPosition,\n closedPosition,\n profile\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nexport interface DefineVPINTurnoutCommandParams {\n turnout: number\n pin: number\n}\n\nconst defineVPINTurnoutCommandKey = 'T'\n\n/**\n * https://dcc-ex.com/reference/software/command-reference.html#defining-setting-up-a-turnout\n */\nexport const defineVPINTurnoutCommand: (params: DefineVPINTurnoutCommandParams) => string = ({ turnout, pin }) => {\n const constant = 'VPIN'\n const attributes = [\n defineVPINTurnoutCommandKey,\n turnout,\n constant,\n pin\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommandFromAttributes } from '../../utils'\n\nconst deleteTurnoutCommandKey = 'T'\n\ninterface DeleteTurnoutCommandParams {\n turnout: number\n}\n\n/**\n *\n * @param {number} turnout\n * @returns {{readonly returnString: string, readonly sendString: string, turnout, returnsKey: string, key: string}|string}\n */\nexport const deleteTurnoutCommand: (params: DeleteTurnoutCommandParams) => string = ({ turnout }) => {\n const attributes = [\n deleteTurnoutCommandKey,\n turnout\n ]\n return makeCommandFromAttributes(attributes)\n}\n", "import { makeCommand } from '../../utils'\n\nconst listTurnoutsCommandKey = 'T'\n\n/**\n *\n * @returns {string|{readonly returnString: string, readonly sendString: string, returnsKey: string, key: string}}\n */\nexport const listTurnoutsCommand: () => string = () => makeCommand(listTurnoutsCommandKey)\n", "export class ParserKeyError extends Error {\n constructor (parser: string, key: string) {\n const message = `${parser} can not parse the key '${key}'`\n super(message)\n this.name = 'ParserKeyError'\n }\n}\n", "import { Command } from '../../utils'\nimport { ParserKeyError } from '../errors'\nimport { ParserResult, ParserStatus } from '../../types'\n\nexport type EraseParams = object\nexport type EraseResult = ParserResult\nexport const eraseParserKey = '0'\n\nexport const eraseParser: (params: Command) => EraseResult = ({ key }) => {\n if (key !== eraseParserKey) {\n throw new ParserKeyError('eraseParser', key)\n }\n\n return {\n key: eraseParserKey,\n status: ParserStatus.SUCCESS,\n params: {}\n }\n}\n", "import { Command } from '../../utils'\nimport { ParserKeyError } from '../errors'\nimport { ParserResult, ParserStatus } from '../../types'\n\nexport type StoreParams = object\nexport type StoreResult = ParserResult\nexport const storeParserKey = 'e'\n\nexport const storeParser: (params: Command) => StoreResult = ({ key, attributes }) => {\n if (key !== storeParserKey) {\n throw new ParserKeyError('storeParser', key)\n }\n\n return {\n key: storeParserKey,\n status: ParserStatus.SUCCESS,\n params: {}\n }\n}\n", "import { Command } from '../../utils'\nimport { ParserKeyError } from '../errors'\nimport { ParserResult, ParserStatus } from '../../types'\n\nexport enum ReturnTrack {\n ALL = 'ALL',\n MAIN = 'MAIN',\n PROG = 'PROG',\n JOIN = 'JOIN'\n}\nexport interface PowerParams {\n power: number\n track: ReturnTrack\n}\nexport type PowerResult = ParserResult\nexport const powerParserKey = 'p'\n\nexport const powerParser: (params: Command) => PowerResult = ({ key: potentialKey, attributes }) => {\n const [key, power] = potentialKey.split('')\n\n if (!isPowerCommand(key, power)) {\n throw new ParserKeyError('powerParser', key)\n }\n\n let [track] = attributes\n\n if (!Object.values(ReturnTrack).includes(track as ReturnTrack)) {\n track = ReturnTrack.ALL\n }\n\n return {\n key: powerParserKey,\n status: ParserStatus.SUCCESS,\n params: {\n power: parseInt(power),\n track: track as ReturnTrack\n }\n }\n}\n\nfunction isPowerCommand (key: string, power: string): boolean {\n return key === powerParserKey && ['0', '1'].includes(power)\n}\n"], - "mappings": ";AAGO,IAAK,eAAL,kBAAK,kBAAL;AACL,6BAAU;AADA;AAAA;;;ACHL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