| | |
| | | //process.exit(0) |
| | | }, 500); |
| | | }); |
| | | }; |
| | | |
| | | module.exports.pushToScreen = function(data) { |
| | | amqp.connect(uri, function(err, conn) { |
| | | conn.createChannel(function(err, ch) { |
| | | ch.assertExchange('ex_data_screen', 'fanout', { durable: false }); |
| | | var message = { |
| | | mac: data.mac, |
| | | address: "江苏省昆山市摩瑞尔电器", |
| | | location: { |
| | | lat:31.430616, |
| | | lng:120.988327 |
| | | }, |
| | | data: { |
| | | x1: data.x1, |
| | | x2: data.x2, |
| | | x3: data.x3, |
| | | x4: data.x4, |
| | | x5: data.x5, |
| | | x6: data.x6 |
| | | } |
| | | }; |
| | | ch.publish('ex_data_screen', '', new Buffer(message)); |
| | | }); |
| | | setTimeout(function() { |
| | | conn.close(); |
| | | }, 500); |
| | | }); |
| | | }; |
| | |
| | | if(value.startsWith('5a0000010003')) { |
| | | var output = [ 0x6A, 0x00, 0x00, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6B ]; |
| | | method.insertData(db, value, function(data, rank) { |
| | | method.insertDocument2(db, value, rank, function(data) {}); |
| | | //method.insertDocument2(db, value, rank, function(data) {}); |
| | | var fields = method.padLeft(rank.toString(16), 8).match(/.{2}/g); |
| | | output[6] = method.toDec(fields[0]); |
| | | output[7] = method.toDec(fields[1]); |