-
Notifications
You must be signed in to change notification settings - Fork 0
/
gpsFun.js
36 lines (32 loc) · 1.15 KB
/
gpsFun.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
var gps = require("gpslibgt06n");
var options = {
'debug' : true,
'port' : 8080,
'device_adapter' : "GT06"
}
var server = gps.server(options,function(device,connection){
connection.on("data",function(res){
console.log(res+ "from server");
});
connection.on("end",function (data) {
console.log("device left" + connection.device.uid+ "from server");
})
device.on("login_request",function (uid,data) {
console.log(uid,data + "from server");
device.login_authorized(true,data);
});
device.on("ping",function (data) {
console.log("data from:"+ connection.device.uid+ "from server");
console.log(data + "from server");
});
device.on("alarm",function (data,alarmData,fullData) {
console.log(data + "from server");
console.log(alarmData + "from server");
console.log(fullData + "from server");
});
device.on("status",function (data,fullData) {
console.log("data from:"+ connection.device.uid+ "from server");
console.log(data + "from server");
console.log(fullData+ "from server");
});
});