Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
zetta-scout
Advanced tools
Readme
$ npm install zetta-scout --save
This is a class you inherit from when writing custom device drivers. Scouts are used to search for devices with external node modules, or protocols.
It's used by require('zetta-scout');
or require('zetta').Scout;
. You must inherit from the Scout
class when building custom Zetta modules.
var util = require('util');
var Scout = require('zetta-scout');
function MyScout(){
Scout.call(this);
}
util.inherits(MyScout, Scout);
func
FunctionThis method should be implemented by you. This allows you to initialize any resources like bluetooth access, serial ports, or
vendor modules needed to look for devices. The argument func
is provided, and must be called after scouting has started.
MyScout.prototype.init = function(next) {
var connection = Serial.connect(function(){
});
connection.on('start', function(){
next();
});
};
constructor
Subclass of Devicearguments
List of ObjectsThis method is called by you when you've found your device. The constructor
argument should be a subclass of Device
, and the second argument is a
list of objects to be used by the constructor.
MyScout.prototype.init = function(next) {
this.discover(MyDevice, foo, bar, 'baz');
};
deviceObject
Objectconstructor
Subclass of DeviceZetta will persist device data to an internal registry. Using an object retrieved from this registry you can initialize a device that Zetta already
knows about. The first argument deviceObject
is just data on the object from Zetta. The constructor
argument is what will be created by Zetta.
MyScout.prototype.init = function(next) {
var deviceObject = {
name:'testObject',
id: '123',
foo: 'bar'
};
this.provision(deviceObject, MyDevice);
};
This gives access to the zetta runtime. Here you can issue queries and lookup devices that Zetta already knows about.
MyScout.prototype.init = function(next) {
var self = this;
// query registry for any device that has type led and an id that we know of.
var query = this.server.where({ type: 'lcd', id: 'some-id' });
this.server.find(query, function(err, results) {
if (results.length > 0) {
// found in registry, tell zetta it came online
self.provision(results[0], MyDevice, foo, bar, 'baz');
} else {
// does not exist in registry, discover a new one.
self.discover(MyDevice, foo, bar, 'baz');
}
});
};
FAQs
A Scout class for Zetta.
We found that zetta-scout demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).