Browse Source

Change RemoteCtrl, for change frame bitrate.

yuchuli 2 months ago
parent
commit
18e8002d1b

+ 3 - 0
src/tool/RemoteCtrl_Wide/RemoteCtrl_Three.pro

@@ -41,6 +41,7 @@ SOURCES += \
     ../../include/msgtype/rawpic.pb.cc \
     ../../include/msgtype/remotectrl.pb.cc \
     ../../plugin/common/pluginapp.cpp \
+    dialogframerate.cpp \
     dialogsetpassword.cpp \
     dialogsetting.cpp \
     joyreadthread.cpp \
@@ -68,6 +69,7 @@ HEADERS += \
     ../../include/msgtype/rawpic.pb.h \
     ../../include/msgtype/remotectrl.pb.h \
     ../../plugin/common/pluginapp.h \
+    dialogframerate.h \
     dialogsetpassword.h \
     dialogsetting.h \
     joyreadthread.h \
@@ -86,6 +88,7 @@ HEADERS += \
     mainwindowleft.h
 
 FORMS += \
+    dialogframerate.ui \
     dialogsetpassword.ui \
     dialogsetting.ui \
     mainwindowcenter.ui \

+ 134 - 0
src/tool/RemoteCtrl_Wide/dialogframerate.cpp

@@ -0,0 +1,134 @@
+#include "dialogframerate.h"
+#include "ui_dialogframerate.h"
+
+DialogFrameRate::DialogFrameRate(iv::framerateset * pframerateset, QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogFrameRate)
+{
+
+    ui->setupUi(this);
+
+    mpframerateset = pframerateset;
+    mnframerate_percept = mpframerateset->mnframerate_percept;
+    mbframerate_sep = mpframerateset->mbframerate_sep;
+    mnframerate_percept_front = mpframerateset->mnframerate_percept_front;
+    mnframerate_percept_rear = mpframerateset->mnframerate_percept_rear;
+    mnframerate_percept_left = mpframerateset->mnframerate_percept_left;
+    mnframerate_percept_right = mpframerateset->mnframerate_percept_right;
+
+    ui->horizontalSlider->setRange(1,100);
+    ui->horizontalSlider_front->setRange(1,100);
+    ui->horizontalSlider_rear->setRange(1,100);
+    ui->horizontalSlider_left->setRange(1,100);
+    ui->horizontalSlider_right->setRange(1,100);
+
+    ui->horizontalSlider->setValue(mnframerate_percept);
+    ui->label_framerate->setText(QString::number(mnframerate_percept));
+    ui->horizontalSlider_left->setValue(mnframerate_percept_left);
+    ui->label_framerate_left->setText(QString::number(mnframerate_percept_left));
+    ui->horizontalSlider_right->setValue(mnframerate_percept_right);
+    ui->label_framerate_right->setText(QString::number(mnframerate_percept_right));
+    ui->horizontalSlider_front->setValue(mnframerate_percept_front);
+    ui->label_framerate_front->setText(QString::number(mnframerate_percept_front));
+    ui->horizontalSlider_rear->setValue(mnframerate_percept_rear);
+    ui->label_framerate_rear->setText(QString::number(mnframerate_percept_rear));
+
+    if(mbframerate_sep == false)
+    {
+        ui->horizontalSlider->setEnabled(true);
+
+        ui->horizontalSlider_left->setEnabled(false);
+        ui->horizontalSlider_right->setEnabled(false);
+        ui->horizontalSlider_front->setEnabled(false);
+        ui->horizontalSlider_rear->setEnabled(false);
+
+        ui->checkBox->setChecked(false);
+    }
+    else
+    {
+        ui->horizontalSlider->setEnabled(false);
+
+        ui->horizontalSlider_left->setEnabled(true);
+        ui->horizontalSlider_right->setEnabled(true);
+        ui->horizontalSlider_front->setEnabled(true);
+        ui->horizontalSlider_rear->setEnabled(true);
+
+        ui->checkBox->setChecked(true);
+
+    }
+
+
+}
+
+DialogFrameRate::~DialogFrameRate()
+{
+    delete ui;
+}
+
+void DialogFrameRate::on_checkBox_stateChanged(int arg1)
+{
+    (void)arg1;
+    if(ui->checkBox->isChecked())
+    {
+        mbframerate_sep = true;
+    }
+    else
+    {
+        mbframerate_sep = false;
+    }
+
+    if(mbframerate_sep == false)
+    {
+        ui->horizontalSlider->setEnabled(true);
+
+        ui->horizontalSlider_left->setEnabled(false);
+        ui->horizontalSlider_right->setEnabled(false);
+        ui->horizontalSlider_front->setEnabled(false);
+        ui->horizontalSlider_rear->setEnabled(false);
+    }
+    else
+    {
+        ui->horizontalSlider->setEnabled(false);
+
+        ui->horizontalSlider_left->setEnabled(true);
+        ui->horizontalSlider_right->setEnabled(true);
+        ui->horizontalSlider_front->setEnabled(true);
+        ui->horizontalSlider_rear->setEnabled(true);
+
+    }
+}
+
+void DialogFrameRate::on_horizontalSlider_valueChanged(int value)
+{
+    ui->label_framerate->setText(QString::number(value));
+}
+
+void DialogFrameRate::on_horizontalSlider_front_valueChanged(int value)
+{
+    ui->label_framerate_front->setText(QString::number(value));
+}
+
+void DialogFrameRate::on_horizontalSlider_rear_valueChanged(int value)
+{
+    ui->label_framerate_rear->setText(QString::number(value));
+}
+
+void DialogFrameRate::on_horizontalSlider_left_valueChanged(int value)
+{
+    ui->label_framerate_left->setText(QString::number(value));
+}
+
+void DialogFrameRate::on_horizontalSlider_right_valueChanged(int value)
+{
+    ui->label_framerate_right->setText(QString::number(value));
+}
+
+void DialogFrameRate::on_buttonBox_accepted()
+{
+    mpframerateset->mnframerate_percept = ui->horizontalSlider->value();
+    mpframerateset->mbframerate_sep = ui->checkBox->isChecked();
+    mpframerateset->mnframerate_percept_front = ui->horizontalSlider_front->value();
+    mpframerateset->mnframerate_percept_rear = ui->horizontalSlider_rear->value();
+    mpframerateset->mnframerate_percept_left = ui->horizontalSlider_left->value();
+    mpframerateset->mnframerate_percept_right = ui->horizontalSlider_right->value();
+}

+ 58 - 0
src/tool/RemoteCtrl_Wide/dialogframerate.h

@@ -0,0 +1,58 @@
+#ifndef DIALOGFRAMERATE_H
+#define DIALOGFRAMERATE_H
+
+#include <QDialog>
+
+namespace iv {
+struct framerateset
+{
+    int mnframerate_percept;
+    bool mbframerate_sep;
+    int mnframerate_percept_front;
+    int mnframerate_percept_rear;
+    int mnframerate_percept_left;
+    int mnframerate_percept_right;
+};
+}
+
+namespace Ui {
+class DialogFrameRate;
+}
+
+class DialogFrameRate : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogFrameRate(iv::framerateset * pframerateset,QWidget *parent = nullptr);
+    ~DialogFrameRate();
+
+private slots:
+    void on_checkBox_stateChanged(int arg1);
+
+    void on_horizontalSlider_valueChanged(int value);
+
+    void on_horizontalSlider_front_valueChanged(int value);
+
+    void on_horizontalSlider_rear_valueChanged(int value);
+
+    void on_horizontalSlider_left_valueChanged(int value);
+
+    void on_horizontalSlider_right_valueChanged(int value);
+
+    void on_buttonBox_accepted();
+
+private:
+    Ui::DialogFrameRate *ui;
+
+    int mnframerate_percept = 100;
+    bool mbframerate_sep = false;
+    int mnframerate_percept_left = 50;
+    int mnframerate_percept_right = 50;
+    int mnframerate_percept_front = 50;
+    int mnframerate_percept_rear = 50;
+
+    iv::framerateset * mpframerateset;
+};
+
+#endif // DIALOGFRAMERATE_H

+ 276 - 0
src/tool/RemoteCtrl_Wide/dialogframerate.ui

@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogFrameRate</class>
+ <widget class="QDialog" name="DialogFrameRate">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>551</width>
+    <height>439</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <widget class="QDialogButtonBox" name="buttonBox">
+   <property name="geometry">
+    <rect>
+     <x>110</x>
+     <y>380</y>
+     <width>341</width>
+     <height>32</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+   <property name="standardButtons">
+    <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>30</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Frame Rate</string>
+   </property>
+  </widget>
+  <widget class="QSlider" name="horizontalSlider">
+   <property name="geometry">
+    <rect>
+     <x>130</x>
+     <y>40</y>
+     <width>291</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_framerate">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>30</y>
+     <width>71</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_2">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>120</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Front Frame Rate</string>
+   </property>
+  </widget>
+  <widget class="QSlider" name="horizontalSlider_front">
+   <property name="geometry">
+    <rect>
+     <x>130</x>
+     <y>130</y>
+     <width>291</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_framerate_front">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>120</y>
+     <width>71</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_3">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>170</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Rear Frame Rate</string>
+   </property>
+  </widget>
+  <widget class="QSlider" name="horizontalSlider_rear">
+   <property name="geometry">
+    <rect>
+     <x>130</x>
+     <y>180</y>
+     <width>291</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_framerate_rear">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>170</y>
+     <width>71</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_4">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>220</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Left Frame Rate</string>
+   </property>
+  </widget>
+  <widget class="QSlider" name="horizontalSlider_left">
+   <property name="geometry">
+    <rect>
+     <x>130</x>
+     <y>230</y>
+     <width>291</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_framerate_left">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>220</y>
+     <width>71</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_5">
+   <property name="geometry">
+    <rect>
+     <x>30</x>
+     <y>270</y>
+     <width>101</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Right Frame Rate</string>
+   </property>
+  </widget>
+  <widget class="QSlider" name="horizontalSlider_right">
+   <property name="geometry">
+    <rect>
+     <x>130</x>
+     <y>280</y>
+     <width>291</width>
+     <height>21</height>
+    </rect>
+   </property>
+   <property name="orientation">
+    <enum>Qt::Horizontal</enum>
+   </property>
+  </widget>
+  <widget class="QLabel" name="label_framerate_right">
+   <property name="geometry">
+    <rect>
+     <x>450</x>
+     <y>270</y>
+     <width>71</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>TextLabel</string>
+   </property>
+  </widget>
+  <widget class="QCheckBox" name="checkBox">
+   <property name="geometry">
+    <rect>
+     <x>100</x>
+     <y>80</y>
+     <width>151</width>
+     <height>31</height>
+    </rect>
+   </property>
+   <property name="text">
+    <string>Separate Control</string>
+   </property>
+  </widget>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>accepted()</signal>
+   <receiver>DialogFrameRate</receiver>
+   <slot>accept()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>248</x>
+     <y>254</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>157</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>DialogFrameRate</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

+ 1 - 0
src/tool/RemoteCtrl_Wide/grpcpc.cpp

@@ -379,6 +379,7 @@ void grpcpc::run()
                                 AddQueryMsg(xmsg);
  //                               sharequerymsg(&xmsg);
                             }
+                            
                         }
 
                         nlasttime = xreply.ntime();

+ 1 - 1
src/tool/RemoteCtrl_Wide/grpcpc.h

@@ -155,7 +155,7 @@ private:
 private:
     bool mbUseRTSP = true;  //Use RTSP connect to the server.
     std::string mstrrtspserverip = "111.33.136.149";
-    std::string mstrrtspserverport = "9554";
+    std::string mstrrtspserverport = "25544";
     std::string mstrrtsppass = "hello";
     rtspclientdown * mprtspdown[NUM_CAM];
 

+ 17 - 0
src/tool/RemoteCtrl_Wide/mainwindowcenter.cpp

@@ -6,6 +6,8 @@
 
 #include "mainwindowleft.h"
 
+#include "dialogframerate.h"
+
 static MainWindow * gw;
 
 extern MainWindowLeft * gwleft,*gwright;
@@ -859,6 +861,12 @@ void MainWindow::onTimerRemote()
     mremotectrl.set_brake(mfBrake);
     mremotectrl.set_wheel(mfWheel);
     mremotectrl.set_shift(mnShift);
+    mremotectrl.set_frame_percent(mframerate.mnframerate_percept);
+    mremotectrl.set_frame_percent_separate(mframerate.mbframerate_sep);
+    mremotectrl.set_frame_percent_front(mframerate.mnframerate_percept_front);
+    mremotectrl.set_frame_percent_rear(mframerate.mnframerate_percept_rear);
+    mremotectrl.set_frame_percent_left(mframerate.mnframerate_percept_left);
+    mremotectrl.set_frame_percent_right(mframerate.mnframerate_percept_right);
 
 
     int nsersize = static_cast<int>(mremotectrl.ByteSize()) ;
@@ -1568,3 +1576,12 @@ void MainWindow::onEscFull()
     ui->menubar->setVisible(true);
     ui->statusbar->setVisible(true);
 }
+
+void MainWindow::on_actionSet_FrameRate_triggered()
+{
+    DialogFrameRate xdlg(&mframerate, this);
+    if(xdlg.exec() == xdlg.Accepted)
+    {
+        std::cout<<"set frame rate."<<mframerate.mnframerate_percept <<std::endl;
+    }
+}

+ 5 - 0
src/tool/RemoteCtrl_Wide/mainwindowcenter.h

@@ -29,6 +29,7 @@
 #include "dialogsetpassword.h"
 #include "dialogsetting.h"
 #include "ivh264framedecode.h"
+#include "dialogframerate.h"
 
 #include "pluginapp.h"
 
@@ -118,6 +119,8 @@ private slots:
 
 #endif
 
+    void on_actionSet_FrameRate_triggered();
+
 signals:
     void CamUpdate(int ncampos);
     void CamUpdate(int ncampos,QImage image);
@@ -257,6 +260,8 @@ private:
 
     bool mbSave[NUM_CAM] = {false,false,false,false};
 
+    iv::framerateset mframerate{100,false,100,100,100,100};
+
 
 #ifdef Q_OS_WIN
 

+ 7 - 1
src/tool/RemoteCtrl_Wide/mainwindowcenter.ui

@@ -568,7 +568,7 @@
      <x>0</x>
      <y>0</y>
      <width>1920</width>
-     <height>28</height>
+     <height>23</height>
     </rect>
    </property>
    <widget class="QMenu" name="menuFile">
@@ -579,6 +579,7 @@
     <addaction name="actionSet_Query_Pass"/>
     <addaction name="actionSet_Ctrl_Pass"/>
     <addaction name="actionSave_Video"/>
+    <addaction name="actionSet_FrameRate"/>
    </widget>
    <widget class="QMenu" name="menuView">
     <property name="title">
@@ -624,6 +625,11 @@
     <string>Save Video</string>
    </property>
   </action>
+  <action name="actionSet_FrameRate">
+   <property name="text">
+    <string>Set FrameRate</string>
+   </property>
+  </action>
  </widget>
  <resources>
   <include location="remotectrl.qrc"/>

+ 1 - 1
src/tool/serverctrl/mainwindow.cpp

@@ -26,7 +26,7 @@ MainWindow::MainWindow(QWidget *parent)
     ResetPush();
 
     mpTimer = new QTimer(this);
-    mpTimer->setInterval(2000);
+    mpTimer->setInterval(5000);
     connect(mpTimer,SIGNAL(timeout()),this,SLOT(onTimer()));
 
     setWindowTitle(tr("服务器运行服务配置程序"));