From c62672504a5c7b9108b3c8f30adb545d3c3d6c73 Mon Sep 17 00:00:00 2001 From: yrong Date: Sat, 27 Jul 2019 11:43:34 +0800 Subject: [PATCH] fix empty value exception&upgrade cwmp version to 1.2 --- .gitignore | 2 ++ methods.js | 18 ++++++++++-------- simulator.js | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 5148e52..87082fc 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,5 @@ jspm_packages # Optional REPL history .node_repl_history + +.idea diff --git a/methods.js b/methods.js index cc7b8be..1063dfc 100644 --- a/methods.js +++ b/methods.js @@ -9,7 +9,7 @@ const NAMESPACES = { "soap-env": "http://schemas.xmlsoap.org/soap/envelope/", "xsd": "http://www.w3.org/2001/XMLSchema", "xsi": "http://www.w3.org/2001/XMLSchema-instance", - "cwmp": "urn:dslforum-org:cwmp-1-0" + "cwmp": "urn:dslforum-org:cwmp-1-2" }; const INFORM_PARAMS = [ @@ -149,13 +149,15 @@ function GetParameterValues(device, xmlIn, xmlOut, callback) { for (let p of parameterNames) { let name = p.text(); - let value = device[name][1]; - let type = device[name][2]; - let valueStruct = parameterList.node("ParameterValueStruct"); - valueStruct.node("Name", name); - valueStruct.node("Value", device[name][1]).attr({ - "xsi:type": type - }); + if(device[name]){ + let value = device[name][1]; + let type = device[name][2]; + let valueStruct = parameterList.node("ParameterValueStruct"); + valueStruct.node("Name", name); + valueStruct.node("Value", device[name][1]).attr({ + "xsi:type": type + }); + } } return callback(xmlOut); diff --git a/simulator.js b/simulator.js index 78db4a1..d96e73c 100644 --- a/simulator.js +++ b/simulator.js @@ -9,7 +9,7 @@ const NAMESPACES = { "soap-env": "http://schemas.xmlsoap.org/soap/envelope/", "xsd": "http://www.w3.org/2001/XMLSchema", "xsi": "http://www.w3.org/2001/XMLSchema-instance", - "cwmp": "urn:dslforum-org:cwmp-1-0" + "cwmp": "urn:dslforum-org:cwmp-1-2" }; let nextInformTimeout = null;