-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbrewometer-nodejs.js
executable file
·57 lines (41 loc) · 1.55 KB
/
brewometer-nodejs.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
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env node
var path = require('path');
var pkg = require( path.join(__dirname, 'package.json') );
var Bleacon = require('bleacon');
// Parse command line options
var program = require('commander');
program
.version(pkg.version)
.option('-p, --port <port>', 'Port on which to listen to (defaults to 3000)', parseInt)
.parse(process.argv);
Bleacon.on('discover', function(bleacon) {
switch(bleacon.uuid){
case 'a495bb10c5b14b44b5121370f02d74de':
console.log('Red ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb20c5b14b44b5121370f02d74de':
console.log('Green ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb30c5b14b44b5121370f02d74de':
console.log('Black ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb40c5b14b44b5121370f02d74de':
console.log('Purple ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb50c5b14b44b5121370f02d74de':
console.log('Orange ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb60c5b14b44b5121370f02d74de':
console.log('Blue ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb70c5b14b44b5121370f02d74de':
console.log('Yellow ' + bleacon.major + ',' + bleacon.minor);
break;
case 'a495bb80c5b14b44b5121370f02d74de':
console.log('Pink ' + bleacon.major + ',' + bleacon.minor);
break;
}
});
Bleacon.startScanning();
//
console.log('Scanning for Brewometers:');