Rename the Suunto Spyder parser as the Eon parser.
Both devices have an almost identical data format. Renaming the parser backend makes it more consistent with the corresponding device backend.
This commit is contained in:
parent
ceeee5b2fa
commit
098b229bc6
@ -304,6 +304,10 @@
|
||||
RelativePath="..\src\suunto_eon.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\suunto_eon_parser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\suunto_solution.c"
|
||||
>
|
||||
@ -312,10 +316,6 @@
|
||||
RelativePath="..\src\suunto_solution_parser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\suunto_spyder_parser.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\suunto_vyper.c"
|
||||
>
|
||||
|
||||
@ -52,8 +52,8 @@ libdivecomputer_la_SOURCES = \
|
||||
suunto_common.h suunto_common.c \
|
||||
suunto_common2.h suunto_common2.c \
|
||||
suunto_solution.h suunto_solution.c suunto_solution_parser.c \
|
||||
suunto_eon.h suunto_eon.c \
|
||||
suunto_vyper.h suunto_vyper.c suunto_vyper_parser.c suunto_spyder_parser.c \
|
||||
suunto_eon.h suunto_eon.c suunto_eon_parser.c \
|
||||
suunto_vyper.h suunto_vyper.c suunto_vyper_parser.c \
|
||||
suunto_vyper2.h suunto_vyper2.c \
|
||||
suunto_d9.h suunto_d9.c suunto_d9_parser.c \
|
||||
reefnet.h \
|
||||
|
||||
@ -26,7 +26,7 @@ uwatec_smart_parser_create
|
||||
#endif
|
||||
suunto_vyper_parser_create
|
||||
suunto_solution_parser_create
|
||||
suunto_spyder_parser_create
|
||||
suunto_eon_parser_create
|
||||
suunto_d9_parser_create
|
||||
mares_nemo_parser_create
|
||||
oceanic_vtpro_parser_create
|
||||
|
||||
@ -29,7 +29,7 @@ extern "C" {
|
||||
typedef enum parser_type_t {
|
||||
PARSER_TYPE_NULL = 0,
|
||||
PARSER_TYPE_SUUNTO_SOLUTION,
|
||||
PARSER_TYPE_SUUNTO_SPYDER,
|
||||
PARSER_TYPE_SUUNTO_EON,
|
||||
PARSER_TYPE_SUUNTO_VYPER,
|
||||
PARSER_TYPE_SUUNTO_D9,
|
||||
PARSER_TYPE_REEFNET_SENSUS,
|
||||
|
||||
@ -22,12 +22,13 @@
|
||||
#ifndef SUUNTO_EON_H
|
||||
#define SUUNTO_EON_H
|
||||
|
||||
#include "device.h"
|
||||
#include "parser.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include "device.h"
|
||||
|
||||
#define SUUNTO_EON_MEMORY_SIZE 0x900
|
||||
|
||||
device_status_t
|
||||
@ -42,6 +43,9 @@ suunto_eon_device_write_interval (device_t *device, unsigned char interval);
|
||||
device_status_t
|
||||
suunto_eon_extract_dives (device_t *device, const unsigned char data[], unsigned int size, dive_callback_t callback, void *userdata);
|
||||
|
||||
parser_status_t
|
||||
suunto_eon_parser_create (parser_t **parser);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@ -22,54 +22,54 @@
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "suunto_vyper.h"
|
||||
#include "suunto_eon.h"
|
||||
#include "parser-private.h"
|
||||
#include "units.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef struct suunto_spyder_parser_t suunto_spyder_parser_t;
|
||||
typedef struct suunto_eon_parser_t suunto_eon_parser_t;
|
||||
|
||||
struct suunto_spyder_parser_t {
|
||||
struct suunto_eon_parser_t {
|
||||
parser_t base;
|
||||
};
|
||||
|
||||
static parser_status_t suunto_spyder_parser_set_data (parser_t *abstract, const unsigned char *data, unsigned int size);
|
||||
static parser_status_t suunto_spyder_parser_samples_foreach (parser_t *abstract, sample_callback_t callback, void *userdata);
|
||||
static parser_status_t suunto_spyder_parser_destroy (parser_t *abstract);
|
||||
static parser_status_t suunto_eon_parser_set_data (parser_t *abstract, const unsigned char *data, unsigned int size);
|
||||
static parser_status_t suunto_eon_parser_samples_foreach (parser_t *abstract, sample_callback_t callback, void *userdata);
|
||||
static parser_status_t suunto_eon_parser_destroy (parser_t *abstract);
|
||||
|
||||
static const parser_backend_t suunto_spyder_parser_backend = {
|
||||
PARSER_TYPE_SUUNTO_SPYDER,
|
||||
suunto_spyder_parser_set_data, /* set_data */
|
||||
suunto_spyder_parser_samples_foreach, /* samples_foreach */
|
||||
suunto_spyder_parser_destroy /* destroy */
|
||||
static const parser_backend_t suunto_eon_parser_backend = {
|
||||
PARSER_TYPE_SUUNTO_EON,
|
||||
suunto_eon_parser_set_data, /* set_data */
|
||||
suunto_eon_parser_samples_foreach, /* samples_foreach */
|
||||
suunto_eon_parser_destroy /* destroy */
|
||||
};
|
||||
|
||||
|
||||
static int
|
||||
parser_is_suunto_spyder (parser_t *abstract)
|
||||
parser_is_suunto_eon (parser_t *abstract)
|
||||
{
|
||||
if (abstract == NULL)
|
||||
return 0;
|
||||
|
||||
return abstract->backend == &suunto_spyder_parser_backend;
|
||||
return abstract->backend == &suunto_eon_parser_backend;
|
||||
}
|
||||
|
||||
|
||||
parser_status_t
|
||||
suunto_spyder_parser_create (parser_t **out)
|
||||
suunto_eon_parser_create (parser_t **out)
|
||||
{
|
||||
if (out == NULL)
|
||||
return PARSER_STATUS_ERROR;
|
||||
|
||||
// Allocate memory.
|
||||
suunto_spyder_parser_t *parser = (suunto_spyder_parser_t *) malloc (sizeof (suunto_spyder_parser_t));
|
||||
suunto_eon_parser_t *parser = (suunto_eon_parser_t *) malloc (sizeof (suunto_eon_parser_t));
|
||||
if (parser == NULL) {
|
||||
WARNING ("Failed to allocate memory.");
|
||||
return PARSER_STATUS_MEMORY;
|
||||
}
|
||||
|
||||
// Initialize the base class.
|
||||
parser_init (&parser->base, &suunto_spyder_parser_backend);
|
||||
parser_init (&parser->base, &suunto_eon_parser_backend);
|
||||
|
||||
*out = (parser_t*) parser;
|
||||
|
||||
@ -78,9 +78,9 @@ suunto_spyder_parser_create (parser_t **out)
|
||||
|
||||
|
||||
static parser_status_t
|
||||
suunto_spyder_parser_destroy (parser_t *abstract)
|
||||
suunto_eon_parser_destroy (parser_t *abstract)
|
||||
{
|
||||
if (! parser_is_suunto_spyder (abstract))
|
||||
if (! parser_is_suunto_eon (abstract))
|
||||
return PARSER_STATUS_TYPE_MISMATCH;
|
||||
|
||||
// Free memory.
|
||||
@ -91,9 +91,9 @@ suunto_spyder_parser_destroy (parser_t *abstract)
|
||||
|
||||
|
||||
static parser_status_t
|
||||
suunto_spyder_parser_set_data (parser_t *abstract, const unsigned char *data, unsigned int size)
|
||||
suunto_eon_parser_set_data (parser_t *abstract, const unsigned char *data, unsigned int size)
|
||||
{
|
||||
if (! parser_is_suunto_spyder (abstract))
|
||||
if (! parser_is_suunto_eon (abstract))
|
||||
return PARSER_STATUS_TYPE_MISMATCH;
|
||||
|
||||
return PARSER_STATUS_SUCCESS;
|
||||
@ -101,9 +101,9 @@ suunto_spyder_parser_set_data (parser_t *abstract, const unsigned char *data, un
|
||||
|
||||
|
||||
static parser_status_t
|
||||
suunto_spyder_parser_samples_foreach (parser_t *abstract, sample_callback_t callback, void *userdata)
|
||||
suunto_eon_parser_samples_foreach (parser_t *abstract, sample_callback_t callback, void *userdata)
|
||||
{
|
||||
if (! parser_is_suunto_spyder (abstract))
|
||||
if (! parser_is_suunto_eon (abstract))
|
||||
return PARSER_STATUS_TYPE_MISMATCH;
|
||||
|
||||
const unsigned char *data = abstract->data;
|
||||
@ -47,9 +47,6 @@ suunto_vyper_extract_dives (device_t *device, const unsigned char data[], unsign
|
||||
parser_status_t
|
||||
suunto_vyper_parser_create (parser_t **parser);
|
||||
|
||||
parser_status_t
|
||||
suunto_spyder_parser_create (parser_t **parser);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user