set_on_disconnected
This is a function for registering the callback function that automatically checks if the connection with the robot controller has been terminated by external force or user. It is useful when functions that should be executed automatically are made.
Definition
DRFLEx.h within class CDRFLEx, public section (line 655)
void set_on_disconnected(TOnDisconnectedCB pCallbackFunc) {
_set_on_disconnected(_rbtCtrl, pCallbackFunc);
};
Parameter
Parameter Name |
Data Type |
Default Value |
Description |
|---|---|---|---|
pCallbackFunc |
Refer to definition of callback function |
Return
None
Example
void OnDisconnectedCB()
{
// Needs the reconnection of the robot controller and error handling
}
int main()
{
drfl.set_on_disconnected(OnDisconnectedCB);
}
When registered, this callback function executes automatically when the connection between the robot controller and the client is lost. It allows the user to implement reconnection logic or error recovery procedures for stable operation in external environments.