Merge pull request #63 from mikeller/cherry_pick_mares_fix
This commit is contained in:
commit
9b12e8e638
@ -183,6 +183,7 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
|
|||||||
{
|
{
|
||||||
dc_status_t status = DC_STATUS_SUCCESS;
|
dc_status_t status = DC_STATUS_SUCCESS;
|
||||||
dc_device_t *abstract = (dc_device_t *) device;
|
dc_device_t *abstract = (dc_device_t *) device;
|
||||||
|
dc_transport_t transport = dc_iostream_get_transport (device->iostream);
|
||||||
|
|
||||||
if (device_is_cancelled (abstract))
|
if (device_is_cancelled (abstract))
|
||||||
return DC_STATUS_CANCELLED;
|
return DC_STATUS_CANCELLED;
|
||||||
@ -198,7 +199,7 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send the command payload to the dive computer.
|
// Send the command payload to the dive computer.
|
||||||
if (size) {
|
if (size && transport == DC_TRANSPORT_BLE) {
|
||||||
status = dc_iostream_write (device->iostream, data, size, NULL);
|
status = dc_iostream_write (device->iostream, data, size, NULL);
|
||||||
if (status != DC_STATUS_SUCCESS) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
ERROR (abstract->context, "Failed to send the command.");
|
ERROR (abstract->context, "Failed to send the command.");
|
||||||
@ -220,6 +221,15 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
|
|||||||
return DC_STATUS_PROTOCOL;
|
return DC_STATUS_PROTOCOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the command payload to the dive computer.
|
||||||
|
if (size && transport != DC_TRANSPORT_BLE) {
|
||||||
|
status = dc_iostream_write (device->iostream, data, size, NULL);
|
||||||
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
|
ERROR (abstract->context, "Failed to send the command data.");
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read the packet.
|
// Read the packet.
|
||||||
status = dc_iostream_read (device->iostream, answer, asize, NULL);
|
status = dc_iostream_read (device->iostream, answer, asize, NULL);
|
||||||
if (status != DC_STATUS_SUCCESS) {
|
if (status != DC_STATUS_SUCCESS) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user