feature:add C++ sample

This commit is contained in:
Livox-SDK
2019-07-31 17:09:41 +08:00
parent 4b97e69d3b
commit 28280005c1
13 changed files with 3798 additions and 11 deletions
+6
View File
@@ -28,6 +28,12 @@ std::shared_ptr<spdlog::logger> logger = NULL;
bool is_save_log_file = false;
void InitLogger() {
if (spdlog::get("console") != nullptr) {
logger = spdlog::get("console");
return;
}
std::vector<spdlog::sink_ptr> sinkList;
auto consoleSink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
consoleSink->set_level(spdlog::level::debug);
+15 -10
View File
@@ -110,15 +110,19 @@ void DeviceManager::UpdateDevices(const DeviceInfo &device, DeviceEvent type) {
connected_cb_(&device, type);
}
if ((device_mode_ == kDeviceModeHub) && (type == kEventConnect)) {
LOG_DEBUG("Send Query lidars command");
command_handler().SendCommand(kHubDefaultHandle,
kCommandSetHub,
kCommandIDHubQueryLidarInformation,
NULL,
0,
MakeCommandCallback<DeviceManager, HubQueryLidarInformationResponse>(
this, &DeviceManager::HubLidarInfomationCallback));
if (device_mode_ == kDeviceModeHub) {
if (type == kEventConnect) {
LOG_DEBUG("Send Query lidars command");
command_handler().SendCommand(kHubDefaultHandle,
kCommandSetHub,
kCommandIDHubQueryLidarInformation,
NULL,
0,
MakeCommandCallback<DeviceManager, HubQueryLidarInformationResponse>(
this, &DeviceManager::HubLidarInfomationCallback));
} else if (connected_cb_) {
connected_cb_(&device, type);
}
}
}
@@ -227,7 +231,8 @@ void DeviceManager::UpdateDeviceState(uint8_t handle, const HeartbeatResponse &r
update = true;
}
if (info.status.progress != response.error_union.progress) {
LOG_INFO(" Update progress {}, device connect {}", (uint16_t)response.error_union.progress, devices_[handle].connected);
LOG_INFO(
" Update progress {}, device connect {}", (uint16_t)response.error_union.progress, devices_[handle].connected);
info.status.progress = response.error_union.progress;
update = true;
}