Connection Management

Establishing and disconnecting from the print service.

ti_connect

Connect to the print service.

The address type is detected automatically:

  • Contains : followed by a numeric port (e.g. 127.0.0.1:50051) → direct TCP connection

  • Any other non-empty string → Unix Domain Socket (the unix: prefix is added automatically)

  • NULL or empty string → uses TI_DEFAULT_UDS_PATH

  • client: Client handle.

  • address: Service address (UTF-8 string). Pass NULL or an empty string to use the default UDS path.

  • Returns: TI_OK — connection successful

  • Returns: TI_ERR_INVALID_ARG — client is NULL

  • Returns: TI_ERR_TIMEOUT — connection timed out

  • Returns: TI_ERR_SERVER — the server rejected the connection

Note: Calling it again first disconnects the current connection, then reconnects. See also: ti_disconnect() See also: TI_DEFAULT_UDS_PATH

ti_disconnect

Disconnect from the server.

Automatically stops the event and log subscriptions (if started) and safely closes the gRPC channel. Calling it when not connected is safe (no-op).

  • client: Client handle.
  • Returns: TI_OK — disconnect successful
  • Returns: TI_ERR_INVALID_ARG — client is NULL

ti_is_connected

Query whether the client is connected.

  • client: Client handle. Returns: 0 — not connected, or client is NULL Returns: 1 — connected