Parameters
Reading and writing server configuration parameters; the Key naming convention distinguishes global parameters from driver-board parameters.
ti_set_parameter
Set a parameter.
The Key naming convention distinguishes global parameters from driver-board parameters:
"key"→ global parameter"board.N.key"→ parameter of driver board N (N is the board number)client: Client handle.
key: Parameter name (case-sensitive, UTF-8 encoded), supports hierarchical naming.
value: Parameter value (string format; the server is responsible for type parsing).
Returns:
TI_OK— set successfullyReturns:
TI_ERR_NOT_CONNECTED— not connectedReturns:
TI_ERR_INVALID_ARG— client / key / value is NULLReturns:
TI_ERR_SERVER— the server rejected the parameter
Example:
// Global parameter
ti_set_parameter(cli, "print_speed", "100");
// Driver board #0 parameter
ti_set_parameter(cli, "board.0.print_speed", "80");
See also: ti_get_parameter()
ti_get_parameter
Get a parameter (single call).
The “two-call” pattern is no longer needed — the caller pre-allocates a buffer of at least TI_MAX_PARAM_VALUE bytes
and passes its capacity in buf_size; one call retrieves the parameter value.
The Key naming convention distinguishes global parameters from driver-board parameters (same as set).
client (input): Client handle.
key (input): Parameter name (UTF-8 encoded), supports hierarchical naming.
value_buf (output): Output buffer (pre-allocated by the caller).
buf_size (input): Capacity of value_buf in bytes. Recommended to be ≥
TI_MAX_PARAM_VALUE.Returns:
TI_OK— retrieved successfullyReturns:
TI_ERR_NOT_CONNECTED— not connectedReturns:
TI_ERR_INVALID_ARG— client / key / value_buf is NULLReturns:
TI_ERR_BUFFER_TOO_SMALL— buf_size is insufficient; the parameter value was truncatedReturns:
TI_ERR_SERVER— the server does not have this parameter
Example:
char buf[TI_MAX_PARAM_VALUE];
int rc = ti_get_parameter(cli, "print_speed", buf, sizeof(buf));
if (rc == TI_OK) printf("print_speed = %s\n", buf);
See also: ti_set_parameter()
See also: TI_MAX_PARAM_VALUE