.. _cb_tonmonitoringctrliocb: TOnMonitoringCtrlIOCB ------------------------------------------ This callback function is used to check the **state data** of the I/O installed in the control box of the robot controller. It provides access to digital and analog input/output values of the robot system in real time. See :ref:`Rules for callback functions `. **Defined in:** ``DRFLEx.h`` .. code-block:: cpp // typedef (DRFL.h) typedef void (*TOnMonitoringCtrlIOCB)(const LPMONITORING_CTRLIO); // registration API (internal + wrapper) DRFL_API void _set_on_monitoring_ctrl_io(LPROBOTCONTROL pCtrl, TOnMonitoringCtrlIOCB pCallbackFunc); void set_on_monitoring_ctrl_io(TOnMonitoringCtrlIOCB pCallbackFunc) { _set_on_monitoring_ctrl_io(_rbtCtrl, pCallbackFunc); }; **Parameter** .. list-table:: :header-rows: 1 :widths: 20 25 15 40 * - Parameter Name - Data Type - Default Value - Description * - pCtrlIO - :ref:`MONITORING_CTRLIO ` - - - Pointer to structure containing digital and analog I/O state data. **Return** |br| None **Example** .. code-block:: cpp #include "DRFLEx.h" #include #include #include using namespace DRAFramework; using namespace std; // Callback function triggered when controller I/O state changes void OnMonitoringCtrlIOCB(const LPMONITORING_CTRLIO pCtrlIO) { cout << "[I/O MONITOR] Digital input state:" << endl; for (int i = 0; i < NUM_DIGITAL; ++i) { cout << "DI#" << i << " : " << static_cast(pCtrlIO->_tInput._iActualDI[i]) << endl; } cout << "[I/O MONITOR] Digital output state:" << endl; for (int i = 0; i < NUM_DIGITAL; ++i) { cout << "DO#" << i << " : " << static_cast(pCtrlIO->_tOutput._iTargetDO[i]) << endl; } } int main() { CDRFLEx drfl; // Connect to the robot controller if (!drfl.open_connection("192.168.137.100")) { cout << "Failed to connect to controller." << endl; return -1; } // Register callback for I/O monitoring drfl.set_on_monitoring_ctrl_io(OnMonitoringCtrlIOCB); // Keep program alive to monitor I/O events while (true) { std::this_thread::sleep_for(std::chrono::seconds(1)); } drfl.close_connection(); return 0; } **Notes** - The callback provides real-time **digital/analog I/O values** from the robot controller. - Commonly used to monitor **sensor inputs**, **signal feedback**, or **tool I/O state**. - For extended versions with more detailed data, refer to :ref:`TOnMonitoringCtrlIOExCB ` and :ref:`TOnMonitoringCtrlIOEx2CB `. - Each callback receives the most recent data. If the callback takes longer than the data period (100 ms before DRCF 3.5, 20 ms from DRCF 3.5), intermediate samples are not delivered. Do not rely on receiving every sample (for example for integration or differentiation).