@zwave-js/cc 15.24.3 → 15.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/cc/AssociationCC.d.ts +1 -1
- package/build/cjs/cc/AssociationCC.js +6 -3
- package/build/cjs/cc/AssociationCC.js.map +2 -2
- package/build/cjs/cc/AssociationGroupInfoCC.js +5 -1
- package/build/cjs/cc/AssociationGroupInfoCC.js.map +2 -2
- package/build/cjs/cc/ColorSwitchCC.js +5 -2
- package/build/cjs/cc/ColorSwitchCC.js.map +2 -2
- package/build/cjs/cc/ConfigurationCC.d.ts +14 -3
- package/build/cjs/cc/ConfigurationCC.js +65 -19
- package/build/cjs/cc/ConfigurationCC.js.map +2 -2
- package/build/cjs/cc/IndicatorCC.js +7 -3
- package/build/cjs/cc/IndicatorCC.js.map +2 -2
- package/build/cjs/cc/IrrigationCC.js +6 -2
- package/build/cjs/cc/IrrigationCC.js.map +2 -2
- package/build/cjs/cc/MeterCC.js +6 -1
- package/build/cjs/cc/MeterCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelAssociationCC.d.ts +1 -1
- package/build/cjs/cc/MultiChannelAssociationCC.js +6 -3
- package/build/cjs/cc/MultiChannelAssociationCC.js.map +2 -2
- package/build/cjs/cc/MultiChannelCC.d.ts +1 -1
- package/build/cjs/cc/MultiChannelCC.js +4 -2
- package/build/cjs/cc/MultiChannelCC.js.map +2 -2
- package/build/cjs/cc/MultilevelSensorCC.js +7 -3
- package/build/cjs/cc/MultilevelSensorCC.js.map +2 -2
- package/build/cjs/cc/NotificationCC.js +9 -2
- package/build/cjs/cc/NotificationCC.js.map +2 -2
- package/build/cjs/cc/SceneControllerConfigurationCC.js +1 -0
- package/build/cjs/cc/SceneControllerConfigurationCC.js.map +2 -2
- package/build/cjs/cc/SecurityCC.d.ts +2 -2
- package/build/cjs/cc/SecurityCC.js +6 -4
- package/build/cjs/cc/SecurityCC.js.map +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.d.ts +1 -1
- package/build/cjs/cc/ThermostatOperatingStateCC.js +2 -2
- package/build/cjs/cc/ThermostatOperatingStateCC.js.map +2 -2
- package/build/cjs/cc/ThermostatSetpointCC.js +8 -3
- package/build/cjs/cc/ThermostatSetpointCC.js.map +2 -2
- package/build/cjs/cc/TransportServiceCC.d.ts +0 -14
- package/build/cjs/cc/TransportServiceCC.js +0 -41
- package/build/cjs/cc/TransportServiceCC.js.map +2 -2
- package/build/cjs/cc/UserCodeCC.js +5 -1
- package/build/cjs/cc/UserCodeCC.js.map +2 -2
- package/build/cjs/cc/UserCredentialCC.d.ts +2 -2
- package/build/cjs/cc/UserCredentialCC.js +7 -3
- package/build/cjs/cc/UserCredentialCC.js.map +2 -2
- package/build/cjs/cc/VersionCC.js +7 -5
- package/build/cjs/cc/VersionCC.js.map +2 -2
- package/build/cjs/cc/WindowCoveringCC.js +6 -4
- package/build/cjs/cc/WindowCoveringCC.js.map +2 -2
- package/build/cjs/lib/CommandClass.d.ts +15 -6
- package/build/cjs/lib/CommandClass.js +10 -5
- package/build/cjs/lib/CommandClass.js.map +2 -2
- package/build/cjs/lib/traits.d.ts +16 -1
- package/build/esm/cc/AssociationCC.d.ts +1 -1
- package/build/esm/cc/AssociationCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationCC.js +6 -3
- package/build/esm/cc/AssociationCC.js.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.d.ts.map +1 -1
- package/build/esm/cc/AssociationGroupInfoCC.js +7 -1
- package/build/esm/cc/AssociationGroupInfoCC.js.map +1 -1
- package/build/esm/cc/ColorSwitchCC.d.ts.map +1 -1
- package/build/esm/cc/ColorSwitchCC.js +5 -2
- package/build/esm/cc/ColorSwitchCC.js.map +1 -1
- package/build/esm/cc/ConfigurationCC.d.ts +14 -3
- package/build/esm/cc/ConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/ConfigurationCC.js +98 -25
- package/build/esm/cc/ConfigurationCC.js.map +1 -1
- package/build/esm/cc/IndicatorCC.d.ts.map +1 -1
- package/build/esm/cc/IndicatorCC.js +8 -3
- package/build/esm/cc/IndicatorCC.js.map +1 -1
- package/build/esm/cc/IrrigationCC.d.ts.map +1 -1
- package/build/esm/cc/IrrigationCC.js +6 -2
- package/build/esm/cc/IrrigationCC.js.map +1 -1
- package/build/esm/cc/MeterCC.d.ts.map +1 -1
- package/build/esm/cc/MeterCC.js +6 -1
- package/build/esm/cc/MeterCC.js.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelAssociationCC.js +6 -3
- package/build/esm/cc/MultiChannelAssociationCC.js.map +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts +1 -1
- package/build/esm/cc/MultiChannelCC.d.ts.map +1 -1
- package/build/esm/cc/MultiChannelCC.js +4 -2
- package/build/esm/cc/MultiChannelCC.js.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.d.ts.map +1 -1
- package/build/esm/cc/MultilevelSensorCC.js +7 -3
- package/build/esm/cc/MultilevelSensorCC.js.map +1 -1
- package/build/esm/cc/NotificationCC.d.ts.map +1 -1
- package/build/esm/cc/NotificationCC.js +9 -2
- package/build/esm/cc/NotificationCC.js.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.d.ts.map +1 -1
- package/build/esm/cc/SceneControllerConfigurationCC.js +1 -0
- package/build/esm/cc/SceneControllerConfigurationCC.js.map +1 -1
- package/build/esm/cc/SecurityCC.d.ts +2 -2
- package/build/esm/cc/SecurityCC.d.ts.map +1 -1
- package/build/esm/cc/SecurityCC.js +7 -4
- package/build/esm/cc/SecurityCC.js.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatOperatingStateCC.js +2 -2
- package/build/esm/cc/ThermostatOperatingStateCC.js.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.d.ts.map +1 -1
- package/build/esm/cc/ThermostatSetpointCC.js +10 -3
- package/build/esm/cc/ThermostatSetpointCC.js.map +1 -1
- package/build/esm/cc/TransportServiceCC.d.ts +0 -14
- package/build/esm/cc/TransportServiceCC.d.ts.map +1 -1
- package/build/esm/cc/TransportServiceCC.js +1 -54
- package/build/esm/cc/TransportServiceCC.js.map +1 -1
- package/build/esm/cc/UserCodeCC.d.ts.map +1 -1
- package/build/esm/cc/UserCodeCC.js +4 -0
- package/build/esm/cc/UserCodeCC.js.map +1 -1
- package/build/esm/cc/UserCredentialCC.d.ts +2 -2
- package/build/esm/cc/UserCredentialCC.d.ts.map +1 -1
- package/build/esm/cc/UserCredentialCC.js +7 -4
- package/build/esm/cc/UserCredentialCC.js.map +1 -1
- package/build/esm/cc/VersionCC.d.ts.map +1 -1
- package/build/esm/cc/VersionCC.js +12 -6
- package/build/esm/cc/VersionCC.js.map +1 -1
- package/build/esm/cc/WindowCoveringCC.d.ts.map +1 -1
- package/build/esm/cc/WindowCoveringCC.js +7 -5
- package/build/esm/cc/WindowCoveringCC.js.map +1 -1
- package/build/esm/lib/CommandClass.d.ts +15 -6
- package/build/esm/lib/CommandClass.d.ts.map +1 -1
- package/build/esm/lib/CommandClass.js +10 -5
- package/build/esm/lib/CommandClass.js.map +1 -1
- package/build/esm/lib/traits.d.ts +16 -1
- package/build/esm/lib/traits.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/ThermostatSetpointCC.ts"],
|
|
4
|
-
"sourcesContent": ["import * as __validateArgs from \"./ThermostatSetpointCC._validateArgs.js\";\nconst { validateArgs_ThermostatSetpointCCAPI_get, validateArgs_ThermostatSetpointCCAPI_set, validateArgs_ThermostatSetpointCCAPI_getCapabilities } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type Scale, type SupervisionResult, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, encodeFloatWithScale, getNamedScale, getUnknownScale, parseBitMask, parseFloatWithScale, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatSetpointCommand, ThermostatSetpointType, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// This array is used to map the advertised supported types (interpretation A)\n// to the actual enum values\nconst thermostatSetpointTypeMap = [\n 0x00,\n 0x01,\n 0x02,\n 0x07,\n 0x08,\n 0x09,\n 0x0a,\n 0x0b,\n 0x0c,\n 0x0d,\n 0x0e,\n 0x0f,\n];\nfunction getScale(scale: number): Scale {\n return getNamedScale(\"temperature\", scale as any)\n ?? getUnknownScale(scale);\n}\nfunction getSetpointUnit(scale: number): string {\n return getScale(scale).unit ?? \"\";\n}\nimport { ThermostatSetpointCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatSetpointCCValues };\n@API(CommandClasses[\"Thermostat Setpoint\"])\nexport class ThermostatSetpointCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatSetpointCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatSetpointCommand.Get:\n case ThermostatSetpointCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatSetpointCommand.Set:\n return true; // This is mandatory\n case ThermostatSetpointCommand.CapabilitiesGet:\n return this.version >= 3 && this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }, value) {\n if (property !== \"setpoint\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the\n // actual Setpoint Type during the node interview. Fall back to the first scale if none is known\n const preferredScale = this.tryGetValueDB()?.getValue<number>(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));\n const result = await this.set(propertyKey, value, preferredScale ?? 0);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property, propertyKey }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"setpoint\":\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n return (await this.get(propertyKey))?.value;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_ThermostatSetpointCCAPI_get()\n public async get(setpointType: ThermostatSetpointType): Promise<{\n value: number;\n scale: Scale;\n } | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);\n const cc = new ThermostatSetpointCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCReport>(cc, this.commandOptions);\n if (!response)\n return;\n if (response.type !== ThermostatSetpointType[\"N/A\"]) {\n // This is a supported setpoint\n const scale = getScale(response.scale);\n return {\n value: response.value,\n scale,\n };\n }\n }\n @validateArgs_ThermostatSetpointCCAPI_set()\n public async set(setpointType: ThermostatSetpointType, value: number, scale: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);\n const cc = new ThermostatSetpointCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n value,\n scale,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ThermostatSetpointCCAPI_getCapabilities()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getCapabilities(setpointType: ThermostatSetpointType) {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);\n const cc = new ThermostatSetpointCCCapabilitiesGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCCapabilitiesReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"minValue\",\n \"maxValue\",\n \"minValueScale\",\n \"maxValueScale\",\n ]);\n }\n }\n /**\n * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended\n * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined\n * during node interview.\n */\n public async getSupportedSetpointTypes(): Promise<MaybeNotKnown<readonly ThermostatSetpointType[]>> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);\n const cc = new ThermostatSetpointCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedSetpointTypes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Setpoint\"])\n@implementedVersion(3)\n@ccValues(ThermostatSetpointCCValues)\nexport class ThermostatSetpointCC extends CommandClass {\n declare ccCommand: ThermostatSetpointCommand;\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if (property === \"setpoint\") {\n return getEnumMemberName(ThermostatSetpointType, propertyKey as any);\n }\n else {\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n if (api.version <= 2) {\n // It has been found that early implementations of this Command Class applied two non-interoperable\n // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat\n // Setpoint Supported Report Command.\n // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2\n // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing\n // the requested Setpoint Type.\n // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the\n // controlling node MUST conclude that the actual Setpoint Type is supported.\n // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report\n // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.\n // The specs require us to query the list of supported setpoint types anyways, even if the response is ignored\n await api.getSupportedSetpointTypes();\n // Now scan all endpoints. Each type we received a value for gets marked as supported\n const supportedSetpointTypes: ThermostatSetpointType[] = [];\n for (let type: ThermostatSetpointType = ThermostatSetpointType.Heating; type <= ThermostatSetpointType[\"Full Power\"]; type++) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n // If the node did not respond, assume the setpoint type is not supported\n let logMessage: string;\n if (setpoint) {\n // Setpoint supported, remember the type\n supportedSetpointTypes.push(type);\n logMessage =\n `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n }\n else {\n // We're sure about the interpretation - this should not happen\n logMessage = `setpoint ${setpointName} is not supported`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n // Remember which setpoint types are actually supported\n this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);\n }\n else {\n // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes\n // Query the supported setpoint types\n let setpointTypes: ThermostatSetpointType[] = [];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"retrieving supported setpoint types...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupportedSetpointTypes();\n if (resp) {\n setpointTypes = [...resp];\n const logMessage = \"received supported setpoint types:\\n\"\n + setpointTypes\n .map((type) => getEnumMemberName(ThermostatSetpointType, type))\n .map((name) => `\u00B7 ${name}`)\n .join(\"\\n\");\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported setpoint types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n for (const type of setpointTypes) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Find out the capabilities of this setpoint\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `retrieving capabilities for setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpointCaps = await api.getCapabilities(type);\n if (setpointCaps) {\n const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);\n const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);\n const logMessage = `received capabilities for setpoint ${setpointName}:\nminimum value: ${setpointCaps.minValue} ${minValueUnit}\nmaximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n // Query the current value for all setpoint types\n await this.refreshValues(ctx);\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const setpointTypes: ThermostatSetpointType[] = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];\n // Query each setpoint's current value\n for (const type of setpointTypes) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n if (setpoint) {\n const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n }\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSetOptions {\n setpointType: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Set)\n@useSupervision()\nexport class ThermostatSetpointCCSet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n value,\n scale,\n });\n }\n public setpointType: ThermostatSetpointType;\n public value: number;\n public scale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // If a config file overwrites how the float should be encoded, use that information\n const override = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.overrideFloatEncoding;\n this.payload = Bytes.concat([\n [this.setpointType & 0b1111],\n encodeFloatWithScale(this.value, this.scale, override),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCReportOptions {\n type: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Report)\nexport class ThermostatSetpointCCReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCReportOptions>) {\n super(options);\n this.type = options.type;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0] & 0b1111;\n if (type === 0) {\n // Not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value: 0,\n scale: 0,\n });\n }\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value,\n scale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const scale = getScale(this.scale);\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n const existingMetadata = this.getMetadata<ValueMetadataNumeric>(ctx, setpointValue);\n // Update the metadata when it is missing or the unit has changed\n if (existingMetadata?.unit !== scale.unit) {\n this.setMetadata(ctx, setpointValue, {\n ...(existingMetadata ?? setpointValue.meta),\n unit: scale.unit,\n });\n }\n this.setValue(ctx, setpointValue, this.value);\n // Remember the device-preferred setpoint scale so it can be used in SET commands\n this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);\n return true;\n }\n public type: ThermostatSetpointType;\n public scale: number;\n public value: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.type & 0b1111],\n encodeFloatWithScale(this.value, this.scale),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\nfunction testResponseForThermostatSetpointGet(sent: ThermostatSetpointCCGet, received: ThermostatSetpointCCReport) {\n // We expect a Thermostat Setpoint Report that matches the requested setpoint type\n return received.type === sent.setpointType;\n}\n// @publicAPI\nexport interface ThermostatSetpointCCGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.Get)\n@expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)\nexport class ThermostatSetpointCCGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesReportOptions {\n type: ThermostatSetpointType;\n minValue: number;\n minValueScale: number;\n maxValue: number;\n maxValueScale: number;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesReportOptions>) {\n super(options);\n this.type = options.type;\n this.minValue = options.minValue;\n this.minValueScale = options.minValueScale;\n this.maxValue = options.maxValue;\n this.maxValueScale = options.maxValueScale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0];\n // parseFloatWithScale does its own validation\n const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));\n const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n minValue,\n minValueScale,\n maxValue,\n maxValueScale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Predefine the metadata\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n this.setMetadata(ctx, setpointValue, {\n ...setpointValue.meta,\n min: this.minValue,\n max: this.maxValue,\n unit: getSetpointUnit(this.minValueScale)\n || getSetpointUnit(this.maxValueScale),\n });\n return true;\n }\n public type: ThermostatSetpointType;\n public minValue: number;\n public maxValue: number;\n public minValueScale: number;\n public maxValueScale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const min = encodeFloatWithScale(this.minValue, this.minValueScale);\n const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);\n this.payload = Bytes.concat([[this.type], min, max]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const minValueScale = getScale(this.minValueScale);\n const maxValueScale = getScale(this.maxValueScale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n \"min value\": `${this.minValue} ${minValueScale.unit}`,\n \"max value\": `${this.maxValue} ${maxValueScale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesGet)\n@expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSupportedReportOptions {\n supportedSetpointTypes: ThermostatSetpointType[];\n}\n@CCCommand(ThermostatSetpointCommand.SupportedReport)\n@ccValueProperty(\"supportedSetpointTypes\", ThermostatSetpointCCValues.supportedSetpointTypes)\nexport class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSupportedReportOptions>) {\n super(options);\n if (options.supportedSetpointTypes.length === 0) {\n throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.supportedSetpointTypes = options.supportedSetpointTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMask = raw.payload;\n const supported = parseBitMask(bitMask, ThermostatSetpointType[\"N/A\"]);\n // We use this command only when we are sure that bitmask interpretation A is used\n // FIXME: Figure out if we can do this without the CC version\n const supportedSetpointTypes: ThermostatSetpointType[] = supported.map((i) => thermostatSetpointTypeMap[i]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSetpointTypes,\n });\n }\n public readonly supportedSetpointTypes: readonly ThermostatSetpointType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(\n // Encode as interpretation A\n this.supportedSetpointTypes\n .map((t) => thermostatSetpointTypeMap.indexOf(t))\n .filter((t) => t !== -1), undefined, ThermostatSetpointType[\"N/A\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported setpoint types\": this.supportedSetpointTypes\n .map((t) => `\\n\u00B7 ${getEnumMemberName(ThermostatSetpointType, t)}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(ThermostatSetpointCommand.SupportedGet)\n@expectedCCResponse(ThermostatSetpointCCSupportedReport)\n/**\n * Issues a SupportedGet command to the node. Due to inconsistencies in interpretation,\n * this command should not be used for nodes with CC versions 1 or 2\n */\nexport class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkY;AAClY,oBAA+C;AAC/C,iBAAwJ;AACx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AI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACgB;IACT,UAAU,KAAsB;AACnC,WAAK,cAAU;;QAEf,KAAK,uBACA,IAAI,CAAC,MAAM,0BAA0B,QAAQ,CAAC,CAAC,EAC/C,OAAO,CAAC,MAAM,MAAM,EAAE;QAAG;QAAW,oCAAuB,KAAK;MAAC;AACtE,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,4BAA4B,KAAK,uBAC5B,IAAI,CAAC,MAAM;WAAO,iCAAkB,qCAAwB,CAAC,CAAC,EAAE,EAChE,KAAK,EAAE;;;IAGxB;;;;IAQS,oCAAgC,MAAA;8BAN5C,yCAAU,uCAA0B,YAAY,OAChD,kDAAmB,mCAAmC,CAAC;;;;oBAKF;wDAAA,YAAoB;WAAA;;;;;;;;AAA1E,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
|
|
4
|
+
"sourcesContent": ["import * as __validateArgs from \"./ThermostatSetpointCC._validateArgs.js\";\nconst { validateArgs_ThermostatSetpointCCAPI_get, validateArgs_ThermostatSetpointCCAPI_set, validateArgs_ThermostatSetpointCCAPI_getCapabilities } = __validateArgs;\nimport { CommandClasses, type GetValueDB, type MaybeNotKnown, type MessageOrCCLogEntry, MessagePriority, type Scale, type SupervisionResult, ValueMetadata, type ValueMetadataNumeric, type WithAddress, ZWaveError, ZWaveErrorCodes, encodeBitMask, encodeFloatWithScale, getNamedScale, getUnknownScale, parseBitMask, parseFloatWithScale, supervisedCommandSucceeded, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, getEnumMemberName, pick } from \"@zwave-js/shared\";\nimport { CCAPI, POLL_VALUE, type PollValueImplementation, SET_VALUE, type SetValueImplementation, throwUnsupportedProperty, throwWrongValueType, } from \"../lib/API.js\";\nimport { type CCRaw, CommandClass, type InterviewContext, type PersistValuesContext, type RefreshValuesContext, type RefreshValuesOptions, } from \"../lib/CommandClass.js\";\nimport { API, CCCommand, ccValueProperty, ccValues, commandClass, expectedCCResponse, implementedVersion, useSupervision, } from \"../lib/CommandClassDecorators.js\";\nimport { V } from \"../lib/Values.js\";\nimport { ThermostatSetpointCommand, ThermostatSetpointType, } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\n// This array is used to map the advertised supported types (interpretation A)\n// to the actual enum values\nconst thermostatSetpointTypeMap = [\n 0x00,\n 0x01,\n 0x02,\n 0x07,\n 0x08,\n 0x09,\n 0x0a,\n 0x0b,\n 0x0c,\n 0x0d,\n 0x0e,\n 0x0f,\n];\nfunction getScale(scale: number): Scale {\n return getNamedScale(\"temperature\", scale as any)\n ?? getUnknownScale(scale);\n}\nfunction getSetpointUnit(scale: number): string {\n return getScale(scale).unit ?? \"\";\n}\nimport { ThermostatSetpointCCValues } from \"./_CCValues.generated.js\";\nexport { ThermostatSetpointCCValues };\n@API(CommandClasses[\"Thermostat Setpoint\"])\nexport class ThermostatSetpointCCAPI extends CCAPI {\n public supportsCommand(cmd: ThermostatSetpointCommand): MaybeNotKnown<boolean> {\n switch (cmd) {\n case ThermostatSetpointCommand.Get:\n case ThermostatSetpointCommand.SupportedGet:\n return this.isSinglecast();\n case ThermostatSetpointCommand.Set:\n return true; // This is mandatory\n case ThermostatSetpointCommand.CapabilitiesGet:\n return this.version >= 3 && this.isSinglecast();\n }\n return super.supportsCommand(cmd);\n }\n protected override get [SET_VALUE](): SetValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }, value) {\n if (property !== \"setpoint\") {\n throwUnsupportedProperty(this.ccId, property);\n }\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n if (typeof value !== \"number\") {\n throwWrongValueType(this.ccId, property, \"number\", typeof value);\n }\n // SDS14223: The Scale field value MUST be identical to the value received in the Thermostat Setpoint Report for the\n // actual Setpoint Type during the node interview. Fall back to the first scale if none is known\n const preferredScale = this.tryGetValueDB()?.getValue<number>(ThermostatSetpointCCValues.setpointScale(propertyKey).endpoint(this.endpoint.index));\n const result = await this.set(propertyKey, value, preferredScale ?? 0);\n // Verify the current value after a delay, unless the command was supervised and successful\n if (this.isSinglecast() && !supervisedCommandSucceeded(result)) {\n // TODO: Ideally this would be a short delay, but some thermostats like Remotec ZXT-600\n // aren't able to handle the GET this quickly.\n this.schedulePoll({ property, propertyKey }, value);\n }\n return result;\n };\n }\n protected get [POLL_VALUE](): PollValueImplementation {\n return async function (this: ThermostatSetpointCCAPI, { property, propertyKey }) {\n switch (property) {\n case \"setpoint\":\n if (typeof propertyKey !== \"number\") {\n throw new ZWaveError(`${CommandClasses[this.ccId]}: \"${property}\" must be further specified by a numeric property key`, ZWaveErrorCodes.Argument_Invalid);\n }\n return (await this.get(propertyKey))?.value;\n default:\n throwUnsupportedProperty(this.ccId, property);\n }\n };\n }\n @validateArgs_ThermostatSetpointCCAPI_get()\n public async get(setpointType: ThermostatSetpointType): Promise<{\n value: number;\n scale: Scale;\n } | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Get);\n const cc = new ThermostatSetpointCCGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCReport>(cc, this.commandOptions);\n if (!response)\n return;\n if (response.type !== ThermostatSetpointType[\"N/A\"]) {\n // This is a supported setpoint\n const scale = getScale(response.scale);\n return {\n value: response.value,\n scale,\n };\n }\n }\n @validateArgs_ThermostatSetpointCCAPI_set()\n public async set(setpointType: ThermostatSetpointType, value: number, scale: number): Promise<SupervisionResult | undefined> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.Set);\n const cc = new ThermostatSetpointCCSet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n value,\n scale,\n });\n return this.host.sendCommand(cc, this.commandOptions);\n }\n @validateArgs_ThermostatSetpointCCAPI_getCapabilities()\n // oxlint-disable-next-line typescript/explicit-module-boundary-types\n public async getCapabilities(setpointType: ThermostatSetpointType) {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.CapabilitiesGet);\n const cc = new ThermostatSetpointCCCapabilitiesGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n setpointType,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCCapabilitiesReport>(cc, this.commandOptions);\n if (response) {\n return pick(response, [\n \"minValue\",\n \"maxValue\",\n \"minValueScale\",\n \"maxValueScale\",\n ]);\n }\n }\n /**\n * Requests the supported setpoint types from the node. Due to inconsistencies it is NOT recommended\n * to use this method on nodes with CC versions 1 and 2. Instead rely on the information determined\n * during node interview.\n */\n public async getSupportedSetpointTypes(): Promise<MaybeNotKnown<readonly ThermostatSetpointType[]>> {\n this.assertSupportsCommand(ThermostatSetpointCommand, ThermostatSetpointCommand.SupportedGet);\n const cc = new ThermostatSetpointCCSupportedGet({\n nodeId: this.endpoint.nodeId,\n endpointIndex: this.endpoint.index,\n });\n const response = await this.host.sendCommand<ThermostatSetpointCCSupportedReport>(cc, this.commandOptions);\n return response?.supportedSetpointTypes;\n }\n}\n@commandClass(CommandClasses[\"Thermostat Setpoint\"])\n@implementedVersion(3)\n@ccValues(ThermostatSetpointCCValues)\nexport class ThermostatSetpointCC extends CommandClass {\n declare ccCommand: ThermostatSetpointCommand;\n public translatePropertyKey(ctx: GetValueDB, property: string | number, propertyKey: string | number): string | undefined {\n if (property === \"setpoint\") {\n return getEnumMemberName(ThermostatSetpointType, propertyKey as any);\n }\n else {\n return super.translatePropertyKey(ctx, property, propertyKey);\n }\n }\n public async interview(ctx: InterviewContext): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: MessagePriority.NodeQuery,\n });\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `Interviewing ${this.ccName}...`,\n direction: \"none\",\n });\n if (api.version <= 2) {\n // It has been found that early implementations of this Command Class applied two non-interoperable\n // interpretations of the bit mask advertising the support for specific Setpoint Types in the Thermostat\n // Setpoint Supported Report Command.\n // A controlling node SHOULD determine the supported Setpoint Types of a version 1 and version 2\n // supporting node by sending one Thermostat Setpoint Get Command at a time while incrementing\n // the requested Setpoint Type.\n // If the same Setpoint Type is advertised in the returned Thermostat Setpoint Report Command, the\n // controlling node MUST conclude that the actual Setpoint Type is supported.\n // If the Setpoint Type 0x00 (type N/A) is advertised in the returned Thermostat Setpoint Report\n // Command, the controlling node MUST conclude that the actual Setpoint Type is not supported.\n // The specs require us to query the list of supported setpoint types anyways, even if the response is ignored\n await api.getSupportedSetpointTypes();\n // Now scan all endpoints. Each type we received a value for gets marked as supported\n const supportedSetpointTypes: ThermostatSetpointType[] = [];\n for (let type: ThermostatSetpointType = ThermostatSetpointType.Heating; type <= ThermostatSetpointType[\"Full Power\"]; type++) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n // If the node did not respond, assume the setpoint type is not supported\n let logMessage: string;\n if (setpoint) {\n // Setpoint supported, remember the type\n supportedSetpointTypes.push(type);\n logMessage =\n `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n }\n else {\n // We're sure about the interpretation - this should not happen\n logMessage = `setpoint ${setpointName} is not supported`;\n }\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n node.reportInterviewProgress(type - ThermostatSetpointType.Heating + 1, ThermostatSetpointType[\"Full Power\"]\n - ThermostatSetpointType.Heating\n + 1);\n }\n // Remember which setpoint types are actually supported\n this.setValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes, supportedSetpointTypes);\n }\n else {\n // Versions >= 3 adhere to bitmap interpretation A, so we can rely on getSupportedSetpointTypes\n // Query the supported setpoint types\n let setpointTypes: ThermostatSetpointType[] = [];\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"retrieving supported setpoint types...\",\n direction: \"outbound\",\n });\n const resp = await api.getSupportedSetpointTypes();\n if (resp) {\n setpointTypes = [...resp];\n const logMessage = \"received supported setpoint types:\\n\"\n + setpointTypes\n .map((type) => getEnumMemberName(ThermostatSetpointType, type))\n .map((name) => `\u00B7 ${name}`)\n .join(\"\\n\");\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n else {\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: \"Querying supported setpoint types timed out, skipping interview...\",\n level: \"warn\",\n });\n return;\n }\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Find out the capabilities of this setpoint\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `retrieving capabilities for setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpointCaps = await api.getCapabilities(type);\n if (setpointCaps) {\n const minValueUnit = getSetpointUnit(setpointCaps.minValueScale);\n const maxValueUnit = getSetpointUnit(setpointCaps.maxValueScale);\n const logMessage = `received capabilities for setpoint ${setpointName}:\nminimum value: ${setpointCaps.minValue} ${minValueUnit}\nmaximum value: ${setpointCaps.maxValue} ${maxValueUnit}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n node.reportInterviewProgress(i + 1, setpointTypes.length);\n }\n // Query the current value for all setpoint types\n await this.refreshValues(ctx, {\n onProgress: (completed, total) => node.reportInterviewProgress(completed, total),\n });\n }\n // Remember that the interview is complete\n this.setInterviewComplete(ctx, true);\n }\n public async refreshValues(ctx: RefreshValuesContext, options?: RefreshValuesOptions): Promise<void> {\n const node = this.getNode(ctx)!;\n const endpoint = this.getEndpoint(ctx)!;\n const api = CCAPI.create(CommandClasses[\"Thermostat Setpoint\"], ctx, endpoint).withOptions({\n priority: options?.priority ?? MessagePriority.NodeQuery,\n });\n const setpointTypes: ThermostatSetpointType[] = this.getValue(ctx, ThermostatSetpointCCValues.supportedSetpointTypes) ?? [];\n // Query each setpoint's current value\n for (const [i, type] of setpointTypes.entries()) {\n const setpointName = getEnumMemberName(ThermostatSetpointType, type);\n // Every time, query the current value\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: `querying current value of setpoint ${setpointName}...`,\n direction: \"outbound\",\n });\n const setpoint = await api.get(type);\n if (setpoint) {\n const logMessage = `received current value of setpoint ${setpointName}: ${setpoint.value} ${setpoint.scale.unit ?? \"\"}`;\n ctx.logNode(node.id, {\n endpoint: this.endpointIndex,\n message: logMessage,\n direction: \"inbound\",\n });\n }\n options?.onProgress?.(i + 1, setpointTypes.length);\n }\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSetOptions {\n setpointType: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Set)\n@useSupervision()\nexport class ThermostatSetpointCCSet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n value,\n scale,\n });\n }\n public setpointType: ThermostatSetpointType;\n public value: number;\n public scale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // If a config file overwrites how the float should be encoded, use that information\n const override = ctx.getDeviceConfig?.(this.nodeId as number)\n ?.compat?.overrideFloatEncoding;\n this.payload = Bytes.concat([\n [this.setpointType & 0b1111],\n encodeFloatWithScale(this.value, this.scale, override),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCReportOptions {\n type: ThermostatSetpointType;\n value: number;\n scale: number;\n}\n@CCCommand(ThermostatSetpointCommand.Report)\nexport class ThermostatSetpointCCReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCReportOptions>) {\n super(options);\n this.type = options.type;\n this.value = options.value;\n this.scale = options.scale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0] & 0b1111;\n if (type === 0) {\n // Not supported\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value: 0,\n scale: 0,\n });\n }\n // parseFloatWithScale does its own validation\n const { value, scale } = parseFloatWithScale(raw.payload.subarray(1));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n value,\n scale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n const scale = getScale(this.scale);\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n const existingMetadata = this.getMetadata<ValueMetadataNumeric>(ctx, setpointValue);\n // Update the metadata when it is missing or the unit has changed\n if (existingMetadata?.unit !== scale.unit) {\n this.setMetadata(ctx, setpointValue, {\n ...(existingMetadata ?? setpointValue.meta),\n unit: scale.unit,\n });\n }\n this.setValue(ctx, setpointValue, this.value);\n // Remember the device-preferred setpoint scale so it can be used in SET commands\n this.setValue(ctx, ThermostatSetpointCCValues.setpointScale(this.type), scale.key);\n return true;\n }\n public type: ThermostatSetpointType;\n public scale: number;\n public value: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.concat([\n [this.type & 0b1111],\n encodeFloatWithScale(this.value, this.scale),\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const scale = getScale(this.scale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n value: `${this.value} ${scale.unit}`,\n },\n };\n }\n}\nfunction testResponseForThermostatSetpointGet(sent: ThermostatSetpointCCGet, received: ThermostatSetpointCCReport) {\n // We expect a Thermostat Setpoint Report that matches the requested setpoint type\n return received.type === sent.setpointType;\n}\n// @publicAPI\nexport interface ThermostatSetpointCCGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.Get)\n@expectedCCResponse(ThermostatSetpointCCReport, testResponseForThermostatSetpointGet)\nexport class ThermostatSetpointCCGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesReportOptions {\n type: ThermostatSetpointType;\n minValue: number;\n minValueScale: number;\n maxValue: number;\n maxValueScale: number;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesReportOptions>) {\n super(options);\n this.type = options.type;\n this.minValue = options.minValue;\n this.minValueScale = options.minValueScale;\n this.maxValue = options.maxValue;\n this.maxValueScale = options.maxValueScale;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesReport {\n validatePayload(raw.payload.length >= 1);\n const type: ThermostatSetpointType = raw.payload[0];\n // parseFloatWithScale does its own validation\n const { value: minValue, scale: minValueScale, bytesRead, } = parseFloatWithScale(raw.payload.subarray(1));\n const { value: maxValue, scale: maxValueScale } = parseFloatWithScale(raw.payload.subarray(1 + bytesRead));\n return new this({\n nodeId: ctx.sourceNodeId,\n type,\n minValue,\n minValueScale,\n maxValue,\n maxValueScale,\n });\n }\n public persistValues(ctx: PersistValuesContext): boolean {\n if (!super.persistValues(ctx))\n return false;\n // Predefine the metadata\n const setpointValue = ThermostatSetpointCCValues.setpoint(this.type);\n this.setMetadata(ctx, setpointValue, {\n ...setpointValue.meta,\n min: this.minValue,\n max: this.maxValue,\n unit: getSetpointUnit(this.minValueScale)\n || getSetpointUnit(this.maxValueScale),\n });\n return true;\n }\n public type: ThermostatSetpointType;\n public minValue: number;\n public maxValue: number;\n public minValueScale: number;\n public maxValueScale: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n const min = encodeFloatWithScale(this.minValue, this.minValueScale);\n const max = encodeFloatWithScale(this.maxValue, this.maxValueScale);\n this.payload = Bytes.concat([[this.type], min, max]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n const minValueScale = getScale(this.minValueScale);\n const maxValueScale = getScale(this.maxValueScale);\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.type),\n \"min value\": `${this.minValue} ${minValueScale.unit}`,\n \"max value\": `${this.maxValue} ${maxValueScale.unit}`,\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCCapabilitiesGetOptions {\n setpointType: ThermostatSetpointType;\n}\n@CCCommand(ThermostatSetpointCommand.CapabilitiesGet)\n@expectedCCResponse(ThermostatSetpointCCCapabilitiesReport)\nexport class ThermostatSetpointCCCapabilitiesGet extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCCapabilitiesGetOptions>) {\n super(options);\n this.setpointType = options.setpointType;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCCapabilitiesGet {\n validatePayload(raw.payload.length >= 1);\n const setpointType: ThermostatSetpointType = raw.payload[0] & 0b1111;\n return new this({\n nodeId: ctx.sourceNodeId,\n setpointType,\n });\n }\n public setpointType: ThermostatSetpointType;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.setpointType & 0b1111]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"setpoint type\": getEnumMemberName(ThermostatSetpointType, this.setpointType),\n },\n };\n }\n}\n// @publicAPI\nexport interface ThermostatSetpointCCSupportedReportOptions {\n supportedSetpointTypes: ThermostatSetpointType[];\n}\n@CCCommand(ThermostatSetpointCommand.SupportedReport)\n@ccValueProperty(\"supportedSetpointTypes\", ThermostatSetpointCCValues.supportedSetpointTypes)\nexport class ThermostatSetpointCCSupportedReport extends ThermostatSetpointCC {\n public constructor(options: WithAddress<ThermostatSetpointCCSupportedReportOptions>) {\n super(options);\n if (options.supportedSetpointTypes.length === 0) {\n throw new ZWaveError(`At least one setpoint type must be supported`, ZWaveErrorCodes.Argument_Invalid);\n }\n this.supportedSetpointTypes = options.supportedSetpointTypes;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): ThermostatSetpointCCSupportedReport {\n validatePayload(raw.payload.length >= 1);\n const bitMask = raw.payload;\n const supported = parseBitMask(bitMask, ThermostatSetpointType[\"N/A\"]);\n // We use this command only when we are sure that bitmask interpretation A is used\n // FIXME: Figure out if we can do this without the CC version\n const supportedSetpointTypes: ThermostatSetpointType[] = supported.map((i) => thermostatSetpointTypeMap[i]);\n return new this({\n nodeId: ctx.sourceNodeId,\n supportedSetpointTypes,\n });\n }\n public readonly supportedSetpointTypes: readonly ThermostatSetpointType[];\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = encodeBitMask(\n // Encode as interpretation A\n this.supportedSetpointTypes\n .map((t) => thermostatSetpointTypeMap.indexOf(t))\n .filter((t) => t !== -1), undefined, ThermostatSetpointType[\"N/A\"]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"supported setpoint types\": this.supportedSetpointTypes\n .map((t) => `\\n\u00B7 ${getEnumMemberName(ThermostatSetpointType, t)}`)\n .join(\"\"),\n },\n };\n }\n}\n@CCCommand(ThermostatSetpointCommand.SupportedGet)\n@expectedCCResponse(ThermostatSetpointCCSupportedReport)\n/**\n * Issues a SupportedGet command to the node. Due to inconsistencies in interpretation,\n * this command should not be used for nodes with CC versions 1 or 2\n */\nexport class ThermostatSetpointCCSupportedGet extends ThermostatSetpointCC {\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qBAAgC;AAEhC,kBAAkY;AAClY,oBAA+C;AAC/C,iBAAwJ;AACxJ,0BAAkJ;AAClJ,oCAAiI;AAEjI,mBAAmE;AAyBnE,gCAA2C;AAhC3C,MAAM,EAA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AO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,UAAU,IAAI;AACpB,YAAM,gBAAY,0BAAa,SAAS,oCAAuB,KAAK,CAAC;AAGrE,YAAM,yBAAmD,UAAU,IAAI,CAAC,MAAM,0BAA0B,CAAC,CAAC;AAC1G,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACgB;IACT,UAAU,KAAsB;AACnC,WAAK,cAAU;;QAEf,KAAK,uBACA,IAAI,CAAC,MAAM,0BAA0B,QAAQ,CAAC,CAAC,EAC/C,OAAO,CAAC,MAAM,MAAM,EAAE;QAAG;QAAW,oCAAuB,KAAK;MAAC;AACtE,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS;UACL,4BAA4B,KAAK,uBAC5B,IAAI,CAAC,MAAM;WAAO,iCAAkB,qCAAwB,CAAC,CAAC,EAAE,EAChE,KAAK,EAAE;;;IAGxB;;;;IAQS,oCAAgC,MAAA;8BAN5C,yCAAU,uCAA0B,YAAY,OAChD,kDAAmB,mCAAmC,CAAC;;;;oBAKF;wDAAA,YAAoB;WAAA;;;;;;;;AAA1E,qCAAA,MAAA,mBAAA,EAAA,OAAA,WAAA,GAAA,kBAAA,EAAA,MAAA,SAAA,MAAA,WAAA,MAAA,UAAA,UAAA,GAAA,MAAA,uBAAA;;;AAAa,0CAAA,YAAA,uBAAA;;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,10 +39,7 @@ export declare class TransportServiceCCFirstSegment extends TransportServiceCC {
|
|
|
39
39
|
sessionId: number;
|
|
40
40
|
headerExtension: BytesView | undefined;
|
|
41
41
|
partialDatagram: BytesView;
|
|
42
|
-
encapsulated: CommandClass;
|
|
43
42
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
44
|
-
expectMoreMessages(): boolean;
|
|
45
|
-
getPartialCCSessionId(): Record<string, any> | undefined;
|
|
46
43
|
protected computeEncapsulationOverhead(): number;
|
|
47
44
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
48
45
|
}
|
|
@@ -57,17 +54,6 @@ export declare class TransportServiceCCSubsequentSegment extends TransportServic
|
|
|
57
54
|
sessionId: number;
|
|
58
55
|
headerExtension: BytesView | undefined;
|
|
59
56
|
partialDatagram: BytesView;
|
|
60
|
-
private _encapsulated;
|
|
61
|
-
get encapsulated(): CommandClass;
|
|
62
|
-
expectMoreMessages(session: [
|
|
63
|
-
TransportServiceCCFirstSegment,
|
|
64
|
-
...TransportServiceCCSubsequentSegment[]
|
|
65
|
-
]): boolean;
|
|
66
|
-
getPartialCCSessionId(): Record<string, any> | undefined;
|
|
67
|
-
mergePartialCCs(partials: [
|
|
68
|
-
TransportServiceCCFirstSegment,
|
|
69
|
-
...TransportServiceCCSubsequentSegment[]
|
|
70
|
-
], ctx: CCParsingContext): Promise<void>;
|
|
71
57
|
serialize(ctx: CCEncodingContext): Promise<Bytes>;
|
|
72
58
|
protected computeEncapsulationOverhead(): number;
|
|
73
59
|
toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry;
|
|
@@ -142,7 +142,6 @@ let TransportServiceCCFirstSegment = (() => {
|
|
|
142
142
|
sessionId;
|
|
143
143
|
headerExtension;
|
|
144
144
|
partialDatagram;
|
|
145
|
-
encapsulated;
|
|
146
145
|
serialize(ctx) {
|
|
147
146
|
this.ccCommand = this.ccCommand & 248 | this.datagramSize >>> 8 & 7;
|
|
148
147
|
const ext = !!this.headerExtension && this.headerExtension.length >= 1;
|
|
@@ -169,12 +168,6 @@ let TransportServiceCCFirstSegment = (() => {
|
|
|
169
168
|
this.payload.writeUInt16BE(crc, this.payload.length - 2);
|
|
170
169
|
return super.serialize(ctx);
|
|
171
170
|
}
|
|
172
|
-
expectMoreMessages() {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
getPartialCCSessionId() {
|
|
176
|
-
return { ccCommand: void 0, sessionId: this.sessionId };
|
|
177
|
-
}
|
|
178
171
|
computeEncapsulationOverhead() {
|
|
179
172
|
return super.computeEncapsulationOverhead() + 4 + (this.headerExtension?.length ? 1 + this.headerExtension.length : 0);
|
|
180
173
|
}
|
|
@@ -258,40 +251,6 @@ let TransportServiceCCSubsequentSegment = (() => {
|
|
|
258
251
|
sessionId;
|
|
259
252
|
headerExtension;
|
|
260
253
|
partialDatagram;
|
|
261
|
-
// This can only be received
|
|
262
|
-
_encapsulated;
|
|
263
|
-
get encapsulated() {
|
|
264
|
-
return this._encapsulated;
|
|
265
|
-
}
|
|
266
|
-
expectMoreMessages(session) {
|
|
267
|
-
if (!(session[0] instanceof TransportServiceCCFirstSegment)) {
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
const datagramSize = session[0].datagramSize;
|
|
271
|
-
const receivedBytes = Array.from({ length: datagramSize }).fill(false);
|
|
272
|
-
for (const segment of [...session, this]) {
|
|
273
|
-
const offset = segment instanceof TransportServiceCCFirstSegment ? 0 : segment.datagramOffset;
|
|
274
|
-
for (let i = offset; i <= offset + segment.partialDatagram.length; i++) {
|
|
275
|
-
receivedBytes[i] = true;
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
return receivedBytes.includes(false);
|
|
279
|
-
}
|
|
280
|
-
getPartialCCSessionId() {
|
|
281
|
-
return { ccCommand: void 0, sessionId: this.sessionId };
|
|
282
|
-
}
|
|
283
|
-
async mergePartialCCs(partials, ctx) {
|
|
284
|
-
const datagram = new import_shared.Bytes(this.datagramSize);
|
|
285
|
-
for (const partial of [...partials, this]) {
|
|
286
|
-
const offset = partial instanceof TransportServiceCCFirstSegment ? 0 : partial.datagramOffset;
|
|
287
|
-
if (offset + partial.partialDatagram.length > datagram.length) {
|
|
288
|
-
throw new import_core.ZWaveError(`The partial datagram offset and length in a segment are not compatible to the communicated datagram length`, import_core.ZWaveErrorCodes.PacketFormat_InvalidPayload);
|
|
289
|
-
}
|
|
290
|
-
datagram.set(partial.partialDatagram, offset);
|
|
291
|
-
}
|
|
292
|
-
this._encapsulated = await import_CommandClass.CommandClass.parse(datagram, ctx);
|
|
293
|
-
this._encapsulated.encapsulatingCC = this;
|
|
294
|
-
}
|
|
295
254
|
serialize(ctx) {
|
|
296
255
|
this.ccCommand = this.ccCommand & 248 | this.datagramSize >>> 8 & 7;
|
|
297
256
|
const ext = !!this.headerExtension && this.headerExtension.length >= 1;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src_gen/cc/TransportServiceCC.ts"],
|
|
4
|
-
"sourcesContent": ["import { CRC16_CCITT, CommandClasses, type GetValueDB, type MessageOrCCLogEntry, type SinglecastCC, type WithAddress, ZWaveError, ZWaveErrorCodes, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex } from \"@zwave-js/shared\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { CCCommand, commandClass, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { TransportServiceCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nexport const MAX_SEGMENT_SIZE = 39;\nexport const RELAXED_TIMING_THRESHOLD = 2;\n// TODO: Figure out how we know if communicating with R2 or R3\n/** @publicAPI */\nexport const TransportServiceTimeouts = {\n /** Waiting time before requesting a missing segment at data rate R2 */\n requestMissingSegmentR2: 800,\n /** Waiting time before requesting a missing segment at data rate R3 */\n requestMissingSegmentR3: 400,\n /** Waiting time before sending another datagram at data rate R2 */\n segmentCompleteR2: 1000,\n /** Waiting time before sending another datagram at data rate R3 */\n segmentCompleteR3: 500,\n /** Waiting time between segments when sending more than {@link RELAXED_TIMING_THRESHOLD} segments at data rate R2 */\n relaxedTimingDelayR2: 35,\n /** Waiting time between segments when sending more than {@link RELAXED_TIMING_THRESHOLD} segments at data rate R3 */\n relaxedTimingDelayR3: 15,\n};\n@commandClass(CommandClasses[\"Transport Service\"])\n@implementedVersion(2)\nexport class TransportServiceCC extends CommandClass implements SinglecastCC<TransportServiceCC> {\n declare ccCommand: TransportServiceCommand;\n declare nodeId: number;\n}\n// @publicAPI\nexport interface TransportServiceCCFirstSegmentOptions {\n datagramSize: number;\n sessionId: number;\n headerExtension?: BytesView | undefined;\n partialDatagram: BytesView;\n}\n/** @publicAPI */\nexport function isTransportServiceEncapsulation(command: CommandClass): command is TransportServiceCCFirstSegment | TransportServiceCCSubsequentSegment {\n return (command.ccId === CommandClasses[\"Transport Service\"]\n && (command.ccCommand === TransportServiceCommand.FirstSegment\n || command.ccCommand === TransportServiceCommand.SubsequentSegment));\n}\n@CCCommand(TransportServiceCommand.FirstSegment)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCFirstSegment extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCFirstSegmentOptions>) {\n super(options);\n this.datagramSize = options.datagramSize;\n this.sessionId = options.sessionId;\n this.headerExtension = options.headerExtension;\n this.partialDatagram = options.partialDatagram;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCFirstSegment {\n // Deserialization has already split the datagram size from the ccCommand.\n // Therefore we have one more payload byte\n validatePayload(raw.payload.length >= 6); // 2 bytes dgram size, 1 byte sessid/ext, 1+ bytes payload, 2 bytes checksum\n // Verify the CRC\n const headerBuffer = Bytes.from([\n CommandClasses[\"Transport Service\"],\n TransportServiceCommand.FirstSegment | raw.payload[0],\n ]);\n const ccBuffer = raw.payload.subarray(1, -2);\n let expectedCRC = CRC16_CCITT(headerBuffer);\n expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);\n validatePayload(expectedCRC === actualCRC);\n const datagramSize = raw.payload.readUInt16BE(0);\n const sessionId = raw.payload[2] >>> 4;\n let payloadOffset = 3;\n // If there is a header extension, read it\n const hasHeaderExtension = !!(raw.payload[2] & 0b1000);\n let headerExtension: BytesView | undefined;\n if (hasHeaderExtension) {\n const extLength = raw.payload[3];\n headerExtension = raw.payload.subarray(4, 4 + extLength);\n payloadOffset += 1 + extLength;\n }\n const partialDatagram: BytesView = raw.payload.subarray(payloadOffset, -2);\n // A node supporting the Transport Service Command Class, version 2\n // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.\n validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n datagramSize,\n sessionId,\n headerExtension,\n partialDatagram,\n });\n }\n public datagramSize: number;\n public sessionId: number;\n public headerExtension: BytesView | undefined;\n public partialDatagram: BytesView;\n public encapsulated!: CommandClass;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Transport Service re-uses the lower 3 bits of the ccCommand as payload\n this.ccCommand = (this.ccCommand & 248)\n | ((this.datagramSize >>> 8) & 0b111);\n const ext = !!this.headerExtension && this.headerExtension.length >= 1;\n this.payload = Bytes.from([\n this.datagramSize & 0xff,\n ((this.sessionId & 0b1111) << 4) | (ext ? 0b1000 : 0),\n ]);\n if (ext) {\n this.payload = Bytes.concat([\n this.payload,\n [this.headerExtension!.length],\n this.headerExtension!,\n ]);\n }\n this.payload = Bytes.concat([\n this.payload,\n this.partialDatagram,\n Bytes.alloc(2, 0), // checksum\n ]);\n // Compute and save the CRC16 in the payload\n // The CC header is included in the CRC computation\n const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);\n let crc = CRC16_CCITT(headerBuffer);\n crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);\n // Write the checksum into the last two bytes of the payload\n this.payload.writeUInt16BE(crc, this.payload.length - 2);\n return super.serialize(ctx);\n }\n public expectMoreMessages(): boolean {\n return true; // The FirstSegment message always expects more messages\n }\n public getPartialCCSessionId(): Record<string, any> | undefined {\n // Only use the session ID to identify the session, not the CC command\n return { ccCommand: undefined, sessionId: this.sessionId };\n }\n protected computeEncapsulationOverhead(): number {\n // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 2 bytes checksum and (0 OR n+1) bytes header extension\n return (super.computeEncapsulationOverhead()\n + 4\n + (this.headerExtension?.length\n ? 1 + this.headerExtension.length\n : 0));\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n \"datagram size\": this.datagramSize,\n \"byte range\": `0...${this.partialDatagram.length - 1}`,\n payload: buffer2hex(this.partialDatagram),\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSubsequentSegmentOptions extends TransportServiceCCFirstSegmentOptions {\n datagramOffset: number;\n}\n@CCCommand(TransportServiceCommand.SubsequentSegment)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCSubsequentSegment extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSubsequentSegmentOptions>) {\n super(options);\n this.datagramSize = options.datagramSize;\n this.datagramOffset = options.datagramOffset;\n this.sessionId = options.sessionId;\n this.headerExtension = options.headerExtension;\n this.partialDatagram = options.partialDatagram;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSubsequentSegment {\n // Deserialization has already split the datagram size from the ccCommand.\n // Therefore we have one more payload byte\n validatePayload(raw.payload.length >= 7); // 2 bytes dgram size, 1 byte sessid/ext/offset, 1 byte offset, 1+ bytes payload, 2 bytes checksum\n // Verify the CRC\n const headerBuffer = Bytes.from([\n CommandClasses[\"Transport Service\"],\n TransportServiceCommand.SubsequentSegment | raw.payload[0],\n ]);\n const ccBuffer = raw.payload.subarray(1, -2);\n let expectedCRC = CRC16_CCITT(headerBuffer);\n expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);\n validatePayload(expectedCRC === actualCRC);\n const datagramSize = raw.payload.readUInt16BE(0);\n const sessionId = raw.payload[2] >>> 4;\n const datagramOffset = ((raw.payload[2] & 0b111) << 8)\n + raw.payload[3];\n let payloadOffset = 4;\n // If there is a header extension, read it\n const hasHeaderExtension = !!(raw.payload[2] & 0b1000);\n let headerExtension: Bytes | undefined;\n if (hasHeaderExtension) {\n const extLength = raw.payload[4];\n headerExtension = raw.payload.subarray(5, 5 + extLength);\n payloadOffset += 1 + extLength;\n }\n const partialDatagram: Bytes = raw.payload.subarray(payloadOffset, -2);\n // A node supporting the Transport Service Command Class, version 2\n // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.\n validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n datagramSize,\n sessionId,\n datagramOffset,\n headerExtension,\n partialDatagram,\n });\n }\n public datagramSize: number;\n public datagramOffset: number;\n public sessionId: number;\n public headerExtension: BytesView | undefined;\n public partialDatagram: BytesView;\n // This can only be received\n private _encapsulated!: CommandClass;\n public get encapsulated(): CommandClass {\n return this._encapsulated;\n }\n public expectMoreMessages(session: [\n TransportServiceCCFirstSegment,\n ...TransportServiceCCSubsequentSegment[]\n ]): boolean {\n if (!(session[0] instanceof TransportServiceCCFirstSegment)) {\n // First segment is missing\n return true;\n }\n const datagramSize = session[0].datagramSize;\n const receivedBytes = Array.from<boolean>({ length: datagramSize })\n .fill(false);\n for (const segment of [...session, this]) {\n const offset = segment instanceof TransportServiceCCFirstSegment\n ? 0\n : segment.datagramOffset;\n for (let i = offset; i <= offset + segment.partialDatagram.length; i++) {\n receivedBytes[i] = true;\n }\n }\n // Expect more messages as long as we haven't received everything\n return receivedBytes.includes(false);\n }\n public getPartialCCSessionId(): Record<string, any> | undefined {\n // Only use the session ID to identify the session, not the CC command\n return { ccCommand: undefined, sessionId: this.sessionId };\n }\n public async mergePartialCCs(partials: [\n TransportServiceCCFirstSegment,\n ...TransportServiceCCSubsequentSegment[]\n ], ctx: CCParsingContext): Promise<void> {\n // Concat the CC buffers\n const datagram = new Bytes(this.datagramSize);\n for (const partial of [...partials, this]) {\n // Ensure that we don't try to write out-of-bounds\n const offset = partial instanceof TransportServiceCCFirstSegment\n ? 0\n : partial.datagramOffset;\n if (offset + partial.partialDatagram.length > datagram.length) {\n throw new ZWaveError(`The partial datagram offset and length in a segment are not compatible to the communicated datagram length`, ZWaveErrorCodes.PacketFormat_InvalidPayload);\n }\n datagram.set(partial.partialDatagram, offset);\n }\n // and deserialize the CC\n this._encapsulated = await CommandClass.parse(datagram, ctx);\n this._encapsulated.encapsulatingCC = this as any;\n }\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Transport Service re-uses the lower 3 bits of the ccCommand as payload\n this.ccCommand = (this.ccCommand & 248)\n | ((this.datagramSize >>> 8) & 0b111);\n const ext = !!this.headerExtension && this.headerExtension.length >= 1;\n this.payload = Bytes.from([\n this.datagramSize & 0xff,\n ((this.sessionId & 0b1111) << 4)\n | (ext ? 0b1000 : 0)\n | ((this.datagramOffset >>> 8) & 0b111),\n this.datagramOffset & 0xff,\n ]);\n if (ext) {\n this.payload = Bytes.concat([\n this.payload,\n [this.headerExtension!.length],\n this.headerExtension!,\n ]);\n }\n this.payload = Bytes.concat([\n this.payload,\n this.partialDatagram,\n Bytes.alloc(2, 0), // checksum\n ]);\n // Compute and save the CRC16 in the payload\n // The CC header is included in the CRC computation\n const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);\n let crc = CRC16_CCITT(headerBuffer);\n crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);\n // Write the checksum into the last two bytes of the payload\n this.payload.writeUInt16BE(crc, this.payload.length - 2);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 1 byte offset, 2 bytes checksum and (0 OR n+1) bytes header extension\n return (super.computeEncapsulationOverhead()\n + 5\n + (this.headerExtension?.length\n ? 1 + this.headerExtension.length\n : 0));\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n \"datagram size\": this.datagramSize,\n \"byte range\": `${this.datagramOffset}...${this.datagramOffset + this.partialDatagram.length - 1}`,\n payload: buffer2hex(this.partialDatagram),\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentRequestOptions {\n sessionId: number;\n datagramOffset: number;\n}\n@CCCommand(TransportServiceCommand.SegmentRequest)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCSegmentRequest extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentRequestOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n this.datagramOffset = options.datagramOffset;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentRequest {\n validatePayload(raw.payload.length >= 3);\n const sessionId = raw.payload[1] >>> 4;\n const datagramOffset = ((raw.payload[1] & 0b111) << 8)\n + raw.payload[2];\n return new this({\n nodeId: ctx.sourceNodeId,\n sessionId,\n datagramOffset,\n });\n }\n public sessionId: number;\n public datagramOffset: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n ((this.sessionId & 0b1111) << 4)\n | ((this.datagramOffset >>> 8) & 0b111),\n this.datagramOffset & 0xff,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n offset: this.datagramOffset,\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentCompleteOptions {\n sessionId: number;\n}\n@CCCommand(TransportServiceCommand.SegmentComplete)\nexport class TransportServiceCCSegmentComplete extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentCompleteOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentComplete {\n validatePayload(raw.payload.length >= 2);\n const sessionId = raw.payload[1] >>> 4;\n return new this({\n nodeId: ctx.sourceNodeId,\n sessionId,\n });\n }\n public sessionId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([(this.sessionId & 0b1111) << 4]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"session ID\": this.sessionId },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentWaitOptions {\n pendingSegments: number;\n}\n@CCCommand(TransportServiceCommand.SegmentWait)\nexport class TransportServiceCCSegmentWait extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentWaitOptions>) {\n super(options);\n this.pendingSegments = options.pendingSegments;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentWait {\n validatePayload(raw.payload.length >= 2);\n const pendingSegments = raw.payload[1];\n return new this({\n nodeId: ctx.sourceNodeId,\n pendingSegments,\n });\n }\n public pendingSegments: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.pendingSegments]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"pending segments\": this.pendingSegments },\n };\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
4
|
+
"sourcesContent": ["import { CRC16_CCITT, CommandClasses, type GetValueDB, type MessageOrCCLogEntry, type SinglecastCC, type WithAddress, validatePayload, } from \"@zwave-js/core\";\nimport { Bytes, type BytesView, buffer2hex } from \"@zwave-js/shared\";\nimport { type CCRaw, CommandClass } from \"../lib/CommandClass.js\";\nimport { CCCommand, commandClass, implementedVersion, } from \"../lib/CommandClassDecorators.js\";\nimport { TransportServiceCommand } from \"../lib/_Types.js\";\nimport type { CCEncodingContext, CCParsingContext } from \"../lib/traits.js\";\nexport const MAX_SEGMENT_SIZE = 39;\nexport const RELAXED_TIMING_THRESHOLD = 2;\n// TODO: Figure out how we know if communicating with R2 or R3\n/** @publicAPI */\nexport const TransportServiceTimeouts = {\n /** Waiting time before requesting a missing segment at data rate R2 */\n requestMissingSegmentR2: 800,\n /** Waiting time before requesting a missing segment at data rate R3 */\n requestMissingSegmentR3: 400,\n /** Waiting time before sending another datagram at data rate R2 */\n segmentCompleteR2: 1000,\n /** Waiting time before sending another datagram at data rate R3 */\n segmentCompleteR3: 500,\n /** Waiting time between segments when sending more than {@link RELAXED_TIMING_THRESHOLD} segments at data rate R2 */\n relaxedTimingDelayR2: 35,\n /** Waiting time between segments when sending more than {@link RELAXED_TIMING_THRESHOLD} segments at data rate R3 */\n relaxedTimingDelayR3: 15,\n};\n@commandClass(CommandClasses[\"Transport Service\"])\n@implementedVersion(2)\nexport class TransportServiceCC extends CommandClass implements SinglecastCC<TransportServiceCC> {\n declare ccCommand: TransportServiceCommand;\n declare nodeId: number;\n}\n// @publicAPI\nexport interface TransportServiceCCFirstSegmentOptions {\n datagramSize: number;\n sessionId: number;\n headerExtension?: BytesView | undefined;\n partialDatagram: BytesView;\n}\n/** @publicAPI */\nexport function isTransportServiceEncapsulation(command: CommandClass): command is TransportServiceCCFirstSegment | TransportServiceCCSubsequentSegment {\n return (command.ccId === CommandClasses[\"Transport Service\"]\n && (command.ccCommand === TransportServiceCommand.FirstSegment\n || command.ccCommand === TransportServiceCommand.SubsequentSegment));\n}\n@CCCommand(TransportServiceCommand.FirstSegment)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCFirstSegment extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCFirstSegmentOptions>) {\n super(options);\n this.datagramSize = options.datagramSize;\n this.sessionId = options.sessionId;\n this.headerExtension = options.headerExtension;\n this.partialDatagram = options.partialDatagram;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCFirstSegment {\n // Deserialization has already split the datagram size from the ccCommand.\n // Therefore we have one more payload byte\n validatePayload(raw.payload.length >= 6); // 2 bytes dgram size, 1 byte sessid/ext, 1+ bytes payload, 2 bytes checksum\n // Verify the CRC\n const headerBuffer = Bytes.from([\n CommandClasses[\"Transport Service\"],\n TransportServiceCommand.FirstSegment | raw.payload[0],\n ]);\n const ccBuffer = raw.payload.subarray(1, -2);\n let expectedCRC = CRC16_CCITT(headerBuffer);\n expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);\n validatePayload(expectedCRC === actualCRC);\n const datagramSize = raw.payload.readUInt16BE(0);\n const sessionId = raw.payload[2] >>> 4;\n let payloadOffset = 3;\n // If there is a header extension, read it\n const hasHeaderExtension = !!(raw.payload[2] & 0b1000);\n let headerExtension: BytesView | undefined;\n if (hasHeaderExtension) {\n const extLength = raw.payload[3];\n headerExtension = raw.payload.subarray(4, 4 + extLength);\n payloadOffset += 1 + extLength;\n }\n const partialDatagram: BytesView = raw.payload.subarray(payloadOffset, -2);\n // A node supporting the Transport Service Command Class, version 2\n // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.\n validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n datagramSize,\n sessionId,\n headerExtension,\n partialDatagram,\n });\n }\n public datagramSize: number;\n public sessionId: number;\n public headerExtension: BytesView | undefined;\n public partialDatagram: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Transport Service re-uses the lower 3 bits of the ccCommand as payload\n this.ccCommand = (this.ccCommand & 248)\n | ((this.datagramSize >>> 8) & 0b111);\n const ext = !!this.headerExtension && this.headerExtension.length >= 1;\n this.payload = Bytes.from([\n this.datagramSize & 0xff,\n ((this.sessionId & 0b1111) << 4) | (ext ? 0b1000 : 0),\n ]);\n if (ext) {\n this.payload = Bytes.concat([\n this.payload,\n [this.headerExtension!.length],\n this.headerExtension!,\n ]);\n }\n this.payload = Bytes.concat([\n this.payload,\n this.partialDatagram,\n Bytes.alloc(2, 0), // checksum\n ]);\n // Compute and save the CRC16 in the payload\n // The CC header is included in the CRC computation\n const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);\n let crc = CRC16_CCITT(headerBuffer);\n crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);\n // Write the checksum into the last two bytes of the payload\n this.payload.writeUInt16BE(crc, this.payload.length - 2);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 2 bytes checksum and (0 OR n+1) bytes header extension\n return (super.computeEncapsulationOverhead()\n + 4\n + (this.headerExtension?.length\n ? 1 + this.headerExtension.length\n : 0));\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n \"datagram size\": this.datagramSize,\n \"byte range\": `0...${this.partialDatagram.length - 1}`,\n payload: buffer2hex(this.partialDatagram),\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSubsequentSegmentOptions extends TransportServiceCCFirstSegmentOptions {\n datagramOffset: number;\n}\n@CCCommand(TransportServiceCommand.SubsequentSegment)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCSubsequentSegment extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSubsequentSegmentOptions>) {\n super(options);\n this.datagramSize = options.datagramSize;\n this.datagramOffset = options.datagramOffset;\n this.sessionId = options.sessionId;\n this.headerExtension = options.headerExtension;\n this.partialDatagram = options.partialDatagram;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSubsequentSegment {\n // Deserialization has already split the datagram size from the ccCommand.\n // Therefore we have one more payload byte\n validatePayload(raw.payload.length >= 7); // 2 bytes dgram size, 1 byte sessid/ext/offset, 1 byte offset, 1+ bytes payload, 2 bytes checksum\n // Verify the CRC\n const headerBuffer = Bytes.from([\n CommandClasses[\"Transport Service\"],\n TransportServiceCommand.SubsequentSegment | raw.payload[0],\n ]);\n const ccBuffer = raw.payload.subarray(1, -2);\n let expectedCRC = CRC16_CCITT(headerBuffer);\n expectedCRC = CRC16_CCITT(ccBuffer, expectedCRC);\n const actualCRC = raw.payload.readUInt16BE(raw.payload.length - 2);\n validatePayload(expectedCRC === actualCRC);\n const datagramSize = raw.payload.readUInt16BE(0);\n const sessionId = raw.payload[2] >>> 4;\n const datagramOffset = ((raw.payload[2] & 0b111) << 8)\n + raw.payload[3];\n let payloadOffset = 4;\n // If there is a header extension, read it\n const hasHeaderExtension = !!(raw.payload[2] & 0b1000);\n let headerExtension: Bytes | undefined;\n if (hasHeaderExtension) {\n const extLength = raw.payload[4];\n headerExtension = raw.payload.subarray(5, 5 + extLength);\n payloadOffset += 1 + extLength;\n }\n const partialDatagram: Bytes = raw.payload.subarray(payloadOffset, -2);\n // A node supporting the Transport Service Command Class, version 2\n // MUST NOT send Transport Service segments with the Payload field longer than 39 bytes.\n validatePayload(partialDatagram.length <= MAX_SEGMENT_SIZE);\n return new this({\n nodeId: ctx.sourceNodeId,\n datagramSize,\n sessionId,\n datagramOffset,\n headerExtension,\n partialDatagram,\n });\n }\n public datagramSize: number;\n public datagramOffset: number;\n public sessionId: number;\n public headerExtension: BytesView | undefined;\n public partialDatagram: BytesView;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n // Transport Service re-uses the lower 3 bits of the ccCommand as payload\n this.ccCommand = (this.ccCommand & 248)\n | ((this.datagramSize >>> 8) & 0b111);\n const ext = !!this.headerExtension && this.headerExtension.length >= 1;\n this.payload = Bytes.from([\n this.datagramSize & 0xff,\n ((this.sessionId & 0b1111) << 4)\n | (ext ? 0b1000 : 0)\n | ((this.datagramOffset >>> 8) & 0b111),\n this.datagramOffset & 0xff,\n ]);\n if (ext) {\n this.payload = Bytes.concat([\n this.payload,\n [this.headerExtension!.length],\n this.headerExtension!,\n ]);\n }\n this.payload = Bytes.concat([\n this.payload,\n this.partialDatagram,\n Bytes.alloc(2, 0), // checksum\n ]);\n // Compute and save the CRC16 in the payload\n // The CC header is included in the CRC computation\n const headerBuffer = Bytes.from([this.ccId, this.ccCommand]);\n let crc = CRC16_CCITT(headerBuffer);\n crc = CRC16_CCITT(this.payload.subarray(0, -2), crc);\n // Write the checksum into the last two bytes of the payload\n this.payload.writeUInt16BE(crc, this.payload.length - 2);\n return super.serialize(ctx);\n }\n protected computeEncapsulationOverhead(): number {\n // Transport Service CC (first segment) adds 1 byte datagram size, 1 byte Session ID/..., 1 byte offset, 2 bytes checksum and (0 OR n+1) bytes header extension\n return (super.computeEncapsulationOverhead()\n + 5\n + (this.headerExtension?.length\n ? 1 + this.headerExtension.length\n : 0));\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n \"datagram size\": this.datagramSize,\n \"byte range\": `${this.datagramOffset}...${this.datagramOffset + this.partialDatagram.length - 1}`,\n payload: buffer2hex(this.partialDatagram),\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentRequestOptions {\n sessionId: number;\n datagramOffset: number;\n}\n@CCCommand(TransportServiceCommand.SegmentRequest)\n// Handling expected responses is done by the RX state machine\nexport class TransportServiceCCSegmentRequest extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentRequestOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n this.datagramOffset = options.datagramOffset;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentRequest {\n validatePayload(raw.payload.length >= 3);\n const sessionId = raw.payload[1] >>> 4;\n const datagramOffset = ((raw.payload[1] & 0b111) << 8)\n + raw.payload[2];\n return new this({\n nodeId: ctx.sourceNodeId,\n sessionId,\n datagramOffset,\n });\n }\n public sessionId: number;\n public datagramOffset: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([\n ((this.sessionId & 0b1111) << 4)\n | ((this.datagramOffset >>> 8) & 0b111),\n this.datagramOffset & 0xff,\n ]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: {\n \"session ID\": this.sessionId,\n offset: this.datagramOffset,\n },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentCompleteOptions {\n sessionId: number;\n}\n@CCCommand(TransportServiceCommand.SegmentComplete)\nexport class TransportServiceCCSegmentComplete extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentCompleteOptions>) {\n super(options);\n this.sessionId = options.sessionId;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentComplete {\n validatePayload(raw.payload.length >= 2);\n const sessionId = raw.payload[1] >>> 4;\n return new this({\n nodeId: ctx.sourceNodeId,\n sessionId,\n });\n }\n public sessionId: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([(this.sessionId & 0b1111) << 4]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"session ID\": this.sessionId },\n };\n }\n}\n// @publicAPI\nexport interface TransportServiceCCSegmentWaitOptions {\n pendingSegments: number;\n}\n@CCCommand(TransportServiceCommand.SegmentWait)\nexport class TransportServiceCCSegmentWait extends TransportServiceCC {\n public constructor(options: WithAddress<TransportServiceCCSegmentWaitOptions>) {\n super(options);\n this.pendingSegments = options.pendingSegments;\n }\n public static from(raw: CCRaw, ctx: CCParsingContext): TransportServiceCCSegmentWait {\n validatePayload(raw.payload.length >= 2);\n const pendingSegments = raw.payload[1];\n return new this({\n nodeId: ctx.sourceNodeId,\n pendingSegments,\n });\n }\n public pendingSegments: number;\n public serialize(ctx: CCEncodingContext): Promise<Bytes> {\n this.payload = Bytes.from([this.pendingSegments]);\n return super.serialize(ctx);\n }\n public toLogEntry(ctx?: GetValueDB): MessageOrCCLogEntry {\n return {\n ...super.toLogEntry(ctx),\n message: { \"pending segments\": this.pendingSegments },\n };\n }\n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AAmB,SAA0D;AACzE,YAAM,OAAO;AACb,WAAK,kBAAkB,QAAQ;IACnC;IACO,OAAO,KAAK,KAAY,KAAqB;AAChD,uCAAgB,IAAI,QAAQ,UAAU,CAAC;AACvC,YAAM,kBAAkB,IAAI,QAAQ,CAAC;AACrC,aAAO,IAAI,KAAK;QACZ,QAAQ,IAAI;QACZ;OACH;IACL;IACO;IACA,UAAU,KAAsB;AACnC,WAAK,UAAU,oBAAM,KAAK,CAAC,KAAK,eAAe,CAAC;AAChD,aAAO,MAAM,UAAU,GAAG;IAC9B;IACO,WAAW,KAAgB;AAC9B,aAAO;QACH,GAAG,MAAM,WAAW,GAAG;QACvB,SAAS,EAAE,oBAAoB,KAAK,gBAAe;;IAE3D;;;;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -617,7 +617,8 @@ let UserCodeCC = (() => {
|
|
|
617
617
|
setUserCodeMetadata.call(this, ctx, userId);
|
|
618
618
|
}
|
|
619
619
|
await this.refreshValues(ctx, {
|
|
620
|
-
queryAllUserCodes: ctx.getInterviewOptions()?.queryAllUserCodes ?? false
|
|
620
|
+
queryAllUserCodes: ctx.getInterviewOptions()?.queryAllUserCodes ?? false,
|
|
621
|
+
onProgress: /* @__PURE__ */ __name((completed, total) => node.reportInterviewProgress(completed, total), "onProgress")
|
|
621
622
|
});
|
|
622
623
|
this.setInterviewComplete(ctx, true);
|
|
623
624
|
}
|
|
@@ -677,6 +678,7 @@ let UserCodeCC = (() => {
|
|
|
677
678
|
let nextUserId = 1;
|
|
678
679
|
while (nextUserId > 0 && nextUserId <= supportedUsers) {
|
|
679
680
|
const response = await api.get(nextUserId, true);
|
|
681
|
+
options?.onProgress?.(nextUserId, supportedUsers);
|
|
680
682
|
if (response) {
|
|
681
683
|
nextUserId = response.nextUserId;
|
|
682
684
|
} else {
|
|
@@ -691,6 +693,7 @@ let UserCodeCC = (() => {
|
|
|
691
693
|
} else {
|
|
692
694
|
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
693
695
|
await api.get(userId);
|
|
696
|
+
options?.onProgress?.(userId, supportedUsers);
|
|
694
697
|
}
|
|
695
698
|
}
|
|
696
699
|
}
|
|
@@ -709,6 +712,7 @@ let UserCodeCC = (() => {
|
|
|
709
712
|
});
|
|
710
713
|
for (let userId = 1; userId <= supportedUsers; userId++) {
|
|
711
714
|
await api.get(userId);
|
|
715
|
+
options?.onProgress?.(userId, supportedUsers);
|
|
712
716
|
}
|
|
713
717
|
}
|
|
714
718
|
}
|