Update examples that previously used findRobot

This commit is contained in:
Andrew Stewart 2014-06-06 11:53:54 -07:00
parent 81fa260963
commit 5690d723fb
5 changed files with 26 additions and 36 deletions

View File

@ -28,16 +28,16 @@ skynet = {
console.log(data);
if (data.payload != null){
var robot,
bot,
robots = data.payload.robots;
for(var index in robots){
robot = robots[index];
console.log(robot);
my.master.findRobot(robot.name, function(err, bot){
bot = Cylon.robots[robot.name];
if (robot.cmd == 'on')
bot.devices[robot.device].turnOn();
else
bot.devices[robot.device].turnOff();
});
}
}
});

View File

@ -29,11 +29,10 @@ var SalesforceRobot = (function() {
msg += "Bucks: " + data.sobject.Bucks__c + ",";
msg += "SM_Id: " + data.sobject.Id;
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);
});
});
});
};
return SalesforceRobot;
@ -70,10 +69,9 @@ var SpheroRobot = (function() {
spheroName: "" + me.name,
bucks: "" + (me.totalBucks++)
});
me.master.findRobot('salesforce', function(err, sf) {
var sf = Cylon.robots['salesforce'];
sf.devices.salesforce.push('SpheroController', 'POST', data);
});
});
};
return SpheroRobot;

View File

@ -42,11 +42,10 @@ tell it what work we want to do:
msg += "Bucks: " + data.sobject.Bucks__c + ",";
msg += "SM_Id: " + data.sobject.Id;
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);
});
});
});
};
return SalesforceRobot;
@ -83,10 +82,9 @@ tell it what work we want to do:
spheroName: "" + me.name,
bucks: "" + (me.totalBucks++)
});
me.master.findRobot('salesforce', function(err, sf) {
var sf = Cylon.robots['salesforce'];
sf.devices.salesforce.push('SpheroController', 'POST', data);
});
});
};
return SpheroRobot;

View File

@ -57,9 +57,8 @@ var SalesforceRobot = (function() {
console.log(msg);
me.master.findRobot(name, function(err, spheroBot) {
var spheroBot = Cylon.robots[name];
spheroBot.react(spheroBot.devices.sphero);
});
me.spheroReport[name] = bucks;
toPebble = "";
@ -71,11 +70,10 @@ var SalesforceRobot = (function() {
toPebble += "" + key + ": $" + val + "\n";
}
me.master.findRobot('pebble', function(error, pebbleBot) {
var pebbleBot = Cylon.robots['pebble'];
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
});
});
});
};
return SalesforceRobot;
@ -141,10 +139,9 @@ var SpheroRobot = (function() {
bucks: "" + (me.totalBucks++)
});
me.master.findRobot('salesforce', function(err, sf) {
var sf = Cylon.robots['salesforce'];
sf.devices.salesforce.push("SpheroController", "POST", data);
});
});
};
return SpheroRobot;

View File

@ -78,9 +78,8 @@ Tell it what work we want to do:
console.log(msg);
me.master.findRobot(name, function(err, spheroBot) {
var spheroBot = Cylon.robots[name];
spheroBot.react(spheroBot.devices.sphero);
});
me.spheroReport[name] = bucks;
toPebble = "";
@ -92,11 +91,10 @@ Tell it what work we want to do:
toPebble += "" + key + ": $" + val + "\n";
}
me.master.findRobot('pebble', function(error, pebbleBot) {
var pebbleBot = Cylon.robots['pebble'];
pebbleBot.message(pebbleBot.devices.pebble, toPebble);
});
});
});
};
return SalesforceRobot;
@ -166,10 +164,9 @@ Tell it what work we want to do:
bucks: "" + (me.totalBucks++)
});
me.master.findRobot('salesforce', function(err, sf) {
var sf = Cylon.robots['salesforce'];
sf.devices.salesforce.push("SpheroController", "POST", data);
});
});
};
return SpheroRobot;