更新 main.js

This commit is contained in:
钟进 2019-01-16 05:12:23 +00:00
parent 796d71524e
commit 78792de453

View File

@ -32,17 +32,8 @@ adapter.on('message', function (obj) {
switch (obj.command) {
case 'listUart':
if (obj.callback) {
if (serialport) {
// read all found serial ports
serialport.list(function (err, ports) {
listSerial(ports);
adapter.log.info('List of port: ' + JSON.stringify(ports));
adapter.sendTo(obj.from, obj.command, ports, obj.callback);
});
} else {
adapter.log.warn('Module serialport is not available');
adapter.sendTo(obj.from, obj.command, [{comName: 'Not available'}], obj.callback);
}
}
break;
}