-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacteristic_weather.js
More file actions
44 lines (38 loc) · 962 Bytes
/
characteristic_weather.js
File metadata and controls
44 lines (38 loc) · 962 Bytes
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
/**
* Dependencies
**/
var bleno = require('/usr/local/lib/node_modules/bleno');
var util = require('util');
/**
* Types
**/
var Characteristic = bleno.Characteristic;
var Descriptor = bleno.Descriptor;
/**
* Constructor
**/
var Characteristic_Weather = function(toilet)
{
Characteristic_Weather.super_.call(this, {
uuid : '0000000000000000000000000000fff3',
properties: [ 'read' ],
value: null,
descriptors: [
new Descriptor({
uuid: '2901',
value: 'Latest precipitation (x1000)'
})
]
});
this.toilet = toilet;
}
util.inherits(Characteristic_Weather, Characteristic);
Characteristic_Weather.prototype.onReadRequest = function(offset, callback)
{
if (offset) {
callback(this.RESULT_ATTR_NOT_LONG);
} else {
callback(this.RESULT_SUCCESS, this.toilet.precipitation());
}
}
module.exports = Characteristic_Weather;