From 92b327d79a3d774e9aa6949b0a5981c89e10c491 Mon Sep 17 00:00:00 2001
From: 沈斌 <bluelazysb@hotmail.com>
Date: Fri, 06 Jan 2017 08:17:03 +0800
Subject: [PATCH] 环境数硬件接口修改 - 通过版本号来判断终端传感器数据的协议格式

---
 test.js   |   18 ++++++++++++------
 method.js |    4 ++++
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/method.js b/method.js
index ded9b19..4ef0589 100644
--- a/method.js
+++ b/method.js
@@ -131,6 +131,10 @@
     mac = mac.toLowerCase();
     this.updateDeviceLastUpdated(db, mac, function(data) {});
 
+    //������������������������������������������������������
+    //var ver = this.toDec(fields[18]) * 256 + this.toDec(fields[19]); //���������
+
+
     var x1  = this.toDec(fields[20]) * 256 + this.toDec(fields[21]); //PM2.5������
     var x2  = this.toDec(fields[22]) * 256 + this.toDec(fields[23]); //PM10
     var x3  = this.toDec(fields[24]) * 256 + this.toDec(fields[25]); //0.1���0.3um���
diff --git a/test.js b/test.js
index 0cc034a..80c2cc4 100644
--- a/test.js
+++ b/test.js
@@ -243,9 +243,15 @@
 // var data = "5a0000010003accf23d4515f00000000000000000030003e198c00110814050300060034001400000004001f000301040200000000000000000003490056048c1f02000000000000000000000000003c5b";
 // console.log(data.length);
 
-var moment = require('moment');
-var a = {
-    data: {a:1, b:2},
-    time: moment().format('YYYY-MM-DD HH:mm:ss')
-};
-console.log(JSON.stringify(a));
\ No newline at end of file
+// var moment = require('moment');
+// var a = {
+//     data: {a:1, b:2},
+//     time: moment().format('YYYY-MM-DD HH:mm:ss')
+// };
+// console.log(JSON.stringify(a));
+
+var a = 999;
+var b = parseInt(a / 256);
+var c = a % 256;
+console.log(b + " | " + c);
+console.log("0" + b)
\ No newline at end of file

--
Gitblit v1.8.0