.. _cb_tontpprogresscb: TOnTpProgressCB ------------------------------------------ This callback is triggered when a DRL program reports its progress with ``tp_progress``. Use it to track or display the progress of the DRL program. See :ref:`Rules for callback functions `. **Defined in:** ``DRFLEx.h`` .. code-block:: cpp // typedef (DRFLEx.h) typedef void (*TOnTpProgressCB)(LPMESSAGE_PROGRESS); // registration API (internal + wrapper) DRFL_API void _set_on_tp_progress(LPROBOTCONTROL pCtrl, TOnTpProgressCB pCallbackFunc); // tp progress message callback void set_on_tp_progress(TOnTpProgressCB pCallbackFunc) { _set_on_tp_progress(_rbtCtrl, pCallbackFunc); }; **Parameter** .. list-table:: :header-rows: 1 :widths: 20 25 15 40 * - Parameter Name - Data Type - Default Value - Description * - tProgress - :ref:`MESSAGE_PROGRESS ` - - - Pointer to the progress data: ``_iCurrentCount`` is the current step and ``_iTotalCount`` the total number of steps. **Return** |br| None **Example** .. code-block:: cpp #include "DRFLEx.h" #include #include #include using namespace DRAFramework; using namespace std; // Callback triggered when a DRL program reports its progress void OnTpProgressCB(LPMESSAGE_PROGRESS tProgress) { if (!tProgress) return; cout << "[TP PROGRESS]" << endl; cout << "Progress : " << static_cast(tProgress->_iCurrentCount) << " / " << static_cast(tProgress->_iTotalCount) << endl; // Example: stop monitoring when a process completes if (tProgress->_iCurrentCount == tProgress->_iTotalCount) cout << "[INFO] Execution completed successfully!" << endl; } int main() { CDRFLEx drfl; // Connect to robot controller if (!drfl.open_connection("192.168.137.100")) { cout << "Failed to connect to controller." << endl; return -1; } // Register T/P progress callback drfl.set_on_tp_progress(OnTpProgressCB); // Keep alive to continuously receive progress updates while (true) std::this_thread::sleep_for(std::chrono::seconds(1)); drfl.close_connection(); return 0; } **Notes** - Triggered whenever a DRL program calls ``tp_progress``. - The :ref:`MESSAGE_PROGRESS ` structure contains the current step (``_iCurrentCount``) and the total number of steps (``_iTotalCount``). - Ideal for implementing **custom progress bars**, **execution monitors**, or **log tracking systems**.