From 4a55f56e487da040a2f66fc773f4d40770547723 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Fri, 22 Nov 2019 16:54:11 -0800 Subject: [PATCH] Fix handling 9005 faults --- lib/session.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/session.ts b/lib/session.ts index 931bff2..19f7e5a 100644 --- a/lib/session.ts +++ b/lib/session.ts @@ -2701,7 +2701,7 @@ export async function rpcFault( // Recover from invalid parameter name faults if (faultResponse.detail.faultCode === "9005") { - const timestamp = sessionContext.timestamp + sessionContext.iteration; + const timestamp = sessionContext.timestamp + sessionContext.iteration + 1; const revision = (sessionContext.revisions[sessionContext.revisions.length - 1] || 0) + 1; sessionContext.deviceData.timestamps.revision = revision; @@ -2728,6 +2728,14 @@ export async function rpcFault( toClear = [[Path.parse(rpcReq.objectName.replace(/\.$/, "")), timestamp]]; } else if (rpcReq.name === "DeleteObject") { toClear = [[Path.parse(rpcReq.objectName.replace(/\.$/, "")), timestamp]]; + } else if (rpcReq.name === "GetParameterAttributes") { + toClear = rpcReq.parameterNames.map( + p => [Path.parse(p.replace(/\.$/, "")), timestamp] as Clear + ); + } else if (rpcReq.name === "SetParameterAttributes") { + toClear = (rpcReq.parameterList as [string, number, string[]][]).map( + p => [Path.parse(p[0].replace(/\.$/, "")), timestamp] as Clear + ); } if (toClear) {