Initial implementation of custom commands feature (e.g. telnet).

This commit is contained in:
Zaid Abdulla committed 2013-09-10 15:54:09 +03:00
1 parent 3c7f554264
commit ff286080e8
5 files changed
+63 -2

No files matched your search

+7
View File
@@ -102,6 +102,13 @@ updateDevice = (currentRequest, actions, callback) ->
updates["#{path}_writable"] = p[1] if p[1]?
updates["#{path}_timestamp"] = now
if actions.customCommands?
for p in actions.customCommands
commandName = p[0]
updates["_customCommands.#{commandName}._value"] = p[1]
updates["_customCommands.#{commandName}._timestamp"] = now
updates["_customCommands.#{commandName}._commands"] = p[2] if p[2]?
if Object.keys(updates).length > 0 or Object.keys(deletes).length > 0
db.devicesCollection.update({'_id' : currentRequest.deviceId}, {'$set' : updates, '$unset' : deletes}, {}, (err, count) ->
if (err)