沈斌
2017-01-31 673c54dd84ef1b861d1b8519311555af153b6c8c
后台添加调试代码帮助除错
2 files modified
13 ■■■■ changed files
client.js 6 ●●●● patch | view | raw | blame | history
method.js 7 ●●●●● patch | view | raw | blame | history
client.js
@@ -14,10 +14,10 @@
    //client.write(new Buffer([ 0x5a, 0x00, 0x10, 0x01, 0x00, 0x07, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xa2 ]));
    //client.write(new Buffer([ 0x5A, 0x00, 0x33, 0x01, 0x00, 0x01 ]));
    //client.write(new Buffer([0x5a,0x00,0x10,0x01,0x00,0x01,0xac,0xcf,0x23,0xb8,0x7f,0xbf]));
    client.write(new Buffer([0x5a,0x00,0x00,0x01,0x00,0x01,0xac, 0xcf, 0x23, 0xb8, 0x7d, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4]));
    //client.write(new Buffer([0x5a,0x00,0x00,0x01,0x00,0x01,0xac, 0xcf, 0x23, 0xb8, 0x7d, 0xa4, 0xa4, 0xa4, 0xa4, 0xa4]));
    
    //client.write(new Buffer([0x5a, 0x00, 0x3d, 0x01, 0x00, 0x06, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xbf, 0xa6, 0x6a, 0x00, 0x51, 0x01, 0x02, 0x03, 0x04, 0x10, 0x06, 0x01, 0x02, 0x00,
    //    , 0x03, 0xfa, 0xae, 0x3e, 0x64, 0x5e, 0x9c, 0xb3, 0xcf, 0xbb, 0x91, 0xf9, 0xe4, 0x6e, 0xab, 0xef, 0xea, 0xcf, 0x42, 0x79, 0x9a, 0xf8, 0x22, 0x18, 0xec, 0x88, 0x6c, 0x4b, 0xf0, 0x4f, 0x9f, 0xef, 0x29, 0x00, 0x00]))
    client.write(new Buffer([0x5a, 0x00, 0x3d, 0x01, 0x00, 0x06, 0xac, 0xcf, 0x23, 0xb8, 0x7f, 0xbf, 0xa6, 0x6a, 0x00, 0x51, 0x01, 0x02, 0x03, 0x04, 0x10, 0x06, 0x01, 0x02, 0x00,
        , 0x03, 0xfa, 0xae, 0x3e, 0x64, 0x5e, 0x9c, 0xb3, 0xcf, 0xbb, 0x91, 0xf9, 0xe4, 0x6e, 0xab, 0xef, 0xea, 0xcf, 0x42, 0x79, 0x9a, 0xf8, 0x22, 0x18, 0xec, 0x88, 0x6c, 0x4b, 0xf0, 0x4f, 0x9f, 0xef, 0x29, 0x00, 0x00]))
});
client.on('data', function(data) {
method.js
@@ -172,12 +172,19 @@
    var mcu = this.toDec(fields[64]) + this.toDec(fields[65]) / 100;
    var _config = global.configs[mac];
    console.log("----------------------1")
    console.log(_config)
    if(_config == null) {
        _config = config.ALARM_DEFAULTS;
        _config.mac = mac;
        global.configs[mac] = _config;
    }
    console.log("----------------------2")
    console.log(_config)
    var current = moment();
    var sensor_data = {