py: Add bindings for ControlId vendor information

Add python bindings for quering vendor information from a ControlId.
While at it, update __repr__ so that it also prints the vendor.

Example usage:
>>> cid
libcamera.ControlId(20, libcamera.Saturation, ControlType.Float)
>>> cid.vendor
'libcamera'

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Paul Elder 2024-10-16 20:19:43 +09:00 committed by Laurent Pinchart
parent b777d8272a
commit 79893cc00f

View file

@ -399,11 +399,12 @@ PYBIND11_MODULE(_libcamera, m)
pyControlId
.def_property_readonly("id", &ControlId::id)
.def_property_readonly("name", &ControlId::name)
.def_property_readonly("vendor", &ControlId::vendor)
.def_property_readonly("type", &ControlId::type)
.def("__str__", [](const ControlId &self) { return self.name(); })
.def("__repr__", [](const ControlId &self) {
return py::str("libcamera.ControlId({}, {}, {})")
.format(self.id(), self.name(), self.type());
return py::str("libcamera.ControlId({}, {}.{}, {})")
.format(self.id(), self.vendor(), self.name(), self.type());
})
.def("enumerators", &ControlId::enumerators);