Option 1
C# SDK (RockPlus.iBoxSDK)
The SDK wraps connection, heartbeat keep-alive, automatic reconnection, I/O read/write, serial port pass-through and event callbacks. The core class is IBOXControlHelper, suited to quick integration into MES, SCADA and host software written in .NET languages.
| Method / Event | Description |
| ConnectIBox(ip, port) | Connect to iBox; default TCP port 5000 |
| InitHebeatEvent() | Start heartbeat monitoring; reconnect automatically after a disconnect |
| OpenDO(i) / CloseDO(i) | Turn the specified relay output on / off |
| OpenAllDO() / CloseAllDO() | Turn all outputs on / off |
| ReadDIStatus() / ReadDOStatus() | Actively read the state of all inputs / outputs |
| SendCOMPortData(port, isHex, data, out msg) | Send data to an RS232 / RS485 serial port, in hex or text |
| GetSoftwareInfo() | Read the software version and release date |
| OnIBoxConnection / OnIBoxDisconnected | Connection and disconnection events |
| OnIBOXDataReceived | Data received event: auto-uploaded inputs, all input / output states, serial data, version, heartbeat |
// C# example
using RockPlus.iBoxSDK;
using RockPlus.iBoxSDK.Objects;
var ibox = new IBOXControlHelper();
ibox.OnIBOXDataReceived += (s, e) =>
{
switch (e.EDataReceivedType)
{
case EDataReceivedType.DIAutoUploadResponse: // input change auto-upload
Console.WriteLine($"DI{e.AutoUploadDIIndex} = {e.AutoUploadDIStatus}");
break;
case EDataReceivedType.COMPortReadData: // serial data auto-upload
Console.WriteLine($"COM{e.ComPort}: {e.Message}");
break;
}
};
if (ibox.ConnectIBox("192.168.1.100", 5000))
{
ibox.InitHebeatEvent(); // heartbeat keep-alive + auto reconnect
ibox.OpenDO(0); // turn on output 1 (numbering starts at 0)
ibox.CloseDO(0); // turn off
ibox.ReadDIStatus(); // actively read all inputs (optional)
}
Option 2
TCP/IP Socket Hex Commands
iBox listens as a TCP server, default port 5000. In any language, just open a TCP connection and send hexadecimal bytes in the frame format; no specific development language or platform is required.
AA 55CommandMessage IDData55 AA
Frame header AA 55, frame tail 55 AA. The message ID is a 1-byte incrementing sequence number that the device returns unchanged in its response, used to match requests.
| Function | Request (hex) |
| Read software version | AA 55 00 ID 00 55 AA |
| Heartbeat | AA 55 01 ID 55 AA |
| Read all inputs | AA 55 03 ID 55 AA |
| Read all outputs | AA 55 05 ID 55 AA |
| Turn on output n | AA 55 07 ID nn 01 55 AA |
| Turn off output n | AA 55 07 ID nn 00 55 AA |
| Turn all outputs on / off | AA 55 07 ID FF 01 55 AA / AA 55 07 ID FF 00 55 AA |
| Send data to serial port | AA 55 09 ID port length-low length-high data... 55 AA |
| Response / Auto-Upload | Frame Format |
| Version response | AA 55 00 ID major minor revision year(2 bytes) month day hour minute ... |
| Heartbeat response | AA 55 02 ID ... |
| All input states | AA 55 04 ID 8 status bytes ... (01 = on, other = off) |
| All output states | AA 55 06 ID 8 status bytes ... |
| Output execution response / serial send response | AA 55 08 ... / AA 55 10 ... |
| Input change auto-upload | AA 55 A0 point state 55 AA |
| Serial data auto-upload | AA 55 A1 port data... 55 AA |
// Example: turn on output 1 (index 0), message ID = 01
AA 55 07 01 00 01 55 AA
// Example: send hex data 01 03 (length 2) to serial port 1
AA 55 09 02 01 02 00 01 03 55 AA
// Auto-upload received: input point 2 turned on
AA 55 A0 02 01 55 AA
Communicate with the device at least once every 60 seconds (for example, by sending a heartbeat). The SDK uses a 60-second heartbeat period by default; if no data is received for more than 60 seconds, it treats the link as disconnected and reconnects.