mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Add function for non-BT connection addresses
Simple rewrite of a piece of code separated to its own function so that is can be used in other places as well. To avoid code duplication for dynamic BT on/off switching on mobile. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
This commit is contained in:
parent
8b8863b640
commit
fa5e685279
2 changed files with 16 additions and 10 deletions
|
@ -7,6 +7,7 @@ void init_ui();
|
|||
|
||||
void run_ui();
|
||||
void exit_ui();
|
||||
void set_non_bt_addresses();
|
||||
|
||||
#if defined(SUBSURFACE_MOBILE)
|
||||
#include <QQuickWindow>
|
||||
|
|
|
@ -30,6 +30,19 @@
|
|||
|
||||
QObject *qqWindowObject = NULL;
|
||||
|
||||
void set_non_bt_addresses() {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
connectionListModel.addAddress("FTDI");
|
||||
#elif defined(Q_OS_LINUX) // since this is in the else, it does NOT include Android
|
||||
connectionListModel.addAddress("/dev/ttyS0");
|
||||
connectionListModel.addAddress("/dev/ttyS1");
|
||||
connectionListModel.addAddress("/dev/ttyS2");
|
||||
connectionListModel.addAddress("/dev/ttyS3");
|
||||
// this makes debugging so much easier - use the simulator
|
||||
connectionListModel.addAddress("/tmp/ttyS1");
|
||||
#endif
|
||||
}
|
||||
|
||||
void init_ui()
|
||||
{
|
||||
init_qt_late();
|
||||
|
@ -76,16 +89,8 @@ void run_ui()
|
|||
ctxt->setContextProperty("diveModel", sortModel);
|
||||
ctxt->setContextProperty("gpsModel", gpsSortModel);
|
||||
ctxt->setContextProperty("vendorList", vendorList);
|
||||
#if defined(Q_OS_ANDROID)
|
||||
connectionListModel.addAddress("FTDI");
|
||||
#elif defined(Q_OS_LINUX) // since this is in the else, it does NOT include Android
|
||||
connectionListModel.addAddress("/dev/ttyS0");
|
||||
connectionListModel.addAddress("/dev/ttyS1");
|
||||
connectionListModel.addAddress("/dev/ttyS2");
|
||||
connectionListModel.addAddress("/dev/ttyS3");
|
||||
// this makes debugging so much easier - use the simulator
|
||||
connectionListModel.addAddress("/tmp/ttyS1");
|
||||
#endif
|
||||
set_non_bt_addresses();
|
||||
|
||||
ctxt->setContextProperty("connectionListModel", &connectionListModel);
|
||||
ctxt->setContextProperty("logModel", MessageHandlerModel::self());
|
||||
|
||||
|
|
Loading…
Reference in a new issue