set_on_tp_progress

This function is used to register the callback function to check the information of the execution step when the tp_progress command is used in DRL. Use it to run your own code automatically when this event occurs.

Definition
DRFLEx.h within class CDRFLEx, public section

void set_on_tp_progress(TOnTpProgressCB pCallbackFunc) {
    _set_on_tp_progress(_rbtCtrl, pCallbackFunc);
};

Parameter

Parameter Name

Data Type

Default Value

Description

pCallbackFunc

TOnTpProgressCB

Refer to definition of callback function

Return
None

Example

// Callback function for TP progress updates
void OnTpProgress(LPMESSAGE_PROGRESS tProgress)
{
    printf("-------------------------------------------\n");
    printf("[TP PROGRESS UPDATE]\n");
    printf("Current Step : %d / %d\n", tProgress->_iCurrentCount, tProgress->_iTotalCount);
    printf("-------------------------------------------\n");

    // Example: report completion when the last step is reached
    if (tProgress->_iCurrentCount >= tProgress->_iTotalCount)
        printf("[Host] Operation completed successfully.\n");
}

// Register the progress callback
drfl.set_on_tp_progress(OnTpProgress);

printf("Monitoring TP progress updates...\n");
while (true)
{
    this_thread::sleep_for(chrono::seconds(1));
}

When registered, this callback function executes automatically when a progress message is reported from the Teach Pendant (TP). It helps track the current and total step count to provide live task progress monitoring.