From 77d53813bdad7ef3f59660bed1c5120d594042e6 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Wed, 2 Jul 2014 16:40:27 +0200 Subject: [PATCH] Remove the device specific example applications. These device specific applications became obsolete long time ago with the introduction of the universal application. --- examples/Makefile.am | 79 +--------- examples/cressi_edy_test.c | 107 -------------- examples/cressi_leonardo_test.c | 107 -------------- examples/hw_frog_test.c | 95 ------------ examples/hw_ostc_test.c | 107 -------------- examples/mares_darwin_test.c | 107 -------------- examples/mares_iconhd_test.c | 114 --------------- examples/mares_nemo_test.c | 107 -------------- examples/mares_puck_test.c | 107 -------------- examples/oceanic_atom2_test.c | 116 --------------- examples/oceanic_veo250_test.c | 116 --------------- examples/oceanic_vtpro_test.c | 107 -------------- examples/reefnet_sensus_test.c | 113 --------------- examples/reefnet_sensuspro_test.c | 113 --------------- examples/reefnet_sensusultra_test.c | 217 ---------------------------- examples/shearwater_predator_test.c | 107 -------------- examples/suunto_d9_test.c | 150 ------------------- examples/suunto_eon_test.c | 107 -------------- examples/suunto_solution_test.c | 87 ----------- examples/suunto_vyper2_test.c | 150 ------------------- examples/suunto_vyper_test.c | 151 ------------------- examples/uwatec_aladin_test.c | 87 ----------- examples/uwatec_memomouse_test.c | 107 -------------- examples/uwatec_smart_test.c | 97 ------------- examples/zeagle_n2ition3_test.c | 107 -------------- 25 files changed, 1 insertion(+), 2861 deletions(-) delete mode 100644 examples/cressi_edy_test.c delete mode 100644 examples/cressi_leonardo_test.c delete mode 100644 examples/hw_frog_test.c delete mode 100644 examples/hw_ostc_test.c delete mode 100644 examples/mares_darwin_test.c delete mode 100644 examples/mares_iconhd_test.c delete mode 100644 examples/mares_nemo_test.c delete mode 100644 examples/mares_puck_test.c delete mode 100644 examples/oceanic_atom2_test.c delete mode 100644 examples/oceanic_veo250_test.c delete mode 100644 examples/oceanic_vtpro_test.c delete mode 100644 examples/reefnet_sensus_test.c delete mode 100644 examples/reefnet_sensuspro_test.c delete mode 100644 examples/reefnet_sensusultra_test.c delete mode 100644 examples/shearwater_predator_test.c delete mode 100644 examples/suunto_d9_test.c delete mode 100644 examples/suunto_eon_test.c delete mode 100644 examples/suunto_solution_test.c delete mode 100644 examples/suunto_vyper2_test.c delete mode 100644 examples/suunto_vyper_test.c delete mode 100644 examples/uwatec_aladin_test.c delete mode 100644 examples/uwatec_memomouse_test.c delete mode 100644 examples/uwatec_smart_test.c delete mode 100644 examples/zeagle_n2ition3_test.c diff --git a/examples/Makefile.am b/examples/Makefile.am index 2283028..d77db45 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -3,88 +3,11 @@ LDADD = $(top_builddir)/src/libdivecomputer.la bin_PROGRAMS = \ universal \ - solution \ - eon \ - vyper \ - vyper2 \ - d9 \ - sensus \ - sensuspro \ - sensusultra \ - aladin \ - memomouse \ - atom2 \ - veo250 \ - vtpro \ - nemo \ - puck \ - darwin \ - iconhd \ - ostc \ - ostc-fwupdate \ - frog \ - edy \ - leonardo \ - n2ition3 \ - predator - -if IRDA -bin_PROGRAMS += smart -endif + ostc-fwupdate COMMON = common.c common.h \ utils.c utils.h universal_SOURCES = universal.c $(COMMON) -solution_SOURCES = suunto_solution_test.c $(COMMON) - -eon_SOURCES = suunto_eon_test.c $(COMMON) - -vyper_SOURCES = suunto_vyper_test.c $(COMMON) - -vyper2_SOURCES = suunto_vyper2_test.c $(COMMON) - -d9_SOURCES = suunto_d9_test.c $(COMMON) - -sensus_SOURCES = reefnet_sensus_test.c $(COMMON) - -sensuspro_SOURCES = reefnet_sensuspro_test.c $(COMMON) - -sensusultra_SOURCES = reefnet_sensusultra_test.c $(COMMON) - -aladin_SOURCES = uwatec_aladin_test.c $(COMMON) - -memomouse_SOURCES = uwatec_memomouse_test.c $(COMMON) - -atom2_SOURCES = oceanic_atom2_test.c $(COMMON) - -veo250_SOURCES = oceanic_veo250_test.c $(COMMON) - -vtpro_SOURCES = oceanic_vtpro_test.c $(COMMON) - -nemo_SOURCES = mares_nemo_test.c $(COMMON) - -puck_SOURCES = mares_puck_test.c $(COMMON) - -darwin_SOURCES = mares_darwin_test.c $(COMMON) - -iconhd_SOURCES = mares_iconhd_test.c $(COMMON) - -ostc_SOURCES = hw_ostc_test.c $(COMMON) - ostc_fwupdate_SOURCES = hw_ostc_fwupdate.c $(COMMON) - -frog_SOURCES = hw_frog_test.c $(COMMON) - -edy_SOURCES = cressi_edy_test.c $(COMMON) - -leonardo_SOURCES = cressi_leonardo_test.c $(COMMON) - -n2ition3_SOURCES = zeagle_n2ition3_test.c $(COMMON) - -predator_SOURCES = shearwater_predator_test.c $(COMMON) - -if IRDA -smart_SOURCES = uwatec_smart_test.c $(COMMON) -endif diff --git a/examples/cressi_edy_test.c b/examples/cressi_edy_test.c deleted file mode 100644 index fb23a11..0000000 --- a/examples/cressi_edy_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2009 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("cressi_edy_device_open\n"); - dc_status_t rc = cressi_edy_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("EDY.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "EDY.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/cressi_leonardo_test.c b/examples/cressi_leonardo_test.c deleted file mode 100644 index 76ff939..0000000 --- a/examples/cressi_leonardo_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2013 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("cressi_leonardo_device_open\n"); - dc_status_t rc = cressi_leonardo_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("LEONARDO.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "LEONARDO.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/hw_frog_test.c b/examples/hw_frog_test.c deleted file mode 100644 index 0582c40..0000000 --- a/examples/hw_frog_test.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2012 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("hw_frog_device_open\n"); - dc_status_t rc = hw_frog_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("FROG.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "FROG.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/hw_ostc_test.c b/examples/hw_ostc_test.c deleted file mode 100644 index ca8d3b7..0000000 --- a/examples/hw_ostc_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2009 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("hw_ostc_device_open\n"); - dc_status_t rc = hw_ostc_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("OSTC.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "OSTC.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/mares_darwin_test.c b/examples/mares_darwin_test.c deleted file mode 100644 index e239a80..0000000 --- a/examples/mares_darwin_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2011 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("mares_darwin_device_open\n"); - dc_status_t rc = mares_darwin_device_open (&device, context, name, 0); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("DARWIN.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "DARWIN.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/mares_iconhd_test.c b/examples/mares_iconhd_test.c deleted file mode 100644 index 2a935b2..0000000 --- a/examples/mares_iconhd_test.c +++ /dev/null @@ -1,114 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2010 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename, unsigned int model) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("mares_iconhd_device_open\n"); - dc_status_t rc = mares_iconhd_device_open (&device, context, name, model); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("ICONHD.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - unsigned int model = 0; - - if (argc > 1) { - name = argv[1]; - } - - if (argc > 2) { - model = strtoul (argv[2], NULL, 0); - } - - message ("DEVICE=%s\n", name); - message ("MODEL=0x%02x\n", model); - - dc_status_t a = test_dump_memory (name, "ICONHD.DMP", model); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/mares_nemo_test.c b/examples/mares_nemo_test.c deleted file mode 100644 index 4028762..0000000 --- a/examples/mares_nemo_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("mares_nemo_device_open\n"); - dc_status_t rc = mares_nemo_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("NEMO.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "NEMO.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/mares_puck_test.c b/examples/mares_puck_test.c deleted file mode 100644 index c6e37e2..0000000 --- a/examples/mares_puck_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2009 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("mares_puck_device_open\n"); - dc_status_t rc = mares_puck_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("PUCK.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "PUCK.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/oceanic_atom2_test.c b/examples/oceanic_atom2_test.c deleted file mode 100644 index 60aac1a..0000000 --- a/examples/oceanic_atom2_test.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("oceanic_atom2_device_open\n"); - dc_status_t rc = oceanic_atom2_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("ATOM2.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "ATOM2.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/oceanic_veo250_test.c b/examples/oceanic_veo250_test.c deleted file mode 100644 index c26de85..0000000 --- a/examples/oceanic_veo250_test.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("oceanic_veo250_device_open\n"); - dc_status_t rc = oceanic_veo250_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("VEO250.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "VEO250.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/oceanic_vtpro_test.c b/examples/oceanic_vtpro_test.c deleted file mode 100644 index d360059..0000000 --- a/examples/oceanic_vtpro_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("oceanic_vtpro_device_open\n"); - dc_status_t rc = oceanic_vtpro_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("VTPRO.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "VTPRO.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/reefnet_sensus_test.c b/examples/reefnet_sensus_test.c deleted file mode 100644 index 9d7d29e..0000000 --- a/examples/reefnet_sensus_test.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include // time - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("reefnet_sensus_device_open\n"); - dc_status_t rc = reefnet_sensus_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - time_t now = time (NULL); - char datetime[21] = {0}; - strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); - message ("time=%lu (%s)\n", (unsigned long)now, datetime); - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("SENSUS.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "SENSUS.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/reefnet_sensuspro_test.c b/examples/reefnet_sensuspro_test.c deleted file mode 100644 index a873589..0000000 --- a/examples/reefnet_sensuspro_test.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include // time - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("reefnet_sensuspro_device_open\n"); - dc_status_t rc = reefnet_sensuspro_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - time_t now = time (NULL); - char datetime[21] = {0}; - strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); - message ("time=%lu (%s)\n", (unsigned long)now, datetime); - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("SENSUSPRO.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "SENSUSPRO.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/reefnet_sensusultra_test.c b/examples/reefnet_sensusultra_test.c deleted file mode 100644 index 9ac9826..0000000 --- a/examples/reefnet_sensusultra_test.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include // time - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory_dives (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("reefnet_sensusultra_device_open\n"); - dc_status_t rc = reefnet_sensusultra_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - time_t now = time (NULL); - char datetime[21] = {0}; - strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); - message ("time=%lu (%s)\n", (unsigned long)now, datetime); - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -dc_status_t -test_dump_memory_data (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("reefnet_sensusultra_device_open\n"); - dc_status_t rc = reefnet_sensusultra_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - time_t now = time (NULL); - char datetime[21] = {0}; - strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); - message ("time=%lu (%s)\n", (unsigned long)now, datetime); - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -dc_status_t -test_dump_memory_user (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - unsigned char data[REEFNET_SENSUSULTRA_USER_SIZE] = {0}; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("reefnet_sensusultra_device_open\n"); - dc_status_t rc = reefnet_sensusultra_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - time_t now = time (NULL); - char datetime[21] = {0}; - strftime (datetime, sizeof (datetime), "%Y-%m-%dT%H:%M:%SZ", gmtime (&now)); - message ("time=%lu (%s)\n", (unsigned long)now, datetime); - - message ("reefnet_sensusultra_device_read_user\n"); - rc = reefnet_sensusultra_device_read_user (device, data, sizeof (data)); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (data, sizeof (unsigned char), sizeof (data), fp); - fclose (fp); - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("SENSUSULTRA.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory_data (name, "SENSUSULTRA_DATA.DMP"); - dc_status_t b = test_dump_memory_user (name, "SENSUSULTRA_USER.DMP"); - dc_status_t c = test_dump_memory_dives (name, "SENSUSULTRA_DIVES.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory_data: %s\n", errmsg (a)); - message ("test_dump_memory_user: %s\n", errmsg (b)); - message ("test_dump_memory_dives: %s\n", errmsg (c)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/shearwater_predator_test.c b/examples/shearwater_predator_test.c deleted file mode 100644 index 9f5463a..0000000 --- a/examples/shearwater_predator_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2012 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("shearwater_predator_device_open\n"); - dc_status_t rc = shearwater_predator_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("PREDATOR.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "PREDATOR.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/suunto_d9_test.c b/examples/suunto_d9_test.c deleted file mode 100644 index 49a0ad3..0000000 --- a/examples/suunto_d9_test.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_sdm (const char* name) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_d9_device_open\n"); - dc_status_t rc = suunto_d9_device_open (&device, context, name, 0); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_d9_device_open\n"); - dc_status_t rc = suunto_d9_device_open (&device, context, name, 0); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("D9.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "D9.DMP"); - dc_status_t b = test_dump_sdm (name); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - message ("test_dump_sdm: %s\n", errmsg (b)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/suunto_eon_test.c b/examples/suunto_eon_test.c deleted file mode 100644 index d5821b9..0000000 --- a/examples/suunto_eon_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_eon_device_open\n"); - dc_status_t rc = suunto_eon_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("EON.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "EON.DMP"); - - message ("SUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/suunto_solution_test.c b/examples/suunto_solution_test.c deleted file mode 100644 index c17afc6..0000000 --- a/examples/suunto_solution_test.c +++ /dev/null @@ -1,87 +0,0 @@ -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_solution_device_open\n"); - int rc = suunto_solution_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int -main(int argc, char *argv[]) -{ - message_set_logfile ("SOLUTION.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "SOLUTION.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/suunto_vyper2_test.c b/examples/suunto_vyper2_test.c deleted file mode 100644 index 368aae3..0000000 --- a/examples/suunto_vyper2_test.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_sdm (const char* name) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_vyper2_device_open\n"); - dc_status_t rc = suunto_vyper2_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_vyper2_device_open\n"); - dc_status_t rc = suunto_vyper2_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("VYPER2.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "VYPER2.DMP"); - dc_status_t b = test_dump_sdm (name); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - message ("test_dump_sdm: %s\n", errmsg (b)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/suunto_vyper_test.c b/examples/suunto_vyper_test.c deleted file mode 100644 index aaf9927..0000000 --- a/examples/suunto_vyper_test.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include // atoi - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_sdm (const char* name) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_vyper_device_open\n"); - dc_status_t rc = suunto_vyper_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - message ("dc_device_foreach\n"); - rc = dc_device_foreach (device, NULL, NULL); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read dives."); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("suunto_vyper_device_open\n"); - dc_status_t rc = suunto_vyper_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("VYPER.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_sdm (name); - dc_status_t b = test_dump_memory (name, "VYPER.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_sdm: %s\n", errmsg (a)); - message ("test_dump_memory: %s\n", errmsg (b)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/uwatec_aladin_test.c b/examples/uwatec_aladin_test.c deleted file mode 100644 index 5de5771..0000000 --- a/examples/uwatec_aladin_test.c +++ /dev/null @@ -1,87 +0,0 @@ -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("uwatec_aladin_device_open\n"); - dc_status_t rc = uwatec_aladin_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("ALADIN.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "ALADIN.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} - diff --git a/examples/uwatec_memomouse_test.c b/examples/uwatec_memomouse_test.c deleted file mode 100644 index e27cdac..0000000 --- a/examples/uwatec_memomouse_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("uwatec_memomouse_device_open\n"); - dc_status_t rc = uwatec_memomouse_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("MEMOMOUSE.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "MEMOMOUSE.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/uwatec_smart_test.c b/examples/uwatec_smart_test.c deleted file mode 100644 index c6ee688..0000000 --- a/examples/uwatec_smart_test.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2008 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose -#include // malloc, free -#include // memset - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("uwatec_smart_device_open\n"); - dc_status_t rc = uwatec_smart_device_open (&device, context); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot open device."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("SMART.LOG"); - - dc_status_t a = test_dump_memory ("SMART.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -} diff --git a/examples/zeagle_n2ition3_test.c b/examples/zeagle_n2ition3_test.c deleted file mode 100644 index 96253ee..0000000 --- a/examples/zeagle_n2ition3_test.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * libdivecomputer - * - * Copyright (C) 2010 Jef Driesen - * - * 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 Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ - -#include // fopen, fwrite, fclose - -#include - -#include "utils.h" -#include "common.h" - -dc_status_t -test_dump_memory (const char* name, const char* filename) -{ - dc_context_t *context = NULL; - dc_device_t *device = NULL; - - dc_context_new (&context); - dc_context_set_loglevel (context, DC_LOGLEVEL_ALL); - dc_context_set_logfunc (context, logfunc, NULL); - - message ("zeagle_n2ition3_device_open\n"); - dc_status_t rc = zeagle_n2ition3_device_open (&device, context, name); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Error opening serial port."); - dc_context_free (context); - return rc; - } - - dc_buffer_t *buffer = dc_buffer_new (0); - - message ("dc_device_dump\n"); - rc = dc_device_dump (device, buffer); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot read memory."); - dc_buffer_free (buffer); - dc_device_close (device); - dc_context_free (context); - return rc; - } - - message ("Dumping data\n"); - FILE* fp = fopen (filename, "wb"); - if (fp != NULL) { - fwrite (dc_buffer_get_data (buffer), sizeof (unsigned char), dc_buffer_get_size (buffer), fp); - fclose (fp); - } - - dc_buffer_free (buffer); - - message ("dc_device_close\n"); - rc = dc_device_close (device); - if (rc != DC_STATUS_SUCCESS) { - WARNING ("Cannot close device."); - dc_context_free (context); - return rc; - } - - dc_context_free (context); - - return DC_STATUS_SUCCESS; -} - - -int main(int argc, char *argv[]) -{ - message_set_logfile ("N2ITION3.LOG"); - -#ifdef _WIN32 - const char* name = "COM1"; -#else - const char* name = "/dev/ttyS0"; -#endif - - if (argc > 1) { - name = argv[1]; - } - - message ("DEVICE=%s\n", name); - - dc_status_t a = test_dump_memory (name, "N2ITION3.DMP"); - - message ("\nSUMMARY\n"); - message ("-------\n"); - message ("test_dump_memory: %s\n", errmsg (a)); - - message_set_logfile (NULL); - - return 0; -}