From f6b63f4957c55107310d092dbf8eecce1e3d12b4 Mon Sep 17 00:00:00 2001
From: Matthias Vogelgesang <matthias.vogelgesang@ipe.fzk.de>
Date: Wed, 23 Feb 2011 22:45:13 +0100
Subject: Add new properties and return PROP_INVALID if not available

---
 src/cameras/uca_pco.c |  8 ++++----
 src/uca.c             |  3 +++
 src/uca.h             | 21 ++++++++++++++-------
 3 files changed, 21 insertions(+), 11 deletions(-)

(limited to 'src')

diff --git a/src/cameras/uca_pco.c b/src/cameras/uca_pco.c
index 44ecf95..3155376 100644
--- a/src/cameras/uca_pco.c
+++ b/src/cameras/uca_pco.c
@@ -70,9 +70,9 @@ static uint32_t uca_pco_set_property(struct uca_t *uca, int32_t property, void *
             break;
 
         default:
-            break;
+            return UCA_ERR_PROP_INVALID;
     }
-    return 0;
+    return UCA_NO_ERROR;
 }
 
 static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *data)
@@ -104,9 +104,9 @@ static uint32_t uca_pco_get_property(struct uca_t *uca, int32_t property, void *
             }
 
         default:
-            break;
+            return UCA_ERR_PROP_INVALID;
     }
-    return 0;
+    return UCA_NO_ERROR;
 }
 
 uint32_t uca_pco_init(struct uca_t *uca)
diff --git a/src/uca.c b/src/uca.c
index cab02ec..ddf3e3d 100644
--- a/src/uca.c
+++ b/src/uca.c
@@ -59,10 +59,13 @@ static const char* property_map[] = {
     "name",
     "width",
     "height",
+    "x-offset",
+    "y-offset",
     "max-width",
     "max-height",
     "bit-depth",
     "exposure",
+    "delay",
     "frame-rate",
     NULL
 };
diff --git a/src/uca.h b/src/uca.h
index 180c8b9..2c8a888 100644
--- a/src/uca.h
+++ b/src/uca.h
@@ -29,12 +29,14 @@ typedef uint32_t (*uca_cam_destroy) (struct uca_t *uca);
 /**
  * \brief Set a property
  * \param[in] property_name Name of the property as defined in XXX
+ * \return UCA_ERR_PROP_INVALID if property is not supported on the camera
  */
 typedef uint32_t (*uca_cam_set_property) (struct uca_t *uca, int32_t property, void *data);
 
 /**
  * \brief Set a property
  * \param[in] property_name Name of the property as defined in XXX
+ * \return UCA_ERR_PROP_INVALID if property is not supported on the camera
  */
 typedef uint32_t (*uca_cam_get_property) (struct uca_t *uca, int32_t property, void *data);
 
@@ -67,18 +69,23 @@ const char* uca_get_property_name(int32_t property_id);
 
 #define UCA_NO_ERROR                    0
 #define UCA_ERR_INIT_NOT_FOUND          1   /**< camera probing or initialization failed */
-#define UCA_ERR_PROP_INVALID            2
+#define UCA_ERR_PROP_INVALID            1   /**< the requested property is not supported by the camera */
 
-/* The property IDs must start with 0 and be continuous */
+/* The property IDs must start with 0 and must be continuous */
 #define UCA_PROP_INVALID    -1
 #define UCA_PROP_NAME       0
 #define UCA_PROP_WIDTH      1
 #define UCA_PROP_HEIGHT     2
-#define UCA_PROP_MAX_WIDTH  3
-#define UCA_PROP_MAX_HEIGHT 4
-#define UCA_PROP_BITDEPTH   5
-#define UCA_PROP_EXPOSURE   6
-#define UCA_PROP_FRAMERATE  7
+#define UCA_PROP_X_OFFSET   3
+#define UCA_PROP_Y_OFFSET   4
+#define UCA_PROP_MAX_WIDTH  5
+#define UCA_PROP_MAX_HEIGHT 6
+#define UCA_PROP_BITDEPTH   7
+#define UCA_PROP_EXPOSURE   8
+#define UCA_PROP_DELAY      9
+#define UCA_PROP_FRAMERATE  10 
+
+#define UCA_PROP_INTERLACE  -1
 
 struct uca_t {
     /* Function pointers to camera-specific methods */
-- 
cgit v1.2.3