aboutsummaryrefslogtreecommitdiffstats
path: root/core/btdiscovery.h
AgeCommit message (Collapse)Author
2020-09-30bluetooth discovery: report more information about progressGravatar Dirk Hohndel
We certainly should log errors and the complete list of discovered devices. Also, it's good practice to set a specific search time (I picked three minutes). This way we won't constantly scan and drain resources. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-09-30bluetooth discovery: differentiate discovered and paired devicesGravatar Dirk Hohndel
We call the same helper from two spots. Once when we report the already paired BT devices on Android, and once from the deviceDescovered signal for the discovery agent. Let's make sure we can tell where the info came from. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-08-22core/bluetooth: stop discovery once the dive computer has been foundGravatar Dirk Hohndel
There is no need to continue to look, and at least with the Shearwater Peregrine having the scan run while we are trying to discover characteristics appeared to cause issues. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-27Revert the singleton PRGravatar Dirk Hohndel
It turns out that this isn't working the way it was intended to. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-25Cleanup: unify idiosyncratic singletonsGravatar Berthold Stoeger
The way we handle singletons in QML, QML insists on allocating the objects. This leads to a very idiosyncratic way of handling singletons: The global instance pointer is set in the constructor. Unify all these by implementing a "SillySingleton" template. All of the weird singleton-classes can derive from this template and don't have to bother with reimplementing the instance() function with all the safety-checks, etc. This serves firstly as documentation but also improves debugging as we will now see wanted and unwanted creation and destruction of these weird singletons. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-02-14Mobile: only show dive computers in the Bluetooth connection listGravatar Dirk Hohndel
And offer an option to show all devices in the settings. This is intentionally not stored in the preferences as this should never be needed. We don't support BT or BLE dive computers that we don't recognize. This is a last resort in case a new firmware were to change the name or some other weird issue causes us not to recognize a dive computer - and that should be fixed instead of worked around. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-02-14Desktop: only show dive computers in the Bluetooth device listGravatar Dirk Hohndel
By default we'll only show devices that we believe to be dive computers, but the user can override that with the recently introduced check box. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-12Bluetooth: add helper to separate BT name and addressGravatar Dirk Hohndel
And restructure the existing "isBtAddress()" function in the process. Also add more tests. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-12Bluetooth: start discovery if address isn't already knownGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-10-12core: helper function to recognize BT/BLE addressesGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-02-26Cleanup: Use QString as parameter for [get|save]BtDeviceInfo()Gravatar Berthold Stoeger
Each callsite of saveBtDeviceInfo() has a QString, which is converted to a C-string, passed and immediately converted back. Remove these conversions by taking a reference to QString directly. getBtDeviceInfo() is not as clear. Here, the callsite has a C-string handed down from libdivecomputer. Nevertheless, pass a reference of QString here as well. Firstly, for reasons of symmetry. Secondly, to avoid multiple conversions in the getBtDeviceInfo() functions. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2017-10-12mobile: enable switching BT on/off during session.Gravatar Jan Mulder
This commit implements possible switching BT on and off during a session, so not needing a restart of the app when the user forgot to switch it on when starting the app. For this, the following needed to be done: 1) create a handler that reacts on local BT device status changes. 2) repopulate the connection list in the download screen when a BT status change is detected. Notice the subtile change of the Q_INVOKABLE btEnabled() function to a Q_PROPERTY. This gives a nice dynamic behaviour when switching BT on/off with the app open. Fixes: #556 Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
2017-10-07Make compile succeed without BT_SUPPORTGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-10-07Move ConnectionListModel into its own source fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-09-17BLE: helper function to get QBtDeviceInfo from UUIDGravatar Dirk Hohndel
Right now this will only work if you scan for your BLE dive computer every time. Ideally we should simply initiate a scan and look for that address if it's not found in the hash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-16Add ConnectionListModelGravatar Dirk Hohndel
We'll use that to do a better job of showing the connection used when talking to a dive computer. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-12BT support: track if Bluetooth is availableGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-07-03Rewrite the matching code for BT devicesGravatar Dirk Hohndel
This should be much more robust in getting us the correct Bluetooth address and the correct vendor / product for our selection. When we pick a paired device, we extract the address right from its name. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-30QML UI: save BT address as stringGravatar Dirk Hohndel
And do the same LE: prefix marking as in the desktop version. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Don't declare static function in .h fileGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Mobile: wrap up fixes for BT download on AndroidGravatar Jan Mulder
Major functional change in this commit is the addition of found static BT devices to the internal administration (on Android), in a way that is equivalent to mobile-on-desktop. So, in both cases, the list of devices in the app are as in the list of devices on the host OS (Linux or Android). To minimize code duplication, the btDeviceDiscovered slot is split in two parts, the part to act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and the part only needed for Android. Remaining to be fixed: the correct handling of the QML UI selection of vendor/product. The first default dive computer is correctly detected, all paired devices from the virtual vendow can be selected, but clicking through vendors results in non logical selections. It is obvious why this is, but a fix is not straigforward at this point. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12Mobile: add BT name to vendor/product capabilityGravatar Jan Mulder
This adds a central function to convert a BT name to a vendor/product pair known to Subsurface. This allows interfacing from a paired BT dive computer, without actively selecting its type, but by selecting it from the list of paired BT devices. So, after this, downloading from multiple (paired) DCs is also possible. And not the niced piece of code ... Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-12QML UI: add internal admin for virtual vendorGravatar Jan Mulder
Added a list of paired BT devices for the "Paired BT Devices" vendor. The devices under this vendor represent all BT devces that can be found from the local BT interface. Some special processing is required, as the BT provided data is (obviously) missing the specific data needed to open a BT device using libdc code. This processing is not in this commit, but will follow. This commit is preparation for that. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11Android build fixGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2017-06-11QML UI: move BT handling into core codeGravatar Dirk Hohndel
This shouldn't be part of the UI (qmlmanager), but part of our overall handling of dive computers and BT devices. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>