Print Workflow

This workflow describes how an application uploads print data and starts printing.

Sequence

  1. Register and start event notifications.
  2. Upload at least one set of print data.
  3. Send the start-print command.
  4. Wait for the print-start result notification.

Starting event notifications and uploading print data both return before the final print result is available.

Retry Guidance

  • If the start-print command fails, wait one second and retry.
  • Limit the total retry period to ten seconds.
  • After the start command succeeds, wait up to ten seconds for the print-start result.

Result Handling

ResultApplication behavior
Start accepted, result successEnter the printable state
Start accepted, result failureShow the failure message and stop the flow
No result within ten secondsReport a start-result timeout
Data upload failedStop the flow and report the upload error

C Example

void on_event(const char *event_json, void *user_data)
{
    (void)event_json;
    (void)user_data;
    /* Update the print workflow state. */
}

ti_set_event_callback(cli, on_event, NULL);
ti_start_event_subscription(cli);

if (ti_set_print_data(cli, print_data, print_data_len, 0) != TI_OK) {
    return;
}

int rc = ti_print_control(cli, "START_PRINT");
if (rc != TI_OK) {
    /* Wait one second and retry within the total timeout. */
}

Integration Notes

  • Use uppercase command keys such as "START_PRINT".
  • Do not treat print-data upload success as proof that the device is ready.
  • Use the print-start result notification as the final startup result.
  • Event callbacks must not block for long periods.