aws / amazon-freertos-ble-android-sdk

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

set MTU #3

Closed chegewara closed 5 years ago

chegewara commented 5 years ago

In my case IoT thing usually returns 0 from MTU characteristic at first connection. When this happen android app is trying set MTU 0 and menu is not being activated. Could we change code in here to value DemoConstants.MTU: https://github.com/aws/amazon-freertos-ble-android-sdk/blob/a15fc244d3d25e1d54b80f3ec50c180e18a6a68c/amazonfreertossdk/src/main/java/com/amazon/aws/amazonfreertossdk/AmazonFreeRTOSManager.java#L560

bxpan commented 5 years ago

Hi chegewara,

Thanks for your interest in Amazon FreeRTOS BLE Android SDK. Is there a particular reason why the default MTU on your IoT thing must be set to 0 ? The idea is that the IoT device should have a default MTU value (usually the max mtu it can support), the SDK will query that default mtu automatically upon connection, and calls setMtu. In this way the logic is fully handled by the SDK and the app does not need to worry about what MTU to set. The DemoConstants.MTU will be removed in the next release to reflect this concept that app should not need to worry about what MTU to set.

chegewara commented 5 years ago

Hi, maybe i used wrong expression. With old version, when i had to exchange MTU manually after connection all has been working fine. Now when it is done auto-magically from android studio logs i can see that for some reason this app is setting MTU = 0. I have not set it to 0 in my esp32 (its not possible, because minimum allowed is 23). I am using amazon AWSFreeRTOS ble-beta branch on esp32, which has set MTU to 512.

The idea is that the IoT device should have a default MTU value (usually the max mtu it can support), the SDK will query that default mtu automatically upon connection, and calls setMtu. In this way the logic is fully handled by the SDK and the app does not need to worry about what MTU to set. The DemoConstants.MTU will be removed in the next release to reflect this concept that app should not need to worry about what MTU to set.

I agree its best option, thanks for update. In such case i will close this issue.