Skip to content

Commit

Permalink
add info logging of feature accesses
Browse files Browse the repository at this point in the history
proper connection to the correct pylonsrc obj
missing for now. requires further restructuring
  • Loading branch information
thiesmoeller authored and emmadrigal committed Mar 23, 2023
1 parent ed6e9e3 commit 20ee61e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
5 changes: 4 additions & 1 deletion ext/pylon/gstpylon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,11 @@ gboolean gst_pylon_set_configuration(GstPylon *self, const GstCaps *conf,

Pylon::CIntegerParameter width(nodemap, "Width");
width.SetValue(gst_width, Pylon::IntegerValueCorrection_None);
GST_INFO("Set Feature Width: %d", gst_width);

Pylon::CIntegerParameter height(nodemap, "Height");
height.SetValue(gst_height, Pylon::IntegerValueCorrection_None);
GST_INFO("Set Feature Height: %d", gst_height);

Pylon::CBooleanParameter framerate_enable(nodemap,
"AcquisitionFrameRateEnable");
Expand All @@ -804,13 +806,14 @@ gboolean gst_pylon_set_configuration(GstPylon *self, const GstCaps *conf,
framerate_enable.TrySetValue(true);

gdouble div = 1.0 * gst_numerator / gst_denominator;

if (self->camera->GetSfncVersion() >= Pylon::Sfnc_2_0_0) {
Pylon::CFloatParameter framerate(nodemap, "AcquisitionFrameRate");
framerate.TrySetValue(div, Pylon::FloatValueCorrection_None);
GST_INFO("Set Feature AcquisitionFrameRate: %f", div);
} else {
Pylon::CFloatParameter framerate(nodemap, "AcquisitionFrameRateAbs");
framerate.TrySetValue(div, Pylon::FloatValueCorrection_None);
GST_INFO("Set Feature AcquisitionFrameRateAbs: %f", div);
}

} catch (const Pylon::GenericException &e) {
Expand Down
18 changes: 17 additions & 1 deletion gst-libs/gst/pylon/gstpylonobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ static void gst_pylon_object_set_pylon_feature(GstPylonObjectPrivate* priv,
const gchar* name) {
P param(*priv->nodemap, name);
param.SetValue(get_value(value));
GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
}

template <>
Expand All @@ -223,6 +224,8 @@ void gst_pylon_object_set_pylon_feature<GGetInt64, Pylon::CIntegerParameter>(
Pylon::EIntegerValueCorrection::IntegerValueCorrection_Nearest);
} else
param.SetValue(get_value(value));

GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
}

template <>
Expand All @@ -240,6 +243,7 @@ void gst_pylon_object_set_pylon_feature<GGetDouble, Pylon::CFloatParameter>(
Pylon::EFloatValueCorrection::FloatValueCorrection_ClipToRange);
} else
param.SetValue(get_value(value));
GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
}

template <>
Expand All @@ -248,6 +252,7 @@ void gst_pylon_object_set_pylon_feature<GGetEnum, Pylon::CEnumParameter>(
const gchar* name) {
Pylon::CEnumParameter param(*priv->nodemap, name);
param.SetIntValue(get_value(value));
GST_INFO("Set Feature %s: %s", name, param.ToString().c_str());
}

/* Get gst property from pylon feature */
Expand All @@ -257,6 +262,7 @@ static void gst_pylon_object_get_pylon_feature(GenApi::INodeMap& nodemap,
const gchar* name) {
P param(nodemap, name);
set_value(value, param.GetValue());
GST_DEBUG("Get Feature %s: %s", name, param.ToString().c_str());
}

template <>
Expand All @@ -265,6 +271,7 @@ void gst_pylon_object_get_pylon_feature<GSetEnum, Pylon::CEnumParameter>(
const gchar* name) {
Pylon::CEnumParameter param(nodemap, name);
set_value(value, param.GetIntValue());
GST_DEBUG("Get Feature %s: %s", name, param.ToString().c_str());
}

template <>
Expand All @@ -273,6 +280,7 @@ void gst_pylon_object_get_pylon_feature<GSetString, Pylon::CStringParameter>(
const gchar* name) {
Pylon::CStringParameter param(nodemap, name);
set_value(value, param.GetValue().c_str());
GST_DEBUG("Get Feature %s: %s", name, param.ToString().c_str());
}

void gst_pylon_object_set_pylon_selector(GenApi::INodeMap& nodemap,
Expand All @@ -283,9 +291,15 @@ void gst_pylon_object_set_pylon_selector(GenApi::INodeMap& nodemap,
switch (selector_type) {
case GenApi::intfIEnumeration:
Pylon::CEnumParameter(nodemap, selector_name).SetIntValue(selector_value);
GST_INFO(
"Set Selector-Feature %s: %s", selector_name,
Pylon::CEnumParameter(nodemap, selector_name).ToString().c_str());
break;
case GenApi::intfIInteger:
Pylon::CIntegerParameter(nodemap, selector_name).SetValue(selector_value);
GST_INFO(
"Set Selector-Feature %s: %s", selector_name,
Pylon::CIntegerParameter(nodemap, selector_name).ToString().c_str());
break;
default:
std::string error_msg = "Selector \"" + std::string(selector_name) +
Expand All @@ -300,7 +314,9 @@ template <typename T, typename P>
static T gst_pylon_object_get_pylon_property(GenApi::INodeMap& nodemap,
const gchar* name) {
P param(nodemap, name);
return param.GetValue();
T val = param.GetValue();
GST_DEBUG("Get Feature %s: %s", name, param.ToString().c_str());
return val;
}

template <typename F, typename P>
Expand Down

0 comments on commit 20ee61e

Please sign in to comment.