.. _get_program_state: get_program_state ------------------------------------------ Returns the state of the program started by this CDRFLEx instance: ``DRL_PROGRAM_STATE_LAST`` after connecting, ``DRL_PROGRAM_STATE_PLAY`` after ``drl_start``, ``DRL_PROGRAM_STATE_HOLD`` and ``DRL_PROGRAM_STATE_PLAY`` after ``drl_pause`` and ``drl_resume``, ``DRL_PROGRAM_STATE_STOP`` when the controller reports that the program stopped. Programs started from the teach pendant or another client are not reflected. ``DRL_PROGRAM_STATE_PLAY`` does not confirm that the controller started the program. **Definition** |br| ``DRFLEx.h`` within class `CDRFLEx`, public section .. code-block:: cpp DRL_PROGRAM_STATE get_program_state() { return _get_program_state(_rbtCtrl); }; **Parameter** |br| None **Return** .. list-table:: :widths: 25 75 :header-rows: 1 * - **Value** - **Description** * - :ref:`DRL_PROGRAM_STATE ` - Refer to the Definition of Enumeration Type **Example** .. code-block:: cpp if (drfl.get_program_state() == DRL_PROGRAM_STATE_PLAY) { // Stops the program execution state drfl.drl_stop(STOP_TYPE_QUICK); } else if (drfl.get_program_state() == DRL_PROGRAM_STATE_HOLD) { // Resumes the program execution state drfl.drl_resume(); } This example checks the **current DRL program execution state**. If the program is in *PLAY* state, it stops execution using `drl_stop()`. If it is in *HOLD* state, it resumes execution with `drl_resume()`. This allows precise monitoring and control of program flow in **Auto mode**.