zwave-js 14.1.0 → 14.2.0
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/Driver.d.ts +1 -1
- package/build/cjs/Driver.js.map +1 -1
- package/build/cjs/lib/_version.d.ts +1 -1
- package/build/cjs/lib/_version.js +1 -1
- package/build/cjs/lib/_version.js.map +1 -1
- package/build/cjs/lib/controller/MockControllerBehaviors.js +2 -2
- package/build/cjs/lib/controller/MockControllerBehaviors.js.map +2 -2
- package/build/cjs/lib/driver/Driver.d.ts +1 -1
- package/build/cjs/lib/driver/Driver.js +9 -8
- package/build/cjs/lib/driver/Driver.js.map +2 -2
- package/build/cjs/lib/driver/MessageGenerators.js +4 -4
- package/build/cjs/lib/driver/MessageGenerators.js.map +2 -2
- package/build/cjs/lib/driver/NetworkCache.d.ts +1 -2
- package/build/cjs/lib/driver/NetworkCache.js.map +2 -2
- package/build/cjs/lib/driver/UpdateConfig.js +6 -4
- package/build/cjs/lib/driver/UpdateConfig.js.map +3 -3
- package/build/cjs/lib/driver/ZWaveOptions.d.ts +2 -2
- package/build/cjs/lib/driver/ZWaveOptions.js.map +2 -2
- package/build/cjs/lib/node/Node.js +2 -2
- package/build/cjs/lib/node/Node.js.map +3 -3
- package/build/cjs/lib/zniffer/Zniffer.js +4 -4
- package/build/cjs/lib/zniffer/Zniffer.js.map +2 -2
- package/build/esm/Driver.d.ts +1 -1
- package/build/esm/Driver.d.ts.map +1 -1
- package/build/esm/lib/_version.d.ts +1 -1
- package/build/esm/lib/_version.js +1 -1
- package/build/esm/lib/controller/MockControllerBehaviors.js +2 -2
- package/build/esm/lib/controller/MockControllerBehaviors.js.map +1 -1
- package/build/esm/lib/driver/Driver.d.ts +1 -1
- package/build/esm/lib/driver/Driver.d.ts.map +1 -1
- package/build/esm/lib/driver/Driver.js +9 -9
- package/build/esm/lib/driver/Driver.js.map +1 -1
- package/build/esm/lib/driver/MessageGenerators.d.ts.map +1 -1
- package/build/esm/lib/driver/MessageGenerators.js +4 -4
- package/build/esm/lib/driver/MessageGenerators.js.map +1 -1
- package/build/esm/lib/driver/NetworkCache.d.ts +1 -2
- package/build/esm/lib/driver/NetworkCache.d.ts.map +1 -1
- package/build/esm/lib/driver/NetworkCache.js.map +1 -1
- package/build/esm/lib/driver/UpdateConfig.d.ts.map +1 -1
- package/build/esm/lib/driver/UpdateConfig.js +6 -4
- package/build/esm/lib/driver/UpdateConfig.js.map +1 -1
- package/build/esm/lib/driver/ZWaveOptions.d.ts +2 -2
- package/build/esm/lib/driver/ZWaveOptions.d.ts.map +1 -1
- package/build/esm/lib/driver/ZWaveOptions.js.map +1 -1
- package/build/esm/lib/node/Node.js +2 -2
- package/build/esm/lib/node/Node.js.map +1 -1
- package/build/esm/lib/zniffer/Zniffer.d.ts.map +1 -1
- package/build/esm/lib/zniffer/Zniffer.js +4 -4
- package/build/esm/lib/zniffer/Zniffer.js.map +1 -1
- package/package.json +9 -9
package/build/cjs/Driver.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { MessagePriority } from "@zwave-js/core";
|
|
2
2
|
export type { SendMessageOptions } from "@zwave-js/core";
|
|
3
|
-
export type { FileSystem } from "@zwave-js/
|
|
3
|
+
export type { FileSystem } from "@zwave-js/core";
|
|
4
4
|
export { FunctionType, Message, MessageType } from "@zwave-js/serial";
|
|
5
5
|
export type { MessageOptions, ResponsePredicate, ResponseRole, } from "@zwave-js/serial";
|
|
6
6
|
export { type CommandRequest, type ContainsCC, type ContainsSerializedCC, type MessageWithCC, containsCC, containsSerializedCC, isCommandRequest, isMessageWithCC, } from "@zwave-js/serial/serialapi";
|
package/build/cjs/Driver.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Driver.ts"],
|
|
4
|
-
"sourcesContent": ["export { MessagePriority } from \"@zwave-js/core\";\nexport type { SendMessageOptions } from \"@zwave-js/core\";\nexport type { FileSystem } from \"@zwave-js/
|
|
4
|
+
"sourcesContent": ["export { MessagePriority } from \"@zwave-js/core\";\nexport type { SendMessageOptions } from \"@zwave-js/core\";\nexport type { FileSystem } from \"@zwave-js/core\";\nexport { FunctionType, Message, MessageType } from \"@zwave-js/serial\";\nexport type {\n\tMessageOptions,\n\tResponsePredicate,\n\tResponseRole,\n} from \"@zwave-js/serial\";\nexport {\n\ttype CommandRequest,\n\ttype ContainsCC,\n\ttype ContainsSerializedCC,\n\ttype MessageWithCC,\n\tcontainsCC,\n\tcontainsSerializedCC,\n\tisCommandRequest,\n\tisMessageWithCC,\n} from \"@zwave-js/serial/serialapi\";\nexport { Driver, libName, libVersion } from \"./lib/driver/Driver.js\";\nexport type {\n\tEditableZWaveOptions,\n\tPartialZWaveOptions,\n\tZWaveOptions,\n} from \"./lib/driver/ZWaveOptions.js\";\nexport type { DriverLogContext } from \"./lib/log/Driver.js\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;AAAA,kBAAgC;AAGhC,oBAAmD;AAMnD,uBASO;AACP,oBAA4C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -22,7 +22,7 @@ __export(version_exports, {
|
|
|
22
22
|
PACKAGE_VERSION: () => PACKAGE_VERSION
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(version_exports);
|
|
25
|
-
const PACKAGE_VERSION = "14.
|
|
25
|
+
const PACKAGE_VERSION = "14.2.0";
|
|
26
26
|
const PACKAGE_NAME = "zwave-js";
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lib/_version.ts"],
|
|
4
|
-
"sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"14.
|
|
4
|
+
"sourcesContent": ["// This file is auto-generated by the codegen maintenance script\nexport const PACKAGE_VERSION = \"14.2.0\";\nexport const PACKAGE_NAME = \"zwave-js\";\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;;AACO,MAAM,kBAAkB;AACxB,MAAM,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -44,9 +44,9 @@ var import_testing = require("@zwave-js/testing");
|
|
|
44
44
|
var import_MockControllerState = require("./MockControllerState.js");
|
|
45
45
|
var import_NodeInformationFrame = require("./NodeInformationFrame.js");
|
|
46
46
|
function createLazySendDataPayload(controller, node, msg) {
|
|
47
|
-
return () => {
|
|
47
|
+
return async () => {
|
|
48
48
|
try {
|
|
49
|
-
const cmd = import_cc.CommandClass.
|
|
49
|
+
const cmd = await import_cc.CommandClass.parseAsync(msg.serializedCC, {
|
|
50
50
|
sourceNodeId: controller.ownNodeId,
|
|
51
51
|
__internalIsMockNode: true,
|
|
52
52
|
...node.encodingContext,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/lib/controller/MockControllerBehaviors.ts"],
|
|
4
|
-
"sourcesContent": ["import { CommandClass, WakeUpTime } from \"@zwave-js/cc\";\nimport {\n\tZWaveProtocolCC,\n\tZWaveProtocolCCAssignSUCReturnRoute,\n\tZWaveProtocolCCNodeInformationFrame,\n\tZWaveProtocolCCRequestNodeInformationFrame,\n} from \"@zwave-js/cc/ZWaveProtocolCC\";\nimport {\n\tNodeType,\n\tTransmitOptions,\n\tTransmitStatus,\n\tZWaveDataRate,\n\tZWaveErrorCodes,\n\tisZWaveError,\n} from \"@zwave-js/core\";\nimport {\n\tApplicationCommandRequest,\n\tSendDataBridgeRequest,\n\tSendDataBridgeRequestTransmitReport,\n\tSendDataBridgeResponse,\n\ttype SendDataMessage,\n\tSendDataMulticastBridgeRequest,\n\tSendDataMulticastBridgeRequestTransmitReport,\n\tSendDataMulticastBridgeResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\ttype ApplicationUpdateRequest,\n\tApplicationUpdateRequestNodeInfoReceived,\n\tApplicationUpdateRequestNodeInfoRequestFailed,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tSerialAPIStartedRequest,\n\tSerialAPIWakeUpReason,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerCapabilitiesRequest,\n\tGetControllerCapabilitiesResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerVersionRequest,\n\tGetControllerVersionResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSerialApiCapabilitiesRequest,\n\tGetSerialApiCapabilitiesResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSerialApiInitDataRequest,\n\tGetSerialApiInitDataResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerIdRequest,\n\tGetControllerIdResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport { SoftResetRequest } from \"@zwave-js/serial/serialapi\";\nimport {\n\tAddNodeStatus,\n\tAddNodeToNetworkRequest,\n\tAddNodeToNetworkRequestStatusReport,\n\tAddNodeType,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tAssignSUCReturnRouteRequest,\n\tAssignSUCReturnRouteRequestTransmitReport,\n\tAssignSUCReturnRouteResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetNodeProtocolInfoRequest,\n\tGetNodeProtocolInfoResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSUCNodeIdRequest,\n\tGetSUCNodeIdResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tRemoveNodeFromNetworkRequest,\n\tRemoveNodeFromNetworkRequestStatusReport,\n\tRemoveNodeStatus,\n\tRemoveNodeType,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tRequestNodeInfoRequest,\n\tRequestNodeInfoResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tSendDataMulticastRequest,\n\tSendDataMulticastRequestTransmitReport,\n\tSendDataMulticastResponse,\n\tSendDataRequest,\n\tSendDataRequestTransmitReport,\n\tSendDataResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tMOCK_FRAME_ACK_TIMEOUT,\n\ttype MockController,\n\ttype MockControllerBehavior,\n\ttype MockNode,\n\tMockZWaveFrameType,\n\tcreateMockZWaveRequestFrame,\n} from \"@zwave-js/testing\";\nimport {\n\tMockControllerCommunicationState,\n\tMockControllerInclusionState,\n\tMockControllerStateKeys,\n} from \"./MockControllerState.js\";\nimport { determineNIF } from \"./NodeInformationFrame.js\";\n\nfunction createLazySendDataPayload(\n\tcontroller: MockController,\n\tnode: MockNode,\n\tmsg: SendDataMessage,\n): () => CommandClass {\n\treturn () => {\n\t\ttry {\n\t\t\tconst cmd = CommandClass.parse(msg.serializedCC!, {\n\t\t\t\tsourceNodeId: controller.ownNodeId,\n\t\t\t\t__internalIsMockNode: true,\n\t\t\t\t...node.encodingContext,\n\t\t\t\t...node.securityManagers,\n\t\t\t\t// The frame type is always singlecast because the controller sends it to the node\n\t\t\t\tframeType: \"singlecast\",\n\t\t\t});\n\t\t\t// Store the command because assertReceivedHostMessage needs it\n\t\t\t// @ts-expect-error\n\t\t\tmsg.command = cmd;\n\t\t\treturn cmd;\n\t\t} catch (e) {\n\t\t\tif (isZWaveError(e)) {\n\t\t\t\tif (e.code === ZWaveErrorCodes.CC_NotImplemented) {\n\t\t\t\t\t// The whole CC is not implemented yet. If this happens in tests, it is because we sent a raw CC.\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst cmd = new CommandClass({\n\t\t\t\t\t\t\tnodeId: controller.ownNodeId,\n\t\t\t\t\t\t\tccId: msg.payload[0],\n\t\t\t\t\t\t\tccCommand: msg.payload[1],\n\t\t\t\t\t\t\tpayload: msg.payload.subarray(2),\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// Store the command because assertReceivedHostMessage needs it\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tmsg.command = cmd;\n\t\t\t\t\t\treturn cmd;\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\te.code === ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.error(e);\n\t\t\tthrow e;\n\t\t}\n\t};\n}\n\nconst respondToGetControllerId: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerIdRequest) {\n\t\t\tconst ret = new GetControllerIdResponse({\n\t\t\t\thomeId: controller.homeId,\n\t\t\t\townNodeId: controller.ownNodeId,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSerialApiCapabilities: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSerialApiCapabilitiesRequest) {\n\t\t\tconst ret = new GetSerialApiCapabilitiesResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetControllerVersion: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerVersionRequest) {\n\t\t\tconst ret = new GetControllerVersionResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetControllerCapabilities: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerCapabilitiesRequest) {\n\t\t\tconst ret = new GetControllerCapabilitiesResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSUCNodeId: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSUCNodeIdRequest) {\n\t\t\tconst sucNodeId = controller.capabilities.isStaticUpdateController\n\t\t\t\t? controller.ownNodeId\n\t\t\t\t: controller.capabilities.sucNodeId;\n\t\t\tconst ret = new GetSUCNodeIdResponse({\n\t\t\t\tsucNodeId,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSerialApiInitData: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSerialApiInitDataRequest) {\n\t\t\tconst nodeIds = new Set(controller.nodes.keys());\n\t\t\tnodeIds.add(controller.ownNodeId);\n\n\t\t\tconst ret = new GetSerialApiInitDataResponse({\n\t\t\t\tzwaveApiVersion: controller.capabilities.zwaveApiVersion,\n\t\t\t\tisPrimary: !controller.capabilities.isSecondary,\n\t\t\t\tnodeType: NodeType.Controller,\n\t\t\t\tsupportsTimers: controller.capabilities.supportsTimers,\n\t\t\t\tisSIS: controller.capabilities.isSISPresent\n\t\t\t\t\t&& controller.capabilities.isStaticUpdateController,\n\t\t\t\tnodeIds: [...nodeIds],\n\t\t\t\tzwaveChipType: controller.capabilities.zwaveChipType,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToSoftReset: MockControllerBehavior = {\n\tonHostMessage(controller, msg) {\n\t\tif (msg instanceof SoftResetRequest) {\n\t\t\tconst ret = new SerialAPIStartedRequest({\n\t\t\t\twakeUpReason: SerialAPIWakeUpReason.SoftwareReset,\n\t\t\t\twatchdogEnabled: controller.capabilities.watchdogEnabled,\n\t\t\t\tisListening: true,\n\t\t\t\t...determineNIF(),\n\t\t\t\tsupportsLongRange: controller.capabilities.supportsLongRange,\n\t\t\t});\n\t\t\tsetImmediate(async () => {\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetNodeProtocolInfo: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetNodeProtocolInfoRequest) {\n\t\t\tif (msg.requestedNodeId === controller.ownNodeId) {\n\t\t\t\tconst ret = new GetNodeProtocolInfoResponse({\n\t\t\t\t\t...determineNIF(),\n\t\t\t\t\tnodeType: NodeType.Controller,\n\t\t\t\t\tisListening: true,\n\t\t\t\t\tisFrequentListening: false,\n\t\t\t\t\tisRouting: true,\n\t\t\t\t\tsupportsSecurity: false,\n\t\t\t\t\tsupportsBeaming: true,\n\t\t\t\t\tsupportedDataRates: [9600, 40000, 100000],\n\t\t\t\t\toptionalFunctionality: true,\n\t\t\t\t\tprotocolVersion: 3,\n\t\t\t\t});\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t\treturn true;\n\t\t\t} else if (controller.nodes.has(msg.requestedNodeId)) {\n\t\t\t\tconst nodeCaps = controller.nodes.get(\n\t\t\t\t\tmsg.requestedNodeId,\n\t\t\t\t)!.capabilities;\n\t\t\t\tconst ret = new GetNodeProtocolInfoResponse({\n\t\t\t\t\t...nodeCaps,\n\t\t\t\t});\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t},\n};\n\nconst handleSendData: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Received SendDataRequest while not idle\");\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\tcontroller,\n\t\t\t\tnode,\n\t\t\t\tmsg,\n\t\t\t);\n\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataMulticast: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataMulticastRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataMulticastRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataMulticastResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst nodeIds = msg.nodeIds;\n\n\t\t\tconst ackPromises = nodeIds.map((nodeId) => {\n\t\t\t\tconst node = controller.nodes.get(nodeId)!;\n\t\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\t\tcontroller,\n\t\t\t\t\tnode,\n\t\t\t\t\tmsg,\n\t\t\t\t);\n\t\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t\t});\n\t\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\t\t\t\treturn ackPromise;\n\t\t\t});\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACKs and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResults = await Promise.all(ackPromises);\n\t\t\t\t\tack = ackResults.every((result) => !!result?.ack);\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataMulticastRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataBridge: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataBridgeRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataBridgeRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataBridgeResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\tcontroller,\n\t\t\t\tnode,\n\t\t\t\tmsg,\n\t\t\t);\n\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataBridgeRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataMulticastBridge: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataMulticastBridgeRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataMulticastBridgeRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataMulticastBridgeResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst nodeIds = msg.nodeIds;\n\n\t\t\tconst ackPromises = nodeIds.map((nodeId) => {\n\t\t\t\tconst node = controller.nodes.get(nodeId)!;\n\t\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\t\tcontroller,\n\t\t\t\t\tnode,\n\t\t\t\t\tmsg,\n\t\t\t\t);\n\t\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t\t});\n\t\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\t\t\t\treturn ackPromise;\n\t\t\t});\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACKs and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResults = await Promise.all(ackPromises);\n\t\t\t\t\tack = ackResults.every((result) => !!result?.ack);\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataMulticastBridgeRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleRequestNodeInfo: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof RequestNodeInfoRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received RequestNodeInfoRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Send the data to the node\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\tconst command = new ZWaveProtocolCCRequestNodeInformationFrame({\n\t\t\t\tnodeId: controller.ownNodeId,\n\t\t\t});\n\t\t\tconst frame = createMockZWaveRequestFrame(command, {\n\t\t\t\tackRequested: false,\n\t\t\t});\n\t\t\tvoid controller.sendToNode(node, frame);\n\t\t\tconst nodeInfoPromise = controller.expectNodeCC(\n\t\t\t\tnode,\n\t\t\t\tMOCK_FRAME_ACK_TIMEOUT,\n\t\t\t\t(cc) => cc instanceof ZWaveProtocolCCNodeInformationFrame,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new RequestNodeInfoResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// Put the controller into waiting state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t);\n\n\t\t\t// Wait for node information and notify the host\n\t\t\tlet cb: ApplicationUpdateRequest;\n\t\t\ttry {\n\t\t\t\tconst nodeInfo = await nodeInfoPromise;\n\t\t\t\tcb = new ApplicationUpdateRequestNodeInfoReceived({\n\t\t\t\t\tnodeInformation: {\n\t\t\t\t\t\t...nodeInfo,\n\t\t\t\t\t\tnodeId: nodeInfo.nodeId as number,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\tcb = new ApplicationUpdateRequestNodeInfoRequestFailed();\n\t\t\t}\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t);\n\n\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleAssignSUCReturnRoute: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof AssignSUCReturnRouteRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received AssignSUCReturnRouteRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\n\t\t\t// Send the command to the node\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\tconst command = new ZWaveProtocolCCAssignSUCReturnRoute({\n\t\t\t\tnodeId: node.id,\n\t\t\t\tdestinationNodeId: controller.ownNodeId,\n\t\t\t\trepeaters: [], // don't care\n\t\t\t\trouteIndex: 0, // don't care\n\t\t\t\tdestinationSpeed: ZWaveDataRate[\"100k\"],\n\t\t\t\tdestinationWakeUp: WakeUpTime.None,\n\t\t\t});\n\t\t\tconst frame = createMockZWaveRequestFrame(command, {\n\t\t\t\tackRequested: expectCallback,\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, frame);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new AssignSUCReturnRouteResponse({\n\t\t\t\twasExecuted: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\tlet ack = false;\n\t\t\tif (expectCallback) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch {\n\t\t\t\t\t// No response\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t);\n\n\t\t\tif (expectCallback) {\n\t\t\t\tconst cb = new AssignSUCReturnRouteRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleAddNode: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof AddNodeToNetworkRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t) as MockControllerInclusionState | undefined;\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\t\t\tlet cb: AddNodeToNetworkRequestStatusReport | undefined;\n\t\t\tif (\n\t\t\t\tstate === MockControllerInclusionState.AddingNode\n\t\t\t) {\n\t\t\t\t// While adding, only accept stop commands\n\t\t\t\tif (msg.addNodeType === AddNodeType.Stop) {\n\t\t\t\t\tcontroller.state.set(\n\t\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\t\tMockControllerInclusionState.Idle,\n\t\t\t\t\t);\n\t\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (state === MockControllerInclusionState.RemovingNode) {\n\t\t\t\t// Cannot start adding nodes while removing one\n\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Idle\n\n\t\t\t\t// Set the controller into \"adding node\" state\n\t\t\t\t// For now we don't actually do anything in that state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\tMockControllerInclusionState.AddingNode,\n\t\t\t\t);\n\n\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: AddNodeStatus.Ready,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (expectCallback && cb) {\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleRemoveNode: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof RemoveNodeFromNetworkRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t) as MockControllerInclusionState | undefined;\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\t\t\tlet cb: RemoveNodeFromNetworkRequestStatusReport | undefined;\n\t\t\tif (\n\t\t\t\tstate === MockControllerInclusionState.RemovingNode\n\t\t\t) {\n\t\t\t\t// While removing, only accept stop commands\n\t\t\t\tif (msg.removeNodeType === RemoveNodeType.Stop) {\n\t\t\t\t\tcontroller.state.set(\n\t\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\t\tMockControllerInclusionState.Idle,\n\t\t\t\t\t);\n\t\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (state === MockControllerInclusionState.AddingNode) {\n\t\t\t\t// Cannot start removing nodes while adding one\n\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Idle\n\n\t\t\t\t// Set the controller into \"removing node\" state\n\t\t\t\t// For now we don't actually do anything in that state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\tMockControllerInclusionState.RemovingNode,\n\t\t\t\t);\n\n\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: RemoveNodeStatus.Ready,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (expectCallback && cb) {\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst forwardCommandClassesToHost: MockControllerBehavior = {\n\tasync onNodeFrame(controller, node, frame) {\n\t\tif (\n\t\t\tframe.type === MockZWaveFrameType.Request\n\t\t\t&& frame.payload instanceof CommandClass\n\t\t\t&& !(frame.payload instanceof ZWaveProtocolCC)\n\t\t) {\n\t\t\t// This is a CC that is meant for the host application\n\t\t\tconst msg = new ApplicationCommandRequest({\n\t\t\t\tcommand: frame.payload,\n\t\t\t});\n\t\t\t// Nodes send commands TO the controller, so we need to fix the node ID before forwarding\n\t\t\tmsg.getNodeId = () => node.id;\n\t\t\t// Simulate a serialized frame being transmitted via radio before receiving it\n\t\t\tawait controller.sendMessageToHost(msg, node);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst forwardUnsolicitedNIF: MockControllerBehavior = {\n\tasync onNodeFrame(controller, node, frame) {\n\t\tif (\n\t\t\tframe.type === MockZWaveFrameType.Request\n\t\t\t&& frame.payload instanceof ZWaveProtocolCCNodeInformationFrame\n\t\t) {\n\t\t\tconst updateRequest = new ApplicationUpdateRequestNodeInfoReceived({\n\t\t\t\tnodeInformation: {\n\t\t\t\t\t...frame.payload,\n\t\t\t\t\tnodeId: frame.payload.nodeId as number,\n\t\t\t\t},\n\t\t\t});\n\t\t\t// Simulate a serialized frame being transmitted via radio before receiving it\n\t\t\tawait controller.sendMessageToHost(\n\t\t\t\tupdateRequest,\n\t\t\t\tnode,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\n/** Predefined default behaviors that are required for interacting with the driver correctly */\nexport function createDefaultBehaviors(): MockControllerBehavior[] {\n\treturn [\n\t\trespondToGetControllerId,\n\t\trespondToGetSerialApiCapabilities,\n\t\trespondToGetControllerVersion,\n\t\trespondToGetControllerCapabilities,\n\t\trespondToGetSUCNodeId,\n\t\trespondToGetSerialApiInitData,\n\t\trespondToSoftReset,\n\t\trespondToGetNodeProtocolInfo,\n\t\thandleSendData,\n\t\thandleSendDataMulticast,\n\t\thandleSendDataBridge,\n\t\thandleSendDataMulticastBridge,\n\t\thandleRequestNodeInfo,\n\t\thandleAssignSUCReturnRoute,\n\t\thandleAddNode,\n\t\thandleRemoveNode,\n\t\tforwardCommandClassesToHost,\n\t\tforwardUnsolicitedNIF,\n\t];\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,gBAAyC;AACzC,6BAKO;AACP,kBAOO;AACP,uBASO;AACP,IAAAA,oBAIO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAAiC;AACjC,IAAAA,qBAKO;AACP,IAAAA,qBAIO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAKO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAOO;AACP,qBAOO;AACP,iCAIO;AACP,kCAA6B;AAE7B,SAAS,0BACR,YACA,MACA,KAAoB;AAEpB,SAAO,MAAK;AACX,QAAI;AACH,YAAM,MAAM,uBAAa,MAAM,IAAI,cAAe;QACjD,cAAc,WAAW;QACzB,sBAAsB;QACtB,GAAG,KAAK;QACR,GAAG,KAAK;;QAER,WAAW;OACX;AAGD,UAAI,UAAU;AACd,aAAO;IACR,SAAS,GAAG;AACX,cAAI,0BAAa,CAAC,GAAG;AACpB,YAAI,EAAE,SAAS,4BAAgB,mBAAmB;AAEjD,cAAI;AACH,kBAAM,MAAM,IAAI,uBAAa;cAC5B,QAAQ,WAAW;cACnB,MAAM,IAAI,QAAQ,CAAC;cACnB,WAAW,IAAI,QAAQ,CAAC;cACxB,SAAS,IAAI,QAAQ,SAAS,CAAC;aAC/B;AAGD,gBAA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;AACzB,cAAM,WAAW,kBAAkB,EAAE;MACtC;AAEA,aAAO;IACR;EACD;;AAGD,MAAM,8BAAsD;EAC3D,MAAM,YAAY,YAAY,MAAM,OAAK;AACxC,QACC,MAAM,SAAS,kCAAmB,WAC/B,MAAM,mBAAmB,0BACzB,EAAE,MAAM,mBAAmB,yCAC7B;AAED,YAAM,MAAM,IAAI,2CAA0B;QACzC,SAAS,MAAM;OACf;AAED,UAAI,YAAY,MAAM,KAAK;AAE3B,YAAM,WAAW,kBAAkB,KAAK,IAAI;AAC5C,aAAO;IACR;EACD;;AAGD,MAAM,wBAAgD;EACrD,MAAM,YAAY,YAAY,MAAM,OAAK;AACxC,QACC,MAAM,SAAS,kCAAmB,WAC/B,MAAM,mBAAmB,4DAC3B;AACD,YAAM,gBAAgB,IAAI,2DAAyC;QAClE,iBAAiB;UAChB,GAAG,MAAM;UACT,QAAQ,MAAM,QAAQ;;OAEvB;AAED,YAAM,WAAW,kBAChB,eACA,IAAI;AAEL,aAAO;IACR;EACD;;AAIK,SAAU,yBAAsB;AACrC,SAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AAEF;",
|
|
4
|
+
"sourcesContent": ["import { CommandClass, WakeUpTime } from \"@zwave-js/cc\";\nimport {\n\tZWaveProtocolCC,\n\tZWaveProtocolCCAssignSUCReturnRoute,\n\tZWaveProtocolCCNodeInformationFrame,\n\tZWaveProtocolCCRequestNodeInformationFrame,\n} from \"@zwave-js/cc/ZWaveProtocolCC\";\nimport {\n\tNodeType,\n\tTransmitOptions,\n\tTransmitStatus,\n\tZWaveDataRate,\n\tZWaveErrorCodes,\n\tisZWaveError,\n} from \"@zwave-js/core\";\nimport {\n\tApplicationCommandRequest,\n\tSendDataBridgeRequest,\n\tSendDataBridgeRequestTransmitReport,\n\tSendDataBridgeResponse,\n\ttype SendDataMessage,\n\tSendDataMulticastBridgeRequest,\n\tSendDataMulticastBridgeRequestTransmitReport,\n\tSendDataMulticastBridgeResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\ttype ApplicationUpdateRequest,\n\tApplicationUpdateRequestNodeInfoReceived,\n\tApplicationUpdateRequestNodeInfoRequestFailed,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tSerialAPIStartedRequest,\n\tSerialAPIWakeUpReason,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerCapabilitiesRequest,\n\tGetControllerCapabilitiesResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerVersionRequest,\n\tGetControllerVersionResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSerialApiCapabilitiesRequest,\n\tGetSerialApiCapabilitiesResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSerialApiInitDataRequest,\n\tGetSerialApiInitDataResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetControllerIdRequest,\n\tGetControllerIdResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport { SoftResetRequest } from \"@zwave-js/serial/serialapi\";\nimport {\n\tAddNodeStatus,\n\tAddNodeToNetworkRequest,\n\tAddNodeToNetworkRequestStatusReport,\n\tAddNodeType,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tAssignSUCReturnRouteRequest,\n\tAssignSUCReturnRouteRequestTransmitReport,\n\tAssignSUCReturnRouteResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetNodeProtocolInfoRequest,\n\tGetNodeProtocolInfoResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tGetSUCNodeIdRequest,\n\tGetSUCNodeIdResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tRemoveNodeFromNetworkRequest,\n\tRemoveNodeFromNetworkRequestStatusReport,\n\tRemoveNodeStatus,\n\tRemoveNodeType,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tRequestNodeInfoRequest,\n\tRequestNodeInfoResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tSendDataMulticastRequest,\n\tSendDataMulticastRequestTransmitReport,\n\tSendDataMulticastResponse,\n\tSendDataRequest,\n\tSendDataRequestTransmitReport,\n\tSendDataResponse,\n} from \"@zwave-js/serial/serialapi\";\nimport {\n\tMOCK_FRAME_ACK_TIMEOUT,\n\ttype MockController,\n\ttype MockControllerBehavior,\n\ttype MockNode,\n\tMockZWaveFrameType,\n\tcreateMockZWaveRequestFrame,\n} from \"@zwave-js/testing\";\nimport {\n\tMockControllerCommunicationState,\n\tMockControllerInclusionState,\n\tMockControllerStateKeys,\n} from \"./MockControllerState.js\";\nimport { determineNIF } from \"./NodeInformationFrame.js\";\n\nfunction createLazySendDataPayload(\n\tcontroller: MockController,\n\tnode: MockNode,\n\tmsg: SendDataMessage,\n): () => Promise<CommandClass> {\n\treturn async () => {\n\t\ttry {\n\t\t\tconst cmd = await CommandClass.parseAsync(msg.serializedCC!, {\n\t\t\t\tsourceNodeId: controller.ownNodeId,\n\t\t\t\t__internalIsMockNode: true,\n\t\t\t\t...node.encodingContext,\n\t\t\t\t...node.securityManagers,\n\t\t\t\t// The frame type is always singlecast because the controller sends it to the node\n\t\t\t\tframeType: \"singlecast\",\n\t\t\t});\n\t\t\t// Store the command because assertReceivedHostMessage needs it\n\t\t\t// @ts-expect-error\n\t\t\tmsg.command = cmd;\n\t\t\treturn cmd;\n\t\t} catch (e) {\n\t\t\tif (isZWaveError(e)) {\n\t\t\t\tif (e.code === ZWaveErrorCodes.CC_NotImplemented) {\n\t\t\t\t\t// The whole CC is not implemented yet. If this happens in tests, it is because we sent a raw CC.\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst cmd = new CommandClass({\n\t\t\t\t\t\t\tnodeId: controller.ownNodeId,\n\t\t\t\t\t\t\tccId: msg.payload[0],\n\t\t\t\t\t\t\tccCommand: msg.payload[1],\n\t\t\t\t\t\t\tpayload: msg.payload.subarray(2),\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// Store the command because assertReceivedHostMessage needs it\n\t\t\t\t\t\t// @ts-expect-error\n\t\t\t\t\t\tmsg.command = cmd;\n\t\t\t\t\t\treturn cmd;\n\t\t\t\t\t} catch (e: any) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\t\t\t\t} else if (\n\t\t\t\t\te.code === ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconsole.error(e);\n\t\t\tthrow e;\n\t\t}\n\t};\n}\n\nconst respondToGetControllerId: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerIdRequest) {\n\t\t\tconst ret = new GetControllerIdResponse({\n\t\t\t\thomeId: controller.homeId,\n\t\t\t\townNodeId: controller.ownNodeId,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSerialApiCapabilities: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSerialApiCapabilitiesRequest) {\n\t\t\tconst ret = new GetSerialApiCapabilitiesResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetControllerVersion: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerVersionRequest) {\n\t\t\tconst ret = new GetControllerVersionResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetControllerCapabilities: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetControllerCapabilitiesRequest) {\n\t\t\tconst ret = new GetControllerCapabilitiesResponse({\n\t\t\t\t...controller.capabilities,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSUCNodeId: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSUCNodeIdRequest) {\n\t\t\tconst sucNodeId = controller.capabilities.isStaticUpdateController\n\t\t\t\t? controller.ownNodeId\n\t\t\t\t: controller.capabilities.sucNodeId;\n\t\t\tconst ret = new GetSUCNodeIdResponse({\n\t\t\t\tsucNodeId,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetSerialApiInitData: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetSerialApiInitDataRequest) {\n\t\t\tconst nodeIds = new Set(controller.nodes.keys());\n\t\t\tnodeIds.add(controller.ownNodeId);\n\n\t\t\tconst ret = new GetSerialApiInitDataResponse({\n\t\t\t\tzwaveApiVersion: controller.capabilities.zwaveApiVersion,\n\t\t\t\tisPrimary: !controller.capabilities.isSecondary,\n\t\t\t\tnodeType: NodeType.Controller,\n\t\t\t\tsupportsTimers: controller.capabilities.supportsTimers,\n\t\t\t\tisSIS: controller.capabilities.isSISPresent\n\t\t\t\t\t&& controller.capabilities.isStaticUpdateController,\n\t\t\t\tnodeIds: [...nodeIds],\n\t\t\t\tzwaveChipType: controller.capabilities.zwaveChipType,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToSoftReset: MockControllerBehavior = {\n\tonHostMessage(controller, msg) {\n\t\tif (msg instanceof SoftResetRequest) {\n\t\t\tconst ret = new SerialAPIStartedRequest({\n\t\t\t\twakeUpReason: SerialAPIWakeUpReason.SoftwareReset,\n\t\t\t\twatchdogEnabled: controller.capabilities.watchdogEnabled,\n\t\t\t\tisListening: true,\n\t\t\t\t...determineNIF(),\n\t\t\t\tsupportsLongRange: controller.capabilities.supportsLongRange,\n\t\t\t});\n\t\t\tsetImmediate(async () => {\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t});\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst respondToGetNodeProtocolInfo: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof GetNodeProtocolInfoRequest) {\n\t\t\tif (msg.requestedNodeId === controller.ownNodeId) {\n\t\t\t\tconst ret = new GetNodeProtocolInfoResponse({\n\t\t\t\t\t...determineNIF(),\n\t\t\t\t\tnodeType: NodeType.Controller,\n\t\t\t\t\tisListening: true,\n\t\t\t\t\tisFrequentListening: false,\n\t\t\t\t\tisRouting: true,\n\t\t\t\t\tsupportsSecurity: false,\n\t\t\t\t\tsupportsBeaming: true,\n\t\t\t\t\tsupportedDataRates: [9600, 40000, 100000],\n\t\t\t\t\toptionalFunctionality: true,\n\t\t\t\t\tprotocolVersion: 3,\n\t\t\t\t});\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t\treturn true;\n\t\t\t} else if (controller.nodes.has(msg.requestedNodeId)) {\n\t\t\t\tconst nodeCaps = controller.nodes.get(\n\t\t\t\t\tmsg.requestedNodeId,\n\t\t\t\t)!.capabilities;\n\t\t\t\tconst ret = new GetNodeProtocolInfoResponse({\n\t\t\t\t\t...nodeCaps,\n\t\t\t\t});\n\t\t\t\tawait controller.sendMessageToHost(ret);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t},\n};\n\nconst handleSendData: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\"Received SendDataRequest while not idle\");\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\tcontroller,\n\t\t\t\tnode,\n\t\t\t\tmsg,\n\t\t\t);\n\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataMulticast: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataMulticastRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataMulticastRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataMulticastResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst nodeIds = msg.nodeIds;\n\n\t\t\tconst ackPromises = nodeIds.map((nodeId) => {\n\t\t\t\tconst node = controller.nodes.get(nodeId)!;\n\t\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\t\tcontroller,\n\t\t\t\t\tnode,\n\t\t\t\t\tmsg,\n\t\t\t\t);\n\t\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t\t});\n\t\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\t\t\t\treturn ackPromise;\n\t\t\t});\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACKs and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResults = await Promise.all(ackPromises);\n\t\t\t\t\tack = ackResults.every((result) => !!result?.ack);\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataMulticastRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataBridge: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataBridgeRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataBridgeRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataBridgeResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\tcontroller,\n\t\t\t\tnode,\n\t\t\t\tmsg,\n\t\t\t);\n\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataBridgeRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleSendDataMulticastBridge: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof SendDataMulticastBridgeRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received SendDataMulticastBridgeRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new SendDataMulticastBridgeResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// We deferred parsing of the CC because it requires the node's host to do so.\n\t\t\t// Now we can do that. Also set the CC node ID to the controller's own node ID,\n\t\t\t// so CC knows it came from the controller's node ID.\n\t\t\tconst nodeIds = msg.nodeIds;\n\n\t\t\tconst ackPromises = nodeIds.map((nodeId) => {\n\t\t\t\tconst node = controller.nodes.get(nodeId)!;\n\t\t\t\t// Create a lazy frame, so it can be deserialized on the node after a short delay to simulate radio transmission\n\t\t\t\tconst lazyPayload = createLazySendDataPayload(\n\t\t\t\t\tcontroller,\n\t\t\t\t\tnode,\n\t\t\t\t\tmsg,\n\t\t\t\t);\n\t\t\t\tconst lazyFrame = createMockZWaveRequestFrame(lazyPayload, {\n\t\t\t\t\tackRequested: !!(msg.transmitOptions & TransmitOptions.ACK),\n\t\t\t\t});\n\t\t\t\tconst ackPromise = controller.sendToNode(node, lazyFrame);\n\t\t\t\treturn ackPromise;\n\t\t\t});\n\n\t\t\tif (msg.callbackId !== 0) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACKs and notify the host\n\t\t\t\tlet ack = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResults = await Promise.all(ackPromises);\n\t\t\t\t\tack = ackResults.every((result) => !!result?.ack);\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// We want to know when we're using a command in tests that cannot be decoded yet\n\t\t\t\t\tif (\n\t\t\t\t\t\tisZWaveError(e)\n\t\t\t\t\t\t&& e.code\n\t\t\t\t\t\t\t=== ZWaveErrorCodes.Deserialization_NotImplemented\n\t\t\t\t\t) {\n\t\t\t\t\t\tconsole.error(e.message);\n\t\t\t\t\t\tthrow e;\n\t\t\t\t\t}\n\n\t\t\t\t\t// Treat all other errors as no response\n\t\t\t\t}\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\n\t\t\t\tconst cb = new SendDataMulticastBridgeRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t} else {\n\t\t\t\t// No callback was requested, we're done\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleRequestNodeInfo: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof RequestNodeInfoRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received RequestNodeInfoRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\t// Send the data to the node\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\tconst command = new ZWaveProtocolCCRequestNodeInformationFrame({\n\t\t\t\tnodeId: controller.ownNodeId,\n\t\t\t});\n\t\t\tconst frame = createMockZWaveRequestFrame(command, {\n\t\t\t\tackRequested: false,\n\t\t\t});\n\t\t\tvoid controller.sendToNode(node, frame);\n\t\t\tconst nodeInfoPromise = controller.expectNodeCC(\n\t\t\t\tnode,\n\t\t\t\tMOCK_FRAME_ACK_TIMEOUT,\n\t\t\t\t(cc) => cc instanceof ZWaveProtocolCCNodeInformationFrame,\n\t\t\t);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new RequestNodeInfoResponse({\n\t\t\t\twasSent: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\t// Put the controller into waiting state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t);\n\n\t\t\t// Wait for node information and notify the host\n\t\t\tlet cb: ApplicationUpdateRequest;\n\t\t\ttry {\n\t\t\t\tconst nodeInfo = await nodeInfoPromise;\n\t\t\t\tcb = new ApplicationUpdateRequestNodeInfoReceived({\n\t\t\t\t\tnodeInformation: {\n\t\t\t\t\t\t...nodeInfo,\n\t\t\t\t\t\tnodeId: nodeInfo.nodeId as number,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\tcb = new ApplicationUpdateRequestNodeInfoRequestFailed();\n\t\t\t}\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t);\n\n\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleAssignSUCReturnRoute: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof AssignSUCReturnRouteRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t) as MockControllerCommunicationState | undefined;\n\t\t\tif (\n\t\t\t\tstate != undefined\n\t\t\t\t&& state !== MockControllerCommunicationState.Idle\n\t\t\t) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Received AssignSUCReturnRouteRequest while not idle\",\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Put the controller into sending state\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Sending,\n\t\t\t);\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\n\t\t\t// Send the command to the node\n\t\t\tconst node = controller.nodes.get(msg.getNodeId()!)!;\n\t\t\tconst command = new ZWaveProtocolCCAssignSUCReturnRoute({\n\t\t\t\tnodeId: node.id,\n\t\t\t\tdestinationNodeId: controller.ownNodeId,\n\t\t\t\trepeaters: [], // don't care\n\t\t\t\trouteIndex: 0, // don't care\n\t\t\t\tdestinationSpeed: ZWaveDataRate[\"100k\"],\n\t\t\t\tdestinationWakeUp: WakeUpTime.None,\n\t\t\t});\n\t\t\tconst frame = createMockZWaveRequestFrame(command, {\n\t\t\t\tackRequested: expectCallback,\n\t\t\t});\n\t\t\tconst ackPromise = controller.sendToNode(node, frame);\n\n\t\t\t// Notify the host that the message was sent\n\t\t\tconst res = new AssignSUCReturnRouteResponse({\n\t\t\t\twasExecuted: true,\n\t\t\t});\n\t\t\tawait controller.sendMessageToHost(res);\n\n\t\t\tlet ack = false;\n\t\t\tif (expectCallback) {\n\t\t\t\t// Put the controller into waiting state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\t\tMockControllerCommunicationState.WaitingForNode,\n\t\t\t\t);\n\n\t\t\t\t// Wait for the ACK and notify the host\n\t\t\t\ttry {\n\t\t\t\t\tconst ackResult = await ackPromise;\n\t\t\t\t\tack = !!ackResult?.ack;\n\t\t\t\t} catch {\n\t\t\t\t\t// No response\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontroller.state.set(\n\t\t\t\tMockControllerStateKeys.CommunicationState,\n\t\t\t\tMockControllerCommunicationState.Idle,\n\t\t\t);\n\n\t\t\tif (expectCallback) {\n\t\t\t\tconst cb = new AssignSUCReturnRouteRequestTransmitReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\ttransmitStatus: ack\n\t\t\t\t\t\t? TransmitStatus.OK\n\t\t\t\t\t\t: TransmitStatus.NoAck,\n\t\t\t\t});\n\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleAddNode: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof AddNodeToNetworkRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t) as MockControllerInclusionState | undefined;\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\t\t\tlet cb: AddNodeToNetworkRequestStatusReport | undefined;\n\t\t\tif (\n\t\t\t\tstate === MockControllerInclusionState.AddingNode\n\t\t\t) {\n\t\t\t\t// While adding, only accept stop commands\n\t\t\t\tif (msg.addNodeType === AddNodeType.Stop) {\n\t\t\t\t\tcontroller.state.set(\n\t\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\t\tMockControllerInclusionState.Idle,\n\t\t\t\t\t);\n\t\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (state === MockControllerInclusionState.RemovingNode) {\n\t\t\t\t// Cannot start adding nodes while removing one\n\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: AddNodeStatus.Failed,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Idle\n\n\t\t\t\t// Set the controller into \"adding node\" state\n\t\t\t\t// For now we don't actually do anything in that state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\tMockControllerInclusionState.AddingNode,\n\t\t\t\t);\n\n\t\t\t\tcb = new AddNodeToNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: AddNodeStatus.Ready,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (expectCallback && cb) {\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst handleRemoveNode: MockControllerBehavior = {\n\tasync onHostMessage(controller, msg) {\n\t\tif (msg instanceof RemoveNodeFromNetworkRequest) {\n\t\t\t// Check if this command is legal right now\n\t\t\tconst state = controller.state.get(\n\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t) as MockControllerInclusionState | undefined;\n\n\t\t\tconst expectCallback = msg.callbackId !== 0;\n\t\t\tlet cb: RemoveNodeFromNetworkRequestStatusReport | undefined;\n\t\t\tif (\n\t\t\t\tstate === MockControllerInclusionState.RemovingNode\n\t\t\t) {\n\t\t\t\t// While removing, only accept stop commands\n\t\t\t\tif (msg.removeNodeType === RemoveNodeType.Stop) {\n\t\t\t\t\tcontroller.state.set(\n\t\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\t\tMockControllerInclusionState.Idle,\n\t\t\t\t\t);\n\t\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (state === MockControllerInclusionState.AddingNode) {\n\t\t\t\t// Cannot start removing nodes while adding one\n\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: RemoveNodeStatus.Failed,\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Idle\n\n\t\t\t\t// Set the controller into \"removing node\" state\n\t\t\t\t// For now we don't actually do anything in that state\n\t\t\t\tcontroller.state.set(\n\t\t\t\t\tMockControllerStateKeys.InclusionState,\n\t\t\t\t\tMockControllerInclusionState.RemovingNode,\n\t\t\t\t);\n\n\t\t\t\tcb = new RemoveNodeFromNetworkRequestStatusReport({\n\t\t\t\t\tcallbackId: msg.callbackId,\n\t\t\t\t\tstatus: RemoveNodeStatus.Ready,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (expectCallback && cb) {\n\t\t\t\tawait controller.sendMessageToHost(cb);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst forwardCommandClassesToHost: MockControllerBehavior = {\n\tasync onNodeFrame(controller, node, frame) {\n\t\tif (\n\t\t\tframe.type === MockZWaveFrameType.Request\n\t\t\t&& frame.payload instanceof CommandClass\n\t\t\t&& !(frame.payload instanceof ZWaveProtocolCC)\n\t\t) {\n\t\t\t// This is a CC that is meant for the host application\n\t\t\tconst msg = new ApplicationCommandRequest({\n\t\t\t\tcommand: frame.payload,\n\t\t\t});\n\t\t\t// Nodes send commands TO the controller, so we need to fix the node ID before forwarding\n\t\t\tmsg.getNodeId = () => node.id;\n\t\t\t// Simulate a serialized frame being transmitted via radio before receiving it\n\t\t\tawait controller.sendMessageToHost(msg, node);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\nconst forwardUnsolicitedNIF: MockControllerBehavior = {\n\tasync onNodeFrame(controller, node, frame) {\n\t\tif (\n\t\t\tframe.type === MockZWaveFrameType.Request\n\t\t\t&& frame.payload instanceof ZWaveProtocolCCNodeInformationFrame\n\t\t) {\n\t\t\tconst updateRequest = new ApplicationUpdateRequestNodeInfoReceived({\n\t\t\t\tnodeInformation: {\n\t\t\t\t\t...frame.payload,\n\t\t\t\t\tnodeId: frame.payload.nodeId as number,\n\t\t\t\t},\n\t\t\t});\n\t\t\t// Simulate a serialized frame being transmitted via radio before receiving it\n\t\t\tawait controller.sendMessageToHost(\n\t\t\t\tupdateRequest,\n\t\t\t\tnode,\n\t\t\t);\n\t\t\treturn true;\n\t\t}\n\t},\n};\n\n/** Predefined default behaviors that are required for interacting with the driver correctly */\nexport function createDefaultBehaviors(): MockControllerBehavior[] {\n\treturn [\n\t\trespondToGetControllerId,\n\t\trespondToGetSerialApiCapabilities,\n\t\trespondToGetControllerVersion,\n\t\trespondToGetControllerCapabilities,\n\t\trespondToGetSUCNodeId,\n\t\trespondToGetSerialApiInitData,\n\t\trespondToSoftReset,\n\t\trespondToGetNodeProtocolInfo,\n\t\thandleSendData,\n\t\thandleSendDataMulticast,\n\t\thandleSendDataBridge,\n\t\thandleSendDataMulticastBridge,\n\t\thandleRequestNodeInfo,\n\t\thandleAssignSUCReturnRoute,\n\t\thandleAddNode,\n\t\thandleRemoveNode,\n\t\tforwardCommandClassesToHost,\n\t\tforwardUnsolicitedNIF,\n\t];\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,gBAAyC;AACzC,6BAKO;AACP,kBAOO;AACP,uBASO;AACP,IAAAA,oBAIO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAGO;AACP,IAAAA,oBAAiC;AACjC,IAAAA,qBAKO;AACP,IAAAA,qBAIO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAKO;AACP,IAAAA,qBAGO;AACP,IAAAA,qBAOO;AACP,qBAOO;AACP,iCAIO;AACP,kCAA6B;AAE7B,SAAS,0BACR,YACA,MACA,KAAoB;AAEpB,SAAO,YAAW;AACjB,QAAI;AACH,YAAM,MAAM,MAAM,uBAAa,WAAW,IAAI,cAAe;QAC5D,cAAc,WAAW;QACzB,sBAAsB;QACtB,GAAG,KAAK;QACR,GAAG,KAAK;;QAER,WAAW;OACX;AAGD,UAAI,UAAU;AACd,aAAO;IACR,SAAS,GAAG;AACX,cAAI,0BAAa,CAAC,GAAG;AACpB,YAAI,EAAE,SAAS,4BAAgB,mBAAmB;AAEjD,cAAI;AACH,kBAAM,MAAM,IAAI,uBAAa;cAC5B,QAAQ,WAAW;cACnB,MAAM,IAAI,QAAQ,CAAC;cACnB,WAAW,IAAI,QAAQ,CAAC;cACxB,SAAS,I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AAiB;SACzB;MACF;AAEA,UAAI,kBAAkB,IAAI;AACzB,cAAM,WAAW,kBAAkB,EAAE;MACtC;AAEA,aAAO;IACR;EACD;;AAGD,MAAM,8BAAsD;EAC3D,MAAM,YAAY,YAAY,MAAM,OAAK;AACxC,QACC,MAAM,SAAS,kCAAmB,WAC/B,MAAM,mBAAmB,0BACzB,EAAE,MAAM,mBAAmB,yCAC7B;AAED,YAAM,MAAM,IAAI,2CAA0B;QACzC,SAAS,MAAM;OACf;AAED,UAAI,YAAY,MAAM,KAAK;AAE3B,YAAM,WAAW,kBAAkB,KAAK,IAAI;AAC5C,aAAO;IACR;EACD;;AAGD,MAAM,wBAAgD;EACrD,MAAM,YAAY,YAAY,MAAM,OAAK;AACxC,QACC,MAAM,SAAS,kCAAmB,WAC/B,MAAM,mBAAmB,4DAC3B;AACD,YAAM,gBAAgB,IAAI,2DAAyC;QAClE,iBAAiB;UAChB,GAAG,MAAM;UACT,QAAQ,MAAM,QAAQ;;OAEvB;AAED,YAAM,WAAW,kBAChB,eACA,IAAI;AAEL,aAAO;IACR;EACD;;AAIK,SAAU,yBAAsB;AACrC,SAAO;IACN;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;;AAEF;",
|
|
6
6
|
"names": ["import_serialapi", "e"]
|
|
7
7
|
}
|
|
@@ -568,7 +568,7 @@ export declare class Driver extends TypedEventEmitter<DriverEventCallbacks> impl
|
|
|
568
568
|
computeNetCCPayloadSize(commandOrMsg: CommandClass | (SendDataRequest | SendDataBridgeRequest) & ContainsCC, ignoreEncapsulation?: boolean): number;
|
|
569
569
|
/** Computes the maximum payload size that can be transmitted with the given message */
|
|
570
570
|
getMaxPayloadLength(msg: SendDataMessage): number;
|
|
571
|
-
exceedsMaxPayloadLength(msg: SendDataMessage): boolean
|
|
571
|
+
exceedsMaxPayloadLength(msg: SendDataMessage): Promise<boolean>;
|
|
572
572
|
/** Determines time in milliseconds to wait for a report from a node */
|
|
573
573
|
getReportTimeout(msg: Message): number;
|
|
574
574
|
/** Returns the preferred constructor to use for singlecast SendData commands */
|
|
@@ -1976,7 +1976,7 @@ class Driver extends import_shared.TypedEventEmitter {
|
|
|
1976
1976
|
try {
|
|
1977
1977
|
msg = import_serial.Message.parse(data, this.getMessageParsingContext());
|
|
1978
1978
|
if ((0, import_serialapi9.isCommandRequest)(msg) && (0, import_serialapi9.containsSerializedCC)(msg)) {
|
|
1979
|
-
msg.command = import_cc.CommandClass.
|
|
1979
|
+
msg.command = await import_cc.CommandClass.parseAsync(msg.serializedCC, {
|
|
1980
1980
|
...this.getCCParsingContext(),
|
|
1981
1981
|
sourceNodeId: msg.getNodeId(),
|
|
1982
1982
|
frameType: msg.frameType
|
|
@@ -2055,7 +2055,7 @@ class Driver extends import_shared.TypedEventEmitter {
|
|
|
2055
2055
|
void this.handleTransportServiceCommand(msg.command).catch(() => {
|
|
2056
2056
|
});
|
|
2057
2057
|
}
|
|
2058
|
-
if (!this.assemblePartialCCs(msg)) {
|
|
2058
|
+
if (!await this.assemblePartialCCs(msg)) {
|
|
2059
2059
|
for (const entry of this.awaitedMessages) {
|
|
2060
2060
|
if (entry.refreshPredicate?.(msg)) {
|
|
2061
2061
|
entry.timeout?.refresh();
|
|
@@ -2483,7 +2483,7 @@ ${(0, import_shared.buffer2hex)(data)}`, "warn");
|
|
|
2483
2483
|
* Assembles partial CCs of in a message body. Returns `true` when the message is complete and can be handled further.
|
|
2484
2484
|
* If the message expects another partial one, this returns `false`.
|
|
2485
2485
|
*/
|
|
2486
|
-
assemblePartialCCs(msg) {
|
|
2486
|
+
async assemblePartialCCs(msg) {
|
|
2487
2487
|
let command = msg.command;
|
|
2488
2488
|
while (true) {
|
|
2489
2489
|
const { partialSessionKey, session } = this.getPartialCCSession(command, true) ?? {};
|
|
@@ -2500,7 +2500,7 @@ ${(0, import_shared.buffer2hex)(data)}`, "warn");
|
|
|
2500
2500
|
} else {
|
|
2501
2501
|
this.partialCCSessions.delete(partialSessionKey);
|
|
2502
2502
|
try {
|
|
2503
|
-
command.
|
|
2503
|
+
await command.mergePartialCCsAsync(session, {
|
|
2504
2504
|
...this.getCCParsingContext(),
|
|
2505
2505
|
sourceNodeId: msg.command.nodeId,
|
|
2506
2506
|
frameType: msg.frameType
|
|
@@ -3264,7 +3264,7 @@ ${handlers.length} left`);
|
|
|
3264
3264
|
if (msg.needsCallbackId() && !msg.hasCallbackId()) {
|
|
3265
3265
|
msg.callbackId = this.getNextCallbackId();
|
|
3266
3266
|
}
|
|
3267
|
-
const machine = (0, import_SerialAPICommandMachine.createSerialAPICommandMachine)(msg, msg.
|
|
3267
|
+
const machine = (0, import_SerialAPICommandMachine.createSerialAPICommandMachine)(msg, await msg.serializeAsync(this.getEncodingContext()), {
|
|
3268
3268
|
sendData: (data) => this.writeSerial(data),
|
|
3269
3269
|
sendDataAbort: () => this.abortSendData(),
|
|
3270
3270
|
notifyUnsolicited: (msg2) => {
|
|
@@ -3569,7 +3569,7 @@ ${handlers.length} left`);
|
|
|
3569
3569
|
async abortSendData() {
|
|
3570
3570
|
try {
|
|
3571
3571
|
const abort = new import_serialapi6.SendDataAbort();
|
|
3572
|
-
await this.writeSerial(abort.
|
|
3572
|
+
await this.writeSerial(await abort.serializeAsync(this.getEncodingContext()));
|
|
3573
3573
|
this.driverLog.logMessage(abort, {
|
|
3574
3574
|
direction: "outbound"
|
|
3575
3575
|
});
|
|
@@ -4047,8 +4047,9 @@ ${handlers.length} left`);
|
|
|
4047
4047
|
return maxExplorerPayloadMulticast + 8;
|
|
4048
4048
|
}
|
|
4049
4049
|
}
|
|
4050
|
-
exceedsMaxPayloadLength(msg) {
|
|
4051
|
-
|
|
4050
|
+
async exceedsMaxPayloadLength(msg) {
|
|
4051
|
+
const serializedCC = await msg.serializeCCAsync(this.getEncodingContext());
|
|
4052
|
+
return serializedCC.length > this.getMaxPayloadLength(msg);
|
|
4052
4053
|
}
|
|
4053
4054
|
/** Determines time in milliseconds to wait for a report from a node */
|
|
4054
4055
|
getReportTimeout(msg) {
|