aws / amazon-freertos-ble-android-sdk

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

BLE connection is not possible with nrf52840 Device #20

Closed tobaro-4 closed 4 years ago

tobaro-4 commented 4 years ago

Hello.

I am trying to do MQTT communication with AWS with nRF52840 Device. https://docs.aws.amazon.com/freertos/latest/userguide/getting_started_nordic.html I am doing this while looking at the guide of this link. However, it seems that the Android SDK Demo App and BLE are not connected.

Debug Log on Android SDK App is as follows. :

I/DeviceScanFragment: connect switch isChecked: ON
D/BluetoothAdapter: STATE_ON
D/BluetoothGatt: connect() - device: C3:CF:94:B6:44:6E, auto: true
D/BluetoothAdapter: isSecureModeEnabled
D/BluetoothGatt: registerApp()
D/BluetoothGatt: registerApp() - UUID=334c5136-bbdf-41c8-8b27-ec70512c459e
D/BluetoothGatt: onClientRegistered() - status=0 clientIf=13
D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=13 device=C3:CF:94:B6:44:6E
I/FRD: BLE connection state changed: 0; new state: BLE_CONNECTED
I/FRD: Connected to GATT server.
D/FRD: Processing BLE command: DISCOVER_SERVICES remaining mqtt queue 0, network queue 0
D/BluetoothGatt: discoverServices() - device: C3:CF:94:B6:44:6E
I/BluetoothDevice: createBond() for device C3:CF:94:B6:44:6E called by pid: 23382 tid: 23581
D/FRD: Bond state changed from 10 to 11
D/ViewRootImpl@deeedda[DeviceScanActivity]: MSG_WINDOW_FOCUS_CHANGED 0 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@13bfaca[DeviceScanActivity]
D/InputMethodManager: getNavigationBarColor() -855310
D/BluetoothGatt: onConnectionUpdated() - Device=C3:CF:94:B6:44:6E interval=6 latency=0 timeout=500 status=0
D/BluetoothGatt: onSearchComplete() = Device=C3:CF:94:B6:44:6E Status=0
I/FRD: Discovered Ble gatt services successfully. Bonding state: 11
D/FRD: GattService: 00001800-0000-1000-8000-00805f9b34fb
D/FRD:  |-characteristics: 00002a00-0000-1000-8000-00805f9b34fb
D/FRD:  |-characteristics: 00002a01-0000-1000-8000-00805f9b34fb
     |-characteristics: 00002a04-0000-1000-8000-00805f9b34fb
D/FRD:  |-characteristics: 00002aa6-0000-1000-8000-00805f9b34fb
    GattService: 00001801-0000-1000-8000-00805f9b34fb
D/FRD: GattService: 8a7f1168-48af-4efb-83b5-e679f932ff00
D/FRD:  |-characteristics: DEVICE_VERSION
     |-characteristics: IOT_ENDPOINT
D/FRD:  |-characteristics: DEVICE_MTU
D/FRD:  |-characteristics: DEVICE_PLATFORM
     |-characteristics: DEVICE_ID
D/FRD: GattService: a9d7166a-d72e-40a9-a002-48044cc30000
D/FRD:  |-characteristics: MQTT_CONTROL
     |-characteristics: MQTT_TX
D/FRD:  |-characteristics: MQTT_RX
D/FRD:  |-characteristics: MQTT_TXLARGE
D/FRD:  |-characteristics: MQTT_RXLARGE
D/FRD: GattService: c6f2d9e3-49e7-4125-9014-bfc6d669ff00
D/FRD:  |-characteristics: c6f2d9e3-49e7-4125-9014-bfc6d669ff01
D/FRD:  |-characteristics: c6f2d9e3-49e7-4125-9014-bfc6d669ff02
    There's no ble command in the queue.
D/BluetoothGatt: onConnectionUpdated() - Device=C3:CF:94:B6:44:6E interval=39 latency=0 timeout=500 status=0
D/ViewRootImpl@deeedda[DeviceScanActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@13bfaca[DeviceScanActivity]
    getNavigationBarColor() -855310
D/ViewRootImpl@deeedda[DeviceScanActivity]: stopped(false) old=false
I/AmazonFreeRTOSManager: Stopping ble device scan
D/BluetoothAdapter: STATE_ON
D/BluetoothLeScanner: Stop Scan with callback
D/BluetoothGatt: onConnectionUpdated() - Device=C3:CF:94:B6:44:6E interval=24 latency=0 timeout=400 status=0
D/BluetoothGatt: onClientConnectionState() - status=19 clientIf=13 device=C3:CF:94:B6:44:6E
I/FRD: BLE connection state changed: 19; new state: BLE_DISCONNECTED
    Disconnected from GATT server.
I/DeviceScanFragment: BLE connection status changed to: BLE_DISCONNECTED
I/DeviceScanFragment: connect switch isChecked: OFF
D/FRD: Bond state changed from 11 to 10
D/InputMethodManager: prepareNavigationBarInfo() DecorView@13bfaca[DeviceScanActivity]
D/InputMethodManager: getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=software.amazon.freertos.demo ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel destroyed: 'ClientS', fd=77
D/ViewRootImpl@deeedda[DeviceScanActivity]: stopped(true) old=false
D/OpenGLRenderer: makeCurrent EglSurface : 0x6fb6b3ce80 -> 0x0
D/OpenGLRenderer: destroyEglSurface : 0x6fb6b3ce80
I/mali_egl: eglDestroySurface() in
I/mali_winsys: delete_surface() [1080x2280] return
I/mali_egl: eglDestroySurface() out
W/libEGL: EGLNativeWindowType 0x6fb3af6dd0 disconnect failed

I think BLE connect is disconnected due to Timeout because'y' msg does not come from Android App. Is that correct? Can you solve this problem? Please.

ravibhagavandas commented 4 years ago

@tobaro-4 I think this is a duplicate of the issue: https://github.com/aws/amazon-freertos/issues/2182

I have commented on the issue, pasting here for reference:

From the logs its seems the device is not receiving the input for confirmation for numeric comparison from the terminal:

9 416 [InputTask] Press 'y' to confirm

Are you using Segger embedded studio terminal ? If so the terminal does not accept input characters as mentioned in the doc:

Note

The Segger embedded studio terminal emulator does not support an input capability. For this, use a terminal emulator like PuTTy, Tera Term, or GNU Screen. Configure the terminal to connect to your board by a serial connection as instructed in Installing a terminal emulator.

As mentioned you can use other terminals like TeraTerm or Putty and press y to confirm numeric comparison on the device.
tobaro-4 commented 4 years ago

@ravibhagavandas Thanks for your kind answer.

What I want to know is that BLE connection is possible only by receiving'Y' MSG. I don't understand. If this is not a problem, I would like to know why the BLE connection is not working.

ravibhagavandas commented 4 years ago

@tobaro-4 I have replied to the post https://github.com/aws/amazon-freertos/issues/2182. Since this is same issue can we close one of them and link to the other issue.