Android Question How to get the device state in BLE2

Rosin

Member
Licensed User
Hello,now i have a app using the library of BLE2 to operate with our company's machine,it works success at all time.Thanks to the platform of B4A!But there is a problem that how can i get the state of BLE2 device.For example,i connect the device.Open the notify,and write data,then disconnect.But if i want to reconnect it.i need know if the device have opened the notify.i try to found the resolution in the forum but what i can know is the type of the service it can provide and how to open it in my code.Any response is appreciated.
 

Rosin

Member
Licensed User
Thank you
You will need to track the state yourself.

1. Make sure to use B4XPages.
2. Add a "connected" global variable and set its state in the Connected / Disconnected events.
Erel,i try to use the global variable is connected and issetnotify in my app,in your suggestion,it is meant that if i have opened the notify and set the variable issetnotify = true,at this time i don't need to check it in other way unless i exit the app?
 
Upvote 0

Rosin

Member
Licensed User
Thank you

Erel,i try to use the global variable is connected and issetnotify in my app,in your suggestion,it is meant that if i have opened the notify and set the variable issetnotify = true,at this time i don't need to check it in other way unless i exit the app?
In my solution I write my code in the event of data available, at the first time I will check If the machine had the function of settingnotify,If it does I will try to open the process in my application.And if succeed I will set the global Variable issetnotify to true
 
Upvote 0
Top