suunto_common2.h (2679B)
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 SUUNTO_COMMON2_H 23 #define SUUNTO_COMMON2_H 24 25 #include "device-private.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif /* __cplusplus */ 30 31 typedef struct suunto_common2_layout_t { 32 // Memory size. 33 unsigned int memsize; 34 // Fingerprint 35 unsigned int fingerprint; 36 // Serial number. 37 unsigned int serial; 38 // Profile ringbuffer 39 unsigned int rb_profile_begin; 40 unsigned int rb_profile_end; 41 } suunto_common2_layout_t; 42 43 typedef struct suunto_common2_device_t { 44 dc_device_t base; 45 const suunto_common2_layout_t *layout; 46 unsigned char version[4]; 47 unsigned char fingerprint[7]; 48 } suunto_common2_device_t; 49 50 typedef struct suunto_common2_device_vtable_t { 51 dc_device_vtable_t base; 52 dc_status_t (*packet) (dc_device_t *device, const unsigned char command[], unsigned int csize, unsigned char answer[], unsigned int asize, unsigned int size); 53 } suunto_common2_device_vtable_t; 54 55 void 56 suunto_common2_device_init (suunto_common2_device_t *device); 57 58 dc_status_t 59 suunto_common2_device_set_fingerprint (dc_device_t *device, const unsigned char data[], unsigned int size); 60 61 dc_status_t 62 suunto_common2_device_version (dc_device_t *device, unsigned char data[], unsigned int size); 63 64 dc_status_t 65 suunto_common2_device_read (dc_device_t *device, unsigned int address, unsigned char data[], unsigned int size); 66 67 dc_status_t 68 suunto_common2_device_write (dc_device_t *device, unsigned int address, const unsigned char data[], unsigned int size); 69 70 dc_status_t 71 suunto_common2_device_dump (dc_device_t *device, dc_buffer_t *buffer); 72 73 dc_status_t 74 suunto_common2_device_foreach (dc_device_t *device, dc_dive_callback_t callback, void *userdata); 75 76 dc_status_t 77 suunto_common2_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime); 78 79 dc_status_t 80 suunto_common2_device_reset_maxdepth (dc_device_t *device); 81 82 #ifdef __cplusplus 83 } 84 #endif /* __cplusplus */ 85 #endif /* SUUNTO_COMMON2_H */