Ignore unsupported BLE handshake

For some BLE enabled models, like the Oceanic Pro Plus X, Aqualung
i750TC, Sherwood Sage and Sherwood Beacon, the BLE handshake command
is not supported and therefore disabled.

However, based on a bug report by a user with two Aqualung i770R dive
computers, this detection mechanism based on the dive computer model
number isn't sufficient. Allthough the two devices have the exact same
firmware version (2A), the handshake command only works on the newest
unit, and fails with a NAK response on the oldest unit.

Remove the model based detection and always try to send the handshake
command and rely on the NAK response to ignore the failure instead. An
additional advantage is that we no longer have to (manually) maintain a
list with the model numbers where the handshaking is known to fail.
This commit is contained in:
Jef Driesen 2021-10-07 19:57:23 +02:00
parent ba4a119a4f
commit cd0f42804a

View File

@ -819,8 +819,14 @@ oceanic_atom2_ble_handshake(oceanic_atom2_device_t *device)
// Send the command to the dive computer.
rc = oceanic_atom2_transfer (device, handshake, sizeof(handshake), ACK, NULL, 0, 0);
if (rc != DC_STATUS_SUCCESS)
return rc;
if (rc != DC_STATUS_SUCCESS) {
if (rc == DC_STATUS_UNSUPPORTED) {
WARNING (abstract->context, "Bluetooth handshake not supported.");
return DC_STATUS_SUCCESS;
} else {
return rc;
}
}
return DC_STATUS_SUCCESS;
}
@ -916,8 +922,7 @@ oceanic_atom2_device_open (dc_device_t **out, dc_context_t *context, dc_iostream
goto error_free;
}
if (dc_iostream_get_transport (device->iostream) == DC_TRANSPORT_BLE &&
model != PROPLUSX && model != I750TC && model != SAGE && model != BEACON) {
if (dc_iostream_get_transport (device->iostream) == DC_TRANSPORT_BLE) {
status = oceanic_atom2_ble_handshake(device);
if (status != DC_STATUS_SUCCESS) {
goto error_free;