mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-18 14:00:35 +08:00
uavcan: add IOCTL interface for queryiung node discovery progress
This commit is contained in:
committed by
Lorenz Meier
parent
efd4552e37
commit
59ee9ea1ae
@@ -1121,6 +1121,24 @@ UavcanNode::ioctl(file *filp, int cmd, unsigned long arg)
|
||||
}
|
||||
break;
|
||||
|
||||
case UAVCAN_IOCG_NODEID_INPROGRESS: {
|
||||
UavcanServers *_servers = UavcanServers::instance();
|
||||
|
||||
if (_servers == nullptr) {
|
||||
// status unavailable
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
} else if (_servers->guessIfAllDynamicNodesAreAllocated()) {
|
||||
// node discovery complete
|
||||
ret = -ETIME;
|
||||
break;
|
||||
} else {
|
||||
// node discovery in progress
|
||||
ret = OK;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
ret = -ENOTTY;
|
||||
break;
|
||||
|
||||
@@ -100,6 +100,8 @@ public:
|
||||
|
||||
void requestCheckAllNodesFirmwareAndUpdate() { _check_fw = true; }
|
||||
|
||||
bool guessIfAllDynamicNodesAreAllocated() { return _server_instance.guessIfAllDynamicNodesAreAllocated(); }
|
||||
|
||||
private:
|
||||
pthread_t _subnode_thread;
|
||||
pthread_mutex_t _subnode_mutex;
|
||||
|
||||
Reference in New Issue
Block a user