pablojimenezmateo / GodotAndroidBluetoothDemo

Godot 3.4.4 demo on how to use Bluetooth communications
9 stars 2 forks source link

Connect function crashes #2

Open Vpiro opened 1 year ago

Vpiro commented 1 year ago

Hi, I am just trying the compiled apk on my android phone, after scan I am trying to connect to a discovered device but it crashes and exits. How can I understand the problem in order to print the error? Thank you Vincenzo

pablojimenezmateo commented 1 year ago

Hi, most likely you forgot to change the UUIDs that are hardcoded on the code here please change those UUIDs to the ones from your device.

Vpiro commented 1 year ago

Thank you for info, the app is not crashing anymore, I have commented the characteristic subscription at row 66 (_on_characteristic_finding method) It should use the service_uuid that has been just discovered.

Vpiro commented 1 year ago

Good morning, I have worked on your bluetooth demo (I will share with you my improvements at the end). I can discover all devices and query all services (using a dictionary to recognize standard ones), the app crashes when I try to subscribe to a characteristic using; GodotBluetooth344.subscribeToCharacteristic(characteristic.service_uuid, characteristic.characteristic_uuid) For this purpose, I use the current characteristic dictionary just discovered in _on_characteristic_found method.

Reading from the site: https://github.com/pablojimenezmateo/GodotAndroidBluetoothPlugin I see this syntax of the following method: GodotBluetooth344.subscribeToCharacteristic(service_uuid, read_uuid) the 2nd parameter should be characteristic_uuid as I see in the arguments specified in the same page.

Could you help me to undestand if I am using correctly this routine. Thank you Vincenzo MainScene.gd.txt MainScene.tscn.txt

pablojimenezmateo commented 1 year ago

Hi Vincenzo,

I am currently on vacations but I will be back on Monday, let me check it then and we can work together on this.

Vpiro commented 1 year ago

Have a nice time! And thank you for your support

Vpiro commented 1 year ago

Hi, just to send you fixed version of plugin. Now the godot app works correctly without crashes, receving all signals from plugin. Some fixes:

Bye, have a nice weekend

[BluetoothManager.java.txt] (https://github.com/pablojimenezmateo/GodotAndroidBluetoothDemo/files/10197292/BluetoothManager.java.txt)

Vpiro commented 1 year ago

Hi, just to send you fixed version of plugin. Now the godot app works correctly without crashes, receving all signals from plugin. Some fixes:

Bye, have a nice weekend

[BluetoothManager.java.txt] (https://github.com/pablojimenezmateo/GodotAndroidBluetoothDemo/files/10197292/BluetoothManager.java.txt)