FH_ConnectDeviceAsync

FH_ConnectDeviceAsync

Connects to a device on another computer. This function is equivalent to clicking the “Connect” button in the GUI.

int WINAPI FH_ConnectDeviceAsync(
        ID_VAR idComp,
        STR_VAR idDevice,
        JSON_VAR jsonParameters,
        int timeoutMs);

Here:

  • idComp – the ID of the computer to which the device is attached physically.
  • idDevice – the ID of the device physically connected to the computer.
  • jsonParameters – optional connection parameters (compression type, etc.) in the format of JSON object of{“compress”:XXX} type. The default parameters are used in case the empty string or object is passed. Refer to FH_SetDefaultConnectParameters
  • timeoutMs – timeout. By default equals to –1.

The returned value is the ID of the invoked command or 0 in case the command cannot be executed.
The result of the command execution is returned by command_result event.

The error codes upon the command completion:
* “not_found_dev” – the specified device not found
* “tcp_error” – not able to establish connection
* “no_driver” – the required drivers (for virtual USB and COM ports) are not installed on one of the computers
* “max_connections” – the limitation for the maximum number of concurrent connections in the account is reached