You're reading the documentation for an older, but still supported version (1.33.4).
For information on the latest version, please have a look at 1.33.5.

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
DRFLEx.h within class CDRFLEx, public section

DRL_PROGRAM_STATE get_program_state() {
    return _get_program_state(_rbtCtrl);
};

Parameter
None

Return

Value

Description

DRL_PROGRAM_STATE

Refer to the Definition of Enumeration Type

Example

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.