diff --git a/examples/pure_gpio/pure_gpio.coffee b/examples/pure_gpio/pure_gpio.coffee deleted file mode 100644 index 771bfff..0000000 --- a/examples/pure_gpio/pure_gpio.coffee +++ /dev/null @@ -1,14 +0,0 @@ -require '../../dist/digital-pin' - -pin4 = new Cylon.IO.DigitalPin(pin: 4, mode: 'w') - -pin4.on 'open', (data) -> console.log "Pin files have been created" - -pin4.on 'digitalWrite', (value) -> - console.log "Value written to pin: #{value}" - -pin4.on 'connect', (data) -> - console.log "Pin mode has been setup!" - pin4.setHigh() - -pin4.connect() diff --git a/examples/pure_gpio/pure_gpio.js b/examples/pure_gpio/pure_gpio.js deleted file mode 100644 index 088c72b..0000000 --- a/examples/pure_gpio/pure_gpio.js +++ /dev/null @@ -1,19 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -require('../../dist/digital-pin'); - -var pin4 = new Cylon.IO.DigitalPin({ pin: 4, mode: 'w' }); - -pin4.on('open', function(data) { - console.log("Pin files have been created"); -}); - -pin4.on('digitalWrite', function(value) { - console.log("Value written to pin: " + value); -}); - -pin4.on('connect', function(data) { - console.log("Pin mode has been setup!"); - pin4.setHigh(); -}); - -pin4.connect(); diff --git a/examples/pure_gpio/pure_gpio.litcoffee b/examples/pure_gpio/pure_gpio.litcoffee deleted file mode 100644 index 91f259b..0000000 --- a/examples/pure_gpio/pure_gpio.litcoffee +++ /dev/null @@ -1,34 +0,0 @@ -# Pure GPIO - -Here we'll demonstrate an example of controlling a digital pin using a pure GPIO -interface. - -First, we need to require the `digital-pin` class inside of Cylon: - - require '../../dist/digital-pin' - -Then we'll instantiate a new instance of it, with write permissions and using -pin 4. - - pin4 = new Cylon.IO.DigitalPin(pin: 4, mode: 'w') - -Once the pin's been opened, we'll write to the console to indicate so: - - pin4.on 'open', (data) -> - console.log "Pin files have been created" - -And on the 'digitalWrite' event for the pin, we'll log the value that's been -written: - - pin4.on 'digitalWrite', (value) -> - console.log "Value written to pin: #{value}" - -When the pin's been connected, we'll set it to high (1) - - pin4.on 'connect', (data) -> - console.log "Pin mode has been setup!" - pin4.setHigh() - -And with all our events defined, we'll connect the pin: - - pin4.connect() diff --git a/examples/pure_spheron/pure_spheron.coffee b/examples/pure_spheron/pure_spheron.coffee deleted file mode 100644 index 0abb536..0000000 --- a/examples/pure_spheron/pure_spheron.coffee +++ /dev/null @@ -1,19 +0,0 @@ -spheron = require('spheron') - -sphero = spheron.sphero() -spheroPort = '/dev/rfcomm0' - -COLORS = spheron.toolbelt.COLORS - -sphero.on 'open', -> - console.log 'EVENT OPEN!' - sphero.configureCollisionDetection 0x01, 0x20, 0x20, 0x20, 0x20, 0x50 - sphero.setRGB COLORS.GREEN, false - -sphero.on 'close', -> console.log 'EVENT CLOSE!' -sphero.on 'end', -> console.log 'EVENT END!' -sphero.on 'error', -> console.log 'EVENT ERROR!' -sphero.on 'notification', (packet) -> console.log "Packet contents: #{packet}" -sphero.on 'message', (packet) -> console.log "Packet contents: #{packet}" - -sphero.open spheroPort diff --git a/examples/pure_spheron/pure_spheron.js b/examples/pure_spheron/pure_spheron.js deleted file mode 100644 index ddb54f1..0000000 --- a/examples/pure_spheron/pure_spheron.js +++ /dev/null @@ -1,34 +0,0 @@ -var spheron = require('spheron'); - -var sphero = spheron.sphero(); -var spheroPort = '/dev/rfcomm0'; - -var COLORS = spheron.toolbelt.COLORS; - -sphero.on('open', function() { - console.log('EVENT OPEN!'); - sphero.configureCollisionDetection(0x01, 0x20, 0x20, 0x20, 0x20, 0x50); - sphero.setRGB(COLORS.GREEN, false); -}); - -sphero.on('close', function() { - console.log('EVENT CLOSE!'); -}); - -sphero.on('end', function() { - console.log('EVENT END!'); -}); - -sphero.on('error', function() { - console.log('EVENT ERROR!'); -}); - -sphero.on('notification', function(packet) { - console.log("Packet contents: " + packet); -}); - -sphero.on('message', function(packet) { - console.log("Packet contents: " + packet); -}); - -sphero.open(spheroPort); diff --git a/examples/pure_spheron/pure_spheron.litcoffee b/examples/pure_spheron/pure_spheron.litcoffee deleted file mode 100644 index 6657dff..0000000 --- a/examples/pure_spheron/pure_spheron.litcoffee +++ /dev/null @@ -1,48 +0,0 @@ -# Pure Spheron - -Here's an example of communicating with a Sphero solely using Spheron. Before -you get started, make sure you've installed the `spheron` module with NPM. - -First, let's make sure we've got Spheron loaded: - - spheron = require 'spheron' - -Next, we'll get our colors from Spheron's toolbelt: - - COLORS = spheron.toolbelt.COLORS - -Let's also keep a reference to the port we'll be using to talk to the Sphero, as -well as the Sphero connection itself: - - sphero = spheron.sphero() - spheroPort = "/dev/rfcomm0" - -Now let's define the event listeners for our Sphero. When the connection is -opened, the sphero will let us know about it, and change it's color to green, -along with enabling collision detection. - - sphero.on 'open', -> - console.log 'EVENT OPEN!' - sphero.configureCollisionDetection 0x01, 0x20, 0x20, 0x20, 0x20, 0x50 - sphero.setRGB COLORS.GREEN, false - -The rest are basic events, logging that a `close`, `error`, or `end` event has -been fired: - - sphero.on 'close', -> console.log 'EVENT CLOSE!' - sphero.on 'end', -> console.log 'EVENT END!' - sphero.on 'error', -> console.log 'EVENT ERROR!' - -For the `notification` and `message` events, though, we're going to log their -accompanying data to the console as well: - - sphero.on 'notification', (packet) -> - console.log "Packet contents: #{packet}" - - sphero.on 'message', (packet) -> - console.log "Packet contents: #{packet}" - -And that wraps up our event listeners. All that's left to do is open -a connection to the Sphero: - - sphero.open spheroPort diff --git a/examples/sf-client/sf-client.coffee b/examples/sf-client/sf-client.coffee deleted file mode 100644 index af34048..0000000 --- a/examples/sf-client/sf-client.coffee +++ /dev/null @@ -1,48 +0,0 @@ -'use strict' - -namespace = require 'node-namespace' -nforce = require 'nforce' -Faye = require 'faye' - -namespace 'SF', -> - class @SFClient - constructor: (opts) -> - @client = null - @outboundMessages = [] - @sfuser = opts.sfuser - @sfpass = opts.sfpass - @orgCreds = opts.orgCredentials - @org = nforce.createConnection @orgCreds - - _processOutboundMessages: () -> - # Do work here - - _handleStreamingAPI: (outboundCB) -> - client = new Faye.Client("#{@oauth.instance_url}/cometd/28.0") - client.setHeader "Authorization", "OAuth #{@oauth.access_token}" - - subscription = client.subscribe '/topic/SpheroMsgOutbound', outboundCB - console.log "Streaming API Connected..." - - authenticate: (outboundCB) -> - @org.authenticate {username: @sfuser, password: @sfpass}, (err, _oauth) => - if err - console.log 'unable to authenticate to sfdc' - console.log err - process.exit 1 - else - console.log "authenticated" - @oauth = _oauth - @_handleStreamingAPI outboundCB - @_processOutboundMessages() - - push: (msg) -> - jsonString = msg - - console.log "SpheroController post msg:" - console.log msg - - methodData = {uri:'SpheroController', method: 'POST', body: jsonString} - - @org.apexRest methodData, @oauth, (err, resp) => - console.log if err then err else resp diff --git a/examples/sf-client/sf-client.js b/examples/sf-client/sf-client.js deleted file mode 100644 index 36d8b80..0000000 --- a/examples/sf-client/sf-client.js +++ /dev/null @@ -1,67 +0,0 @@ -'use strict'; - -var namespace = require('node-namespace'); -var nforce = require('nforce'); -var Faye = require('faye'); - -namespace('SF', function() { - this.SFClient = (function() { - - function SFClient(opts) { - this.client = null; - this.outboundMessages = []; - this.sfuser = opts.sfuser; - this.sfpass = opts.sfpass; - this.orgCreds = opts.orgCredentials; - this.org = nforce.createConnection(this.orgCreds); - } - - SFClient.prototype._processOutboundMessages = function() {}; - - SFClient.prototype._handleStreamingAPI = function(outboundCB) { - var client, subscription; - client = new Faye.Client("" + this.oauth.instance_url + "/cometd/28.0"); - client.setHeader("Authorization", "OAuth " + this.oauth.access_token); - subscription = client.subscribe('/topic/SpheroMsgOutbound', outboundCB); - console.log("Streaming API Connected..."); - }; - - SFClient.prototype.authenticate = function(outboundCB) { - var _this = this; - this.org.authenticate({ - username: this.sfuser, - password: this.sfpass - }, function(err, _oauth) { - if (err) { - console.log('unable to authenticate to sfdc'); - console.log(err); - process.exit(1); - } else { - console.log("authenticated"); - _this.oauth = _oauth; - _this._handleStreamingAPI(outboundCB); - _this._processOutboundMessages(); - } - }); - }; - - SFClient.prototype.push = function(msg) { - var jsonString, methodData, - _this = this; - jsonString = msg; - console.log("SpheroController post msg:"); - console.log(msg); - methodData = { - uri: 'SpheroController', - method: 'POST', - body: jsonString - }; - this.org.apexRest(methodData, this.oauth, function(err, resp) { - console.log(err ? err : resp); - }); - }; - - return SFClient; - - })(); -}); diff --git a/examples/sf-client/sf-client.litcoffee b/examples/sf-client/sf-client.litcoffee deleted file mode 100644 index 11f69c4..0000000 --- a/examples/sf-client/sf-client.litcoffee +++ /dev/null @@ -1,51 +0,0 @@ -# Sales force Client - - 'use strict' - - namespace = require 'node-namespace' - nforce = require 'nforce' - Faye = require 'faye' - - namespace 'SF', -> - class @SFClient - constructor: (opts) -> - @client = null - @outboundMessages = [] - @sfuser = opts.sfuserjeje ok - - @sfpass = opts.sfpass - @orgCreds = opts.orgCredentials - @org = nforce.createConnection @orgCreds - - _processOutboundMessages: () -> - # Do work here - - _handleStreamingAPI: (outboundCB) -> - client = new Faye.Client("#{@oauth.instance_url}/cometd/28.0") - client.setHeader "Authorization", "OAuth #{@oauth.access_token}" - - subscription = client.subscribe '/topic/SpheroMsgOutbound', outboundCB - console.log "Streaming API Connected..." - - authenticate: (outboundCB) -> - @org.authenticate {username: @sfuser, password: @sfpass}, (err, _oauth) => - if err - console.log 'unable to authenticate to sfdc' - console.log err - process.exit 1 - else - console.log "authenticated" - @oauth = _oauth - @_handleStreamingAPI outboundCB - @_processOutboundMessages() - - push: (msg) -> - jsonString = msg - - console.log "SpheroController post msg:" - console.log msg - - methodData = {uri:'SpheroController', method: 'POST', body: jsonString} - - @org.apexRest methodData, @oauth, (err, resp) => - console.log if err then err else resp diff --git a/examples/sf-test/sf-test.coffee b/examples/sf-test/sf-test.coffee deleted file mode 100644 index e589499..0000000 --- a/examples/sf-test/sf-test.coffee +++ /dev/null @@ -1,36 +0,0 @@ -require '../examples/sf-client' - -sfuser = process.env.SF_USERNAME -sfpass = process.env.SF_SECURITY_TOKEN - -orgCreds = - clientId: process.env.SF_CLIENT_ID - clientSecret: process.env.SF_CLIENT_SECRET - redirectUri: 'http://localhost:3000/oauth/_callback' - -sf = new Cylon.SF.SFClient - sfuser: sfuser - sfpass: sfpass - orgCredentials: orgCreds - -cc = 0 - -sf.authenticate (msg) -> - string = "^ Sphero Name: #{msg.sobject.Sphero_Name__c}," - string += " Msg Content:#{ msg.sobject.Content__c }" - string += ", SM Id:#{ msg.sobject.Id }" - console.log "Printed from callback in client program.program" - console.log string + "\n" - -myId = null -message = "hello" -detail = "Some Stuff for details" - -setInterval () => - cc++ - myId = cc - - data = JSON.stringify { identifier: "run3#{myId}", msg: message } - - sf.push data -, 1000 diff --git a/examples/sf-test/sf-test.js b/examples/sf-test/sf-test.js deleted file mode 100644 index 6e18c00..0000000 --- a/examples/sf-test/sf-test.js +++ /dev/null @@ -1,38 +0,0 @@ -require('../examples/sf-client'); - -var sfuser = process.env.SF_USERNAME; -var sfpass = process.env.SF_SECURITY_TOKEN; - -var orgCreds = { - clientId: process.env.SF_CLIENT_ID, - clientSecret: process.env.SF_CLIENT_SECRET, - redirectUri: 'http://localhost:3000/oauth/_callback' -}; - -var sf = new Cylon.SF.SFClient({ - sfuser: sfuser, - sfpass: sfpass, - orgCredentials: orgCreds -}); - -var cc = 0; - -sf.authenticate(function(msg) { - var string; - string = "^ Sphero Name: " + msg.sobject.Sphero_Name__c + ","; - string += " Msg Content:" + msg.sobject.Content__c; - string += ", SM Id:" + msg.sobject.Id; - console.log("Printed from callback in client program.program"); - console.log(string + "\n"); -}); - -var myId = null; -var message = "hello"; -var detail = "Some Stuff for details"; - -setInterval(function() { - cc++; - myId = cc; - var data = JSON.stringify({ identifier: "run3" + myId, msg: message }); - sf.push(data); -}, 1000); diff --git a/examples/sf-test/sf-test.litcoffee b/examples/sf-test/sf-test.litcoffee deleted file mode 100644 index 2431925..0000000 --- a/examples/sf-test/sf-test.litcoffee +++ /dev/null @@ -1,38 +0,0 @@ -# Sales Force Test - - require '../examples/sf-client' - - sfuser = process.env.SF_USERNAME - sfpass = process.env.SF_SECURITY_TOKEN - - orgCreds = - clientId: process.env.SF_CLIENT_ID - clientSecret: process.env.SF_CLIENT_SECRET - redirectUri: 'http://localhost:3000/oauth/_callback' - - sf = new Cylon.SF.SFClient - sfuser: sfuser - sfpass: sfpass - orgCredentials: orgCreds - - cc = 0 - - sf.authenticate (msg) -> - string = "^ Sphero Name: #{msg.sobject.Sphero_Name__c}," - string += " Msg Content:#{ msg.sobject.Content__c }" - string += ", SM Id:#{ msg.sobject.Id }" - console.log "Printed from callback in client program.program" - console.log string + "\n" - - myId = null - message = "hello" - detail = "Some Stuff for details" - - setInterval () => - cc++ - myId = cc - - data = JSON.stringify { identifier: "run3#{myId}", msg: message } - - sf.push data - , 1000