Files
ANSLIB/IOBox/Backup/v1.0.0/readme.md

55 lines
1.9 KiB
Markdown
Raw Normal View History

2026-03-28 11:39:04 +11:00
### IOBOX API USAGE GUIDE
This document provides an overview and usage instructions for the APIs available in `iobox_api.h`.
#### 1. Api name and features
* Scan
`std::vector<std::string> scanNetworkDevicesMulticast(int timeout);`
API need to be passed a timeout in second unit. The API will return a list of IPs as a vector string.
* Connect
`bool connectToIobox(const std::string& ip, int port); `
Connect to a specific IP device from list of IPs above. Default port is 502.
* Disconnect
`bool disconnectToIobox(const std::string& ip);`
Disconnect to a specific IP device that is connected before
* Get value of channel
`std::string getValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName);`
Get value of specific channel name from a IP device that is connected before.
List of channel name is included in `channel_name` array.
* Set value of channel
`bool setValueDataStringIoboxFromChannelName(const std::string& ip, const std::string& channelName, const std::string& value);`
Set a value of specific channel name from a IP device that is connected before. List of channel name is included in `channel_name` array.
#### 2. How to using example test in main.cpp
You need build this project before run by using g++ compiler
`g++ .\*.cpp -lws2_32 -o main.exe`
Then you need only running `main.exe`.
Start application, it will show
`Enter command followed by Enter: exit, scan, setip, connect, disconnect, show, get, set`
* You type `scan`, it will scan all device iobox on local network then it will list them on terminal attach their IP address if they is found.
* Then type `setip` to setup IP of iobox you need to connect
Then you will be required to input of specific IP address and you need type IP you want.
* Next you type `connect` to connect to this IP device
* Then you can use `get` or `set` command to continue get or set value to any channel.