#include #include #include #include #include #include namespace lcamera_dev { std::string locationPropertyToLabel(int32_t locationValue) { using namespace libcamera::properties; if (locationValue == CameraLocationFront) { return "front"; } if (locationValue == CameraLocationBack) { return "back"; } if (locationValue == CameraLocationExternal) { return "external"; } return ""; } CameraIdentityRecord buildIdentityRecord( const std::shared_ptr& camera) { CameraIdentityRecord record; record.id = camera->id(); const libcamera::ControlList& props = camera->properties(); const std::optional model = props.get(libcamera::properties::Model); if (model) { record.model.assign(model->begin(), model->end()); } const std::optional location = props.get(libcamera::properties::Location); if (location) { record.locationLabel = locationPropertyToLabel(*location); } return record; } std::vector buildIdentityRecords( const std::vector>& cameras) { std::vector records; records.reserve(cameras.size()); for (const auto& camera : cameras) { if (!camera) { continue; } records.push_back(buildIdentityRecord(camera)); } return records; } } // namespace lcamera_dev