Allow spaces in device ID. Parse xsd:int values.
This commit is contained in:
1 parent
49e689f7e9
commit
88c506299c
3 files changed
+15
-10
No files matched your search
+3
-3
@@ -6,9 +6,9 @@ db = require './db'
|
|||||||
mongodb = require 'mongodb'
|
mongodb = require 'mongodb'
|
||||||
|
|
||||||
# regular expression objects
|
# regular expression objects
|
||||||
TASKS_REGEX = /^\/devices\/([a-zA-Z0-9\-\_]+)\/tasks\/?$/
|
TASKS_REGEX = /^\/devices\/([a-zA-Z0-9\-\_\%]+)\/tasks\/?$/
|
||||||
TAGS_REGEX = /^\/devices\/([a-zA-Z0-9\-\_]+)\/tags\/([a-zA-Z0-9\-\_]+)\/?$/
|
TAGS_REGEX = /^\/devices\/([a-zA-Z0-9\-\_\%]+)\/tags\/([a-zA-Z0-9\-\_\%]+)\/?$/
|
||||||
PRESETS_REGEX = /^\/presets\/([a-zA-Z0-9\-\_]+)\/?$/
|
PRESETS_REGEX = /^\/presets\/([a-zA-Z0-9\-\_\%]+)\/?$/
|
||||||
|
|
||||||
connectionRequest = (deviceId, callback) ->
|
connectionRequest = (deviceId, callback) ->
|
||||||
db.devicesCollection.findOne({_id : deviceId}, {'InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value' : 1}, (err, device)->
|
db.devicesCollection.findOne({_id : deviceId}, {'InternetGatewayDevice.ManagementServer.ConnectionRequestURL._value' : 1}, (err, device)->
|
||||||
|
|||||||
+2
-2
@@ -25,9 +25,9 @@ exports.arrayToHash = (arr) ->
|
|||||||
exports.getDeviceId = (deviceIdStruct) ->
|
exports.getDeviceId = (deviceIdStruct) ->
|
||||||
# Guaranteeing globally unique id as defined in TR-069
|
# Guaranteeing globally unique id as defined in TR-069
|
||||||
if deviceIdStruct['ProductClass']
|
if deviceIdStruct['ProductClass']
|
||||||
return "#{escape(deviceIdStruct['OUI'])}-#{escape(deviceIdStruct['ProductClass'])}-#{escape(deviceIdStruct['SerialNumber'])}"
|
return "#{deviceIdStruct['OUI']}-#{deviceIdStruct['ProductClass']}-#{deviceIdStruct['SerialNumber']}"
|
||||||
|
|
||||||
return "#{escape(deviceIdStruct['OUI'])}-#{escape(deviceIdStruct['SerialNumber'])}"
|
return "#{deviceIdStruct['OUI']}-#{deviceIdStruct['SerialNumber']}"
|
||||||
|
|
||||||
|
|
||||||
exports.extend = (obj, mixin) ->
|
exports.extend = (obj, mixin) ->
|
||||||
|
|||||||
+10
-5
@@ -46,11 +46,16 @@ parameterValueList = (xml) ->
|
|||||||
valueType = e.get('Value').attr('type').value().trim()
|
valueType = e.get('Value').attr('type').value().trim()
|
||||||
name = e.get('Name').text().trim()
|
name = e.get('Name').text().trim()
|
||||||
value = e.get('Value').text().trim()
|
value = e.get('Value').text().trim()
|
||||||
switch valueType
|
try
|
||||||
when 'xsd:boolean'
|
switch valueType
|
||||||
value = Boolean(JSON.parse(value))
|
when 'xsd:boolean'
|
||||||
when 'xsd:unsignedInt'
|
value = Boolean(JSON.parse(value))
|
||||||
value = JSON.parse(value)
|
when 'xsd:unsignedInt'
|
||||||
|
value = JSON.parse(value)
|
||||||
|
when 'xsd:int'
|
||||||
|
value = JSON.parse(value)
|
||||||
|
catch err
|
||||||
|
value = null
|
||||||
valueList.push([name, value])
|
valueList.push([name, value])
|
||||||
return valueList
|
return valueList
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user