Control API

Controls the output signal (relay) of the device.

int executeOutputAction(Channel channel, Relay relay)

Parameters

  • channel: relay channel (0–1)
  • relay: output signal information

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.


Controls the LED of the device.

int executeLedAction(LedColor color)

Parameters

  • color: LED color

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.


Sets the Ethernet information.

int setEthernetConfig(boolean enableDHCP, String ip, String subnet, String gateway, String dnsServer)

Parameters

  • enableDHCP: Decides whether to use DHCP.
  • ip: IP address assigned to the device.
  • subnet: Subnet mask of the device.
  • gateway: IP address of the gateway.
  • dnsServer: DNS server address.

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.

The API will return immediately upon starting the Ethernet setting, the result will be passed on to the onActivityResult.


Open RS-232 serial port.

int openRS232(int baudrate)

Parameters

  • baudrate: The RS-232 communication speed.

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.

Close RS-232 serial port.

int closeRS232()

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.


Read RS-232 data.

int readRS232(RS232Data data)

Parameters

  • data: RS-232 data.

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.


Send RS-232 data.

int writeRS232(RS232Data data)

Parameters

  • data: RS-232 data.

Return Code

Returns “SUCCESS” if successfully launched; returns the corresponding error code if an error occurs.