summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt4
-rw-r--r--test/benchmark.c9
-rw-r--r--test/grab.c40
3 files changed, 32 insertions, 21 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 8fe702b..37ea6bf 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,12 +36,12 @@ if (HAVE_PYLON_CAMERA)
link_directories(${PYLON_LIB_DIRS} ${LIBPYLONCAM_LIBDIR})
endif()
-#add_executable(grab grab.c)
+add_executable(grab grab.c)
#add_executable(grab-async grab-async.c)
add_executable(benchmark benchmark.c)
target_link_libraries(benchmark uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-#target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
#target_link_libraries(grab-async uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
#add_executable(grab_pylon grab_pylon.c)
diff --git a/test/benchmark.c b/test/benchmark.c
index 73b6805..ef99fd1 100644
--- a/test/benchmark.c
+++ b/test/benchmark.c
@@ -42,7 +42,7 @@ print_usage (void)
UcaPluginManager *manager;
manager = uca_plugin_manager_new ();
- g_print ("Usage: benchmark [");
+ g_print ("Usage: benchmark [ ");
types = uca_plugin_manager_get_available_cameras (manager);
if (types == NULL) {
@@ -52,10 +52,11 @@ print_usage (void)
for (GList *it = g_list_first (types); it != NULL; it = g_list_next (it)) {
gchar *name = (gchar *) it->data;
- g_print ("`%s' ", name);
+ if (g_list_next (it) == NULL)
+ g_print ("%s ]\n", name);
+ else
+ g_print ("%s, ", name);
}
-
- g_print ("]\n");
}
static void
diff --git a/test/grab.c b/test/grab.c
index 41e6d88..e507d69 100644
--- a/test/grab.c
+++ b/test/grab.c
@@ -19,6 +19,7 @@
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include "uca-plugin-manager.h"
#include "uca-camera.h"
static UcaCamera *camera = NULL;
@@ -31,26 +32,33 @@ static void sigint_handler(int signal)
exit(signal);
}
-static void print_usage(void)
+static void
+print_usage (void)
{
- gchar **types;
-
- g_print("Usage: grab (");
- types = uca_camera_get_types();
-
- for (guint i = 0; types[i] != NULL; i++) {
- if (types[i+1] == NULL)
- g_print("%s)", types[i]);
- else
- g_print("%s | ", types[i]);
+ GList *types;
+ UcaPluginManager *manager;
+
+ manager = uca_plugin_manager_new ();
+ g_print ("Usage: benchmark [ ");
+ types = uca_plugin_manager_get_available_cameras (manager);
+
+ if (types == NULL) {
+ g_print ("] -- no camera plugin found\n");
+ return;
}
- g_print("\n");
- g_strfreev(types);
+ for (GList *it = g_list_first (types); it != NULL; it = g_list_next (it)) {
+ gchar *name = (gchar *) it->data;
+ if (g_list_next (it) == NULL)
+ g_print ("%s ]\n", name);
+ else
+ g_print ("%s, ", name);
+ }
}
int main(int argc, char *argv[])
{
+ UcaPluginManager *manager;
GError *error = NULL;
(void) signal(SIGINT, sigint_handler);
@@ -59,13 +67,15 @@ int main(int argc, char *argv[])
guint bits;
gchar *name;
+ g_type_init();
+
if (argc < 2) {
print_usage();
return 1;
}
- g_type_init();
- camera = uca_camera_new(argv[1], &error);
+ manager = uca_plugin_manager_new ();
+ camera = uca_plugin_manager_new_camera (manager, argv[1], &error);
if (camera == NULL) {
g_print("Error during initialization: %s\n", error->message);