-
Notifications
You must be signed in to change notification settings - Fork 23
/
index.js
47 lines (37 loc) · 1.04 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
var _ = require('underscore'),
Sniffer = require('./Sniffer'),
Emitter = require('./Emitter');
module.exports = {
/**
* Create an instance of the sniffer
*
* @param options
* options.pin The pin on which to listen codes
* options.debounceDelay Delay before reading another code
*
* @return Sniffer Sniffer instance (singleton)
*/
sniffer: function (options) {
_.defaults(options, {
pin: 2,
debounceDelay: 500
});
return Sniffer.getInstance(options);
},
/**
* Send a decimal code through 433Mhz (and return a promise).
*
* @param [options] Options to configure pin or pulseLength
* options.pin Pin on which send the code
* options.pulseLength Pulse length
*
* @return Function Function used to send codes
*/
emitter: function (options) {
_.defaults(options, {
pin: 0,
pulseLength: 350
});
return new Emitter(options);
}
};