Add bluetooth stuff

This commit is contained in:
hawkeyexp 2018-08-15 20:03:28 +02:00
parent 4a7fbae6f6
commit 63d784dcbe
4 changed files with 161 additions and 70 deletions

View File

@ -203,6 +203,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
ui_->systemConfigInProgress->hide();
ui_->systemDebugging->hide();
ui_->pushButtonLock->hide();
ui_->btDevice->hide();
QFileInfo DebugmodeFile("/tmp/usb_debug_mode");
if (DebugmodeFile.exists()) {
@ -520,6 +521,23 @@ void f1x::openauto::autoapp::ui::MainWindow::showTime()
}
}
QFileInfo phoneBTConnectedFile("/tmp/btdevice");
if (phoneBTConnectedFile.exists()) {
if (ui_->btDevice->isVisible() == false) {
QFile phoneBTData(QString("/tmp/btdevice"));
phoneBTData.open(QIODevice::ReadOnly);
QTextStream data_date(&phoneBTData);
QString linedate = data_date.readAll();
phoneBTData.close();
ui_->btDevice->setText(linedate);
ui_->btDevice->show();
}
} else {
if (ui_->btDevice->isVisible() == true) {
ui_->btDevice->hide();
}
}
QFileInfo configInProgressFile("/tmp/config_in_progress");
QFileInfo debugInProgressFile("/tmp/debug_in_progress");

View File

@ -189,6 +189,12 @@ void SettingsWindow::onSave()
params.append("#");
params.append( std::string(ui_->comboBoxCam->currentText().toStdString()) );
params.append("#");
if (ui_->checkBoxBluetoothAutoPair->isChecked()) {
params.append("1");
} else {
params.append("0");
}
params.append("#");
if (ui_->checkBoxHardwareSave->isChecked()) {
params.append("1");
} else {
@ -573,6 +579,13 @@ void SettingsWindow::loadSystemValues()
// set cam
ui_->comboBoxCam->setCurrentText(getparams[33]);
// set cs bluetooth
if (getparams[34] == "1") {
ui_->checkBoxBluetoothAutoPair->setChecked(true);
} else {
ui_->checkBoxBluetoothAutoPair->setChecked(false);
}
}
}

View File

@ -51,6 +51,36 @@
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="btDevice">
<property name="geometry">
<rect>
<x>668</x>
<y>52</y>
<width>120</width>
<height>24</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>120</width>
<height>24</height>
</size>
</property>
<property name="font">
<font>
<family>Roboto</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">color: #00CCFF;</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QLabel" name="phoneConnected">
<property name="geometry">
<rect>
@ -793,6 +823,7 @@ QPushButton:pressed { background: orange; border: none; }</string>
<zorder>pushButtonCameraHide</zorder>
<zorder>pushButtonExit</zorder>
<zorder>Digital_clock</zorder>
<zorder>btDevice</zorder>
<zorder>phoneConnected</zorder>
<zorder>versionString</zorder>
<zorder>dateString</zorder>

View File

@ -1104,7 +1104,7 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<x>0</x>
<y>10</y>
<width>646</width>
<height>171</height>
<height>101</height>
</rect>
</property>
<property name="title">
@ -1126,8 +1126,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QRadioButton" name="radioButtonUseExternalBluetoothAdapter">
<property name="geometry">
<rect>
<x>20</x>
<y>60</y>
<x>210</x>
<y>30</y>
<width>171</width>
<height>23</height>
</rect>
@ -1139,8 +1139,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLineEdit" name="lineEditExternalBluetoothAdapterAddress">
<property name="geometry">
<rect>
<x>110</x>
<y>90</y>
<x>410</x>
<y>66</y>
<width>231</width>
<height>31</height>
</rect>
@ -1149,8 +1149,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLabel" name="labelBluetoothAdapterAddress">
<property name="geometry">
<rect>
<x>40</x>
<y>90</y>
<x>340</x>
<y>66</y>
<width>67</width>
<height>31</height>
</rect>
@ -1162,8 +1162,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLabel" name="labelBluetoothAddressFormatInfo">
<property name="geometry">
<rect>
<x>400</x>
<y>80</y>
<x>440</x>
<y>20</y>
<width>181</width>
<height>41</height>
</rect>
@ -1183,8 +1183,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QLabel" name="labelBluetoothAddressFormatInfoIcon">
<property name="geometry">
<rect>
<x>370</x>
<y>90</y>
<x>410</x>
<y>30</y>
<width>21</width>
<height>21</height>
</rect>
@ -1196,8 +1196,8 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<widget class="QRadioButton" name="radioButtonUseLocalBluetoothAdapter">
<property name="geometry">
<rect>
<x>180</x>
<y>30</y>
<x>20</x>
<y>60</y>
<width>151</width>
<height>23</height>
</rect>
@ -1206,37 +1206,6 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<string>Use local adapter</string>
</property>
</widget>
<widget class="QLabel" name="labelPairWarningIcon">
<property name="geometry">
<rect>
<x>50</x>
<y>130</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_warning.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelPairWarning">
<property name="geometry">
<rect>
<x>90</x>
<y>130</y>
<width>551</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>In order to use bluetooth features please remember to pair your device.</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxWifiClient">
<property name="geometry">
@ -1263,19 +1232,6 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<string>Credentials must be set in crankshaft_env.sh!</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarningIcon">
<property name="geometry">
<rect>
<x>50</x>
<y>70</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_warning.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarning">
<property name="geometry">
<rect>
@ -1317,6 +1273,19 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<string>Used SSID:</string>
</property>
</widget>
<widget class="QLabel" name="labelWifiClientInfoIcon">
<property name="geometry">
<rect>
<x>60</x>
<y>76</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxWifiHotspot">
<property name="geometry">
@ -1343,19 +1312,6 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<string>Credentials must be set in crankshaft_env.sh!</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarningIcon_2">
<property name="geometry">
<rect>
<x>50</x>
<y>100</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_warning.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
<widget class="QLabel" name="labelUseWarning_2">
<property name="geometry">
<rect>
@ -1416,6 +1372,79 @@ QSlider::groove:horizontal { background: #6d6d6d; height: 32px;}</string>
<string>Enable Hotspot</string>
</property>
</widget>
<widget class="QLabel" name="labelWifiHotspotSSIDInfoIcon">
<property name="geometry">
<rect>
<x>60</x>
<y>106</y>
<width>21</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_info.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBoxBluetoothCS">
<property name="geometry">
<rect>
<x>0</x>
<y>120</y>
<width>646</width>
<height>61</height>
</rect>
</property>
<property name="title">
<string>Bluetooth Pairing / Connect</string>
</property>
<widget class="QCheckBox" name="checkBoxBluetoothAutoPair">
<property name="geometry">
<rect>
<x>20</x>
<y>26</y>
<width>241</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Enable Autopairing / Autoconnect</string>
</property>
</widget>
<widget class="QLabel" name="labelBluetoothAddressFormatInfo_1">
<property name="geometry">
<rect>
<x>360</x>
<y>20</y>
<width>281</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Experimental and only using local adapter! Needs a reboot after changing!</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="labelUseWarningIcon_4">
<property name="geometry">
<rect>
<x>320</x>
<y>20</y>
<width>31</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;img src=&quot;:/ico_warning.png&quot;/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="tabCSBase">