For information on the latest version, please have a look at 1.33.5.
TOnLogAlarmCB
This callback is triggered whenever an alarm or log event is generated by the robot controller.
It provides detailed information such as the alarm group, level, and parameters that describe the nature of the warning, error, or system message.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFL.h)
typedef void (*TOnLogAlarmCB)(LPLOG_ALARM);
// registration API (internal + wrapper)
DRFL_API void _set_on_log_alarm(LPROBOTCONTROL pCtrl, TOnLogAlarmCB pCallbackFunc);
// robot alarm data callback
void set_on_log_alarm(TOnLogAlarmCB pCallbackFunc)
{
_set_on_log_alarm(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
pLogAlarm |
Pointer to the structure containing alarm group, level, index, and parameter details. |
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
// Callback function that handles alarm and log messages
void OnLogAlarmCB(LPLOG_ALARM pLogAlarm)
{
if (!pLogAlarm) return;
cout << "\n[ROBOT ALARM CALLBACK]" << endl;
cout << "Group : " << pLogAlarm->_iGroup << " ("
<< ((pLogAlarm->_iGroup == LOG_GROUP_SYSTEMFMK) ? "System" : "Other") << ")" << endl;
cout << "Level : " << pLogAlarm->_iLevel << endl;
cout << "Index : " << pLogAlarm->_iIndex << endl;
cout << "Parameters : ";
for (int i = 0; i < 3; ++i)
cout << pLogAlarm->_szParam[i] << (i < 2 ? ", " : "");
cout << endl;
// Example filtering: handle only critical alarms
if (pLogAlarm->_iLevel == LOG_LEVEL_SYSINFO)
cout << "[INFO] System message logged." << 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 the alarm/log callback
drfl.set_on_log_alarm(OnLogAlarmCB);
// Keep program alive to monitor logs
while (true)
std::this_thread::sleep_for(std::chrono::seconds(1));
drfl.close_connection();
return 0;
}
Notes
Triggered automatically when a system log or alarm is generated.
The LOG_ALARM structure provides details such as alarm group, level, index, and parameters.
Common uses:
- Logging or displaying alarm history
- Detecting critical errors or warnings
- Implementing custom fault-recovery logicAn alarm index is unique only within its group. Always match the pair (group, index); the same index has different meanings in different groups.
The controller identifies each alarm by its group and index. DART Studio shows the message of each alarm it receives while connected, and the alarm search on the Doosan Robotics service portal describes every alarm code.