This commit is contained in:
2015-06-11 19:08:09 +02:00
parent 632a792f3a
commit 0a63e3752c
6 changed files with 187 additions and 72 deletions
@@ -6,12 +6,20 @@ define([
'dstore/SimpleQuery',
'dstore/Trackable',
'dstore/Tree',
"dojox/socket",
"dojo/_base/xhr",
"hos/Socket",
"dojo/request/xhr",
"dojox/uuid/generateRandomUuid"
], function(config, declare, Rest, RequestMemory, SimpleQuery, Trackable, Tree, Socket, xhr, generateRandomUuid){
var RuleEngineStore = declare([Rest, RequestMemory, SimpleQuery, Trackable, Tree]);
var RuleEngineStore = declare([Rest, RequestMemory, SimpleQuery, Trackable, Tree], {
_getTarget: function(id){
var target = this.target;
if(!target.slice(-1) == '/'){
target += "/";
}
return target + "packages" + id;
}
});
var _store = new RuleEngineStore({
target: config.hos.ruleEngineUrl
@@ -1,29 +0,0 @@
define([
'dojo/_base/declare',
'dstore/Rest',
'dstore/RequestMemory',
'dstore/SimpleQuery',
'dstore/Trackable',
'hos/Socket',
'dojo/_base/xhr',
'dojox/uuid/generateRandomUuid'
], function(declare, Rest, RequestMemory, SimpleQuery, Trackable, Socket, xhr, generateRandomUuid){
return declare([Rest, RequestMemory, SimpleQuery, Trackable], {
sendDeviceCommand: 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){
// Do something with the handled data
}, function(err){
// Handle the error condition
}, function(evt){
// Handle a progress event from the request if the
// browser supports XHR2
});
};
});
});
+1 -1
View File
@@ -41,7 +41,7 @@
"dojo/on",
"dojo/domReady!"
], function(RuleEngine, domConstruct, dom, on){
var test1 = RuleEngine.get("myid/bla");
var test1 = RuleEngine.get("rulepkg01");
console.log("test1: ", test1);
var test2 = RuleEngine.filter({arg01: "param01"});
console.log("test2: ", test2);