36
36
37
37
#define CMD_VERSION 0x00
38
38
#define CMD_SET_TIME 0x13
39
+ #define CMD_EXIT_PCLINK 0x1D
39
40
#define CMD_LOGBOOK 0x21
40
41
#define CMD_DIVE 0x22
41
42
@@ -66,6 +67,7 @@ typedef struct cressi_goa_device_t {
66
67
static dc_status_t cressi_goa_device_set_fingerprint (dc_device_t * abstract , const unsigned char data [], unsigned int size );
67
68
static dc_status_t cressi_goa_device_foreach (dc_device_t * abstract , dc_dive_callback_t callback , void * userdata );
68
69
static dc_status_t cressi_goa_device_timesync (dc_device_t * abstract , const dc_datetime_t * datetime );
70
+ static dc_status_t cressi_goa_device_close (dc_device_t * abstract );
69
71
70
72
static const dc_device_vtable_t cressi_goa_device_vtable = {
71
73
sizeof (cressi_goa_device_t ),
@@ -76,7 +78,7 @@ static const dc_device_vtable_t cressi_goa_device_vtable = {
76
78
NULL , /* dump */
77
79
cressi_goa_device_foreach , /* foreach */
78
80
cressi_goa_device_timesync , /* timesync */
79
- NULL /* close */
81
+ cressi_goa_device_close /* close */
80
82
};
81
83
82
84
static dc_status_t
@@ -659,3 +661,23 @@ cressi_goa_device_timesync (dc_device_t *abstract, const dc_datetime_t *datetime
659
661
660
662
return status ;
661
663
}
664
+
665
+ static dc_status_t
666
+ cressi_goa_device_close (dc_device_t * abstract )
667
+ {
668
+ dc_status_t status = DC_STATUS_SUCCESS ;
669
+ cressi_goa_device_t * device = (cressi_goa_device_t * ) abstract ;
670
+ dc_transport_t transport = dc_iostream_get_transport (device -> iostream );
671
+
672
+ if (transport == DC_TRANSPORT_BLE ) {
673
+ return DC_STATUS_SUCCESS ;
674
+ }
675
+
676
+ status = cressi_goa_device_transfer (device , CMD_EXIT_PCLINK , NULL , 0 , NULL , 0 , NULL , NULL );
677
+ if (status != DC_STATUS_SUCCESS ) {
678
+ ERROR (abstract -> context , "Failed to exit PC Link." );
679
+ return status ;
680
+ }
681
+
682
+ return status ;
683
+ }
0 commit comments