Modbus Gateway (modgate): read/write modbus device by url, 使用網址來讀寫modbus設備
http://0.0.0.0:8080/<protocol>/<ip and port>/<function code>/<address start>/<length>/<format>
protocol: only support modbustcp
ip and port: modbus tcp device host and port, for example - 10.0.0.1:502
function code: modbus function code, for example - 1, 2, 3, 4
address start: start of modbus address
length: number of readouts
format: convert bytes to (integer) I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (float) F64BE,F64LE,F32BE,F32LE, (string) S64BE,S64LE
protocol: 目前只支持 modbustcp
ip and port: modbus設備的地址與埠號, 例如 - 10.0.0.1:502
function code: modbus的功能代碼, 例如 - 1, 2, 3, 4
address start: modbus地址起始位置
length: 讀出的資料個數
format: 將位元組資料轉換成可以讀取的數值, (整數類)I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (浮點數) F64BE,F64LE,F32BE,F32LE, (字串) S64BE,S64LE
{"code":0,"data":[666,123],"format":"I16BE","message":""}
code: 0 succeed, others failed
data: array of result
format: same as input
message: if code != 0, error message is here
code: 0成功, 非0失敗
message: 失敗時的錯誤訊息
format: 轉換的格式(與輸入相同)
data: 資料陣列
url format for writing (http POST)
http://0.0.0.0:8080/<protocol>/<ip and port>/<function code>/<address start>/<format>
[1,2,3,4]
protocol: only support modbustcp
ip and port: modbus tcp device host and port, for example - 10.0.0.1:502
function code: modbus function code, for example - 15 or 16
address start: start of modbus address
format: force convert data to these formats, (integer) I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (float) F64BE,F64LE,F32BE,F32LE, (string) S64BE,S64LE
Refer to No.5. It may be panic, if you force convert data from string to number. I need some help to make this better.
寫入modbus的網址格式, 使用http POST方式
protocol: 目前只支持 modbustcp 協定
ip and port: modbus設備的地址與埠號, 例如 - 10.0.0.1:502
function code: modbus的功能代碼, 例如 - 15或16
address start: modbus地址起始位置
format: 將資料轉換成特定格式寫進去, 例如(整數類)I64BE,I64LE,I32BE,I32LE,I16BE,I16LE, (浮點數) F64BE,F64LE,F32BE,F32LE, (字串) S64BE,S64LE, 目前沒有檢查假如資料為字串, 強制轉成數字類可能會出錯
Show modegate data 用來呈現modgate資料
http://0.0.0.0:8080/ui/demo.html
Put your static in sub-folder ./html, 將你的靜態頁面放在 html 資料夾下面