fix: retry to query device info when command timeout
This commit is contained in:
@@ -160,6 +160,18 @@ void DeviceManager::HubLidarInfomationCallback(livox_status status, uint8_t, Hub
|
|||||||
if (connected_cb_) {
|
if (connected_cb_) {
|
||||||
connected_cb_(&(devices_[kHubDefaultHandle].info), kEventHubConnectionChange);
|
connected_cb_(&(devices_[kHubDefaultHandle].info), kEventHubConnectionChange);
|
||||||
}
|
}
|
||||||
|
} else if (status == kStatusTimeout) {
|
||||||
|
LOG_WARN("Query lidars information Timeout.");
|
||||||
|
if (IsDeviceConnected(kHubDefaultHandle)) {
|
||||||
|
LOG_INFO("Retry to query lidars information.");
|
||||||
|
command_handler().SendCommand(kHubDefaultHandle,
|
||||||
|
kCommandSetHub,
|
||||||
|
kCommandIDHubQueryLidarInformation,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
MakeCommandCallback<DeviceManager, HubQueryLidarInformationResponse>(
|
||||||
|
this, &DeviceManager::HubLidarInfomationCallback));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Failed to query lidars information connected to hub.");
|
LOG_ERROR("Failed to query lidars information connected to hub.");
|
||||||
}
|
}
|
||||||
@@ -178,6 +190,18 @@ void DeviceManager::QueryDeviceInformationCallback(livox_status status, uint8_t
|
|||||||
if (connected_cb_) {
|
if (connected_cb_) {
|
||||||
connected_cb_(&devices_[handle].info, kEventConnect);
|
connected_cb_(&devices_[handle].info, kEventConnect);
|
||||||
}
|
}
|
||||||
|
} else if (status == kStatusTimeout) {
|
||||||
|
LOG_WARN("Query lidar information Timeout.");
|
||||||
|
if (IsDeviceConnected(handle)) {
|
||||||
|
LOG_INFO("Retry to query lidar information.");
|
||||||
|
command_handler().SendCommand(handle,
|
||||||
|
kCommandSetGeneral,
|
||||||
|
kCommandIDGeneralDeviceInfo,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
MakeCommandCallback<DeviceManager, DeviceInformationResponse>(
|
||||||
|
this, &DeviceManager::QueryDeviceInformationCallback));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("Failed to query lidar information.");
|
LOG_ERROR("Failed to query lidar information.");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user