.. _cb_tonmonitoringrobotsystemcb: TOnMonitoringRobotSystemCB ------------------------------------------ This callback is executed when the **robot operation system** changes in the robot controller. It allows you to monitor transitions between the Real Robot and Virtual Robot system modes. See :ref:`Rules for callback functions `. **Defined in:** ``DRFLEx.h`` .. code-block:: cpp // typedef (DRFLEx.h) typedef void (*TOnMonitoringRobotSystemCB)(const ROBOT_SYSTEM); // internal definition DRFL_API void _set_on_monitoring_robot_system(LPROBOTCONTROL pCtrl, TOnMonitoringRobotSystemCB pCallbackFunc); // user-callable wrapper void set_on_monitoring_robot_system(TOnMonitoringRobotSystemCB pCallbackFunc) { _set_on_monitoring_robot_system(_rbtCtrl, pCallbackFunc); }; **Parameter** .. list-table:: :header-rows: 1 :widths: 20 25 15 40 * - Parameter Name - Data Type - Default Value - Description * - eRobotSystem - :ref:`ROBOT_SYSTEM ` - - - Indicates the current robot operation system (ROBOT_SYSTEM_REAL or ROBOT_SYSTEM_VIRTUAL). **Return** |br| None **Example** .. code-block:: cpp #include "DRFLEx.h" #include #include #include using namespace DRAFramework; using namespace std; // Callback executed when robot operation system changes void OnMonitoringRobotSystemCB(const ROBOT_SYSTEM eSystem) { cout << "[ROBOT SYSTEM STATE UPDATED]" << endl; switch (eSystem) { case ROBOT_SYSTEM_REAL: cout << "Robot system: REAL ROBOT — connected to physical hardware." << endl; break; case ROBOT_SYSTEM_VIRTUAL: cout << "Robot system: VIRTUAL ROBOT — operating in virtual mode." << endl; break; default: cout << "Robot system: UNKNOWN (" << (int)eSystem << ")" << endl; break; } } 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 callback for robot system monitoring drfl.set_on_monitoring_robot_system(OnMonitoringRobotSystemCB); // Keep monitoring loop alive while (true) std::this_thread::sleep_for(std::chrono::seconds(1)); drfl.close_connection(); return 0; } **Notes** - Triggered when the controller changes between: |br| - **Real Robot (ROBOT_SYSTEM_REAL)** |br| - **Virtual Robot (ROBOT_SYSTEM_VIRTUAL)** |br| - Common uses: |br| - Displaying current system mode in UI |br| - Logging system transitions |br| - Automatically adapting control logic to match system type |br|