summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/downloadfromdcthread.cpp48
-rwxr-xr-xscripts/dcTransport.pl85
2 files changed, 120 insertions, 13 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp
index 98550ad79..76b314da7 100644
--- a/core/downloadfromdcthread.cpp
+++ b/core/downloadfromdcthread.cpp
@@ -53,32 +53,54 @@ void DownloadThread::run()
static void fill_supported_mobile_list()
{
- /* currently no BLE devices added as BLE backend is not ready yet */
+ // This segment of the source is automatically generated
+ // please edit scripts/dcTransport.pl , regenerated the code and copy it here
#if defined(Q_OS_ANDROID)
/* BT, BLE and FTDI devices */
+ mobileProductList["Aeris"] =
+ QStringList({{"500 AI"}, {"A300"}, {"A300 AI"}, {"A300CS"}, {"Atmos 2"}, {"Atmos AI"}, {"Atmos AI 2"}, {"Compumask"}, {"Elite"}, {"Elite T3"}, {"Epic"}, {"F10"}, {"F11"}, {"Manta"}, {"XR-1 NX"}, {"XR-2"}});
+ mobileProductList["Aqualung"] =
+ QStringList({{"i300"}, {"i450T"}, {"i550"}, {"i750TC"}});
+ mobileProductList["Beuchat"] =
+ QStringList({{"Mundial 2"}, {"Mundial 3"}, {"Voyager 2G"}});
+ mobileProductList["Genesis"] =
+ QStringList({{"React Pro"}, {"React Pro White"}});
mobileProductList["Heinrichs Weikamp"] =
- QStringList({{"OSTC Sport"}, {"OSTC 2N"}, {"OSTC 3"},
- {"OSTC 3+"}, {"OSTC 4"}});
- mobileProductList["Shearwater"] =
- QStringList({{"Petrel"}, {"Petrel 2"}, {"Perdix"}});
- mobileProductList["Suunto"] =
- QStringList({"EON Steel"});
+ QStringList({{"Frog"}, {"OSTC"}, {"OSTC 2"}, {"OSTC 2C"}, {"OSTC 2N"}, {"OSTC 3"}, {"OSTC 3+"}, {"OSTC 4"}, {"OSTC Mk2"}, {"OSTC Sport"}, {"OSTC cR"}});
+ mobileProductList["Hollis"] =
+ QStringList({{"DG02"}, {"DG03"}, {"TX1"}});
+ mobileProductList["Oceanic"] =
+ QStringList({{"Atom 1.0"}, {"Atom 2.0"}, {"Atom 3.0"}, {"Atom 3.1"}, {"Datamask"}, {"F10"}, {"F11"}, {"Geo"}, {"Geo 2.0"}, {"OC1"}, {"OCS"}, {"OCi"}, {"Pro Plus 2"}, {"Pro Plus 2.1"}, {"Pro Plus 3"}, {"VT 4.1"}, {"VT Pro"}, {"VT3"}, {"VT4"}, {"VTX"}, {"Veo 1.0"}, {"Veo 180"}, {"Veo 2.0"}, {"Veo 200"}, {"Veo 250"}, {"Veo 3.0"}, {"Versa Pro"}});
mobileProductList["Scubapro"] =
QStringList({{"G2"}});
+ mobileProductList["Seemann"] =
+ QStringList({{"XP5"}});
+ mobileProductList["Shearwater"] =
+ QStringList({{"Nerd"}, {"Perdix"}, {"Perdix AI"}, {"Petrel"}, {"Petrel 2"}, {"Predator"}});
+ mobileProductList["Sherwood"] =
+ QStringList({{"Amphos"}, {"Amphos Air"}, {"Insight"}, {"Insight 2"}, {"Vision"}, {"Wisdom"}, {"Wisdom 2"}, {"Wisdom 3"}});
+ mobileProductList["Subgear"] =
+ QStringList({{"XP-Air"}});
+ mobileProductList["Suunto"] =
+ QStringList({{"Cobra"}, {"Cobra 2"}, {"Cobra 3"}, {"D3"}, {"D4"}, {"D4i"}, {"D6"}, {"D6i"}, {"D9"}, {"D9tx"}, {"DX"}, {"EON Steel"}, {"Eon"}, {"Gekko"}, {"HelO2"}, {"Mosquito"}, {"Solution"}, {"Solution Alpha"}, {"Solution Nitrox"}, {"Spyder"}, {"Stinger"}, {"Vyper"}, {"Vyper 2"}, {"Vyper Air"}, {"Vyper Novo"}, {"Vytec"}, {"Zoop"}, {"Zoop Novo"}});
+ mobileProductList["Tusa"] =
+ QStringList({{"Element II (IQ-750)"}, {"Zen (IQ-900)"}, {"Zen Air (IQ-950)"}});
+ mobileProductList["Uwatec"] =
+ QStringList({{"Aladin Air Twin"}, {"Aladin Air Z"}, {"Aladin Air Z Nitrox"}, {"Aladin Air Z O2"}, {"Aladin Pro"}, {"Aladin Pro Ultra"}, {"Aladin Sport Plus"}, {"Memomouse"}});
#endif
#if defined(Q_OS_IOS)
/* BLE only, Qt does not support classic BT on iOS */
- mobileProductList["Heinrichs Weikamp"] =
- QStringList({{"OSTC 4"}});
- mobileProductList["Shearwater"] =
- QStringList({{"Petrel"}, {"Petrel 2"}, {"Perdix"}});
- mobileProductList["Suunto"] =
- QStringList({"EON Steel"});
mobileProductList["Scubapro"] =
QStringList({{"G2"}});
+ mobileProductList["Shearwater"] =
+ QStringList({{"Perdix AI"}});
+ mobileProductList["Suunto"] =
+ QStringList({{"EON Steel"}});
+
#endif
+ // end of the automatically generated code
}
void fill_computer_list()
diff --git a/scripts/dcTransport.pl b/scripts/dcTransport.pl
new file mode 100755
index 000000000..1d2e0dba4
--- /dev/null
+++ b/scripts/dcTransport.pl
@@ -0,0 +1,85 @@
+#!/bin/perl
+#
+# Extract supported divecomputers on Android and iOS from libdivecomputer source
+#
+# Usage:
+#
+# dcTransport.pl <path to libdivecomputer/src/descriptor.c> <outfile>
+#
+use Carp;
+
+#set command line arguments
+my ($infi, $outfi) = @ARGV;
+
+if ($infi !~ /.*descriptor.c/) {
+ croak "run as $ARGV[0] <path to descriptor.c> <outputfile>\n";
+}
+
+open(my $fh, "<", $infi) || croak "can't open $infi: $!";
+open(STDOUT, ">", $outfi) || croak "can't open $outfi: $!";
+
+my $ftdi = "\/\/ FTDI";
+my $bt = "\/\/ BT";
+my $ble = "\/\/ BLE";
+printf("// This segment of the source is automatically generated\n");
+printf("// please edit scripts/dcTransport.pl , regenerated the code and copy it here\n\n");
+
+my @android = ();
+my @ios = ();
+while (<$fh>) {
+ if (/^\s*{\s*"([^\,]*)"\s*,\s*"([^\,]*)"\s*,\s*([^\,]*).*}/) {
+ my $v = $1;
+ my $p = $2;
+ if (/$ftdi/) {
+ push(@android, "$v,$p");
+ }
+ if (/$bt/) {
+ push(@android, "$v,$p");
+ }
+ if (/$ble/) {
+ push(@android, "$v,$p");
+ push(@ios, "$v,$p");
+ }
+ }
+}
+
+my $lastMod;
+my $lastVend;
+my @sortedandroid = sort @android;
+my @sortedios = sort @ios;
+print("#if defined(Q_OS_ANDROID)\n\t/* BT, BLE and FTDI devices */\n");
+
+my $endV;
+foreach (@sortedandroid) {
+ ($vend, $mod) = split(',', $_);
+ next if ($vend eq $lastVend && $mod eq $lastMod);
+ if ($vend eq $lastVend) {
+ printf(", {\"%s\"}", $mod);
+ } else {
+ printf($endV);
+ printf("\tmobileProductList[\"%s\"] =\n\t\tQStringList({{\"%s\"}", $vend, $mod);
+ $endV = "});\n";
+ }
+ $lastVend = $vend;
+ $lastMod = $mod;
+}
+printf($endV);
+$endV="";
+printf("\n#endif\n#if defined(Q_OS_IOS)\n\t/* BLE only, Qt does not support classic BT on iOS */\n");
+foreach (@sortedios) {
+ ($vend, $mod) = split(',', $_);
+ next if ($vend eq $lastVend && $mod eq $lastMod);
+ if ($vend eq $lastVend) {
+ printf(", {\"%s\"}", $mod);
+ } else {
+ printf($endV);
+ printf("\tmobileProductList[\"%s\"] =\n\t\tQStringList({{\"%s\"}", $vend, $mod);
+ $endV = "});\n";
+ }
+ $lastVend = $vend;
+ $lastMod = $mod;
+}
+printf($endV);
+printf("\n#endif\n");
+printf("// end of the automatically generated code\n");
+close $fh;