latest
This commit is contained in:
parent
e5c031774e
commit
a87a3eef82
@ -29,7 +29,7 @@ add_definitions(-DBOOST_ALL_DYN_LINK)
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS system log OPTIONAL_COMPONENTS unit_test_framework)
|
||||
find_package(libusb-1.0 REQUIRED)
|
||||
find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth)
|
||||
find_package(Qt5 COMPONENTS Multimedia MultimediaWidgets Bluetooth Network)
|
||||
find_package(Protobuf REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(rtaudio REQUIRED)
|
||||
@ -53,6 +53,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
|
||||
${Qt5MultimediaWidgets_INCLUDE_DIRS}
|
||||
${Qt5Widgets_INCLUDE_DIRS}
|
||||
${Qt5Bluetooth_INCLUDE_DIRS}
|
||||
${Qt5Network_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${LIBUSB_1_INCLUDE_DIRS}
|
||||
${PROTOBUF_INCLUDE_DIR}
|
||||
@ -81,6 +82,7 @@ target_link_libraries(autoapp
|
||||
${Qt5Multimedia_LIBRARIES}
|
||||
${Qt5MultimediaWidgets_LIBRARIES}
|
||||
${Qt5Bluetooth_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${LIBUSB_1_LIBRARIES}
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${BCM_HOST_LIBRARIES}
|
||||
@ -101,6 +103,7 @@ add_executable(btservice ${btservice_source_files})
|
||||
target_link_libraries(btservice
|
||||
${Boost_LIBRARIES}
|
||||
${Qt5Bluetooth_LIBRARIES}
|
||||
${Qt5Network_LIBRARIES}
|
||||
${Qt5MultimediaWidgets_LIBRARIES}
|
||||
${PROTOBUF_LIBRARIES}
|
||||
${AASDK_PROTO_LIBRARIES})
|
||||
|
@ -81,6 +81,7 @@ signals:
|
||||
void cameraRecord();
|
||||
void openConnectDialog();
|
||||
void openUSBDialog();
|
||||
void openWifiDialog();
|
||||
void showBrightnessSlider();
|
||||
void showVolumeSlider();
|
||||
void showAlphaSlider();
|
||||
|
59
include/f1x/openauto/autoapp/UI/WifiDialog.hpp
Normal file
59
include/f1x/openauto/autoapp/UI/WifiDialog.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
#include <QDialog>
|
||||
#include <QTimer>
|
||||
#include <QList>
|
||||
#include <QInputDialog>
|
||||
#include <QStandardItem>
|
||||
#include <QStandardItemModel>
|
||||
#include <QNetworkConfiguration>
|
||||
#include <QNetworkConfigurationManager>
|
||||
#include <QNetworkSession>
|
||||
|
||||
namespace Ui {
|
||||
class WifiDialog;
|
||||
}
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
namespace openauto
|
||||
{
|
||||
namespace autoapp
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
|
||||
class WifiDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WifiDialog(QWidget *parent = nullptr);
|
||||
~WifiDialog() override;
|
||||
|
||||
bool connected;
|
||||
int foundCount;
|
||||
QNetworkConfiguration netcfg;
|
||||
QStringList WiFisList;
|
||||
QList<QNetworkConfiguration> netcfgList;
|
||||
|
||||
Ui::WifiDialog* ui_;
|
||||
|
||||
public slots:
|
||||
void findActiveWirelesses();
|
||||
void connectionStatusOpened();
|
||||
void connectionStatusClosed();
|
||||
void statusBarMessage(QString msg, QString color);
|
||||
void configurationStateChanged();
|
||||
|
||||
private slots:
|
||||
void on_btnConnect_clicked();
|
||||
|
||||
private:
|
||||
QTimer *findTimer;
|
||||
QStandardItemModel* listModel;
|
||||
QNetworkSession *session;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -67,7 +67,6 @@ void AndroidAutoEntity::start(IAndroidAutoEntityEventHandler& eventHandler)
|
||||
controlServiceChannel_->sendVersionRequest(std::move(versionRequestPromise));
|
||||
controlServiceChannel_->receive(this->shared_from_this());
|
||||
});
|
||||
system("/opt/crankshaft/aa_device_state.sh connected &");
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::stop()
|
||||
@ -82,7 +81,6 @@ void AndroidAutoEntity::stop()
|
||||
transport_->stop();
|
||||
cryptor_->deinit();
|
||||
});
|
||||
system("/opt/crankshaft/aa_device_state.sh disconnected &");
|
||||
}
|
||||
|
||||
void AndroidAutoEntity::onVersionResponse(uint16_t majorCode, uint16_t minorCode, aasdk::proto::enums::VersionResponseStatus::Enum status)
|
||||
|
@ -129,6 +129,7 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
ui_->setupUi(this);
|
||||
connect(ui_->pushButtonSettings, &QPushButton::clicked, this, &MainWindow::openSettings);
|
||||
connect(ui_->pushButtonSettings2, &QPushButton::clicked, this, &MainWindow::openSettings);
|
||||
connect(ui_->pushButtonWifiSetup, &QPushButton::clicked, this, &MainWindow::openWifiDialog);
|
||||
connect(ui_->pushButtonExit, &QPushButton::clicked, this, &MainWindow::toggleExit);
|
||||
connect(ui_->pushButtonExit2, &QPushButton::clicked, this, &MainWindow::toggleExit);
|
||||
connect(ui_->pushButtonShutdown, &QPushButton::clicked, this, &MainWindow::exit);
|
||||
@ -175,7 +176,8 @@ MainWindow::MainWindow(configuration::IConfiguration::Pointer configuration, QWi
|
||||
ui_->pushButtonUSB->hide();
|
||||
|
||||
ui_->SysinfoTopLeft->hide();
|
||||
|
||||
ui_->pushButtonWifiSetup->hide();
|
||||
|
||||
QTimer *timer=new QTimer(this);
|
||||
connect(timer, SIGNAL(timeout()),this,SLOT(showTime()));
|
||||
timer->start(1000);
|
||||
|
@ -751,7 +751,7 @@ void SettingsWindow::onStartHotspot()
|
||||
ui_->lineEdit_wifimode->setText("");
|
||||
ui_->lineEdit_wlan0->setText("");
|
||||
ui_->lineEditWifiSSID->setText("");
|
||||
system("sudo systemctl start hotspot &");
|
||||
system("touch /tmp/manual_hotspot_control && sudo systemctl start hotspot &");
|
||||
QTimer::singleShot(15000, this, SLOT(updateNetworkInfo()));
|
||||
}
|
||||
|
||||
|
149
src/autoapp/UI/WifiDialog.cpp
Normal file
149
src/autoapp/UI/WifiDialog.cpp
Normal file
@ -0,0 +1,149 @@
|
||||
#include <f1x/openauto/autoapp/UI/WifiDialog.hpp>
|
||||
#include <ui_wifidialog.h>
|
||||
|
||||
namespace f1x
|
||||
{
|
||||
namespace openauto
|
||||
{
|
||||
namespace autoapp
|
||||
{
|
||||
namespace ui
|
||||
{
|
||||
|
||||
WifiDialog::WifiDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, ui_(new Ui::WifiDialog)
|
||||
{
|
||||
ui_->setupUi(this);
|
||||
|
||||
findTimer = new QTimer();
|
||||
findTimer->setInterval(1000);
|
||||
connect(findTimer,&QTimer::timeout,this,&WifiDialog::findActiveWirelesses);
|
||||
connect(ui_->pushButtonClose, &QPushButton::clicked, this, &WifiDialog::close);
|
||||
findTimer->start();
|
||||
connected = false;
|
||||
foundCount = 0;
|
||||
ui_->treeWidgetWiFis->setColumnWidth(0,50);
|
||||
ui_->treeWidgetWiFis->setColumnWidth(1,200);
|
||||
findActiveWirelesses();
|
||||
}
|
||||
|
||||
WifiDialog::~WifiDialog()
|
||||
{
|
||||
delete ui_;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::findActiveWirelesses()
|
||||
{
|
||||
QNetworkConfigurationManager *ncm = new QNetworkConfigurationManager();
|
||||
connect(ncm, &QNetworkConfigurationManager::onlineStateChanged, this, &WifiDialog::configurationStateChanged);
|
||||
|
||||
netcfgList = ncm->allConfigurations();
|
||||
WiFisList.clear();
|
||||
for (auto &x : netcfgList)
|
||||
{
|
||||
if (x.bearerType() == QNetworkConfiguration::BearerWLAN)
|
||||
{
|
||||
if(x.name() == "")
|
||||
WiFisList << "Unknown(Other Network)";
|
||||
else
|
||||
WiFisList << x.name();
|
||||
|
||||
qDebug() << x.type();
|
||||
}
|
||||
}
|
||||
for(int i=0; i<WiFisList.size(); i++)
|
||||
{
|
||||
bool exist = false;
|
||||
QTreeWidgetItem * item = new QTreeWidgetItem();
|
||||
for(int j=0; j<ui_->treeWidgetWiFis->topLevelItemCount(); j++)
|
||||
{
|
||||
QTreeWidgetItem *index = ui_->treeWidgetWiFis->topLevelItem(j);
|
||||
QString str = index->text(1);
|
||||
if(str == WiFisList[i])
|
||||
{
|
||||
exist = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!exist)
|
||||
{
|
||||
item->setTextAlignment(0,Qt::AlignVCenter);
|
||||
item->setTextAlignment(1,Qt::AlignHCenter);
|
||||
item->setText(0,QString::number(++foundCount));
|
||||
item->setText(1,WiFisList[i]);
|
||||
ui_->treeWidgetWiFis->addTopLevelItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::connectionStatusOpened()
|
||||
{
|
||||
connected = true;
|
||||
ui_->btnConnect->setText("Disconnect");
|
||||
statusBarMessage("Successfully Connected.","green");
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::connectionStatusClosed()
|
||||
{
|
||||
connected = false;
|
||||
ui_->btnConnect->setText("Connect");
|
||||
statusBarMessage("Successfully Disonnected.","red");
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::on_btnConnect_clicked()
|
||||
{
|
||||
if(!connected)
|
||||
{
|
||||
QString pass = QInputDialog::getText(this, "Password", "Enter Password:",QLineEdit::Password);
|
||||
if(pass.isEmpty()) return;
|
||||
|
||||
QModelIndex index = ui_->treeWidgetWiFis->currentIndex();
|
||||
QString str = index.data(Qt::DisplayRole).toString();
|
||||
for (auto &x : netcfgList)
|
||||
{
|
||||
if (x.bearerType() == QNetworkConfiguration::BearerWLAN)
|
||||
{
|
||||
if (x.name() == str)
|
||||
{
|
||||
netcfg = x;
|
||||
session = new QNetworkSession(netcfg, this);
|
||||
connect(session,&QNetworkSession::opened,this,&WifiDialog::connectionStatusOpened);
|
||||
connect(session,&QNetworkSession::closed,this,&WifiDialog::connectionStatusClosed);
|
||||
session->open();
|
||||
if(session->isOpen())
|
||||
{
|
||||
connected = true;
|
||||
ui_->btnConnect->setText("Disconnect");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
session->close();
|
||||
if(!session->isOpen())
|
||||
{
|
||||
connected = false;
|
||||
ui_->btnConnect->setText("Connect");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::statusBarMessage(QString msg, QString color)
|
||||
{
|
||||
ui_->statusBar->clearMessage();
|
||||
ui_->statusBar->setStyleSheet("color:"+color+";");
|
||||
ui_->statusBar->showMessage(msg, 5000);
|
||||
}
|
||||
|
||||
void f1x::openauto::autoapp::ui::WifiDialog::configurationStateChanged()
|
||||
{
|
||||
qDebug()<< "emited";
|
||||
}
|
@ -757,6 +757,25 @@ outline: none;</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonWifiSetup">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(100, 62, 4, 0.5);
|
||||
border-radius: 4px;
|
||||
border: 2px solid rgba(255,255,255,0.5);
|
||||
outline: none;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Setup</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_c7">
|
||||
<property name="sizePolicy">
|
||||
|
@ -2670,7 +2670,7 @@ outline: none;</string>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable Hotspot</string>
|
||||
<string>Enable Hotspot at system startup</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
164
src/autoapp/UI/wifidialog.ui
Normal file
164
src/autoapp/UI/wifidialog.ui
Normal file
@ -0,0 +1,164 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WifiDialog</class>
|
||||
<widget class="QDialog" name="WifiDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>376</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(85, 87, 83);</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QWidget" name="centralWidget" native="true">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>411</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>WiFi Networks Avaliable:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="btnConnect">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>141</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(211, 215, 207);
|
||||
background-color: rgb(186, 189, 182);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTreeWidget" name="treeWidgetWiFis">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>30</y>
|
||||
<width>411</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(186, 189, 182);</string>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Num</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
<stylestrategy>PreferDefault</stylestrategy>
|
||||
</font>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>SSID</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Secturity</string>
|
||||
</property>
|
||||
<property name="textAlignment">
|
||||
<set>AlignCenter</set>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButtonClose">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>440</x>
|
||||
<y>170</y>
|
||||
<width>80</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgb(186, 189, 182);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QStatusBar" name="statusBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="mainToolBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>540</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -35,6 +35,7 @@
|
||||
#include <f1x/openauto/autoapp/UI/SettingsWindow.hpp>
|
||||
#include <f1x/openauto/autoapp/UI/ConnectDialog.hpp>
|
||||
#include <f1x/openauto/autoapp/UI/USBDialog.hpp>
|
||||
#include <f1x/openauto/autoapp/UI/WifiDialog.hpp>
|
||||
#include <f1x/openauto/Common/Log.hpp>
|
||||
|
||||
namespace aasdk = f1x::aasdk;
|
||||
@ -110,6 +111,11 @@ int main(int argc, char* argv[])
|
||||
// center dialog
|
||||
usbDialog.move((width - 500)/2,(height-306)/2);
|
||||
|
||||
autoapp::ui::WifiDialog wifiDialog;
|
||||
wifiDialog.setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
// center dialog
|
||||
wifiDialog.move((width - 540)/2,(height-340)/2);
|
||||
|
||||
aasdk::tcp::TCPWrapper tcpWrapper;
|
||||
autoapp::ui::ConnectDialog connectDialog(ioService, tcpWrapper, recentAddressesList);
|
||||
connectDialog.setWindowFlags(Qt::WindowStaysOnTopHint);
|
||||
@ -122,6 +128,7 @@ int main(int argc, char* argv[])
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openSettings, &settingsWindow, &autoapp::ui::SettingsWindow::loadSystemValues);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openConnectDialog, &connectDialog, &autoapp::ui::ConnectDialog::exec);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openUSBDialog, &usbDialog, &autoapp::ui::USBDialog::exec);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::openWifiDialog, &wifiDialog, &autoapp::ui::WifiDialog::exec);
|
||||
|
||||
qApplication.setOverrideCursor(Qt::BlankCursor);
|
||||
QObject::connect(&mainWindow, &autoapp::ui::MainWindow::toggleCursor, [&qApplication]() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user