For information on the latest version, please have a look at 1.33.5.
TOnMonitoringAccessControlCB
This callback monitors control authority (access control) changes in the robot controller. It is triggered when a control right event occurs, such as request, permission, or rejection of control ownership.
See Rules for callback functions.
Defined in: DRFLEx.h
// typedef (DRFL.h)
typedef void (*TOnMonitoringAccessControlCB)(const MONITORING_ACCESS_CONTROL);
// internal definition
DRFL_API void _set_on_monitoring_access_control(LPROBOTCONTROL pCtrl, TOnMonitoringAccessControlCB pCallbackFunc);
// user-callable API
void set_on_monitoring_access_control(TOnMonitoringAccessControlCB pCallbackFunc)
{
_set_on_monitoring_access_control(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
eAccCtrl |
Represents the access control event state (e.g., REQUEST, PERMISSION, REJECTION). |
Return
None
Example
#include "DRFLEx.h"
#include <iostream>
#include <thread>
#include <chrono>
using namespace DRAFramework;
using namespace std;
CDRFLEx drfl;
// Callback executed on access control event
void OnMonitoringAccessControlCB(const MONITORING_ACCESS_CONTROL eAccCtrl)
{
cout << "[ACCESS CONTROL EVENT]" << endl;
switch (eAccCtrl)
{
case MONITORING_ACCESS_CONTROL_REQUEST:
cout << "Received control transfer request." << endl;
// Example: accept the request so that the requester (for example the teach pendant) gets control
drfl.manage_access_control(MANAGE_ACCESS_CONTROL_RESPONSE_YES);
break;
case MONITORING_ACCESS_CONTROL_GRANT:
cout << "Control has been granted." << endl;
break;
case MONITORING_ACCESS_CONTROL_DENY:
cout << "Control request has been denied." << endl;
break;
default:
cout << "Unknown access control state (" << (int)eAccCtrl << ")" << endl;
break;
}
}
int main()
{
// Connect to robot controller
if (!drfl.open_connection("192.168.137.100")) {
cout << "Failed to connect to controller." << endl;
return -1;
}
// Register callback for access control events
drfl.set_on_monitoring_access_control(OnMonitoringAccessControlCB);
// Keep monitoring
while (true)
std::this_thread::sleep_for(std::chrono::seconds(1));
drfl.close_connection();
return 0;
}
Notes
This callback is triggered by the robot controller when:
- Another device or user requests control transfer.
- The controller grants or denies control authority.The parameter MONITORING_ACCESS_CONTROL indicates the event type.
Common use cases:
- Automatically rejecting external control requests.
- Logging or alerting operators about control state changes.
- Handling cooperative robot operation environments.Control authority is handed over only on request. When another client (for example the teach pendant) requests control, the holder receives MONITORING_ACCESS_CONTROL_REQUEST in TOnMonitoringAccessControlCB. When another client sends MANAGE_ACCESS_CONTROL_REQUEST, authority moves only if the holder answers manage_access_control(MANAGE_ACCESS_CONTROL_RESPONSE_YES); the requester then receives GRANT and the holder LOSS. If the holder answers MANAGE_ACCESS_CONTROL_RESPONSE_NO or does not answer, the requester does not get control, and further requests are not forwarded while the first one is pending. There is no function to give up control without a request. manage_access_control returns as soon as the request is made; the outcome arrives later in TOnMonitoringAccessControlCB. If your application must let the teach pendant take over, answer REQUEST with RESPONSE_YES. A client that sends MANAGE_ACCESS_CONTROL_FORCE_REQUEST takes control without an answer.