Use underscores.
Scouts and drivers appended with _scout.js or _driver.js unless in separate folder.
Examples
var test = require('./test/fixture/zetta_test'); | |
var Scout = require('./test/fixture/example_scout'); | |
var cluster = test({startPort : 22000}); | |
cluster.server('cloud'); | |
for (var i=0; i< process.env.PEERS; i++) { | |
cluster.server('peer-'+(i+1), [Scout], ['cloud']); | |
} | |
cluster.run(function(err){ |
var test = function() { | |
var someval = 123; | |
} |
//Works... | |
var app = argo(); | |
app.use(titan) | |
.add(RootResource, runtime) | |
.add(DevicesResource, runtime) | |
.add(ServerResource, runtime, 123) | |
.listen(3000) | |
/// Doesn't work? |
{ | |
"class": [ | |
"arm" | |
], | |
"properties": { | |
"type": "arm", | |
"name": "arm-192.168.1.8", | |
"data": {}, | |
"id": "b47c4550-f252-11e3-ba90-b7dd9280b642", | |
"ip": "192.168.1.8", |
var zetta = require('zetta'); | |
var Arduino = require('./arduino'); | |
var app = zetta(); | |
app.name('i-heard-that'); // give the empress a name | |
app.expose('*'); // explore other arguments | |
app.load(Arduino); // load that scout in |
var zetta = require('zetta'); | |
var ArduinoScout = require('./scouts/arduino_scout'); | |
var app = zetta(); | |
app.name('I heard that!'); | |
app.load(ArduinoScout); | |
app.observe('sound', function(microphone) { | |
app.observe('lcd', function(lcd) { | |
microphone.stream('sound').read(function(value) { |
//Driver is an event emitter | |
var Driver = require('zetta').Driver; | |
var util = require('util'); | |
var Sound = module.exports = function(port){ | |
Driver.call(this); | |
this._port = port; | |
}; | |
//UUID is given to us by the Driver constructor | |
util.inherits(Sound, Driver); |
var util = require('util'); | |
var Scout = require('zetta').Scout; | |
var SerialPort = require('serialport').SerialPort; | |
var Sound = require('./sound'); | |
var ArduinoScout = module.exports = function(runtime) { | |
Scout.call(this); | |
this.runtime = runtime; | |
this.portName = '/dev/tty.usbserial'; |
var SerialPort = require('serialport').SerialPort; | |
var Sound = require('./sound'); | |
var ArduinoScout = module.exports = function(){ | |
this.portName = '/dev/tty.usbserial'; | |
}; | |
ArduinoScout.prototype.init = function(cb){ | |
this.connect(this.portName, cb); | |
}; |