summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-09-21 12:07:31 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-09-21 12:07:31 +0200
commit7132f5b74e74597fea4e358381e9e102bba7c8ed (patch)
tree6c12cfccfe4185d023319223f89a8126a720bfd5 /test
parentec0e31d89baf7cb6c2fb30ead081655886478609 (diff)
downloaduca-7132f5b74e74597fea4e358381e9e102bba7c8ed.tar.gz
uca-7132f5b74e74597fea4e358381e9e102bba7c8ed.tar.bz2
uca-7132f5b74e74597fea4e358381e9e102bba7c8ed.tar.xz
uca-7132f5b74e74597fea4e358381e9e102bba7c8ed.zip
Remove obsolete test tools
Diffstat (limited to 'test')
-rw-r--r--test/enum.c88
-rw-r--r--test/grab_pylon.c96
-rwxr-xr-xtest/run.py31
3 files changed, 0 insertions, 215 deletions
diff --git a/test/enum.c b/test/enum.c
deleted file mode 100644
index 75ca596..0000000
--- a/test/enum.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (Karlsruhe Institute of Technology)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2.1 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this library; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110, USA */
-
-#include <stdio.h>
-#include "uca.h"
-
-int count_dots(const char *s)
-{
- int res = 0;
- while (*(s++) != '\0')
- if (*s == '.')
- res++;
- return res;
-}
-
-void print_level(int depth)
-{
- for (int i = 0; i < depth; i++)
- printf("| ");
- printf("|-- ");
-}
-
-int main(int argc, char *argv[])
-{
- uca *u = uca_init(NULL);
- if (u == NULL) {
- printf("Couldn't find a camera\n");
- return 1;
- }
-
- /* take first camera */
- uca_camera *cam = u->cameras;
-
- const size_t num_bytes = 256;
- char string_value[num_bytes];
- uint32_t uint32_value;
- uint8_t uint8_value;
-
- while (cam != NULL) {
- for (int i = 0; i < UCA_PROP_LAST; i++) {
- uca_property *prop = uca_get_full_property(i);
- print_level(count_dots(prop->name));
- printf("%s = ", prop->name);
- switch (prop->type) {
- case uca_string:
- if (uca_cam_get_property(cam, i, string_value, num_bytes) == UCA_NO_ERROR) {
- printf("%s ", string_value);
- }
- else
- printf("n/a");
- break;
- case uca_uint32t:
- if (uca_cam_get_property(cam, i, &uint32_value, 0) == UCA_NO_ERROR) {
- printf("%u %s", uint32_value, uca_unit_map[prop->unit]);
- }
- else
- printf("n/a");
- break;
- case uca_uint8t:
- if (uca_cam_get_property(cam, i, &uint8_value, 0) == UCA_NO_ERROR) {
- printf("%u %s", uint8_value, uca_unit_map[prop->unit]);
- }
- else
- printf("n/a");
- break;
- }
- printf("\n");
- }
- cam = cam->next;
- }
-
- uca_destroy(u);
- return 0;
-}
diff --git a/test/grab_pylon.c b/test/grab_pylon.c
deleted file mode 100644
index 2f9b5a0..0000000
--- a/test/grab_pylon.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* Copyright (C) 2011, 2012 Matthias Vogelgesang <matthias.vogelgesang@kit.edu>
- (Karlsruhe Institute of Technology)
-
- This library is free software; you can redistribute it and/or modify it
- under the terms of the GNU Lesser General Public License as published by the
- Free Software Foundation; either version 2.1 of the License, or (at your
- option) any later version.
-
- This library is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
- details.
-
- You should have received a copy of the GNU Lesser General Public License along
- with this library; if not, write to the Free Software Foundation, Inc., 51
- Franklin St, Fifth Floor, Boston, MA 02110, USA */
-
-#include <glib-object.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include "uca-camera.h"
-
-#define handle_error(errno) {if ((errno) != UCA_NO_ERROR) printf("error at <%s:%i>\n", \
- __FILE__, __LINE__);}
-
-static UcaCamera *camera = NULL;
-
-void sigint_handler(int signal)
-{
- printf("Closing down libuca\n");
- uca_camera_stop_recording(camera, NULL);
- g_object_unref(camera);
- exit(signal);
-}
-
-int main(int argc, char *argv[])
-{
- GError *error = NULL;
- (void) signal(SIGINT, sigint_handler);
-
- g_type_init();
- camera = uca_camera_new("pylon", &error);
-
- if (camera == NULL) {
- g_print("Couldn't initialize camera\n");
- return 1;
- }
-
- guint width, height, bits;
- g_object_get(G_OBJECT(camera),
- "sensor-width", &width,
- "sensor-height", &height,
- "sensor-bitdepth", &bits,
- NULL);
-
- const int pixel_size = bits == 8 ? 1 : 2;
- g_print("allocate buffer %u, %u, %d\n", width, height, pixel_size);
- gpointer buffer = g_malloc0(width * height * pixel_size);
-
- gchar filename[FILENAME_MAX];
-
- for (int i = 0; i < 2; i++) {
- gint counter = 0;
- g_print("Start recording\n");
- uca_camera_start_recording(camera, &error);
- g_assert_no_error(error);
-
- while (counter < 10) {
- g_print(" grab frame ... ");
- uca_camera_grab(camera, &buffer, &error);
- if (error != NULL) {
- g_print("\nError: %s\n", error->message);
- goto cleanup;
- }
- g_print("done\n");
-
- snprintf(filename, FILENAME_MAX, "frame-%08i.raw", counter++);
- FILE *fp = fopen(filename, "wb");
- fwrite(buffer, width*height, pixel_size, fp);
- fclose(fp);
- //g_usleep(2 * G_USEC_PER_SEC);
- }
-
- g_print("Stop recording\n");
- uca_camera_stop_recording(camera, &error);
- g_assert_no_error(error);
- }
-
-cleanup:
- uca_camera_stop_recording(camera, NULL);
- g_object_unref(camera);
- g_free(buffer);
-
- return error != NULL ? 1 : 0;
-}
diff --git a/test/run.py b/test/run.py
deleted file mode 100755
index 7982617..0000000
--- a/test/run.py
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/usr/bin/env python
-
-import Tkinter
-import threading
-import subprocess
-
-class App(object):
- def __init__(self, parent):
- self.parent = parent
- self.canvas = Tkinter.Canvas(root, width=300, height=300)
- self.canvas.pack()
- self.rect = self.canvas.create_rectangle(0, 0, 300, 300, fill='yellow')
- self.run_button = Tkinter.Button(parent, text='Start grabbing', command=self.run_click)
- self.run_button.pack()
-
- def run_grab(self):
- proc = subprocess.Popen(['./grab'])
- proc.wait()
- self.canvas.itemconfig(self.rect, fill='red')
- self.run_button.config(state=Tkinter.NORMAL, text='Close', command=self.parent.destroy)
-
- def run_click(self):
- self.canvas.itemconfig(self.rect, fill='green')
- self.run_button.config(state=Tkinter.DISABLED)
- thread = threading.Thread(None, self.run_grab)
- thread.start()
-
-if __name__ == '__main__':
- root = Tkinter.Tk()
- app = App(root)
- root.mainloop()