Changeset ac750bbf in subsurface


Ignore:
Timestamp:
Jun 22, 2017, 4:19:06 AM (4 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
d9cb65c
Parents:
05435d6
git-author:
Jan Mulder <jlmulder@…> (06/22/17 02:27:51)
git-committer:
Dirk Hohndel <dirk@…> (06/22/17 04:19:06)
Message:

mobile: prune DC list to download from

Currently, only a small number of dive computers can be downloaded from
the mobile app. Only present the supported ones to the user. So, currently
restricted to classic BT. Not sure about FTDI support at this point.

Version 2 of the same commit after review from Dirk. Fundamentally,
support is as follows: Android: BT, BLE, and FTDI. iOS: BLE only. For
all other OSses, this commit has no changes. As the BLE backend is
not yet ready, no support on iOS yet.

Signed-off-by: Jan Mulder <jlmulder@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/downloadfromdcthread.cpp

    r23df593 rac750bbf  
    55QStringList vendorList;
    66QHash<QString, QStringList> productList;
     7static QHash<QString, QStringList> mobileProductList;   // BT, BLE or FTDI supported DCs for mobile
    78QMap<QString, dc_descriptor_t *> descriptorLookup;
    89
     
    5051}
    5152
     53static void fill_supported_mobile_list()
     54{
     55        /* currently no BLE devices added as BLE backend is not ready yet */
     56
     57#if defined(Q_OS_ANDROID)
     58        /* BT, BLE and FTDI devices */
     59        mobileProductList["Heinrichs Weikamp"] =
     60                        QStringList({{"OSTC Sport"}, {"OSTC 2N"}, {"OSTC 3"},
     61                                     {"OSTC 3+"}, {"OSTC 4"}});
     62        mobileProductList["Shearwater"] =
     63                        QStringList({{"Petrel"}, {"Petrel 2"}, {"Perdix"}});
     64#endif
     65#if defined(Q_OS_IOS)
     66        /* BLE only, Qt does not support classic BT on iOS */
     67#endif
     68}
     69
    5270void fill_computer_list()
    5371{
     
    5674        struct mydescriptor *mydescriptor;
    5775
    58         QStringList computer;
     76        fill_supported_mobile_list();
     77
    5978        dc_descriptor_iterator(&iterator);
    6079        while (dc_iterator_next(iterator, &descriptor) == DC_STATUS_SUCCESS) {
    6180                const char *vendor = dc_descriptor_get_vendor(descriptor);
    6281                const char *product = dc_descriptor_get_product(descriptor);
    63 
     82#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
     83                if (!mobileProductList.contains(vendor))
     84                        continue;
     85#endif
    6486                if (!vendorList.contains(vendor))
    6587                        vendorList.append(vendor);
    66 
     88#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
     89                if (!mobileProductList[vendor].contains(product))
     90                        continue;
     91#endif
    6792                if (!productList[vendor].contains(product))
    6893                        productList[vendor].push_back(product);
     
    7398        Q_FOREACH (QString vendor, vendorList)
    7499                qSort(productList[vendor]);
     100
     101#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
     102        /* currently suppress the Uemis Zurich on Q_OS_ANDROID and Q_OS_IOS,
     103         * as it is no BT device */
    75104
    76105        /* and add the Uemis Zurich which we are handling internally
     
    93122
    94123        descriptorLookup["UemisZurich"] = (dc_descriptor_t *)mydescriptor;
     124#endif
    95125
    96126        qSort(vendorList);
Note: See TracChangeset for help on using the changeset viewer.