mares_common.h (1873B)
1 /* 2 * libdivecomputer 3 * 4 * Copyright (C) 2009 Jef Driesen 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Lesser General Public 8 * License as published by the Free Software Foundation; either 9 * version 2.1 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Lesser General Public License for more details. 15 * 16 * You should have received a copy of the GNU Lesser General Public 17 * License along with this library; if not, write to the Free Software 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 19 * MA 02110-1301 USA 20 */ 21 22 #ifndef MARES_COMMON_H 23 #define MARES_COMMON_H 24 25 #include <libdivecomputer/iostream.h> 26 27 #include "device-private.h" 28 29 #ifdef __cplusplus 30 extern "C" { 31 #endif /* __cplusplus */ 32 33 #define PACKETSIZE 0x20 34 35 typedef struct mares_common_layout_t { 36 unsigned int memsize; 37 unsigned int rb_profile_begin; 38 unsigned int rb_profile_end; 39 unsigned int rb_freedives_begin; 40 unsigned int rb_freedives_end; 41 } mares_common_layout_t; 42 43 typedef struct mares_common_device_t { 44 dc_device_t base; 45 dc_iostream_t *iostream; 46 unsigned int echo; 47 unsigned int delay; 48 } mares_common_device_t; 49 50 void 51 mares_common_device_init (mares_common_device_t *device, dc_iostream_t *iostream); 52 53 dc_status_t 54 mares_common_device_read (dc_device_t *abstract, unsigned int address, unsigned char data[], unsigned int size); 55 56 dc_status_t 57 mares_common_extract_dives (dc_context_t *context, const mares_common_layout_t *layout, const unsigned char fingerprint[], const unsigned char data[], dc_dive_callback_t callback, void *userdata); 58 59 #ifdef __cplusplus 60 } 61 #endif /* __cplusplus */ 62 #endif /* MARES_COMMON_H */