I have some questions on the use of Bluetooth Medic, based on the following observations.
Because Bluetooth stops on one of my devices I have been looking at the BluetoothMedic to see whether it can help. I've looked at the debug messages and the source code. I get somewhat different results depending on whether I use enablePeriodicTests() or individually run runScanTest() and runTransmitterTest().
With enablePeriodicTests(), BluetoothTestJob.onStartJob() runs scan and transmitter tests every 15 minutes, apparently OK. If my beacon is transmitting, I get "Scan test succeeded" then "scan test complete" from the scan test, and if not I get "Timeout running scan test" then "scan test complete". After that the transmitter test runs and I get "Transmitter test succeeded" then "transmitter test complete" in all cases.
However I get different behaviour when I add buttons that execute the runScanTest() and runTransmitterTest() calls. In both cases the code enters the while() loops waiting for a non-null test result, and times out after 5s. Because the test results are null, the calls then return true (for the scan test) and false (for the transmitter test).
In the case of the scan test, the onScanResult() callback is never called if my beacon is not transmitting, but if the beacon is transmitting it is called 10-20 times (I see many "Scan test succeeded" messages) but only AFTER runScanTest() returns.
In the case of the transmitter test, the onStartSuccess() callback is fired once and I see a "Transmitter test succeeded" message but only AFTER the runTransmitterTest() returns.
Behaviour is the same for two devices (Android 7 and 8).
It would be good to have further documentation on these tests and how to use them.
Firstly, what do these tests do and what errors might they find?
Secondly - how should they be used? It looks like runScanTest() and runTransmitterTest() can't be called simply - do they need their own threads or something?
Finally, are they safe to use while the ranging and monitoring code is in action, or do they interfere?