From 7da76e0de77125df58ea6e9c230fb8c1e2108253 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Sun, 21 Jul 2013 10:01:43 +0300 Subject: [PATCH] Mark object instances in the device doc --- acs.coffee | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/acs.coffee b/acs.coffee index 76a0e08..e7cc1e8 100644 --- a/acs.coffee +++ b/acs.coffee @@ -12,6 +12,9 @@ mongodb = require 'mongodb' fs = require 'fs' apiFunctions = require './api-functions' +OBJECT_REGEX = /\.$/ +INSTANCE_REGEX = /\.[\d]+\.$/ + applyConfigurations = (currentRequest, taskList) -> if taskList.length @@ -83,9 +86,14 @@ updateDevice = (currentRequest, actions, callback) -> if actions.parameterNames? for p in actions.parameterNames - path = if common.endsWith(p[0], '.') then p[0] else "#{p[0]}." - if common.endsWith(p[0], '.') - updates["#{path}_object"] = true + if OBJECT_REGEX.test(p[0]) + path = p[0] + 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}_timestamp"] = now