style(api): change sdk version api
This commit is contained in:
		
							parent
							
								
									2896e00acf
								
							
						
					
					
						commit
						3b22fa3abc
					
				@ -187,7 +187,10 @@ class MYNTEYE_API API {
 | 
			
		||||
   * Get the device info.
 | 
			
		||||
   */
 | 
			
		||||
  std::string GetInfo(const Info &info) const;
 | 
			
		||||
 | 
			
		||||
  /**
 | 
			
		||||
   * Get the sdk version.
 | 
			
		||||
   */
 | 
			
		||||
  std::string GetSDKVersion() const;
 | 
			
		||||
  /**
 | 
			
		||||
   * @deprecated Get the intrinsics (pinhole) of stream.
 | 
			
		||||
   */
 | 
			
		||||
 | 
			
		||||
@ -126,8 +126,6 @@ enum class Info : std::uint8_t {
 | 
			
		||||
  AUXILIARY_CHIP_VERSION,
 | 
			
		||||
  /** Isp version */
 | 
			
		||||
  ISP_VERSION,
 | 
			
		||||
  /** SDK version*/
 | 
			
		||||
  SDK_VERSION,
 | 
			
		||||
  /** Last guard */
 | 
			
		||||
  LAST
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@ -328,23 +328,23 @@ std::shared_ptr<DeviceInfo> API::GetInfo() const {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string API::GetInfo(const Info &info) const {
 | 
			
		||||
  if (info == Info::SDK_VERSION) {
 | 
			
		||||
    std::string info_path =
 | 
			
		||||
        utils::get_sdk_install_dir();
 | 
			
		||||
    info_path.append(MYNTEYE_OS_SEP "share" \
 | 
			
		||||
        MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
 | 
			
		||||
 | 
			
		||||
    cv::FileStorage fs(info_path, cv::FileStorage::READ);
 | 
			
		||||
    if (!fs.isOpened()) {
 | 
			
		||||
      LOG(WARNING) << "build.info not found: " << info_path;
 | 
			
		||||
      return "null";
 | 
			
		||||
    }
 | 
			
		||||
    return fs["MYNTEYE_VERSION"];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return device_->GetInfo(info);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
std::string API::GetSDKVersion() const {
 | 
			
		||||
  std::string info_path =
 | 
			
		||||
      utils::get_sdk_install_dir();
 | 
			
		||||
  info_path.append(MYNTEYE_OS_SEP "share" \
 | 
			
		||||
      MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
 | 
			
		||||
 | 
			
		||||
  cv::FileStorage fs(info_path, cv::FileStorage::READ);
 | 
			
		||||
  if (!fs.isOpened()) {
 | 
			
		||||
    LOG(WARNING) << "build.info not found: " << info_path;
 | 
			
		||||
    return "null";
 | 
			
		||||
  }
 | 
			
		||||
  return fs["MYNTEYE_VERSION"];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
IntrinsicsPinhole API::GetIntrinsics(const Stream &stream) const {
 | 
			
		||||
  auto in = GetIntrinsicsBase(stream);
 | 
			
		||||
  if (in->calib_model() == CalibrationModel::PINHOLE) {
 | 
			
		||||
 | 
			
		||||
@ -385,8 +385,6 @@ void Synthetic::InitProcessors() {
 | 
			
		||||
  processors_.push_back(points_processor);
 | 
			
		||||
  processors_.push_back(depth_processor);
 | 
			
		||||
  using namespace std::placeholders;  // NOLINT
 | 
			
		||||
  root_processor->SetProcessCallback(
 | 
			
		||||
      std::bind(&Synthetic::OnDeviceProcess, this, _1, _2, _3));
 | 
			
		||||
  rectify_processor->SetProcessCallback(
 | 
			
		||||
      std::bind(&Synthetic::OnRectifyProcess, this, _1, _2, _3));
 | 
			
		||||
  disparity_processor->SetProcessCallback(
 | 
			
		||||
@ -398,8 +396,6 @@ void Synthetic::InitProcessors() {
 | 
			
		||||
  depth_processor->SetProcessCallback(
 | 
			
		||||
      std::bind(&Synthetic::OnDepthProcess, this, _1, _2, _3));
 | 
			
		||||
 | 
			
		||||
  root_processor->SetPostProcessCallback(
 | 
			
		||||
      std::bind(&Synthetic::OnDevicePostProcess, this, _1));
 | 
			
		||||
  rectify_processor->SetPostProcessCallback(
 | 
			
		||||
      std::bind(&Synthetic::OnRectifyPostProcess, this, _1));
 | 
			
		||||
  disparity_processor->SetPostProcessCallback(
 | 
			
		||||
 | 
			
		||||
@ -113,7 +113,7 @@ STATUS_UNIT checkUnit(const std::string& sdkv,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool checkFirmwareVersion(const std::shared_ptr<API> api) {
 | 
			
		||||
  auto sdkv = api->GetInfo(Info::SDK_VERSION);
 | 
			
		||||
  auto sdkv = api->GetSDKVersion();
 | 
			
		||||
  auto devn = api->GetInfo(Info::DEVICE_NAME);
 | 
			
		||||
  auto firmv = api->GetInfo(Info::FIRMWARE_VERSION);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user