Skip to content

Commit 9b12e8e

Browse files
authored
Merge pull request #63 from mikeller/cherry_pick_mares_fix
2 parents 5d321de + d9c2308 commit 9b12e8e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/mares_iconhd.c

+11-1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
183183
{
184184
dc_status_t status = DC_STATUS_SUCCESS;
185185
dc_device_t *abstract = (dc_device_t *) device;
186+
dc_transport_t transport = dc_iostream_get_transport (device->iostream);
186187

187188
if (device_is_cancelled (abstract))
188189
return DC_STATUS_CANCELLED;
@@ -198,7 +199,7 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
198199
}
199200

200201
// Send the command payload to the dive computer.
201-
if (size) {
202+
if (size && transport == DC_TRANSPORT_BLE) {
202203
status = dc_iostream_write (device->iostream, data, size, NULL);
203204
if (status != DC_STATUS_SUCCESS) {
204205
ERROR (abstract->context, "Failed to send the command.");
@@ -220,6 +221,15 @@ mares_iconhd_packet (mares_iconhd_device_t *device,
220221
return DC_STATUS_PROTOCOL;
221222
}
222223

224+
// Send the command payload to the dive computer.
225+
if (size && transport != DC_TRANSPORT_BLE) {
226+
status = dc_iostream_write (device->iostream, data, size, NULL);
227+
if (status != DC_STATUS_SUCCESS) {
228+
ERROR (abstract->context, "Failed to send the command data.");
229+
return status;
230+
}
231+
}
232+
223233
// Read the packet.
224234
status = dc_iostream_read (device->iostream, answer, asize, NULL);
225235
if (status != DC_STATUS_SUCCESS) {

0 commit comments

Comments
 (0)