Открыть боковую панель
МОС
Исходные коды
devel
smartcar
Коммиты
3460d6f3
Коммит
3460d6f3
создал
Сен 01, 2025
по автору
Коул Милена Ричардовна
Просмотр файлов
set status view
владелец
c3a59a40
Изменения
5
Скрыть пробелы
Построчно
Рядом
forms/bluetoothmode.ui
Просмотр файла @
3460d6f3
...
...
@@ -70,6 +70,19 @@
</property>
</widget>
</item>
<item>
<spacer
name=
"verticalSpacer_7"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
...
...
forms/mainwindow.cpp
Просмотр файла @
3460d6f3
...
...
@@ -2,6 +2,7 @@
#include
"ui_mainwindow.h"
#include
"bluetoothmode.h"
#include
<QMessageBox>
MainWindow
::
MainWindow
(
QString
kat
,
QString
prt
,
QWidget
*
parent
)
:
QMainWindow
(
parent
),
...
...
@@ -12,9 +13,13 @@ MainWindow::MainWindow(QString kat, QString prt, QWidget *parent) :
setAcceptDrops
(
false
);
setFocusPolicy
(
Qt
::
ClickFocus
);
m_vench
=
new
Vench
(
kat
,
prt
);
connect
(
m_vench
,
&
Vench
::
informationMessage
,
this
,
[
this
](
QString
title
,
QString
text
,
QString
buttonText
)
{
QMessageBox
::
information
(
this
,
title
,
text
,
buttonText
);
});
ui
->
centralwidget
->
layout
()
->
addWidget
(
new
BluetoothMode
(
m_vench
,
this
));
m_vench
->
PortConnected
();
}
MainWindow
::~
MainWindow
()
...
...
forms/mainwindow.ui
Просмотр файла @
3460d6f3
...
...
@@ -11,7 +11,7 @@
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
MainWindow
</string>
<string>
Умки
</string>
</property>
<property
name=
"windowIcon"
>
<iconset
resource=
"../res.qrc"
>
...
...
vench.cpp
Просмотр файла @
3460d6f3
...
...
@@ -11,6 +11,7 @@
#include
<unistd.h>
#include
<QtCore>
#include
<QColor>
#include
<QMessageBox>
#ifdef LINUX_D
#ifndef QSERIAL
...
...
@@ -23,6 +24,7 @@ Vench::Vench(QString kat, QString prt, QObject* parent) :
{
fl_kat
=
0
;
fl_port_s
=
0
;
portOpen
=
false
;
mSleep
(
100
);
...
...
@@ -72,15 +74,8 @@ void Vench::init()
mass_comm_n
.
clear
();
qDebug
(
"ustroistvo vvoda-vivoda: %s
\n
"
,
addr
.
toLocal8Bit
().
constData
());
// smotrim kakoe ustroistvo otkrilos
if
((
flcomport
==
0
)
&&
(
COMInit
(
addr
.
toLocal8Bit
().
constData
())
!=
1
))
{
qDebug
(
"Error open port Exit
\n
"
);
QString
st
=
trUtf8
(
"Ошибка инициализации порта: "
)
+
addr
;
/*!!!!
*QMessageBox::information( this, trUtf8("Ошибка"), st, trUtf8("Ok") );*/
}
if
((
flcomport
!=
0
)
||
(
COMInit
(
addr
.
toLocal8Bit
().
constData
())
==
1
))
portOpen
=
true
;
if
(
flcomport
!=
0
)
ansStatus
=
1
;
mSleep
(
3
);
...
...
@@ -93,6 +88,18 @@ void Vench::init()
mSleep
(
10
);
}
bool
Vench
::
PortConnected
()
{
if
(
!
portOpen
)
{
qDebug
(
"Error open port Exit
\n
"
);
emit
informationMessage
(
trUtf8
(
"Ошибка"
),
trUtf8
(
"Ошибка инициализации порта: "
)
+
addr
,
trUtf8
(
"Ok"
));
}
return
portOpen
;
}
void
Vench
::
mSleep
(
int
duration
)
{
QEventLoop
loopEvent
;
...
...
@@ -645,11 +652,10 @@ void Vench::RuchnComm(QString text)
Write
(
com_port
,
buf
);
/*!!!!
*QMessageBox::information( this,
trUtf8("Информация"),
trUtf8("Команда отправлена на выполнение\n"),
trUtf8("Ok") );*/
emit
informationMessage
(
trUtf8
(
"Информация"
),
trUtf8
(
"Команда отправлена на выполнение
\n
"
),
trUtf8
(
"Ok"
));
#ifdef PRINT_DEBUG
qDebug
(
"Send comm Ruchn vvod
\n
"
);
#endif
...
...
vench.h
Просмотр файла @
3460d6f3
...
...
@@ -63,6 +63,7 @@ public:
void
BPressPlay
();
void
BRec_pressed_n
();
void
RuchnComm
(
QString
text
);
bool
PortConnected
();
protected:
QList
<
int
>
mass_comm_n
;
...
...
@@ -74,6 +75,7 @@ protected:
int
flcomport
;
int
com_port
;
bool
fl_print_log
;
bool
portOpen
;
int
ansStatus
;
QString
f_name_xml
;
...
...
@@ -121,6 +123,7 @@ public slots:
signals:
void
playDone
();
void
informationMessage
(
QString
title
,
QString
text
,
QString
buttonText
);
};
#endif
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать