Include xsi:type attribute with SetParameterValues method
This commit is contained in:
1 parent
5934178d91
commit
3f45c7e887
4 files changed
+32
-9
No files matched your search
+5
-1
@@ -67,6 +67,10 @@ updateDevice = (currentRequest, actions, callback) ->
|
||||
updates["#{path}_orig"] = origValue
|
||||
updates["#{path}_value"] = v
|
||||
updates["#{path}_timestamp"] = now
|
||||
if p[2]?
|
||||
updates["#{path}_type"] = p[2]
|
||||
else
|
||||
deletes["#{path}_type"] = 1
|
||||
|
||||
if actions.parameterNames?
|
||||
for p in actions.parameterNames
|
||||
@@ -144,7 +148,7 @@ isTaskExpired = (task) ->
|
||||
|
||||
nextTask = (currentRequest) ->
|
||||
cur = db.tasksCollection.find({'device' : currentRequest.deviceId}).sort(['timestamp']).limit(1)
|
||||
cur.nextObject( (err, task) ->
|
||||
cur.nextObject((err, task) ->
|
||||
cwmpResponse = {}
|
||||
|
||||
if not task
|
||||
|
||||
+16
@@ -85,6 +85,22 @@ sanitizeTask = (deviceId, task, callback) ->
|
||||
task.parameterNames = parameterNames
|
||||
callback(task)
|
||||
)
|
||||
when 'setParameterValues'
|
||||
projection = {}
|
||||
values = {}
|
||||
for p in task.parameterValues
|
||||
for pp in expandParam(p[0])
|
||||
projection[pp] = 1
|
||||
values[pp] = p[1]
|
||||
db.devicesCollection.findOne({_id : deviceId}, projection, (err, device) ->
|
||||
parameterValues = []
|
||||
for k of projection
|
||||
param = common.getParamValueFromPath(device, k)
|
||||
if param?
|
||||
parameterValues.push([k, values[k], param._type])
|
||||
task.parameterValues = parameterValues
|
||||
callback(task)
|
||||
)
|
||||
else
|
||||
# TODO implement setParameterValues
|
||||
callback(task)
|
||||
|
||||
+7
-6
@@ -71,15 +71,16 @@ exports.assertPresets = (deviceId, presetsHash, callback) ->
|
||||
getParameterValues = []
|
||||
setParameterValues = []
|
||||
for c in configurations
|
||||
param = common.getParamValueFromPath(device, c.name)
|
||||
continue if not param? # ignore parameters that don't exist
|
||||
|
||||
switch c.type
|
||||
when 'value'
|
||||
src = common.getParamValueFromPath(device, "#{c.name}._value")
|
||||
if src isnt undefined # ignore parameters that don't exist
|
||||
dst = common.matchType(src, c.value)
|
||||
if src != dst
|
||||
setParameterValues.push([c.name, dst])
|
||||
dst = common.matchType(param._value, c.value)
|
||||
if param._value != dst
|
||||
setParameterValues.push([c.name, dst, param._type])
|
||||
when 'age'
|
||||
timeDiff = (now - common.getParamValueFromPath(device, "#{c.name}._timestamp")) / 1000
|
||||
timeDiff = (now - param._timestamp) / 1000
|
||||
if (c.age - timeDiff < config.PRESETS_TIME_PADDING)
|
||||
expiry = Math.min(expiry, c.age)
|
||||
getParameterValues.push(c.name)
|
||||
|
||||
+4
-2
@@ -56,7 +56,7 @@ parameterValueList = (xml) ->
|
||||
value = JSON.parse(value)
|
||||
catch err
|
||||
value = null
|
||||
valueList.push([name, value])
|
||||
valueList.push([name, value, valueType])
|
||||
return valueList
|
||||
|
||||
|
||||
@@ -86,7 +86,9 @@ cpeSetParameterValues = (xml, methodRequest) ->
|
||||
for i in methodRequest.parameterList
|
||||
pvs = paramList.node('ParameterValueStruct')
|
||||
pvs.node('Name').text(i[0])
|
||||
pvs.node('Value').text(i[1])
|
||||
v = pvs.node('Value')
|
||||
v.text(i[1])
|
||||
v.attr({'xsi:type' : i[2]}) if i[2]?
|
||||
# Huawei CPEs need this element present otherwise won't respond
|
||||
el.node('ParameterKey').text(if methodRequest.parameterKey? then methodRequest.parameterKey else '')
|
||||
|
||||
|
||||
Reference in new issue
Block a user