This is a rough merge of the upstream libdivecomputer changes. I say "rough", because this disables the custom serial code as it clashes very badly with Jef's new dc_serial_t abstraction. Anton Lundin has patches on top of this to re-introduce the custom code in a way that integrates better with the upstream libdivecomputer state. * git://git.libdivecomputer.org/libdivecomputer: (42 commits) Add support for the Sherwood Vision. Fix the decoding of the maximum depth. Improve the default layout detection. Add a warning for unsupported devices. Fix the temperature for the Tusa Zen Air. Add support for the Aqualung i550T. Use the new settings field for the salinity. Fix the parsing of freedives. Detect the gauge and freedive mode correctly. Add the salinity field for the Aladin Tec. Add support for the Scubapro Mantis 2. Fix the decoding of the dive time. Add support for the Scubapro Mantis. Fix the Aeris 500AI serial number. Add the serial number encoding to the layout. Add salinity and timezone fields to Aladin Tec 2G Add NDL and RBT for the ATOM31 and I450T Add support for the new extended hardware descriptor. Update the OSTC device descriptors. Add a workaround for an OSTC4 firmware bug. ...
114 lines
3.3 KiB
C
114 lines
3.3 KiB
C
/*
|
|
* libdivecomputer
|
|
*
|
|
* Copyright (C) 2008 Jef Driesen
|
|
* Copyright (C) 2015 Claudiu Olteanu
|
|
*
|
|
* 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
|
|
*/
|
|
|
|
#ifndef DC_DEVICE_H
|
|
#define DC_DEVICE_H
|
|
|
|
#include "common.h"
|
|
#include "context.h"
|
|
#include "descriptor.h"
|
|
#include "buffer.h"
|
|
#include "datetime.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
typedef enum dc_event_type_t {
|
|
DC_EVENT_WAITING = (1 << 0),
|
|
DC_EVENT_PROGRESS = (1 << 1),
|
|
DC_EVENT_DEVINFO = (1 << 2),
|
|
DC_EVENT_CLOCK = (1 << 3),
|
|
DC_EVENT_VENDOR = (1 << 4)
|
|
} dc_event_type_t;
|
|
|
|
typedef struct dc_device_t dc_device_t;
|
|
typedef struct dc_serial_t dc_serial_t;
|
|
|
|
typedef struct dc_event_progress_t {
|
|
unsigned int current;
|
|
unsigned int maximum;
|
|
} dc_event_progress_t;
|
|
|
|
typedef struct dc_event_devinfo_t {
|
|
unsigned int model;
|
|
unsigned int firmware;
|
|
unsigned int serial;
|
|
} dc_event_devinfo_t;
|
|
|
|
typedef struct dc_event_clock_t {
|
|
unsigned int devtime;
|
|
dc_ticks_t systime;
|
|
} dc_event_clock_t;
|
|
|
|
typedef struct dc_event_vendor_t {
|
|
const unsigned char *data;
|
|
unsigned int size;
|
|
} dc_event_vendor_t;
|
|
|
|
typedef int (*dc_cancel_callback_t) (void *userdata);
|
|
|
|
typedef void (*dc_event_callback_t) (dc_device_t *device, dc_event_type_t event, const void *data, void *userdata);
|
|
|
|
typedef int (*dc_dive_callback_t) (const unsigned char *data, unsigned int size, const unsigned char *fingerprint, unsigned int fsize, void *userdata);
|
|
|
|
dc_status_t
|
|
dc_device_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descriptor, const char *name);
|
|
|
|
dc_status_t
|
|
dc_device_custom_open (dc_device_t **out, dc_context_t *context, dc_descriptor_t *descriptor, dc_serial_t *serial);
|
|
|
|
dc_family_t
|
|
dc_device_get_type (dc_device_t *device);
|
|
|
|
dc_status_t
|
|
dc_device_set_cancel (dc_device_t *device, dc_cancel_callback_t callback, void *userdata);
|
|
|
|
dc_status_t
|
|
dc_device_set_events (dc_device_t *device, unsigned int events, dc_event_callback_t callback, void *userdata);
|
|
|
|
dc_status_t
|
|
dc_device_set_fingerprint (dc_device_t *device, const unsigned char data[], unsigned int size);
|
|
|
|
dc_status_t
|
|
dc_device_version (dc_device_t *device, unsigned char data[], unsigned int size);
|
|
|
|
dc_status_t
|
|
dc_device_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size);
|
|
|
|
dc_status_t
|
|
dc_device_write (dc_device_t *device, unsigned int address, const unsigned char data[], unsigned int size);
|
|
|
|
dc_status_t
|
|
dc_device_dump (dc_device_t *device, dc_buffer_t *buffer);
|
|
|
|
dc_status_t
|
|
dc_device_foreach (dc_device_t *device, dc_dive_callback_t callback, void *userdata);
|
|
|
|
dc_status_t
|
|
dc_device_close (dc_device_t *device);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
#endif /* DC_DEVICE_H */
|