aws / amazon-freertos-ble-android-sdk

Android SDK for FreeRTOS Bluetooth Devices.
Apache License 2.0
49 stars 41 forks source link

Send error codes to MCU #28

Closed dachalco closed 3 years ago

dachalco commented 4 years ago

Add mechanism to send 7-bit error codes to MCU device. Reports errors in upper 7-bits of existing CONTROL Gatt characteristic which previously only used the lowest bit. Now instead of cluelessly observing mqtt timeouts, the MCU can get a sense of what triggered that TIMEOUT from the peer's error codes.

There is a companion PR in amazon-freertos for handling these error codes on MCU side.

Side Note: Wanted to make full use of the exception reasons listed in org.eclipse.paho.client.mqttv3.MqttException.java and catch them in application layer but kept getting REASON_CODE_CLIENT_EXCEPTION claiming 'already connected 'despite adding triggers for other exception reasons, like deleting a policy that should be there. May be a separate issue, or I may need to look elsewhere in the code to retrieve that information.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.