Mark object instances in the device doc
This commit is contained in:
1 parent
690afb3522
commit
7da76e0de7
1 file changed
+11
-3
+11
-3
@@ -12,6 +12,9 @@ mongodb = require 'mongodb'
|
|||||||
fs = require 'fs'
|
fs = require 'fs'
|
||||||
apiFunctions = require './api-functions'
|
apiFunctions = require './api-functions'
|
||||||
|
|
||||||
|
OBJECT_REGEX = /\.$/
|
||||||
|
INSTANCE_REGEX = /\.[\d]+\.$/
|
||||||
|
|
||||||
|
|
||||||
applyConfigurations = (currentRequest, taskList) ->
|
applyConfigurations = (currentRequest, taskList) ->
|
||||||
if taskList.length
|
if taskList.length
|
||||||
@@ -83,9 +86,14 @@ updateDevice = (currentRequest, actions, callback) ->
|
|||||||
|
|
||||||
if actions.parameterNames?
|
if actions.parameterNames?
|
||||||
for p in actions.parameterNames
|
for p in actions.parameterNames
|
||||||
path = if common.endsWith(p[0], '.') then p[0] else "#{p[0]}."
|
if OBJECT_REGEX.test(p[0])
|
||||||
if common.endsWith(p[0], '.')
|
path = p[0]
|
||||||
updates["#{path}_object"] = true
|
if INSTANCE_REGEX.test(p[0])
|
||||||
|
updates["#{path}_instance"] = true
|
||||||
|
else
|
||||||
|
updates["#{path}_object"] = true
|
||||||
|
else
|
||||||
|
path = "#{p[0]}."
|
||||||
updates["#{path}_writable"] = p[1]
|
updates["#{path}_writable"] = p[1]
|
||||||
updates["#{path}_timestamp"] = now
|
updates["#{path}_timestamp"] = now
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user