apps: cam: Print enum string for camera properties

Some camera properties might be set as a enumeration for e.g.
properties::Location. Instead of printing the int32_t values
for the enumeration, print the enum string as well. This will
enhance the readability for the user.

Signed-off-by: Umang Jain <uajain@igalia.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Umang Jain
2025-07-21 18:18:26 +05:30
committed by Kieran Bingham
parent 92df79112f
commit c7c40ed1a3
+11 -1
View File
@@ -236,7 +236,17 @@ void CameraSession::listProperties() const
const ControlId *id = properties::properties.at(key);
std::cout << "Property: " << id->name() << " = "
<< value.toString() << std::endl;
<< value.toString();
if (!id->enumerators().empty()) {
int32_t val = value.get<int32_t>();
const auto &iter = id->enumerators().find(val);
if (iter != id->enumerators().end())
std::cout << " (" << iter->second << ")";
}
std::cout << std::endl;
}
}