J Josias Member Licensed User Longtime User Jul 16, 2018 #1 I am using Ble2 library to connect to my device. No problem. Enhancing my program I decided to change the program such that when the user opens my program it should automatically enable the BT adaptor if not enabled and start a scan for BLE devices. I am using both the BLE2 library and BluetoothAdmin. BluetoothAdmin is used to enable the adaptor and Ble2 is used for Tx/RX. Both libraries have got a 'StateChanged' event. It seems that two libraries are not playing nice together. Is there a way not to use BluetoothAdmin and to enable the BT adaptor or what are my options?
I am using Ble2 library to connect to my device. No problem. Enhancing my program I decided to change the program such that when the user opens my program it should automatically enable the BT adaptor if not enabled and start a scan for BLE devices. I am using both the BLE2 library and BluetoothAdmin. BluetoothAdmin is used to enable the adaptor and Ble2 is used for Tx/RX. Both libraries have got a 'StateChanged' event. It seems that two libraries are not playing nice together. Is there a way not to use BluetoothAdmin and to enable the BT adaptor or what are my options?
Erel B4X founder Staff member Licensed User Longtime User Jul 16, 2018 #2 Have you set the event name to a different value (when you initialize the relevant object)? Upvote 0
J Josias Member Licensed User Longtime User Jul 16, 2018 #3 THe majority of my code is snippets that I got from the various examples on the forum. Public manager As BleManager2 Public admin As BluetoothAdmin admin.Initialize("admin") manager.Initialize("manager") Upvote 0
THe majority of my code is snippets that I got from the various examples on the forum. Public manager As BleManager2 Public admin As BluetoothAdmin admin.Initialize("admin") manager.Initialize("manager")
J Josias Member Licensed User Longtime User Jul 16, 2018 #4 Should the name be the same or different? What effect does it have? What should be initialized first? manager or admin? Does it make a difference? Upvote 0
Should the name be the same or different? What effect does it have? What should be initialized first? manager or admin? Does it make a difference?
Erel B4X founder Staff member Licensed User Longtime User Jul 16, 2018 #5 It should be different. What exactly happens when it is not working properly? Upvote 0
J Josias Member Licensed User Longtime User Jul 16, 2018 #6 It seems to loose synchronization. The one will report that Bluetooth is off and the other will report that it is on. Upvote 0
It seems to loose synchronization. The one will report that Bluetooth is off and the other will report that it is on.
Erel B4X founder Staff member Licensed User Longtime User Jul 17, 2018 #7 Can you upload a small example that reproduces it? Upvote 0
J Josias Member Licensed User Longtime User Jul 17, 2018 #8 It seems that my understanding of the libraries is not complete. It seems that I am fighting something that is happening in the background as I was trying to enable the BT adaptor myself if it is not enabled. But it seems that something else is trying to enable the BT adaptor every 60 seconds. Can it be BleManager2 that is doing it? I've disabled BluetoothAdmin. If BleManager2 is trying to enable BT, what is the reason and what is trying to achieve? Upvote 0
It seems that my understanding of the libraries is not complete. It seems that I am fighting something that is happening in the background as I was trying to enable the BT adaptor myself if it is not enabled. But it seems that something else is trying to enable the BT adaptor every 60 seconds. Can it be BleManager2 that is doing it? I've disabled BluetoothAdmin. If BleManager2 is trying to enable BT, what is the reason and what is trying to achieve?
Erel B4X founder Staff member Licensed User Longtime User Jul 18, 2018 #9 BleManager2 doesn't enable the adapter. Upvote 0
P PeterPaulGumpal Member Licensed User Jul 27, 2018 #10 I can't find BleManager2 from the B4A Library, could some provide instruction please. Upvote 0
DonManfred Expert Licensed User Longtime User Jul 27, 2018 #11 https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/ The manager is a class module 7n the example from the Tutorial Upvote 0
https://www.b4x.com/android/forum/threads/android-bluetooth-bluetoothadmin-tutorial.14768/ The manager is a class module 7n the example from the Tutorial
Erel B4X founder Staff member Licensed User Longtime User Jul 29, 2018 #12 PeterPaulGumpal said: I can't find BleManager2 from the B4A Library, could some provide instruction please. Click to expand... You should never post in existing threads. Upvote 0
PeterPaulGumpal said: I can't find BleManager2 from the B4A Library, could some provide instruction please. Click to expand... You should never post in existing threads.