This commit is contained in:
2015-06-10 20:28:48 +02:00
parent 3451e66f16
commit 632a792f3a
33 changed files with 595 additions and 854 deletions
@@ -5,8 +5,8 @@ define([
'dstore/RequestMemory',
'dstore/SimpleQuery',
'dstore/Trackable',
"dojox/socket",
"dojo/_base/xhr",
"hos/Socket",
"dojo/request/xhr",
"dojox/uuid/generateRandomUuid"
], function(config, declare, Rest, RequestMemory, SimpleQuery, Trackable, Socket, xhr, generateRandomUuid){
@@ -51,8 +51,9 @@ define([
});
_store.sendCommand = function(id, cmd) {
console.log("ToDo: send command", cmd ,"to " + id);
var devurl = config.hos.deviceRepoUrl + "/" + id + "?method=command&value=" + encodeURIComponent(JSON.stringify(cmd));
xhr.get({url: devurl}).then(function(data){
//var devurl = config.hos.deviceRepoUrl + "/" + id + "?method=command&value=" + encodeURIComponent(JSON.stringify(cmd));
var devurl = config.hos.deviceRepoUrl + "/" + id;
xhr.post(devurl, {handleAs: 'json', data: {method: 'command', value: JSON.stringify(cmd)}}).then(function(data){
// Do something with the handled data
}, function(err){
// Handle the error condition