diff options
| author | jidalong <jidalong_yewu@cmss.chinamobile.com> | 2020-09-08 16:49:29 +0800 |
|---|---|---|
| committer | jidalong <jidalong@cmss.chinamobile.com> | 2020-09-08 16:51:35 +0800 |
| commit | 6f935a60531bb7ca412ff1cdc72f5bfc6cd954ce (patch) | |
| tree | cb3741da3c62aefaaee4d326a4747e455e68e221 /mappers | |
| parent | fix deviceProfile json bug (diff) | |
| download | kubeedge-6f935a60531bb7ca412ff1cdc72f5bfc6cd954ce.tar.gz | |
modify all protocol_config to protocolConfig in modbus mapper
Diffstat (limited to 'mappers')
| -rw-r--r-- | mappers/modbus_mapper/dpl/deviceProfile.json | 2 | ||||
| -rw-r--r-- | mappers/modbus_mapper/src/modbus.js | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/mappers/modbus_mapper/dpl/deviceProfile.json b/mappers/modbus_mapper/dpl/deviceProfile.json index 1ee4936dc..78401c0b7 100644 --- a/mappers/modbus_mapper/dpl/deviceProfile.json +++ b/mappers/modbus_mapper/dpl/deviceProfile.json @@ -31,7 +31,7 @@ "name": "temperature" }], "protocols": [{ - "protocol_config": { + "protocolConfig": { "ip": "127.0.0.1", "port": 5028, "slaveID": 1 diff --git a/mappers/modbus_mapper/src/modbus.js b/mappers/modbus_mapper/src/modbus.js index f05abe29c..5a7631a79 100644 --- a/mappers/modbus_mapper/src/modbus.js +++ b/mappers/modbus_mapper/src/modbus.js @@ -16,9 +16,9 @@ class Modbus { let client = this.client; switch(protocol.protocol) { case 'modbus-tcp': - client.connectTCP(protocol.protocol_config.ip, { port: parseInt(protocol.protocol_config.port) }, ()=>{ + client.connectTCP(protocol.protocolConfig.ip, { port: parseInt(protocol.protocolConfig.port) }, ()=>{ client.setTimeout(500); - client.setID(parseInt(protocol.protocol_config.slaveID)); + client.setID(parseInt(protocol.protocolConfig.slaveID)); callback(client); }); break; @@ -30,9 +30,9 @@ class Modbus { }, 100); }, function (callback) { - client.connectRTUBuffered(protocol.protocol_config.serialPort, { baudRate: parseInt(protocol.protocol_config.baudRate) }, ()=>{ + client.connectRTUBuffered(protocol.protocolConfig.serialPort, { baudRate: parseInt(protocol.protocolConfig.baudRate) }, ()=>{ client.setTimeout(500); - client.setID(parseInt(protocol.protocol_config.slaveID)); + client.setID(parseInt(protocol.protocolConfig.slaveID)); callback(null, client); }); }], (err, res) => {callback(res[1]); |
