[aravis] genicam: implement is_locked.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis] genicam: implement is_locked.
- Date: Thu, 5 Apr 2012 13:21:26 +0000 (UTC)
commit c2fd127dfe09e59a6fbcb7686d5ff9a2ee3fb204
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Thu Apr 5 15:20:23 2012 +0200
genicam: implement is_locked.
Still not actually used when writing nodes.
docs/reference/aravis/aravis-sections.txt | 3 ++
src/arv-fake-camera.xml | 8 +++++++
src/arvgc.c | 2 +
src/arvgcenumeration.c | 6 +++-
src/arvgcfeaturenode.c | 31 +++++++++++++++++++++++++---
src/arvgcfeaturenode.h | 2 +
src/arvgcpropertynode.c | 8 +++++++
src/arvgcpropertynode.h | 2 +
src/arvgvdevice.c | 18 ++++++++++++++--
src/arvtool.c | 15 +++++++++----
tests/data/genicam.xml | 8 +++++++
tests/genicam.c | 21 +++++++++++++++++++
12 files changed, 110 insertions(+), 14 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 73c8533..ba86601 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -233,6 +233,7 @@ arv_gc_property_node_new_p_feature
arv_gc_property_node_new_p_increment
arv_gc_property_node_new_p_is_available
arv_gc_property_node_new_p_is_implemented
+arv_gc_property_node_new_p_is_locked
arv_gc_property_node_new_p_length
arv_gc_property_node_new_p_maximum
arv_gc_property_node_new_p_minimum
@@ -327,6 +328,8 @@ arv_gc_feature_node_get_description
arv_gc_feature_node_is_available
arv_gc_feature_node_inc_modification_count
arv_gc_feature_node_get_modification_count
+arv_gc_feature_node_is_implemented
+arv_gc_feature_node_is_locked
<SUBSECTION Standard>
ARV_GC_FEATURE_NODE
ARV_IS_GC_FEATURE_NODE
diff --git a/src/arv-fake-camera.xml b/src/arv-fake-camera.xml
index 30ea1e5..9b40d9c 100644
--- a/src/arv-fake-camera.xml
+++ b/src/arv-fake-camera.xml
@@ -454,6 +454,14 @@
<Formula>WIDTH * HEIGHT</Formula>
</IntSwissKnife>
+ <Integer Name="TLParamsLocked">
+ <ToolTip> Indicates whether a live grab is under way</ToolTip>
+ <Visibility>Invisible</Visibility>
+ <Value>0</Value>
+ <Min>0</Min>
+ <Max>1</Max>
+ </Integer>
+
<!-- Debug -->
<Category Name="Debug" NameSpace="Standard">
diff --git a/src/arvgc.c b/src/arvgc.c
index e931734..5195d34 100644
--- a/src/arvgc.c
+++ b/src/arvgc.c
@@ -150,6 +150,8 @@ arv_gc_create_element (ArvDomDocument *document, const char *tag_name)
node = arv_gc_property_node_new_p_is_implemented ();
else if (strcmp (tag_name, "pIsAvailable") == 0)
node = arv_gc_property_node_new_p_is_available ();
+ else if (strcmp (tag_name, "pIsLocked") == 0)
+ node = arv_gc_property_node_new_p_is_locked ();
else if (strcmp (tag_name, "Length") == 0)
node = arv_gc_property_node_new_length ();
else if (strcmp (tag_name, "pLength") == 0)
diff --git a/src/arvgcenumeration.c b/src/arvgcenumeration.c
index cb7780d..9187039 100644
--- a/src/arvgcenumeration.c
+++ b/src/arvgcenumeration.c
@@ -165,7 +165,8 @@ arv_gc_enumeration_get_available_int_values (ArvGcEnumeration *enumeration, guin
*n_values = 0;
for (iter = entries; iter != NULL; iter = iter->next)
- if (arv_gc_feature_node_is_available (iter->data))
+ if (arv_gc_feature_node_is_available (iter->data) &&
+ arv_gc_feature_node_is_implemented (iter->data))
(*n_values)++;
if (*n_values == 0)
@@ -173,7 +174,8 @@ arv_gc_enumeration_get_available_int_values (ArvGcEnumeration *enumeration, guin
values = g_new (gint64, *n_values);
for (iter = entries, i = 0; iter != NULL; iter = iter->next)
- if (arv_gc_feature_node_is_available (iter->data)) {
+ if (arv_gc_feature_node_is_available (iter->data) &&
+ arv_gc_feature_node_is_implemented (iter->data)) {
values[i] = arv_gc_enum_entry_get_value (iter->data);
i++;
}
diff --git a/src/arvgcfeaturenode.c b/src/arvgcfeaturenode.c
index 5fa26da..3d1b1db 100644
--- a/src/arvgcfeaturenode.c
+++ b/src/arvgcfeaturenode.c
@@ -47,6 +47,7 @@ struct _ArvGcFeatureNodePrivate {
ArvGcPropertyNode *display_name;
ArvGcPropertyNode *is_implemented;
ArvGcPropertyNode *is_available;
+ ArvGcPropertyNode *is_locked;
gint modification_count;
};
@@ -83,6 +84,9 @@ arv_gc_feature_node_post_new_child (ArvDomNode *self, ArvDomNode *child)
case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
node->priv->is_implemented = property_node;
break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_LOCKED:
+ node->priv->is_locked = property_node;
+ break;
default:
break;
}
@@ -113,6 +117,9 @@ arv_gc_feature_node_pre_remove_child (ArvDomNode *self, ArvDomNode *child)
case ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED:
node->priv->is_implemented = NULL;
break;
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_LOCKED:
+ node->priv->is_locked = NULL;
+ break;
default:
break;
}
@@ -200,14 +207,30 @@ arv_gc_feature_node_get_display_name (ArvGcFeatureNode *node)
}
gboolean
+arv_gc_feature_node_is_implemented (ArvGcFeatureNode *gc_feature_node)
+{
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
+
+ return (gc_feature_node->priv->is_implemented == NULL ||
+ arv_gc_property_node_get_int64 (gc_feature_node->priv->is_implemented) != 0);
+}
+
+gboolean
arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node)
{
g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
- return ((gc_feature_node->priv->is_implemented == NULL ||
- arv_gc_property_node_get_int64 (gc_feature_node->priv->is_implemented) != 0) &&
- (gc_feature_node->priv->is_available == NULL ||
- arv_gc_property_node_get_int64 (gc_feature_node->priv->is_available) != 0));
+ return (gc_feature_node->priv->is_available == NULL ||
+ arv_gc_property_node_get_int64 (gc_feature_node->priv->is_available) != 0);
+}
+
+gboolean
+arv_gc_feature_node_is_locked (ArvGcFeatureNode *gc_feature_node)
+{
+ g_return_val_if_fail (ARV_IS_GC_FEATURE_NODE (gc_feature_node), FALSE);
+
+ return (gc_feature_node->priv->is_locked != NULL &&
+ arv_gc_property_node_get_int64 (gc_feature_node->priv->is_locked) != 0);
}
ArvGcFeatureNode *
diff --git a/src/arvgcfeaturenode.h b/src/arvgcfeaturenode.h
index 6a13200..ad23e2c 100644
--- a/src/arvgcfeaturenode.h
+++ b/src/arvgcfeaturenode.h
@@ -59,6 +59,8 @@ const char * arv_gc_feature_node_get_name (ArvGcFeatureNode *gc_feature_node)
const char * arv_gc_feature_node_get_tooltip (ArvGcFeatureNode *gc_feature_node);
const char * arv_gc_feature_node_get_description (ArvGcFeatureNode *gc_feature_node);
gboolean arv_gc_feature_node_is_available (ArvGcFeatureNode *gc_feature_node);
+gboolean arv_gc_feature_node_is_implemented (ArvGcFeatureNode *gc_feature_node);
+gboolean arv_gc_feature_node_is_locked (ArvGcFeatureNode *gc_feature_node);
GType arv_gc_feature_node_get_value_type (ArvGcFeatureNode *gc_feature_node);
void arv_gc_feature_node_set_value_from_string (ArvGcFeatureNode *gc_feature_node, const char *string);
const char * arv_gc_feature_node_get_value_as_string (ArvGcFeatureNode *gc_feature_node);
diff --git a/src/arvgcpropertynode.c b/src/arvgcpropertynode.c
index 5256707..2610cc0 100644
--- a/src/arvgcpropertynode.c
+++ b/src/arvgcpropertynode.c
@@ -112,6 +112,8 @@ arv_gc_property_node_get_node_name (ArvDomNode *node)
return "pIsImplemented";
case ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE:
return "pIsAvailable";
+ case ARV_GC_PROPERTY_NODE_TYPE_P_IS_LOCKED:
+ return "pIsLocked";
case ARV_GC_PROPERTY_NODE_TYPE_P_MINIMUM:
return "pMin";
case ARV_GC_PROPERTY_NODE_TYPE_P_MAXIMUM:
@@ -503,6 +505,12 @@ arv_gc_property_node_new_p_is_available (void)
}
ArvGcNode *
+arv_gc_property_node_new_p_is_locked (void)
+{
+ return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_P_IS_LOCKED);
+}
+
+ArvGcNode *
arv_gc_property_node_new_length (void)
{
return arv_gc_property_node_new (ARV_GC_PROPERTY_NODE_TYPE_LENGTH);
diff --git a/src/arvgcpropertynode.h b/src/arvgcpropertynode.h
index 8aa6c01..3f346b1 100644
--- a/src/arvgcpropertynode.h
+++ b/src/arvgcpropertynode.h
@@ -62,6 +62,7 @@ typedef enum {
ARV_GC_PROPERTY_NODE_TYPE_P_VALUE,
ARV_GC_PROPERTY_NODE_TYPE_P_ADDRESS,
ARV_GC_PROPERTY_NODE_TYPE_P_IS_IMPLEMENTED,
+ ARV_GC_PROPERTY_NODE_TYPE_P_IS_LOCKED,
ARV_GC_PROPERTY_NODE_TYPE_P_IS_AVAILABLE,
ARV_GC_PROPERTY_NODE_TYPE_P_MINIMUM,
ARV_GC_PROPERTY_NODE_TYPE_P_MAXIMUM,
@@ -115,6 +116,7 @@ ArvGcNode * arv_gc_property_node_new_on_value (void);
ArvGcNode * arv_gc_property_node_new_off_value (void);
ArvGcNode * arv_gc_property_node_new_p_is_implemented (void);
ArvGcNode * arv_gc_property_node_new_p_is_available (void);
+ArvGcNode * arv_gc_property_node_new_p_is_locked (void);
ArvGcNode * arv_gc_property_node_new_length (void);
ArvGcNode * arv_gc_property_node_new_p_length (void);
ArvGcNode * arv_gc_property_node_new_p_port (void);
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index e6e578a..53c1dbe 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -582,7 +582,13 @@ arv_gv_device_load_genicam (ArvGvDevice *gv_device)
gv_device->priv->genicam = arv_gc_new (ARV_DEVICE (gv_device), genicam, size);
arv_gc_set_default_node_data (gv_device->priv->genicam, "GevSCPSPacketSize",
- "<MaskedIntReg Name=\"GevSCPSPacketSize\">"
+ "<Integer Name=\"GevSCPSPacketSize\">"
+ "<Visibility>Expert</Visibility>"
+ "<pIsLocked>TLParamsLocked</pIsLocked>"
+ "<pValue>GevSCPSPacketSizeReg</pValue>"
+ "</Integer>");
+ arv_gc_set_default_node_data (gv_device->priv->genicam, "GevSCPSPacketSizeReg",
+ "<MaskedIntReg Name=\"GevSCPSPacketSizeReg\">"
"<Address>0xd04</Address>"
"<Length>4</Length>"
"<AccessMode>RW</AccessMode>"
@@ -591,8 +597,14 @@ arv_gv_device_load_genicam (ArvGvDevice *gv_device)
"<MSB>16</MSB>"
"<Sign>Unsigned</Sign>"
"<Endianess>BigEndian</Endianess>"
- "</MaskedIntReg>"
- );
+ "</MaskedIntReg>");
+ arv_gc_set_default_node_data (gv_device->priv->genicam, "TLParamsLocked",
+ "<Integer Name=\"TLParamsLocked\">"
+ "<Visibility>Invisible</Visibility>"
+ "<Value>0</Value>"
+ "<Min>0</Min>"
+ "<Max>1</Max>"
+ "</Integer>");
}
}
diff --git a/src/arvtool.c b/src/arvtool.c
index cdb9f58..757622d 100644
--- a/src/arvtool.c
+++ b/src/arvtool.c
@@ -9,13 +9,17 @@ arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_descr
ArvGcNode *node;
node = arv_gc_get_node (genicam, feature);
- if (ARV_IS_GC_NODE (node)) {
+ if (ARV_IS_GC_FEATURE_NODE (node) &&
+ arv_gc_feature_node_is_implemented (ARV_GC_FEATURE_NODE (node))) {
int i;
for (i = 0; i < level; i++)
printf (" ");
- printf ("%s: '%s'\n", arv_dom_node_get_node_name (ARV_DOM_NODE (node)), feature);
+ printf ("%s: '%s'%s\n",
+ arv_dom_node_get_node_name (ARV_DOM_NODE (node)),
+ feature,
+ arv_gc_feature_node_is_available (ARV_GC_FEATURE_NODE (node)) ? "" : " (Not available)");
if (show_description) {
const char *description;
@@ -39,13 +43,14 @@ arv_tool_list_features (ArvGc *genicam, const char *feature, gboolean show_descr
childs = arv_gc_enumeration_get_entries (ARV_GC_ENUMERATION (node));
for (iter = childs; iter != NULL; iter = iter->next) {
- if (arv_gc_feature_node_is_available (iter->data)) {
+ if (arv_gc_feature_node_is_implemented (iter->data)) {
for (i = 0; i < level + 1; i++)
printf (" ");
- printf ("%s: '%s'\n",
+ printf ("%s: '%s'%s\n",
arv_dom_node_get_node_name (iter->data),
- arv_gc_feature_node_get_name (iter->data));
+ arv_gc_feature_node_get_name (iter->data),
+ arv_gc_feature_node_is_available (iter->data) ? "" : " (Not available)");
}
}
}
diff --git a/tests/data/genicam.xml b/tests/data/genicam.xml
index fe46044..5b35e04 100644
--- a/tests/data/genicam.xml
+++ b/tests/data/genicam.xml
@@ -152,4 +152,12 @@
<Formula>0x1234</Formula>
</IntSwissKnife>
+ <Integer Name="TLParamsLocked">
+ <ToolTip> Indicates whether a live grab is under way</ToolTip>
+ <Visibility>Invisible</Visibility>
+ <Value>0</Value>
+ <Min>0</Min>
+ <Max>1</Max>
+ </Integer>
+
</RegisterDescription>
diff --git a/tests/genicam.c b/tests/genicam.c
index 1184556..ac6a51e 100644
--- a/tests/genicam.c
+++ b/tests/genicam.c
@@ -264,6 +264,26 @@ url_test (void)
g_strfreev (tokens);
}
+static void
+mandatory_test (void)
+{
+ ArvDevice *device;
+ ArvGc *genicam;
+ ArvGcNode *node;
+ gint64 value;
+
+ device = arv_fake_device_new ("TEST0");
+ g_assert (ARV_IS_FAKE_DEVICE (device));
+
+ genicam = arv_device_get_genicam (device);
+ g_assert (ARV_IS_GC (genicam));
+
+ node = arv_gc_get_node (genicam, "TLParamsLocked");
+ g_assert (ARV_IS_GC_INTEGER (node));
+
+ g_object_unref (device);
+}
+
int
main (int argc, char *argv[])
{
@@ -283,6 +303,7 @@ main (int argc, char *argv[])
g_test_add_func ("/genicam/swissknife", swiss_knife_test);
g_test_add_func ("/genicam/register", register_test);
g_test_add_func ("/genicam/url", url_test);
+ g_test_add_func ("/genicam/mandatory", mandatory_test);
result = g_test_run();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]