API Documentation
Loading...
Searching...
No Matches
SerialConnectionDialog.h
Go to the documentation of this file.
1/**--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: NDEVR
28File: SerialConnectionDialog
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
35#include "Base/Headers/String.h"
36#include <QSerialPort>
37#include <QWidget>
38namespace Ui
39{
40 class SerialSetupUI;
41}
42
43class QIntValidator;
44
45namespace NDEVR
46{
47 class Connection;
49 {
50 Q_OBJECT
51 public:
52 struct Settings
53 {
54 QString name;
55 qint32 baudRate;
57 QSerialPort::DataBits dataBits;
59 QSerialPort::Parity parity;
60 QString stringParity;
61 QSerialPort::StopBits stopBits;
63 QSerialPort::FlowControl flowControl;
65 };
66
67 explicit SerialConnectionDialog(QWidget *parent = nullptr);
69
70 Settings settings() const;
71 QSerialPort* createSerialPort() const;
72
73 virtual void clear() override;
74 virtual ConnectionInfo connectionInfo() const override;
75 virtual void setConnectionInfo(const ConnectionInfo& connection) override;
76 virtual bool handlesConnection(const ConnectionInfo& connection) override;
77 //private slots:
78 void showPortInfo(int idx);
79 void apply();
80 void cancel();
81 void checkCustomBaudRatePolicy(int idx);
82 void checkCustomDevicePathPolicy(int idx);
83
84 private:
85 void fillPortsParameters();
86 void fillPortsInfo();
87 void updateSettings();
88
89 private:
90 Ui::SerialSetupUI *ui = nullptr;
91 Settings m_current_settings;
92 QIntValidator *m_intValidator = nullptr;
93 };
94
96 {
97 public:
98 virtual bool handlesType(const String& connection) const override;
99 virtual TranslatedString title() const override;
100 virtual String icon() const override;
101 virtual ConnectionDialog* createConnectionDialog() const override;
102 };
103}
#define NDEVR_SERIAL_PORT_API
Definition DLLInfo.h:73
Definition ConnectionDialog.h:23
Definition ConnectionDialog.h:8
Definition SerialConnectionDialog.h:49
Definition SerialConnectionDialog.h:96
virtual bool handlesType(const String &connection) const override
Definition SerialConnectionDialog.cpp:245
virtual ConnectionDialog * createConnectionDialog() const override
Definition SerialConnectionDialog.cpp:257
virtual TranslatedString title() const override
Definition SerialConnectionDialog.cpp:249
virtual String icon() const override
Definition SerialConnectionDialog.cpp:253
Definition String.h:40
Definition TranslatedString.h:9
Definition ACIColor.h:37
Definition FontEditor.h:6
Definition Connection.h:87
Definition SerialConnectionDialog.h:53
QSerialPort::DataBits dataBits
Definition SerialConnectionDialog.h:57
QString stringBaudRate
Definition SerialConnectionDialog.h:56
QSerialPort::StopBits stopBits
Definition SerialConnectionDialog.h:61
QString stringFlowControl
Definition SerialConnectionDialog.h:64
QString stringStopBits
Definition SerialConnectionDialog.h:62
QSerialPort::Parity parity
Definition SerialConnectionDialog.h:59
QSerialPort::FlowControl flowControl
Definition SerialConnectionDialog.h:63
QString stringDataBits
Definition SerialConnectionDialog.h:58
QString name
Definition SerialConnectionDialog.h:54
QString stringParity
Definition SerialConnectionDialog.h:60
qint32 baudRate
Definition SerialConnectionDialog.h:55