Remove the device specific example applications.

These device specific applications became obsolete long time ago with
the introduction of the universal application.
This commit is contained in:
Jef Driesen 2014-07-02 16:40:27 +02:00
parent 33710423ac
commit 77d53813bd
25 changed files with 1 additions and 2861 deletions

View File

@ -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

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/cressi_edy.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/cressi_leonardo.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/hw_frog.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/hw_ostc.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/mares_darwin.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <stdlib.h>
#include <libdivecomputer/mares_iconhd.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/mares_nemo.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/mares_puck.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/oceanic_atom2.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/oceanic_veo250.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/oceanic_vtpro.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <time.h> // time
#include <libdivecomputer/reefnet_sensus.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <time.h> // time
#include <libdivecomputer/reefnet_sensuspro.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <time.h> // time
#include <libdivecomputer/reefnet_sensusultra.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/shearwater_predator.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/suunto_d9.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/suunto_eon.h>
#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;
}

View File

@ -1,87 +0,0 @@
#include <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/suunto.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/suunto_vyper2.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <stdlib.h> // atoi
#include <libdivecomputer/suunto_vyper.h>
#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;
}

View File

@ -1,87 +0,0 @@
#include <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/uwatec_aladin.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/uwatec_memomouse.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <stdlib.h> // malloc, free
#include <string.h> // memset
#include <libdivecomputer/uwatec_smart.h>
#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;
}

View File

@ -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 <stdio.h> // fopen, fwrite, fclose
#include <libdivecomputer/zeagle_n2ition3.h>
#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;
}