Add cancellation support to several backends.

Some backends are technically capable of supporting cancellation, but
still lacked the necessary code to enable it.
This commit is contained in:
Jef Driesen 2013-09-02 23:28:48 +02:00
parent 888b6ab03f
commit b35e07b71b
6 changed files with 18 additions and 0 deletions

View File

@ -83,6 +83,9 @@ cressi_edy_transfer (cressi_edy_device_t *device, const unsigned char command[],
assert (asize >= csize);
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Flush the serial input buffer.
int rc = serial_flush (device->port, SERIAL_QUEUE_INPUT);
if (rc == -1) {

View File

@ -111,6 +111,9 @@ hw_frog_transfer (hw_frog_device_t *device,
{
dc_device_t *abstract = (dc_device_t *) device;
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Send the command.
unsigned char command[1] = {cmd};
int n = serial_write (device->port, command, sizeof (command));

View File

@ -108,6 +108,9 @@ hw_ostc3_transfer (hw_ostc3_device_t *device,
{
dc_device_t *abstract = (dc_device_t *) device;
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Send the command.
unsigned char command[1] = {cmd};
int n = serial_write (device->port, command, sizeof (command));

View File

@ -122,6 +122,9 @@ mares_iconhd_transfer (mares_iconhd_device_t *device,
assert (csize >= 2);
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Send the command header to the dive computer.
int n = serial_write (device->port, command, 2);
if (n != 2) {

View File

@ -266,6 +266,9 @@ shearwater_common_transfer (shearwater_common_device_t *device, const unsigned c
if (isize > SZ_PACKET || osize > SZ_PACKET)
return DC_STATUS_INVALIDARGS;
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Setup the request packet.
packet[0] = 0xFF;
packet[1] = 0x01;

View File

@ -79,6 +79,9 @@ zeagle_n2ition3_packet (zeagle_n2ition3_device_t *device, const unsigned char co
assert (asize >= csize + 5);
if (device_is_cancelled (abstract))
return DC_STATUS_CANCELLED;
// Send the command to the device.
int n = serial_write (device->port, command, csize);
if (n != csize) {