Page 1 of 1

Suspend bluetooth - mergBLE?

Posted: Sat May 04, 2019 12:32 am
by david_fff
I am a type 1 diabetic using a continuous glucose monitor (CGM) to track my blood sugar levels. On a few occasions my blood sugar may drop into the very low range and the monitor sounds a loud alert. Even after I eat carbs to bring my sugar levels up, the monitor will beep loudly every 5 minutes for 20 to 30 minutes until my sugars drift into an acceptable range. I can stop the beeping by turning off bluetooth then turning it on 30 minutes later. When this happens in the middle of the night, however, I would prefer to open an app that would suspend bluetooth for 20 to 30 minutes. Someone suggested the extension mergBLE could do this, but I am totally a novice when it comes to using extensions in Livecode. I would be most grateful for any suggestions, and I imagine many other diabetics using CGM would as well.

Re: Suspend bluetooth - mergBLE?

Posted: Sat May 04, 2019 4:47 pm
by jacque
Once installed, an extension works just like it's part of the engine. It sends messages to your scripts and scripts send commands to the extension.

Can you clarify a little more on the behavior you want? Do you want the app to recognize the alarm and turn off bluetooth by itself or are you just looking for a convenient way to tap an icon?

I assume you're on an iPhone since the merg extensions only work with iOS. If you have an Android phone there may be an easier way to do what you want with available software.

Re: Suspend bluetooth - mergBLE?

Posted: Sat May 04, 2019 7:29 pm
by SparkOut
I *think* he does not wamt any interactions between LiveCode and the CGM software. Only to have an app that can turn off Bluetooth (which will stop the alarm) and turn it ln again 30 minutes later (which will restore the app's monitoring).

On iOS, yes.

Re: Suspend bluetooth - mergBLE?

Posted: Sat May 04, 2019 10:46 pm
by david_fff
Yes, exactly that: when I click a button, it turns off Bluetooth (which will stop the alarm from repeating) and after a scripted amount of time (say 25 minutes) it automatically turns Bluetooth back on. That way I can go back to sleep right away without being continuously awakened by the alarm.
And yes, this is for iOS. Android users already can get an app that does this.
The CGM manufacturer (Dexcom) should really script this function into its iOS app but so far they do not seem to be interested.

Re: Suspend bluetooth - mergBLE?

Posted: Sun May 05, 2019 4:07 pm
by jacque
I took a look at the list of commands and messages available and while mergBLE has options for setting up and interacting with a device, I don't see anything that allows you to turn off Bluetooth at the hardware level. You might want to look at IFTTT in the App Store, there may be some options there.

On the other hand, Apple is very restrictive about what software can do, and they may not allow apps to control Bluetooth availability. If so, that may be why there isn't an iOS app already.

Edit : A quick search shows that Apple does disallow software control of the Bluetooth state.