aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-08-20Turn serial_ftdi.c into a custom_serialGravatar Anton Lundin
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>
2015-08-20Re-indent and style up serial ftdiGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20serial_ftdi.c for communication with ftdi devicesGravatar Venkatesh Shukla
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>
2015-08-20Wire up get_usb_fd to libusb_set_android_open_callbackGravatar Anton Lundin
Signed-off-by: Anton Lundin <glance@acc.umu.se> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Extract usb file descriptor of ftdi on AndroidGravatar Venkatesh Shukla
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>
2015-08-20Enable android logging from libusbGravatar Anton Lundin
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>
2015-08-20Patch libusb for android custom open functionGravatar Anton Lundin
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>
2015-08-20Add implementation for device discovery agent initialization (Windows)Gravatar Claudiu Olteanu
Register the metatypes needed for Windows platforms and initialize our custom device discovery agent. Signed-off-by: Claudiu Olteanu <olteanu.claudiu@ymail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-20Get a pretty print message when a device discovery error occuredGravatar Claudiu Olteanu
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>
2015-08-20Add implementation for BTH device item selection on Windows platformsGravatar Claudiu Olteanu
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>
2015-08-20Use the address of the BTH device if its name is emptyGravatar Claudiu Olteanu
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>
2015-08-20Add implementation for add remote Bluetooth device handlerGravatar Claudiu Olteanu
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>
2015-08-20Wait for BTH device discovery thread to finish on stop callGravatar Claudiu Olteanu
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>
2015-08-20Initialize WinSock and hide the information about the local deviceGravatar Claudiu Olteanu
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>
2015-08-20Add implementation for our custom BTH device discovery serviceGravatar Claudiu Olteanu
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>
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-08-20Reimplement pairingFinished methodGravatar Claudiu Olteanu
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>
2015-08-20Clear the BTH discovered devices list on each searchGravatar Claudiu Olteanu
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>
2015-08-20Check the last error when the BTH device scanning is finishedGravatar Claudiu Olteanu
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>
2015-08-20Cleanup Bluetooth local device and the discovery agent on exitGravatar Claudiu Olteanu
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>
2015-08-20Display dives from the same location on the listGravatar Tomaz Canabrava
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>
2015-08-20Always save taxonomy data, even if disabled in the prefsGravatar Dirk Hohndel
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>
2015-08-20Use boyle_compensation in profileGravatar Robert C. Helling
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>
2015-08-20Leftovers from introduction of in_planner() helper functionGravatar Robert C. Helling
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>
2015-08-19Avoid duplicate divesites on Liquivision importGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19More precise commentsGravatar Miika Turkia
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-19Restore selection after renumbering dives.Gravatar Sander Kleijwegt
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>
2015-08-19Fix startup crash with missing HOME or LOGNAME environment variablesGravatar Sander Kleijwegt
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>
2015-08-18VPM-B: Update critical_volume_lambdaGravatar Rick Walsh
The default value for critical_volume_lambda is 6500 fsw.min (= 199.58 bar.min) for VPM-B, rather than 7500 fsw.min (= 230.284 bar.min) for VPM. This is consistent with V-Planner, MultiDeco, GUE DecoPlanner, HLPlanner and the comments in the Fortran code explanation. Signed-off-by: Rick Walsh <rickmwalsh@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18Replace global in_planner variable by helper functionGravatar Robert C. Helling
as promised earlier Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18Get rid of is_ok_vpmbGravatar Robert C. Helling
Since a8ce8, that made deco_allowed_depth work for VPM-B as well, this function became obsolete but was reintroduced by one of Jan's latest patches. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18Compare ceiling to next stop rather than try to ascent for VPM-BGravatar Robert C. Helling
For VPM-B, to stay within the reference implementation, to decide if we need to stop we check if the current ceiling is above the next stop depth rather than trying to ascent and check if we violate a ceiling. This leads to more conservative profiles. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-18Revert "Pref. to ascent to next stop only when stop is below ceiling"Gravatar Dirk Hohndel
This reverts commit a6ed36fb7368254d694a4f397d6d033326c37ef2.
2015-08-18VPM-B: Fix calculating Boyles compensation on gas change stops.Gravatar Jan Darowski
Previously we were calculating the compensation only on the deco stops, gas change stops appearing before the first deco stop were ommited. Signed-off-by: Jan Darowski <jan.darowski@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Explicit names for initialization of deco constantsGravatar Robert C. Helling
This patch is purely cosmetic except for the fact it changes the critical radii to the V-planner with Boyle compensation values. These values would have been set anyway by Jan's commit "VPM-B: Set radius constants to values reccomended by V-Planner" which will conflict with this anyway. This way, the last chunk of Jan's patch can just be discarded. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Pref. to ascent to next stop only when stop is below ceilingGravatar Robert C. Helling
Usually, we try to ascent to the next stop and check if we break the ceiling while doing that. This patch adds a preference value to rather check if the ceiling is above the next stop before attempting to ascent. The difference if off-gasing during the ascent is taken into account. Logically, it does not sound like it could be relevant to ignore that off-gasing but it leads to more conservative schedules and it seems the original Fortran VPM-B implementation does just this. So one could argue it is part of that model (if it makes sense or not), so we should at least give users the possibility to turn this on. Maybe we should even make this the default for VPM-B. This patch just addes the code to have the value in the preferences and the planner to act accordingly. There is no UI for it, yet. To test, you have to set it in the code. There could be a later patch with a UI if people like to have it. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Factor out root of cubic to be used also for update_gradientGravatar Robert C. Helling
We can use the analytic solution of a cubic in two different places. Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Merge branch 'boyle-ready' of https://github.com/Slagvi/subsurfaceGravatar Dirk Hohndel
Fixed merge conflicts in deco.c dive.h planner.c Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Fix MKVI erroneous sample timeGravatar Miika Turkia
There was a bug in MKVI download tool that resulted in erroneous sample times. This fix takes care of that and should work similarly as the vendor's own. Fixes #916 Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Explicit cast to stop compiler warningGravatar Robert C. Helling
Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-17Cmake: automatically create version for Mac bundleGravatar Dirk Hohndel
The version info that is used for the Mac bundle is created at cmake run time, not at make run time. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16INSTALL file: update Mac build instructionsGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16Build script: fix install_name for libssrfmarblewidget on MacGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16Build script: make sure cmake finds Qt on MacGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-08-16INSTALL file: build the latest master / testing branchesGravatar Dirk Hohndel
The INSTALL file in the sources should show the instructions to build the latest master - and then be updated to build the latest release as we get closer to making a release. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>