Update examples that previously used findRobot
This commit is contained in:
parent
81fa260963
commit
5690d723fb
|
@ -28,16 +28,16 @@ skynet = {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
if (data.payload != null){
|
if (data.payload != null){
|
||||||
var robot,
|
var robot,
|
||||||
|
bot,
|
||||||
robots = data.payload.robots;
|
robots = data.payload.robots;
|
||||||
for(var index in robots){
|
for(var index in robots){
|
||||||
robot = robots[index];
|
robot = robots[index];
|
||||||
console.log(robot);
|
console.log(robot);
|
||||||
my.master.findRobot(robot.name, function(err, bot){
|
bot = Cylon.robots[robot.name];
|
||||||
if (robot.cmd == 'on')
|
if (robot.cmd == 'on')
|
||||||
bot.devices[robot.device].turnOn();
|
bot.devices[robot.device].turnOn();
|
||||||
else
|
else
|
||||||
bot.devices[robot.device].turnOff();
|
bot.devices[robot.device].turnOff();
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,9 +29,8 @@ var SalesforceRobot = (function() {
|
||||||
msg += "Bucks: " + data.sobject.Bucks__c + ",";
|
msg += "Bucks: " + data.sobject.Bucks__c + ",";
|
||||||
msg += "SM_Id: " + data.sobject.Id;
|
msg += "SM_Id: " + data.sobject.Id;
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
me.master.findRobot(data.sobject.Sphero_Name__c, function(err, spheroBot) {
|
var spheroBot = Cylon.robots[data.sobject.Sphero_Name__c];
|
||||||
spheroBot.react(spheroBot.devices.sphero);
|
spheroBot.react(spheroBot.devices.sphero);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -70,9 +69,8 @@ var SpheroRobot = (function() {
|
||||||
spheroName: "" + me.name,
|
spheroName: "" + me.name,
|
||||||
bucks: "" + (me.totalBucks++)
|
bucks: "" + (me.totalBucks++)
|
||||||
});
|
});
|
||||||
me.master.findRobot('salesforce', function(err, sf) {
|
var sf = Cylon.robots['salesforce'];
|
||||||
sf.devices.salesforce.push('SpheroController', 'POST', data);
|
sf.devices.salesforce.push('SpheroController', 'POST', data);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -42,9 +42,8 @@ tell it what work we want to do:
|
||||||
msg += "Bucks: " + data.sobject.Bucks__c + ",";
|
msg += "Bucks: " + data.sobject.Bucks__c + ",";
|
||||||
msg += "SM_Id: " + data.sobject.Id;
|
msg += "SM_Id: " + data.sobject.Id;
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
me.master.findRobot(data.sobject.Sphero_Name__c, function(err, spheroBot) {
|
var spheroBot = Cylon.robots[data.sobject.Sphero_Name__c];
|
||||||
spheroBot.react(spheroBot.devices.sphero);
|
spheroBot.react(spheroBot.devices.sphero);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -83,9 +82,8 @@ tell it what work we want to do:
|
||||||
spheroName: "" + me.name,
|
spheroName: "" + me.name,
|
||||||
bucks: "" + (me.totalBucks++)
|
bucks: "" + (me.totalBucks++)
|
||||||
});
|
});
|
||||||
me.master.findRobot('salesforce', function(err, sf) {
|
var sf = Cylon.robots['salesforce'];
|
||||||
sf.devices.salesforce.push('SpheroController', 'POST', data);
|
sf.devices.salesforce.push('SpheroController', 'POST', data);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,8 @@ var SalesforceRobot = (function() {
|
||||||
|
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
|
|
||||||
me.master.findRobot(name, function(err, spheroBot) {
|
var spheroBot = Cylon.robots[name];
|
||||||
spheroBot.react(spheroBot.devices.sphero);
|
spheroBot.react(spheroBot.devices.sphero);
|
||||||
});
|
|
||||||
|
|
||||||
me.spheroReport[name] = bucks;
|
me.spheroReport[name] = bucks;
|
||||||
toPebble = "";
|
toPebble = "";
|
||||||
|
@ -71,9 +70,8 @@ var SalesforceRobot = (function() {
|
||||||
toPebble += "" + key + ": $" + val + "\n";
|
toPebble += "" + key + ": $" + val + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
me.master.findRobot('pebble', function(error, pebbleBot) {
|
var pebbleBot = Cylon.robots['pebble'];
|
||||||
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
|
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -141,9 +139,8 @@ var SpheroRobot = (function() {
|
||||||
bucks: "" + (me.totalBucks++)
|
bucks: "" + (me.totalBucks++)
|
||||||
});
|
});
|
||||||
|
|
||||||
me.master.findRobot('salesforce', function(err, sf) {
|
var sf = Cylon.robots['salesforce'];
|
||||||
sf.devices.salesforce.push("SpheroController", "POST", data);
|
sf.devices.salesforce.push("SpheroController", "POST", data);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -78,9 +78,8 @@ Tell it what work we want to do:
|
||||||
|
|
||||||
console.log(msg);
|
console.log(msg);
|
||||||
|
|
||||||
me.master.findRobot(name, function(err, spheroBot) {
|
var spheroBot = Cylon.robots[name];
|
||||||
spheroBot.react(spheroBot.devices.sphero);
|
spheroBot.react(spheroBot.devices.sphero);
|
||||||
});
|
|
||||||
|
|
||||||
me.spheroReport[name] = bucks;
|
me.spheroReport[name] = bucks;
|
||||||
toPebble = "";
|
toPebble = "";
|
||||||
|
@ -92,9 +91,8 @@ Tell it what work we want to do:
|
||||||
toPebble += "" + key + ": $" + val + "\n";
|
toPebble += "" + key + ": $" + val + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
me.master.findRobot('pebble', function(error, pebbleBot) {
|
var pebbleBot = Cylon.robots['pebble'];
|
||||||
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
|
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -166,9 +164,8 @@ Tell it what work we want to do:
|
||||||
bucks: "" + (me.totalBucks++)
|
bucks: "" + (me.totalBucks++)
|
||||||
});
|
});
|
||||||
|
|
||||||
me.master.findRobot('salesforce', function(err, sf) {
|
var sf = Cylon.robots['salesforce'];
|
||||||
sf.devices.salesforce.push("SpheroController", "POST", data);
|
sf.devices.salesforce.push("SpheroController", "POST", data);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue