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;
48 /**--------------------------------------------------------------------------------------------------
49 \brief A ConnectionDialog that allows the user to modify a Serial port connection.
50 **/
52 {
53 Q_OBJECT
54 public:
55 struct Settings
56 {
57 QString name;
58 qint32 baudRate;
60 QSerialPort::DataBits dataBits;
62 QSerialPort::Parity parity;
63 QString stringParity;
64 QSerialPort::StopBits stopBits;
66 QSerialPort::FlowControl flowControl;
68 };
69
70 explicit SerialConnectionDialog(QWidget *parent = nullptr);
72
74 QSerialPort* createSerialPort() const;
75
76 virtual void clear() override;
77 virtual ConnectionInfo connectionInfo() const override;
78 virtual void setConnectionInfo(const ConnectionInfo& connection) override;
79 virtual bool handlesConnection(const ConnectionInfo& connection) override;
80 //private slots:
81 void showPortInfo(int idx);
82 void apply();
83 void cancel();
86
87 private:
88 void fillPortsParameters();
89 void fillPortsInfo();
90 void updateSettings();
91
92 private:
93 Ui::SerialSetupUI *ui = nullptr;
94 Settings m_current_settings;
95 QIntValidator *m_intValidator = nullptr;
96 };
97 /**--------------------------------------------------------------------------------------------------
98 \brief A ConnectionDialogFactory which enables the creation of a SerialConnectionDialog
99 **/
101 {
102 public:
103 virtual bool handlesType(const String& connection) const override;
104 virtual TranslatedString title() const override;
105 virtual String icon() const override;
106 virtual ConnectionDialog* createConnectionDialog() const override;
107 };
108}
#define NDEVR_SERIAL_PORT_API
Definition DLLInfo.h:55
Used to, given a Connection, generate an appropriate ConnectionDialog to allow adjustment of paramete...
Definition ConnectionDialog.h:31
A virtual dialog that provides an interface that allows the user to adjust certain parameters for a C...
Definition ConnectionDialog.h:13
A ConnectionDialog that allows the user to modify a Serial port connection.
Definition SerialConnectionDialog.h:52
virtual ConnectionInfo connectionInfo() const override
void checkCustomDevicePathPolicy(int idx)
void checkCustomBaudRatePolicy(int idx)
QSerialPort * createSerialPort() const
SerialConnectionDialog(QWidget *parent=nullptr)
virtual void clear() override
virtual void setConnectionInfo(const ConnectionInfo &connection) override
virtual bool handlesConnection(const ConnectionInfo &connection) override
A ConnectionDialogFactory which enables the creation of a SerialConnectionDialog.
Definition SerialConnectionDialog.h:101
virtual bool handlesType(const String &connection) const override
virtual String icon() const override
virtual ConnectionDialog * createConnectionDialog() const override
virtual TranslatedString title() const override
The core String class for the NDEVR API.
Definition String.h:69
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
Definition TranslatedString.h:13
Definition ACIColor.h:37
Definition FontEditor.h:6
A structure designed to store information about a specific Connection.
Definition Connection.h:97
Definition SerialConnectionDialog.h:56
QSerialPort::DataBits dataBits
Definition SerialConnectionDialog.h:60
QString stringBaudRate
Definition SerialConnectionDialog.h:59
QSerialPort::StopBits stopBits
Definition SerialConnectionDialog.h:64
QString stringFlowControl
Definition SerialConnectionDialog.h:67
QString stringStopBits
Definition SerialConnectionDialog.h:65
QSerialPort::Parity parity
Definition SerialConnectionDialog.h:62
QSerialPort::FlowControl flowControl
Definition SerialConnectionDialog.h:66
QString stringDataBits
Definition SerialConnectionDialog.h:61
QString name
Definition SerialConnectionDialog.h:57
QString stringParity
Definition SerialConnectionDialog.h:63
qint32 baudRate
Definition SerialConnectionDialog.h:58