set_on_log_alarm

This function registers a callback that automatically monitors and processes alarm and log information generated by the robot controller. It is particularly useful for implementing event-driven responses to system warnings, errors, or informational messages.

Definition
DRFLEx.h within class CDRFLEx, public section (line 637)

void set_on_log_alarm(TOnLogAlarmCB pCallbackFunc) {
    _set_on_log_alarm(_rbtCtrl, pCallbackFunc);
};

Parameter

Parameter Name

Data Type

Default Value

Description

pCallbackFunc

TOnLogAlarmCB

Callback function pointer triggered when an alarm or log is generated by the controller.

Return
None

Example

void OnLogAlarmCB(LPLOG_ALARM pLogAlarm)
{
    switch(pLogAlarm->_iGroup)
    {
        case LOG_GROUP_SYSTEMFRMK:
            switch(pLogAlarm->_iLevel)
            {
                case LOG_LEVEL_SYSINFO:
                    cout << "Index(" << pLogAlarm->_iIndex << "), ";
                    cout << "Param0: " << pLogAlarm->_szParam[0] << ", ";
                    cout << "Param1: " << pLogAlarm->_szParam[1] << ", ";
                    cout << "Param2: " << pLogAlarm->_szParam[2] << endl;
                    break;
                default:
                    break;
            }
            break;
        default:
            break;
    }
}

int main()
{
    drfl.set_on_log_alarm(OnLogAlarmCB);
}

When this function is registered, the callback OnLogAlarmCB() is automatically invoked whenever an alarm or system log occurs in the controller. It prints the alarm index and parameters to the console, allowing developers to track detailed event information for debugging or monitoring purposes.