Workaround for missing parameters in GPN response
Some clients don't report certain parameters in GPN response but report their descendants only. This patch attemps to add those missing parameters assuming writable attribute being false.
This commit is contained in:
1 parent
60931e2b68
commit
f9e96fe7f4
1 file changed
+13
@@ -1128,8 +1128,16 @@ rpcResponse = (sessionData, id, rpcRes, callback) ->
|
|||||||
params = []
|
params = []
|
||||||
params.push([root.concat('*'), timestamp])
|
params.push([root.concat('*'), timestamp])
|
||||||
|
|
||||||
|
# Some clients don't report all ancestors explicitly
|
||||||
|
missing = {}
|
||||||
|
|
||||||
for p in rpcRes.parameterList
|
for p in rpcRes.parameterList
|
||||||
|
i = p[0].length - 1
|
||||||
|
while (i = p[0].lastIndexOf('.', i - 1)) > rpcReq.parameterPath.length
|
||||||
|
missing[p[0].slice(0, i)] |= 0
|
||||||
|
|
||||||
if common.endsWith(p[0], '.')
|
if common.endsWith(p[0], '.')
|
||||||
|
missing[p[0][0...-1]] |= 1
|
||||||
path = common.parsePath(p[0][0...-1])
|
path = common.parsePath(p[0][0...-1])
|
||||||
if not rpcReq.nextLevel
|
if not rpcReq.nextLevel
|
||||||
params.push([path.concat('*'), timestamp])
|
params.push([path.concat('*'), timestamp])
|
||||||
@@ -1138,9 +1146,14 @@ rpcResponse = (sessionData, id, rpcRes, callback) ->
|
|||||||
{object: [timestamp, 1], writable: [timestamp, if p[1] then 1 else 0]}])
|
{object: [timestamp, 1], writable: [timestamp, if p[1] then 1 else 0]}])
|
||||||
|
|
||||||
else
|
else
|
||||||
|
missing[p[0]] |= 1
|
||||||
params.push([common.parsePath(p[0]), timestamp,
|
params.push([common.parsePath(p[0]), timestamp,
|
||||||
{object: [timestamp, 0], writable: [timestamp, if p[1] then 1 else 0]}])
|
{object: [timestamp, 0], writable: [timestamp, if p[1] then 1 else 0]}])
|
||||||
|
|
||||||
|
for k, v of missing when v == 0
|
||||||
|
# TODO consider showing a warning
|
||||||
|
params.push([common.parsePath(k), timestamp, {object: [timestamp, 1], writable: [timestamp, 0]}])
|
||||||
|
|
||||||
# Sort such that actual parameters are set before wildcard ones
|
# Sort such that actual parameters are set before wildcard ones
|
||||||
params.sort((a, b) ->
|
params.sort((a, b) ->
|
||||||
al = a[0].length
|
al = a[0].length
|
||||||
|
|||||||
Reference in new issue
Block a user