this does not increas binary size increadably but is usefull
when trying to figure out what the planner is doing.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This uses a bit of algebra to simplify the formula for Boyle's law
correction and introduces another algebraic cubic root solver that
can also deal with negative discriminants thanks to a trigonometric
formula from Wikipedia.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
The Boyle's law compensation depends on first_stop_pressure. To produce
profiles similar to other VPM-B implementations, we should calculate it as the
ceiling before starting the ascent.
Commit 159c9eb2c1, Compare ceiling to next stop
rather than try to ascent for VPM-B, changed (VPM-B) to consider the current
ceiling rather than an incremental ascent between one stop level and the next.
However, the initial ascent generally steps through several stop levels, so
first_stop_pressure was still not calculated as the ceiling prior to commencing
the calculated ascent.
Signed-off-by: Rick Walsh <rickmwalsh@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Gas switch is not part of recreational mode, so disable the switch options.
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Cmake has a bug that causes the moc process not being handed the necessary
defines for the architecture we are building for.
Also we were missing a library to make the BT implementation on Windows
work.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After a replot, check if there is an error message to display.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There is nothing to compensate but we would hit a 0/0 numerical
instability there.
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Each state can have the same widgets but with different
properties - currently I'm using "enabled" : true and false
for the DiveSiteEdit, it looks like a big amount of code
for such a small thing but it was the cleaner way that
I tougth of doing.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Added USB usage permissions in manifest.
Also added various FTDI based USB devices in xml/device_filter.xml. When any
device matching the VID and PID provided in the device_filter.xml is attached,
subsurface application is opened automatically. Also, the USB permissions are
granted to the application. This simplifies the USB file generation approach.
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This connects the serial_ftdi implementation to subsurface, and builds
libftdi1 for the android builds.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This cleans up serial_ftdi.c from being a libdivecomputer source and
making it into a subsurface custom_serial.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This script is based on serial_posix.c and is primarily meant to work on
android, but could be used elsewhere as well. This script communicates with
libftdi devices connected to the system using libftdi library.
ftdi_read_data returns 0 if no data is received from the device. Allowing to
continue on recieving 0 might end up in an infinite loop. But it works in
OSTC3. This needs to be checked further.
libftdi returns -3 when it could not find any device corresponding to the pid
and vid given. (Different from -3 of libusb which means you do not have
permissions to access the device) Use this to return value to check for other
accepted chipsets including the custom pids used by divecomputer manufacturers
such as Cressi (Leonardo), Suunto and Oceanic.
ftdi_read_data returns the number of bytes read (+ve), 0 when there is no data
to read, and negative when there is an error.
Instead of infinitely waiting for the data to appear, it is better to implement
an exponential backoff which times out after MAX_BACKOFF.
[Anton Lundin: This code was originally intended to be included in
libdivecomputer, but because we now got the custom-serial
patches, its included in subsurface instead, and wired in
from there - renamed the resulting file to serial_ftdi.c]
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Rename serial_ftdi.c for subsurface source
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Using JNI implementation of QtAndroid, usb file descriptor
of attached ftdi usb device is extracted. This would then
be used for opening usb device on android.
This implementation assumes that permission for usage of
device is already present. This is because of the device_filter
due to which on attaching a recognised usb device (Only ftdi
for now) to android, a dialog pops up asking for permission to
use it with subsurface.
Not an ideal assumption but works sufficiently well.
Signed-off-by: Venkatesh Shukla <venkatesh.shukla.eee11@iitbhu.ac.in>
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This makes libusb to log straight to the android logging system. This
makes sure we can reach the logs and debug things.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This idea was inspired by:
https://github.com/PointCloudLibrary/mobile/blob/master/3rdparty/android/patches/libusb.patch
The whole thing is re-written from scratch but the idea came from there,
and its a way simpler way of getting a system-opened fd to the right
place than patching every call in the stack to pass a fd down.
Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Try to get a pretty print message when a device discovery error
is raised and it is unknown.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
When a Bluetooth device is selected from the discovered list
display information about its address and enable the save button.
On Windows we don't need to check if the devices are paired because
the pairing process is done automatically on the connection step.
If the devices are not paired Windows will ask for user's permission
to continue the process.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
There are moments when the name of the device is not collected
properly and it is unavailable. Instead of showing an empty string
then print the address of the device.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Windows we cannot determine the pairing status of the
device. Therefore we print only information about its name
and about its BTH address.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
We should wait for the WinBluetoothDeviceDiscoveryAgent completion
when the stop method was called.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
On Windows we cannot select a device or show information about the
local device. Therefore we disable the UI section related to local
device details.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Implement a custom lookup service for remote Bluetooth devices
discovery. This will be used on Windows platforms to collect
information about the name and the address of a remote Bluetooth
device.
In the beginning we initialize the queryset with the necessary
flags and we start the lookup service. When a device is discovered
we collect information about its name and its address and we
raise a signal with it using the same signature as the one emitted
by QtBluetoothDeviceDiscoveryAgent implementation.
Finally we end the lookup service and we reset the internal flags.
This code was written with the help of the sample code documenting the
relevant APIs provided by Microsoft Corporation at
https://code.msdn.microsoft.com/windowsdesktop/Bluetooth-Connection-e3263296
which is under the MS-LPL. No code from the samples was copied and the
code in this commit is covered by the GPL and not the MS-LPL.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
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>
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>
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>
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>
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>
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>
The old implementation didn't use the correct deviceLabel pattern.
When the pairing status of a device was changed the name of the device
was missing from the new label. With the new implementation when the
pairing status is changed we replace the old state with the new one and
maintain the device information from the old label.
Also we set the same pairing background colors used in the
addRemoteDevice callback. In this way the label's state is consistent
and the UX is improved.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Clear the Bluetooth discovered devices list on each search.
In this way we will show only the devices that are in range
and active during the last scannning. Also if we clear the
list before each call we don't need to check anymore if the
discovered device is already in the list.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
If there is no error reported when the device scanning is finished
then report to the dialog status that the scanning finished
successfully. Otherwise report the last error.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Do some extra cleanup when the BtDeviceSelectionDialog is
destroyed.
Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Some dive sites are separated in more than one real dive site
(for instance, a 'blue hole' dive site that has different
entry points on the gps), so instead of checking only the
dive_site id, also check it's name.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Otherwise, if one of the systems used with cloud storage doesn't have the
preference for geo encoding enabled, the taxonomy data will be lost.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
otherwise VPM-B planned profiles seem to violate the ceiling. This needs
the first_stop_pressure to be available also in the profile, so I made
it global in planner.c
Important lesson: If you want to use deco_allowed_depth on a tissue_tolerance
that comes from a VPM-B planned dive, you have to call boyles_law() before
add_segment()!
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
I have no idea how these could have been left behind
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
After renumbering any number of selected dives, the selected
dives would still be selected, but this was not visible from
the divelist view. Clicking on subsequent dives would deselect
them while the GUI shows them as selected, any further action
like delete would not be done on the visible selection, but
on the invisible dive->selected state, leading to apparently
very weird behaviour.
Fixes#917
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Check whether setenv returns NULL and if so default to '~' for HOME
and 'default' for LOGNAME.
Signed-off-by: Sander Kleijwegt <sander@myowndomain.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>