Modbus
Цей контент ще не доступний вашою мовою.
Find Modbus Devices
Section titled “Find Modbus Devices”Starts searching for Modbus devices on the RS-485 bus.
POST /api/modbus/find/start/
Request Parameters:
| Parameter | Type | Description |
|---|---|---|
baudRate | integer | Baud rate (bps: 75 to 230400). |
charFormat | integer | Byte format: |
0 - E1S; | ||
1 - O1S; | ||
2 - SPACE (0P1S); | ||
3 - MARK (1P1S / NP2S); | ||
4 - NP1S; | ||
5 - AUTO STOP (Rx: NP1S / Tx: NP2S). | ||
frameMode | integer | Frame format: 0 - RTU, 1 - ASCII. Optional. |
fastSearch | boolean | Enable fast search (true/false). Optional. |
Example Request:
{ "baudRate": 9600, "charFormat": 3, "frameMode": 0, "fastSearch": false}Stop Search
Section titled “Stop Search”Stops the active Modbus device search.
POST /api/modbus/find/stop/
Response:
| Parameter | Type | Description |
|---|---|---|
status | string | Status: DONE - search stopped successfully; BUSY - unable to stop search (try again later). |
{ "status": "DONE"}Get Search Result
Section titled “Get Search Result”Returns the list of found devices.
GET /api/modbus/find/result/?list
Request Parameters:
| Parameter | Description |
|---|---|
list | If specified, the response includes the list of found devices foundDevices. |
Response:
| Parameter | Type | Description |
|---|---|---|
foundDevices | array | List of found devices. |
uid | integer | Device UID. |
baudRate | integer | Baud rate (bps: 75 to 230400). |
charFormat | integer | Byte format: |
0 - E1S; | ||
1 - O1S; | ||
2 - SPACE (0P1S); | ||
3 - MARK (1P1S / NP2S); | ||
4 - NP1S; | ||
5 - AUTO STOP (Rx: NP1S / Tx: NP2S). | ||
frameMode | integer | Frame format: 0 - RTU, 1 - ASCII. |
{ "foundDevices": [ { "uid": 1, "baudRate": 9600, "charFormat": 0, "frameMode": 0 } ]}Template Search and Identification
Section titled “Template Search and Identification”Get META Info from Template
Section titled “Get META Info from Template”POST /api/modbus/class-find/search-meta-info/
Request Parameters:
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path to template file on SD card. |
Example Request:
{ "filePath": "/templates/em-481.txt"}Response:
| Parameter | Type | Description |
|---|---|---|
status | string | Status: DONE (success), ERROR (failed). |
errorCode | string / null | Error code if failed. See Error Codes. |
Start Search by Template
Section titled “Start Search by Template”POST /api/modbus/class-find/start/?search-meta-info
Request Parameters:
| Parameter | Type | Description |
|---|---|---|
filePath | string | Path to template file on SD card. |
baudRate | integer | Baud rate. |
charFormat | integer | Byte format. |
frameMode | integer | Frame format: 0 - RTU, 1 - ASCII. |
uid | integer | Device UID (1-254). |
Example Request:
{ "filePath": "/templates/em-481.txt", "baudRate": 9600, "charFormat": 3, "frameMode": 0, "uid": 111}Response:
| Parameter | Type | Description |
|---|---|---|
status | string | Status: DONE (started), ERROR (failed). |
errorCode | string / null | Error code if failed. See Error Codes. |
Stop Template Search
Section titled “Stop Template Search”POST /api/modbus/class-find/stop/
Response:
| Parameter | Type | Description |
|---|---|---|
status | string | Status: DONE (stopped), BUSY (cannot stop). |
Get Search Result
Section titled “Get Search Result”GET /api/modbus/class-find/result/
Response:
| Parameter | Type | Description |
|---|---|---|
mbReqPassed | integer | Number of completed Modbus requests. |
checksPassed | integer | Number of executed template commands. |
linesPassed | integer | Number of read template lines. |
mbUid | integer | Device UID. |
deviceClass | string / null | Identified device class, or null. |
scriptTime | string / null | Template file creation time (ISO 8601), or null. |
scriptVersion | string / null | Template file version, or null. |
status | string | Status: DONE (success), BUSY (searching), ERROR (failed). |
errorCode | string / null | Error code if failed. See Error Codes. |
Template Search Error Codes
Section titled “Template Search Error Codes”| Code | Description |
|---|---|
| File System Errors | |
ERROR_FR_DISK_ERR | Low-level disk error |
ERROR_FR_INT_ERR | Internal file system error |
ERROR_FR_NOT_READY | Storage device not ready |
ERROR_FR_NO_FILE | File not found |
ERROR_FR_NO_PATH | Path not found |
ERROR_FR_INVALID_NAME | Invalid file or path name |
ERROR_FR_DENIED | Access denied |
ERROR_FR_EXIST | File already exists |
ERROR_FR_INVALID_OBJECT | Invalid file object |
ERROR_FR_WRITE_PROTECTED | Write protected |
ERROR_FR_INVALID_DRIVE | Invalid drive |
ERROR_FR_NOT_ENABLED | File system not mounted |
ERROR_FR_NO_FILESYSTEM | No file system |
ERROR_FR_MKFS_ABORTED | Formatting aborted |
ERROR_FR_TIMEOUT | Timeout |
ERROR_FR_LOCKED | File locked |
ERROR_FR_NOT_ENOUGH_CORE | Not enough memory |
ERROR_FR_TOO_MANY_OPEN_FILES | Too many open files |
ERROR_FR_INVALID_PARAMETER | Invalid parameter |
| Search Engine Errors | |
ERROR_META | Template structure error |
ERROR_LABEL | Invalid or missing label |
ERROR_CONDITION | Condition expression error |
ERROR_CHECK_TYPE | Unknown check type |
ERROR_MODIFIER_PARAMETER | Modifier parameter error |
ERROR_DATA_SOURCE | Data source error |
ERROR_DATA_SOURCE_FUNCTION | Unknown data source function |
ERROR_DATA_SOURCE_ADDRESS | Invalid data source address |
ERROR_CHECK_PARAMETERS | Check parameters error |
ERROR_ACTION | Action error |
ERROR_ACTION_TYPE | Unknown action type |
ERROR_UNSUPPORTED_UTF_FORMAT | Unsupported UTF format |
ERROR_FILE_NOT_READ | Failed to read template file |
ERROR_LINE_OUTOFBOUND | Line out of bound |
ERROR_UID_HIDDEN_BY_VDEVICE | UID hidden by virtual device |
ERROR_ARG | General argument error |
ERROR_MEM | Memory allocation error |
ERROR_BUSY | Resource busy |
ERROR_SERIAL_IS_SLAVE | Device is in slave mode |
ERROR_EOF | End of file reached |
Modbus Request/Response
Section titled “Modbus Request/Response”Send Modbus Request
Section titled “Send Modbus Request”POST /api/modbus/req/
Request Parameters:
| Parameter | Type | Description |
|---|---|---|
reqData | string | Hexadecimal string of Modbus request (without CRC). |
Example Request:
{ "reqData": "010300000002"}Response:
| Parameter | Type | Description |
|---|---|---|
tid | integer | Transaction ID assigned to the packet. |
Get Modbus Response
Section titled “Get Modbus Response”GET /api/modbus/resp/?tid=...
Request Parameters:
| Parameter | Type | Description |
|---|---|---|
tid | integer | Transaction ID. |
Response:
| Parameter | Type | Description |
|---|---|---|
respData | string | Hexadecimal string of Modbus response. |
status | string | Status: DONE (received), BUSY (pending). |
Reconnect to Cloud via Modbus
Section titled “Reconnect to Cloud via Modbus”Disconnects and reconnects to the cloud server.
POST /api/cmd/callback/reconnect/
Request Parameters:
| Field | Type | Description |
|---|---|---|
requestNewCode | boolean | Request new activation code upon reconnection. |
Example Request:
{ "requestNewCode": true}