aboutsummaryrefslogtreecommitdiffstats
path: root/qtserialbluetooth.cpp
AgeCommit message (Collapse)Author
2015-10-30Move all core-functionality to subsurface-coreGravatar Tomaz Canabrava
And adapt a new CMakeLists.txt file for it. On the way I've also found out that we where double-compilling a few files. I've also set the subsurface-core as a include_path but that was just to reduce the noise on this commit, since I plan to remove it from the include path to make it obligatory to specify something like include "subsurface-core/dive.h" for the header files. Since the app is growing quite a bit we ended up having a few different files with almost same name that did similar things, I want to kill that (for instance Dive.h, dive.h, PrintDive.h and such). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-29qtserialbluetooth: use QIODevice::Unbuffered ioGravatar Anton Lundin
This adds the QIODevice::Unbuffered flag to our rfcomm connections to bypass the buffering layer in QIODevice. This fixes so firmware upgrades work against the OSTC Sport. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-29qtserialbluetooth: Remove no-op callsGravatar Anton Lundin
waitForReadyRead and waitForBytesWritten not overridden in QBluetoothSocket and the default implementation in QIODevice are just no-ops that always return false. This removes those calls to lessen the confusion for anyone who looks at the code. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22qtbluetooth: Break read/write loops on bad stateGravatar Anton Lundin
This introduces a state check to only continue to try to read/write from the bluetooth device while its in a sane state. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-22qtbluetooth: add a read timeoutGravatar Anton Lundin
This adds a read timeout to the qt serial bluetooth code. This is needed for error handling and error recovery purposes. Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09Fix memory leak on serial bluetoothGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-09-09Delay freeing of memory after useGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for BTH custom serial write method used on WindowsGravatar Claudiu Olteanu
Implement the write method used for our custom serial implementation on Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for BTH custom serial read method used on WindowsGravatar Claudiu Olteanu
Implement the read method used for our custom serial implementation on Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for BTH custom serial close method on WindowsGravatar Claudiu Olteanu
Implement the close method used on Windows platforms for our custom serial implementation. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add implementation for BTH custom serial open method on Windows platformsGravatar Claudiu Olteanu
Implement the custom serial open method using the WinSocket2 API. First the device address is converted from text representation into a sockaddr structure. Then a connection is initiated to the device using device's Serial Port service. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add skeleton for Bluetooth custom serial implementation on Windows platformsGravatar Claudiu Olteanu
Add a skeleton which will be used to develop the Bluetooth custom serial implementation for Windows platforms. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Add set_timeout callback for Bluetooth custom serial implementationGravatar Claudiu Olteanu
The new callback will be usefull when we will implement the support for Windows. The implementation of native serial set_timeout method uses a HANDLER on Windows and we will use the WinSock2 API which has a socket descriptor. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-20Use SPP's uuid to connect to a device on Apple platformsGravatar Claudiu Olteanu
Use the uuid of the Serial Port Profile service to connect to a remote Bluetooth device on OS X (and iOS) platforms with a Qt version greater than 5.5.0. In the future the same section should be used for BT connectivity on Linux platforms. Currently there is a problem with the SDP discovery and it doesn't work as expected. [Dirk Hohndel: modified OS check for consistency] Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-13Use SPP's uuid to connect to a device on Android platformGravatar Claudiu Olteanu
On Android, a Bluetooth connection to a service cannot be established using a port. Therefore we use the uuid of the Serial Port Profile service to connect to the remote BT device. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-08Build fix for older Qt5Gravatar Dirk Hohndel
This breaks for example on Ubuntu Trusty. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-07Allow to compile Subsurface with upstream libdivecomputerGravatar Dirk Hohndel
This will create an inconsistent build that has some UI features implying BT support but those will be non-functional. I don't think this is the right thing to do - either fail to build with a decent message or really remove the BT support. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06Code cleanupGravatar Dirk Hohndel
Make precedence of && over || explicit. Explicitly convert between char * and unsigned char *. Don't assign potentially negative return code to an unsigend variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06Add extra logs for custom serial Bluetooth implementationGravatar Claudiu Olteanu
This patch increases the verbosity level for QtBluetooth API and add some extra logs for custom serial Bluetooth open method. The scope of this patch is only for testing. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-07-06Implement the custom Bluetooth serial communication and use itGravatar Claudiu Olteanu
Create a custom Bluetooth serial communication using the QTBluetooth API and use it when the Bluetooth download mode is enabled. First try to connect on RFCOMM channel 1 because this is the default RFCOMM channel of SPP service for most devices. If this doesn't work try again on RFCOMM channel number 5 because it could be a Petrel2 device. Add a fake open function for the custom implementation. This is used when the selected device is HW OSTC 2N and the Bluetooth mode is activated, then fake the open call of the serial device. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>