mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 02:30:44 +00:00
Moving Quazip and QExtSerialPort to external libraries for mac and unix
This commit is contained in:
parent
1b2b7adef6
commit
edb7bc3690
2
3rdparty/3rdparty.pro
vendored
2
3rdparty/3rdparty.pro
vendored
@ -1,6 +1,6 @@
|
||||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = qextserialport quazip
|
||||
SUBDIRS = quazip qextserialport
|
||||
|
||||
CONFIG += ordered
|
||||
|
||||
|
47
3rdparty/qextserialport/.gitignore
vendored
47
3rdparty/qextserialport/.gitignore
vendored
@ -1,47 +0,0 @@
|
||||
syntax: glob
|
||||
*.pro.user*
|
||||
*.app
|
||||
*.moc
|
||||
*.prl
|
||||
Makefile*
|
||||
doc/html/
|
||||
*.framework/
|
||||
*.xcodeproj/
|
||||
debug/
|
||||
release/
|
||||
qtc-gdbmacros/
|
||||
*.rej
|
||||
*.orig
|
||||
*.obj
|
||||
*.swp
|
||||
*.dll
|
||||
*.exp
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.lib
|
||||
Thumbs.db
|
||||
moc_*.cpp
|
||||
qrc_*.cpp
|
||||
*.o
|
||||
*.so.*
|
||||
*.so
|
||||
*.pdb
|
||||
ui_*.h
|
||||
*~
|
||||
.qmake.cache
|
||||
extserialport.prf
|
||||
lib/*
|
||||
*.orig
|
||||
*.exe
|
||||
*.vcproj
|
||||
*.vcproj.*.user
|
||||
*_resource.rc
|
||||
*.sln
|
||||
*.idb
|
||||
*.ncb
|
||||
*.suo
|
||||
examples/enumerator/enumerator
|
||||
examples/event/event
|
||||
examples/qespta/qespta
|
||||
examples/uartassistant/uartassistant
|
||||
object_script.*
|
24
3rdparty/qextserialport/doc/doc.pri
vendored
24
3rdparty/qextserialport/doc/doc.pri
vendored
@ -1,12 +1,12 @@
|
||||
OTHER_FILES += $$PWD/qextserialport.qdocconf
|
||||
|
||||
#name of qdoc3 has been changed to qdoc under Qt5
|
||||
QESP_QDOC = qdoc
|
||||
lessThan(QT_MAJOR_VERSION, 5):QESP_QDOC = qdoc3
|
||||
|
||||
docs_target.target = docs
|
||||
docs_target.commands = $$QESP_QDOC $$PWD/qextserialport.qdocconf
|
||||
|
||||
QMAKE_EXTRA_TARGETS = docs_target
|
||||
QMAKE_CLEAN += "-r $$PWD/html"
|
||||
|
||||
OTHER_FILES += $$PWD/qextserialport.qdocconf
|
||||
|
||||
#name of qdoc3 has been changed to qdoc under Qt5
|
||||
QESP_QDOC = qdoc
|
||||
lessThan(QT_MAJOR_VERSION, 5):QESP_QDOC = qdoc3
|
||||
|
||||
docs_target.target = docs
|
||||
docs_target.commands = $$QESP_QDOC $$PWD/qextserialport.qdocconf
|
||||
|
||||
QMAKE_EXTRA_TARGETS = docs_target
|
||||
QMAKE_CLEAN += "-r $$PWD/html"
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
/*!
|
||||
\example examples/enumerator
|
||||
\title enumerator Demo
|
||||
|
||||
The example demonstrates how to use QextSerialEnumerator.
|
||||
|
||||
Include the proper header file
|
||||
\snippet examples/enumerator/main.cpp 0
|
||||
|
||||
Get available ports in the system.
|
||||
\snippet examples/enumerator/main.cpp 1
|
||||
|
||||
Output
|
||||
\snippet examples/enumerator/main.cpp 2
|
||||
*/
|
||||
|
||||
/*!
|
||||
\example examples/enumerator
|
||||
\title enumerator Demo
|
||||
|
||||
The example demonstrates how to use QextSerialEnumerator.
|
||||
|
||||
Include the proper header file
|
||||
\snippet examples/enumerator/main.cpp 0
|
||||
|
||||
Get available ports in the system.
|
||||
\snippet examples/enumerator/main.cpp 1
|
||||
|
||||
Output
|
||||
\snippet examples/enumerator/main.cpp 2
|
||||
*/
|
||||
|
||||
|
14
3rdparty/qextserialport/doc/examples/qespta.qdoc
vendored
14
3rdparty/qextserialport/doc/examples/qespta.qdoc
vendored
@ -1,7 +1,7 @@
|
||||
/*!
|
||||
\example examples/qespta
|
||||
\title qespta Demo
|
||||
|
||||
The example demonstrates how to use QextSerialPort.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\example examples/qespta
|
||||
\title qespta Demo
|
||||
|
||||
The example demonstrates how to use QextSerialPort.
|
||||
*/
|
||||
|
||||
|
@ -1,24 +1,24 @@
|
||||
/*!
|
||||
\example examples/uartassistant
|
||||
\title UartAssistant Demo
|
||||
|
||||
The example demonstrates how to use QextSerialPort.
|
||||
|
||||
Initialze UI element.
|
||||
\snippet examples/uartassistant/dialog.cpp 0
|
||||
|
||||
Initialize serial port
|
||||
\snippet examples/uartassistant/dialog.cpp 1
|
||||
|
||||
port Settings
|
||||
\snippet examples/uartassistant/dialog.cpp 2
|
||||
|
||||
Open or Close the port.
|
||||
\snippet examples/uartassistant/dialog.cpp 3
|
||||
|
||||
Read from or Write to the port
|
||||
\snippet examples/uartassistant/dialog.cpp 4
|
||||
|
||||
\image uartassistant.png
|
||||
*/
|
||||
|
||||
/*!
|
||||
\example examples/uartassistant
|
||||
\title UartAssistant Demo
|
||||
|
||||
The example demonstrates how to use QextSerialPort.
|
||||
|
||||
Initialze UI element.
|
||||
\snippet examples/uartassistant/dialog.cpp 0
|
||||
|
||||
Initialize serial port
|
||||
\snippet examples/uartassistant/dialog.cpp 1
|
||||
|
||||
port Settings
|
||||
\snippet examples/uartassistant/dialog.cpp 2
|
||||
|
||||
Open or Close the port.
|
||||
\snippet examples/uartassistant/dialog.cpp 3
|
||||
|
||||
Read from or Write to the port
|
||||
\snippet examples/uartassistant/dialog.cpp 4
|
||||
|
||||
\image uartassistant.png
|
||||
*/
|
||||
|
||||
|
106
3rdparty/qextserialport/doc/qextserialport.qdocconf
vendored
106
3rdparty/qextserialport/doc/qextserialport.qdocconf
vendored
@ -1,53 +1,53 @@
|
||||
# Run qdoc3 from the directory that contains this file.
|
||||
project = qesp
|
||||
description = QextSerialPort Reference Documentation
|
||||
url = http://code.google.com/p/qextserialport
|
||||
|
||||
outputencoding = UTF-8
|
||||
language = Cpp
|
||||
|
||||
#Paths are relative to the location of this file
|
||||
headerdirs = . ../src
|
||||
sourcedirs = . ../src
|
||||
exampledirs = ../examples ..
|
||||
imagedirs = ./examples/images images
|
||||
|
||||
Cpp.ignoretokens = QEXTSERIALPORT_EXPORT
|
||||
|
||||
indexes = $QTDIR/doc/html/qt.index
|
||||
|
||||
qhp.projects = qesp
|
||||
qhp.qesp.file = qesp.qhp
|
||||
qhp.qesp.namespace = com.google.code.qextserialport.120
|
||||
qhp.qesp.virtualFolder = qdoc
|
||||
qhp.qesp.indexTitle = QextSerialPort Reference Documentation
|
||||
qhp.qesp.indexRoot =
|
||||
qhp.qesp.extraFiles = style/style.css
|
||||
|
||||
|
||||
#------------------------------------------------------------------
|
||||
outputdir = html
|
||||
outputformats = HTML
|
||||
|
||||
headers.fileextensions = "*.h"
|
||||
sources.fileextensions = "*.cpp *.qdoc"
|
||||
|
||||
HTML.templatedir = .
|
||||
HTML.stylesheets = style/style.css
|
||||
|
||||
HTML.headerstyles = " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n"
|
||||
HTML.endheader = "</head>\n"
|
||||
|
||||
HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
|
||||
"<tr>\n" \
|
||||
"<td class=\"postheader\" valign=\"center\">" \
|
||||
"<a href=\"index.html\">Home</a> ·" \
|
||||
" <a href=\"classes.html\">All Classes</a> ·" \
|
||||
"</td></tr></table>"
|
||||
|
||||
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
|
||||
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
|
||||
"<td width=\"40%\" align=\"left\">Copyright © 2000-2012</td>\n" \
|
||||
"<td width=\"20%\" align=\"center\"><a href=\"http://code.google.com/p/qextserialport\">QextSerialPort Project</a></td>\n" \
|
||||
"<td width=\"40%\" align=\"right\"><div align=\"right\">QextSerialPort Manual</div></td>\n" \
|
||||
"</tr></table></div></address>"
|
||||
# Run qdoc3 from the directory that contains this file.
|
||||
project = qesp
|
||||
description = QextSerialPort Reference Documentation
|
||||
url = http://code.google.com/p/qextserialport
|
||||
|
||||
outputencoding = UTF-8
|
||||
language = Cpp
|
||||
|
||||
#Paths are relative to the location of this file
|
||||
headerdirs = . ../src
|
||||
sourcedirs = . ../src
|
||||
exampledirs = ../examples ..
|
||||
imagedirs = ./examples/images images
|
||||
|
||||
Cpp.ignoretokens = QEXTSERIALPORT_EXPORT
|
||||
|
||||
indexes = $QTDIR/doc/html/qt.index
|
||||
|
||||
qhp.projects = qesp
|
||||
qhp.qesp.file = qesp.qhp
|
||||
qhp.qesp.namespace = com.google.code.qextserialport.120
|
||||
qhp.qesp.virtualFolder = qdoc
|
||||
qhp.qesp.indexTitle = QextSerialPort Reference Documentation
|
||||
qhp.qesp.indexRoot =
|
||||
qhp.qesp.extraFiles = style/style.css
|
||||
|
||||
|
||||
#------------------------------------------------------------------
|
||||
outputdir = html
|
||||
outputformats = HTML
|
||||
|
||||
headers.fileextensions = "*.h"
|
||||
sources.fileextensions = "*.cpp *.qdoc"
|
||||
|
||||
HTML.templatedir = .
|
||||
HTML.stylesheets = style/style.css
|
||||
|
||||
HTML.headerstyles = " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/style.css\" />\n"
|
||||
HTML.endheader = "</head>\n"
|
||||
|
||||
HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
|
||||
"<tr>\n" \
|
||||
"<td class=\"postheader\" valign=\"center\">" \
|
||||
"<a href=\"index.html\">Home</a> ·" \
|
||||
" <a href=\"classes.html\">All Classes</a> ·" \
|
||||
"</td></tr></table>"
|
||||
|
||||
HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
|
||||
"<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
|
||||
"<td width=\"40%\" align=\"left\">Copyright © 2000-2012</td>\n" \
|
||||
"<td width=\"20%\" align=\"center\"><a href=\"http://code.google.com/p/qextserialport\">QextSerialPort Project</a></td>\n" \
|
||||
"<td width=\"40%\" align=\"right\"><div align=\"right\">QextSerialPort Manual</div></td>\n" \
|
||||
"</tr></table></div></address>"
|
||||
|
274
3rdparty/qextserialport/doc/style/style.css
vendored
274
3rdparty/qextserialport/doc/style/style.css
vendored
@ -1,137 +1,137 @@
|
||||
a:link, a:visited {
|
||||
color: #00732F;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
body {
|
||||
font: normal 400 14px/1.2 Arial;
|
||||
margin-top: 85px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font: 500 20px/1.2 Arial;
|
||||
}
|
||||
|
||||
h3.fn, span.fn {
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #E6E6E6;
|
||||
word-spacing: 3px;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
|
||||
table, pre {
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border: 1px solid #E6E6E6;
|
||||
border-collapse: separate;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 25px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 3px 15px 3px 20px;
|
||||
}
|
||||
|
||||
table tr.even {
|
||||
background-color: white;
|
||||
color: #66666E;
|
||||
}
|
||||
|
||||
table tr.odd {
|
||||
background-color: #F6F6F6;
|
||||
color: #66666E;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 10px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.cpp {
|
||||
display: block;
|
||||
margin: 10;
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
padding: 20px 0 20px 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.memItemLeft {
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.memItemRight {
|
||||
padding: 3px 15px 3px 0;
|
||||
}
|
||||
|
||||
.qml {
|
||||
display: block;
|
||||
margin: 10;
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
padding: 20px 0 20px 0;
|
||||
}
|
||||
|
||||
.qmldefault {
|
||||
padding-left: 5px;
|
||||
float: right;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.qmlreadonly {
|
||||
padding-left: 5px;
|
||||
float: right;
|
||||
color: #254117;
|
||||
}
|
||||
|
||||
.rightAlign {
|
||||
padding: 3px 5px 3px 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.title {
|
||||
background-color: white;
|
||||
color: #44A51C;
|
||||
font-family: Verdana;
|
||||
font-size: 35px;
|
||||
font-weight: normal;
|
||||
left: 0;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 16px;
|
||||
padding-top: 20px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.toc {
|
||||
float: right;
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border: 1px solid #DDD;
|
||||
margin: 0 20px 10px 10px;
|
||||
padding: 20px 15px 20px 20px;
|
||||
height: auto;
|
||||
width: 200px;
|
||||
}
|
||||
a:link, a:visited {
|
||||
color: #00732F;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
body {
|
||||
font: normal 400 14px/1.2 Arial;
|
||||
margin-top: 85px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font: 500 20px/1.2 Arial;
|
||||
}
|
||||
|
||||
h3.fn, span.fn {
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #E6E6E6;
|
||||
word-spacing: 3px;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
|
||||
table, pre {
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border: 1px solid #E6E6E6;
|
||||
border-collapse: separate;
|
||||
font-size: 12px;
|
||||
line-height: 1.2;
|
||||
margin-bottom: 25px;
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
table td {
|
||||
padding: 3px 15px 3px 20px;
|
||||
}
|
||||
|
||||
table tr.even {
|
||||
background-color: white;
|
||||
color: #66666E;
|
||||
}
|
||||
|
||||
table tr.odd {
|
||||
background-color: #F6F6F6;
|
||||
color: #66666E;
|
||||
}
|
||||
|
||||
li {
|
||||
margin-bottom: 10px;
|
||||
padding-left: 12px;
|
||||
}
|
||||
|
||||
.cpp {
|
||||
display: block;
|
||||
margin: 10;
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
padding: 20px 0 20px 0;
|
||||
}
|
||||
|
||||
.footer {
|
||||
margin-top: 50px;
|
||||
}
|
||||
|
||||
.memItemLeft {
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.memItemRight {
|
||||
padding: 3px 15px 3px 0;
|
||||
}
|
||||
|
||||
.qml {
|
||||
display: block;
|
||||
margin: 10;
|
||||
overflow: hidden;
|
||||
overflow-x: hidden;
|
||||
overflow-y: hidden;
|
||||
padding: 20px 0 20px 0;
|
||||
}
|
||||
|
||||
.qmldefault {
|
||||
padding-left: 5px;
|
||||
float: right;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.qmlreadonly {
|
||||
padding-left: 5px;
|
||||
float: right;
|
||||
color: #254117;
|
||||
}
|
||||
|
||||
.rightAlign {
|
||||
padding: 3px 5px 3px 10px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.title {
|
||||
background-color: white;
|
||||
color: #44A51C;
|
||||
font-family: Verdana;
|
||||
font-size: 35px;
|
||||
font-weight: normal;
|
||||
left: 0;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 16px;
|
||||
padding-top: 20px;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.toc {
|
||||
float: right;
|
||||
-moz-border-radius: 7px 7px 7px 7px;
|
||||
-webkit-border-radius: 7px 7px 7px 7px;
|
||||
border-radius: 7px 7px 7px 7px;
|
||||
background-color: #F6F6F6;
|
||||
border: 1px solid #DDD;
|
||||
margin: 0 20px 10px 10px;
|
||||
padding: 20px 15px 20px 20px;
|
||||
height: auto;
|
||||
width: 200px;
|
||||
}
|
||||
|
5
3rdparty/qextserialport/qextserialport.pro
vendored
5
3rdparty/qextserialport/qextserialport.pro
vendored
@ -4,7 +4,7 @@
|
||||
# CONFIG += qesp_static
|
||||
|
||||
# Uncomment following line if you want to build framework for mac
|
||||
# macx:CONFIG += qesp_mac_framework
|
||||
#macx:CONFIG += qesp_mac_framework
|
||||
|
||||
# Uncomment following line if you want to enable udev for linux
|
||||
# linux*:CONFIG += qesp_linux_udev
|
||||
@ -70,7 +70,6 @@ greaterThan(QT_MAJOR_VERSION, 4) {
|
||||
QESP_LIB_BASENAME = qextserialport
|
||||
}
|
||||
TARGET = $$qextLibraryName($$QESP_LIB_BASENAME)
|
||||
|
||||
VERSION = 1.2.0
|
||||
|
||||
# generate feature file by qmake based on this *.in file.
|
||||
@ -78,7 +77,7 @@ QMAKE_SUBSTITUTES += extserialport.prf.in
|
||||
OTHER_FILES += extserialport.prf.in
|
||||
|
||||
# for make docs
|
||||
#include(doc/doc.pri)
|
||||
include(doc/doc.pri)
|
||||
|
||||
# for make install
|
||||
win32:!qesp_static {
|
||||
|
72
3rdparty/qextserialport/src/qextserialport.pri
vendored
72
3rdparty/qextserialport/src/qextserialport.pri
vendored
@ -1,36 +1,36 @@
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
PUBLIC_HEADERS += $$PWD/qextserialport.h \
|
||||
$$PWD/qextserialenumerator.h \
|
||||
$$PWD/qextserialport_global.h
|
||||
|
||||
HEADERS += $$PUBLIC_HEADERS \
|
||||
$$PWD/qextserialport_p.h \
|
||||
$$PWD/qextserialenumerator_p.h \
|
||||
|
||||
SOURCES += $$PWD/qextserialport.cpp \
|
||||
$$PWD/qextserialenumerator.cpp
|
||||
unix {
|
||||
SOURCES += $$PWD/qextserialport_unix.cpp
|
||||
linux* {
|
||||
SOURCES += $$PWD/qextserialenumerator_linux.cpp
|
||||
} else:macx {
|
||||
SOURCES += $$PWD/qextserialenumerator_osx.cpp
|
||||
} else {
|
||||
SOURCES += $$PWD/qextserialenumerator_unix.cpp
|
||||
}
|
||||
}
|
||||
win32:SOURCES += $$PWD/qextserialport_win.cpp \
|
||||
$$PWD/qextserialenumerator_win.cpp
|
||||
|
||||
linux*{
|
||||
!qesp_linux_udev:DEFINES += QESP_NO_UDEV
|
||||
qesp_linux_udev: LIBS += -ludev
|
||||
}
|
||||
|
||||
macx:LIBS += -framework IOKit -framework CoreFoundation
|
||||
win32:LIBS += -lsetupapi -ladvapi32 -luser32
|
||||
|
||||
# moc doesn't detect Q_OS_LINUX correctly, so add this to make it work
|
||||
linux*:DEFINES += __linux__
|
||||
INCLUDEPATH += $$PWD
|
||||
DEPENDPATH += $$PWD
|
||||
|
||||
PUBLIC_HEADERS += $$PWD/qextserialport.h \
|
||||
$$PWD/qextserialenumerator.h \
|
||||
$$PWD/qextserialport_global.h
|
||||
|
||||
HEADERS += $$PUBLIC_HEADERS \
|
||||
$$PWD/qextserialport_p.h \
|
||||
$$PWD/qextserialenumerator_p.h \
|
||||
|
||||
SOURCES += $$PWD/qextserialport.cpp \
|
||||
$$PWD/qextserialenumerator.cpp
|
||||
unix {
|
||||
SOURCES += $$PWD/qextserialport_unix.cpp
|
||||
linux* {
|
||||
SOURCES += $$PWD/qextserialenumerator_linux.cpp
|
||||
} else:macx {
|
||||
SOURCES += $$PWD/qextserialenumerator_osx.cpp
|
||||
} else {
|
||||
SOURCES += $$PWD/qextserialenumerator_unix.cpp
|
||||
}
|
||||
}
|
||||
win32:SOURCES += $$PWD/qextserialport_win.cpp \
|
||||
$$PWD/qextserialenumerator_win.cpp
|
||||
|
||||
linux*{
|
||||
!qesp_linux_udev:DEFINES += QESP_NO_UDEV
|
||||
qesp_linux_udev: LIBS += -ludev
|
||||
}
|
||||
|
||||
macx:LIBS += -framework IOKit -framework CoreFoundation
|
||||
win32:LIBS += -lsetupapi -ladvapi32 -luser32
|
||||
|
||||
# moc doesn't detect Q_OS_LINUX correctly, so add this to make it work
|
||||
linux*:DEFINES += __linux__
|
||||
|
144
3rdparty/qextserialport/src/qextserialport_global.h
vendored
144
3rdparty/qextserialport/src/qextserialport_global.h
vendored
@ -1,72 +1,72 @@
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2000-2003 Wayne Roth
|
||||
** Copyright (c) 2004-2007 Stefan Sander
|
||||
** Copyright (c) 2007 Michal Policht
|
||||
** Copyright (c) 2008 Brandon Fosdick
|
||||
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||
** Copyright (c) 2011 Debao Zhang
|
||||
** All right reserved.
|
||||
** Web: http://code.google.com/p/qextserialport/
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining
|
||||
** a copy of this software and associated documentation files (the
|
||||
** "Software"), to deal in the Software without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||
** permit persons to whom the Software is furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QEXTSERIALPORT_GLOBAL_H
|
||||
#define QEXTSERIALPORT_GLOBAL_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#ifdef QEXTSERIALPORT_BUILD_SHARED
|
||||
# define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(QEXTSERIALPORT_USING_SHARED)
|
||||
# define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
|
||||
#else
|
||||
# define QEXTSERIALPORT_EXPORT
|
||||
#endif
|
||||
|
||||
// ### for compatible with old version. should be removed in QESP 2.0
|
||||
#ifdef _TTY_NOWARN_
|
||||
# define QESP_NO_WARN
|
||||
#endif
|
||||
#ifdef _TTY_NOWARN_PORT_
|
||||
# define QESP_NO_PORTABILITY_WARN
|
||||
#endif
|
||||
|
||||
/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
|
||||
#ifdef QESP_NO_WARN
|
||||
# define QESP_NO_PORTABILITY_WARN
|
||||
#endif
|
||||
|
||||
/*macros for warning and debug messages*/
|
||||
#ifdef QESP_NO_PORTABILITY_WARN
|
||||
# define QESP_PORTABILITY_WARNING while (false)qWarning
|
||||
#else
|
||||
# define QESP_PORTABILITY_WARNING qWarning
|
||||
#endif /*QESP_NOWARN_PORT*/
|
||||
|
||||
#ifdef QESP_NO_WARN
|
||||
# define QESP_WARNING while (false)qWarning
|
||||
#else
|
||||
# define QESP_WARNING qWarning
|
||||
#endif /*QESP_NOWARN*/
|
||||
|
||||
#endif // QEXTSERIALPORT_GLOBAL_H
|
||||
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2000-2003 Wayne Roth
|
||||
** Copyright (c) 2004-2007 Stefan Sander
|
||||
** Copyright (c) 2007 Michal Policht
|
||||
** Copyright (c) 2008 Brandon Fosdick
|
||||
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||
** Copyright (c) 2011 Debao Zhang
|
||||
** All right reserved.
|
||||
** Web: http://code.google.com/p/qextserialport/
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining
|
||||
** a copy of this software and associated documentation files (the
|
||||
** "Software"), to deal in the Software without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||
** permit persons to whom the Software is furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QEXTSERIALPORT_GLOBAL_H
|
||||
#define QEXTSERIALPORT_GLOBAL_H
|
||||
|
||||
#include <QtCore/QtGlobal>
|
||||
|
||||
#ifdef QEXTSERIALPORT_BUILD_SHARED
|
||||
# define QEXTSERIALPORT_EXPORT Q_DECL_EXPORT
|
||||
#elif defined(QEXTSERIALPORT_USING_SHARED)
|
||||
# define QEXTSERIALPORT_EXPORT Q_DECL_IMPORT
|
||||
#else
|
||||
# define QEXTSERIALPORT_EXPORT
|
||||
#endif
|
||||
|
||||
// ### for compatible with old version. should be removed in QESP 2.0
|
||||
#ifdef _TTY_NOWARN_
|
||||
# define QESP_NO_WARN
|
||||
#endif
|
||||
#ifdef _TTY_NOWARN_PORT_
|
||||
# define QESP_NO_PORTABILITY_WARN
|
||||
#endif
|
||||
|
||||
/*if all warning messages are turned off, flag portability warnings to be turned off as well*/
|
||||
#ifdef QESP_NO_WARN
|
||||
# define QESP_NO_PORTABILITY_WARN
|
||||
#endif
|
||||
|
||||
/*macros for warning and debug messages*/
|
||||
#ifdef QESP_NO_PORTABILITY_WARN
|
||||
# define QESP_PORTABILITY_WARNING while (false)qWarning
|
||||
#else
|
||||
# define QESP_PORTABILITY_WARNING qWarning
|
||||
#endif /*QESP_NOWARN_PORT*/
|
||||
|
||||
#ifdef QESP_NO_WARN
|
||||
# define QESP_WARNING while (false)qWarning
|
||||
#else
|
||||
# define QESP_WARNING qWarning
|
||||
#endif /*QESP_NOWARN*/
|
||||
|
||||
#endif // QEXTSERIALPORT_GLOBAL_H
|
||||
|
||||
|
500
3rdparty/qextserialport/src/qextserialport_p.h
vendored
500
3rdparty/qextserialport/src/qextserialport_p.h
vendored
@ -1,250 +1,250 @@
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2000-2003 Wayne Roth
|
||||
** Copyright (c) 2004-2007 Stefan Sander
|
||||
** Copyright (c) 2007 Michal Policht
|
||||
** Copyright (c) 2008 Brandon Fosdick
|
||||
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||
** Copyright (c) 2011 Debao Zhang
|
||||
** All right reserved.
|
||||
** Web: http://code.google.com/p/qextserialport/
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining
|
||||
** a copy of this software and associated documentation files (the
|
||||
** "Software"), to deal in the Software without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||
** permit persons to whom the Software is furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QEXTSERIALPORT_P_H_
|
||||
#define _QEXTSERIALPORT_P_H_
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the QESP API. It exists for the convenience
|
||||
// of other QESP classes. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qextserialport.h"
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <termios.h>
|
||||
#elif (defined Q_OS_WIN)
|
||||
# include <QtCore/qt_windows.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
// This is QextSerialPort's read buffer, needed by posix system.
|
||||
// ref: QRingBuffer & QIODevicePrivateLinearBuffer
|
||||
class QextReadBuffer
|
||||
{
|
||||
public:
|
||||
inline QextReadBuffer(size_t growth=4096)
|
||||
: len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) {
|
||||
}
|
||||
|
||||
~QextReadBuffer() {
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
inline void clear() {
|
||||
first = buf;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
inline int size() const {
|
||||
return len;
|
||||
}
|
||||
|
||||
inline bool isEmpty() const {
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
inline int read(char *target, int size) {
|
||||
int r = qMin(size, len);
|
||||
if (r == 1) {
|
||||
*target = *first;
|
||||
--len;
|
||||
++first;
|
||||
} else {
|
||||
memcpy(target, first, r);
|
||||
len -= r;
|
||||
first += r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
inline char *reserve(size_t size) {
|
||||
if ((first - buf) + len + size > capacity) {
|
||||
size_t newCapacity = qMax(capacity, basicBlockSize);
|
||||
while (newCapacity < len + size)
|
||||
newCapacity *= 2;
|
||||
if (newCapacity > capacity) {
|
||||
// allocate more space
|
||||
char *newBuf = new char[newCapacity];
|
||||
memmove(newBuf, first, len);
|
||||
delete [] buf;
|
||||
buf = newBuf;
|
||||
capacity = newCapacity;
|
||||
} else {
|
||||
// shift any existing data to make space
|
||||
memmove(buf, first, len);
|
||||
}
|
||||
first = buf;
|
||||
}
|
||||
char *writePtr = first + len;
|
||||
len += (int)size;
|
||||
return writePtr;
|
||||
}
|
||||
|
||||
inline void chop(int size) {
|
||||
if (size >= len)
|
||||
clear();
|
||||
else
|
||||
len -= size;
|
||||
}
|
||||
|
||||
inline void squeeze() {
|
||||
if (first != buf) {
|
||||
memmove(buf, first, len);
|
||||
first = buf;
|
||||
}
|
||||
size_t newCapacity = basicBlockSize;
|
||||
while (newCapacity < size_t(len))
|
||||
newCapacity *= 2;
|
||||
if (newCapacity < capacity) {
|
||||
char *tmp = static_cast<char *>(realloc(buf, newCapacity));
|
||||
if (tmp) {
|
||||
buf = tmp;
|
||||
capacity = newCapacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline QByteArray readAll() {
|
||||
char *f = first;
|
||||
int l = len;
|
||||
clear();
|
||||
return QByteArray(f, l);
|
||||
}
|
||||
|
||||
inline int readLine(char *target, int size) {
|
||||
int r = qMin(size, len);
|
||||
char *eol = static_cast<char *>(memchr(first, '\n', r));
|
||||
if (eol)
|
||||
r = 1+(eol-first);
|
||||
memcpy(target, first, r);
|
||||
len -= r;
|
||||
first += r;
|
||||
return int(r);
|
||||
}
|
||||
|
||||
inline bool canReadLine() const {
|
||||
return memchr(first, '\n', len);
|
||||
}
|
||||
|
||||
private:
|
||||
int len;
|
||||
char *first;
|
||||
char *buf;
|
||||
size_t capacity;
|
||||
size_t basicBlockSize;
|
||||
};
|
||||
|
||||
class QWinEventNotifier;
|
||||
class QReadWriteLock;
|
||||
class QSocketNotifier;
|
||||
|
||||
class QextSerialPortPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QextSerialPort)
|
||||
public:
|
||||
QextSerialPortPrivate(QextSerialPort *q);
|
||||
~QextSerialPortPrivate();
|
||||
enum DirtyFlagEnum
|
||||
{
|
||||
DFE_BaudRate = 0x0001,
|
||||
DFE_Parity = 0x0002,
|
||||
DFE_StopBits = 0x0004,
|
||||
DFE_DataBits = 0x0008,
|
||||
DFE_Flow = 0x0010,
|
||||
DFE_TimeOut = 0x0100,
|
||||
DFE_ALL = 0x0fff,
|
||||
DFE_Settings_Mask = 0x00ff //without TimeOut
|
||||
};
|
||||
mutable QReadWriteLock lock;
|
||||
QString port;
|
||||
PortSettings settings;
|
||||
QextReadBuffer readBuffer;
|
||||
int settingsDirtyFlags;
|
||||
ulong lastErr;
|
||||
QextSerialPort::QueryMode queryMode;
|
||||
|
||||
// platform specific members
|
||||
#ifdef Q_OS_UNIX
|
||||
int fd;
|
||||
QSocketNotifier *readNotifier;
|
||||
struct termios currentTermios;
|
||||
struct termios oldTermios;
|
||||
#elif (defined Q_OS_WIN)
|
||||
HANDLE handle;
|
||||
OVERLAPPED overlap;
|
||||
COMMCONFIG commConfig;
|
||||
COMMTIMEOUTS commTimeouts;
|
||||
QWinEventNotifier *winEventNotifier;
|
||||
DWORD eventMask;
|
||||
QList<OVERLAPPED *> pendingWrites;
|
||||
QReadWriteLock *bytesToWriteLock;
|
||||
#endif
|
||||
|
||||
/*fill PortSettings*/
|
||||
void setBaudRate(BaudRateType baudRate, bool update=true);
|
||||
void setDataBits(DataBitsType dataBits, bool update=true);
|
||||
void setParity(ParityType parity, bool update=true);
|
||||
void setStopBits(StopBitsType stopbits, bool update=true);
|
||||
void setFlowControl(FlowType flow, bool update=true);
|
||||
void setTimeout(long millisec, bool update=true);
|
||||
void setPortSettings(const PortSettings &settings, bool update=true);
|
||||
|
||||
void platformSpecificDestruct();
|
||||
void platformSpecificInit();
|
||||
void translateError(ulong error);
|
||||
void updatePortSettings();
|
||||
|
||||
qint64 readData_sys(char *data, qint64 maxSize);
|
||||
qint64 writeData_sys(const char *data, qint64 maxSize);
|
||||
void setDtr_sys(bool set=true);
|
||||
void setRts_sys(bool set=true);
|
||||
bool open_sys(QIODevice::OpenMode mode);
|
||||
bool close_sys();
|
||||
bool flush_sys();
|
||||
ulong lineStatus_sys();
|
||||
qint64 bytesAvailable_sys() const;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void _q_onWinEvent(HANDLE h);
|
||||
#endif
|
||||
void _q_canRead();
|
||||
|
||||
QextSerialPort *q_ptr;
|
||||
};
|
||||
|
||||
#endif //_QEXTSERIALPORT_P_H_
|
||||
/****************************************************************************
|
||||
** Copyright (c) 2000-2003 Wayne Roth
|
||||
** Copyright (c) 2004-2007 Stefan Sander
|
||||
** Copyright (c) 2007 Michal Policht
|
||||
** Copyright (c) 2008 Brandon Fosdick
|
||||
** Copyright (c) 2009-2010 Liam Staskawicz
|
||||
** Copyright (c) 2011 Debao Zhang
|
||||
** All right reserved.
|
||||
** Web: http://code.google.com/p/qextserialport/
|
||||
**
|
||||
** Permission is hereby granted, free of charge, to any person obtaining
|
||||
** a copy of this software and associated documentation files (the
|
||||
** "Software"), to deal in the Software without restriction, including
|
||||
** without limitation the rights to use, copy, modify, merge, publish,
|
||||
** distribute, sublicense, and/or sell copies of the Software, and to
|
||||
** permit persons to whom the Software is furnished to do so, subject to
|
||||
** the following conditions:
|
||||
**
|
||||
** The above copyright notice and this permission notice shall be
|
||||
** included in all copies or substantial portions of the Software.
|
||||
**
|
||||
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef _QEXTSERIALPORT_P_H_
|
||||
#define _QEXTSERIALPORT_P_H_
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the QESP API. It exists for the convenience
|
||||
// of other QESP classes. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qextserialport.h"
|
||||
#include <QtCore/QReadWriteLock>
|
||||
#ifdef Q_OS_UNIX
|
||||
# include <termios.h>
|
||||
#elif (defined Q_OS_WIN)
|
||||
# include <QtCore/qt_windows.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
// This is QextSerialPort's read buffer, needed by posix system.
|
||||
// ref: QRingBuffer & QIODevicePrivateLinearBuffer
|
||||
class QextReadBuffer
|
||||
{
|
||||
public:
|
||||
inline QextReadBuffer(size_t growth=4096)
|
||||
: len(0), first(0), buf(0), capacity(0), basicBlockSize(growth) {
|
||||
}
|
||||
|
||||
~QextReadBuffer() {
|
||||
delete [] buf;
|
||||
}
|
||||
|
||||
inline void clear() {
|
||||
first = buf;
|
||||
len = 0;
|
||||
}
|
||||
|
||||
inline int size() const {
|
||||
return len;
|
||||
}
|
||||
|
||||
inline bool isEmpty() const {
|
||||
return len == 0;
|
||||
}
|
||||
|
||||
inline int read(char *target, int size) {
|
||||
int r = qMin(size, len);
|
||||
if (r == 1) {
|
||||
*target = *first;
|
||||
--len;
|
||||
++first;
|
||||
} else {
|
||||
memcpy(target, first, r);
|
||||
len -= r;
|
||||
first += r;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
inline char *reserve(size_t size) {
|
||||
if ((first - buf) + len + size > capacity) {
|
||||
size_t newCapacity = qMax(capacity, basicBlockSize);
|
||||
while (newCapacity < len + size)
|
||||
newCapacity *= 2;
|
||||
if (newCapacity > capacity) {
|
||||
// allocate more space
|
||||
char *newBuf = new char[newCapacity];
|
||||
memmove(newBuf, first, len);
|
||||
delete [] buf;
|
||||
buf = newBuf;
|
||||
capacity = newCapacity;
|
||||
} else {
|
||||
// shift any existing data to make space
|
||||
memmove(buf, first, len);
|
||||
}
|
||||
first = buf;
|
||||
}
|
||||
char *writePtr = first + len;
|
||||
len += (int)size;
|
||||
return writePtr;
|
||||
}
|
||||
|
||||
inline void chop(int size) {
|
||||
if (size >= len)
|
||||
clear();
|
||||
else
|
||||
len -= size;
|
||||
}
|
||||
|
||||
inline void squeeze() {
|
||||
if (first != buf) {
|
||||
memmove(buf, first, len);
|
||||
first = buf;
|
||||
}
|
||||
size_t newCapacity = basicBlockSize;
|
||||
while (newCapacity < size_t(len))
|
||||
newCapacity *= 2;
|
||||
if (newCapacity < capacity) {
|
||||
char *tmp = static_cast<char *>(realloc(buf, newCapacity));
|
||||
if (tmp) {
|
||||
buf = tmp;
|
||||
capacity = newCapacity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline QByteArray readAll() {
|
||||
char *f = first;
|
||||
int l = len;
|
||||
clear();
|
||||
return QByteArray(f, l);
|
||||
}
|
||||
|
||||
inline int readLine(char *target, int size) {
|
||||
int r = qMin(size, len);
|
||||
char *eol = static_cast<char *>(memchr(first, '\n', r));
|
||||
if (eol)
|
||||
r = 1+(eol-first);
|
||||
memcpy(target, first, r);
|
||||
len -= r;
|
||||
first += r;
|
||||
return int(r);
|
||||
}
|
||||
|
||||
inline bool canReadLine() const {
|
||||
return memchr(first, '\n', len);
|
||||
}
|
||||
|
||||
private:
|
||||
int len;
|
||||
char *first;
|
||||
char *buf;
|
||||
size_t capacity;
|
||||
size_t basicBlockSize;
|
||||
};
|
||||
|
||||
class QWinEventNotifier;
|
||||
class QReadWriteLock;
|
||||
class QSocketNotifier;
|
||||
|
||||
class QextSerialPortPrivate
|
||||
{
|
||||
Q_DECLARE_PUBLIC(QextSerialPort)
|
||||
public:
|
||||
QextSerialPortPrivate(QextSerialPort *q);
|
||||
~QextSerialPortPrivate();
|
||||
enum DirtyFlagEnum
|
||||
{
|
||||
DFE_BaudRate = 0x0001,
|
||||
DFE_Parity = 0x0002,
|
||||
DFE_StopBits = 0x0004,
|
||||
DFE_DataBits = 0x0008,
|
||||
DFE_Flow = 0x0010,
|
||||
DFE_TimeOut = 0x0100,
|
||||
DFE_ALL = 0x0fff,
|
||||
DFE_Settings_Mask = 0x00ff //without TimeOut
|
||||
};
|
||||
mutable QReadWriteLock lock;
|
||||
QString port;
|
||||
PortSettings settings;
|
||||
QextReadBuffer readBuffer;
|
||||
int settingsDirtyFlags;
|
||||
ulong lastErr;
|
||||
QextSerialPort::QueryMode queryMode;
|
||||
|
||||
// platform specific members
|
||||
#ifdef Q_OS_UNIX
|
||||
int fd;
|
||||
QSocketNotifier *readNotifier;
|
||||
struct termios currentTermios;
|
||||
struct termios oldTermios;
|
||||
#elif (defined Q_OS_WIN)
|
||||
HANDLE handle;
|
||||
OVERLAPPED overlap;
|
||||
COMMCONFIG commConfig;
|
||||
COMMTIMEOUTS commTimeouts;
|
||||
QWinEventNotifier *winEventNotifier;
|
||||
DWORD eventMask;
|
||||
QList<OVERLAPPED *> pendingWrites;
|
||||
QReadWriteLock *bytesToWriteLock;
|
||||
#endif
|
||||
|
||||
/*fill PortSettings*/
|
||||
void setBaudRate(BaudRateType baudRate, bool update=true);
|
||||
void setDataBits(DataBitsType dataBits, bool update=true);
|
||||
void setParity(ParityType parity, bool update=true);
|
||||
void setStopBits(StopBitsType stopbits, bool update=true);
|
||||
void setFlowControl(FlowType flow, bool update=true);
|
||||
void setTimeout(long millisec, bool update=true);
|
||||
void setPortSettings(const PortSettings &settings, bool update=true);
|
||||
|
||||
void platformSpecificDestruct();
|
||||
void platformSpecificInit();
|
||||
void translateError(ulong error);
|
||||
void updatePortSettings();
|
||||
|
||||
qint64 readData_sys(char *data, qint64 maxSize);
|
||||
qint64 writeData_sys(const char *data, qint64 maxSize);
|
||||
void setDtr_sys(bool set=true);
|
||||
void setRts_sys(bool set=true);
|
||||
bool open_sys(QIODevice::OpenMode mode);
|
||||
bool close_sys();
|
||||
bool flush_sys();
|
||||
ulong lineStatus_sys();
|
||||
qint64 bytesAvailable_sys() const;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void _q_onWinEvent(HANDLE h);
|
||||
#endif
|
||||
void _q_canRead();
|
||||
|
||||
QextSerialPort *q_ptr;
|
||||
};
|
||||
|
||||
#endif //_QEXTSERIALPORT_P_H_
|
||||
|
1
3rdparty/quazip/quazip.pro
vendored
1
3rdparty/quazip/quazip.pro
vendored
@ -1,3 +1,4 @@
|
||||
PREFIX=/usr/local/
|
||||
TEMPLATE=subdirs
|
||||
SUBDIRS=quazip
|
||||
#SUBDIRS += qztest
|
||||
|
3
3rdparty/quazip/quazip/quazip.pro
vendored
3
3rdparty/quazip/quazip/quazip.pro
vendored
@ -31,6 +31,7 @@ zip.h
|
||||
|
||||
SOURCES += *.c *.cpp
|
||||
|
||||
PREFIX = /usr/local
|
||||
unix:!symbian {
|
||||
headers.path=$$PREFIX/include/quazip
|
||||
headers.files=$$HEADERS
|
||||
@ -39,6 +40,8 @@ unix:!symbian {
|
||||
|
||||
OBJECTS_DIR=.obj
|
||||
MOC_DIR=.moc
|
||||
|
||||
LIBS += -lz
|
||||
|
||||
}
|
||||
|
||||
|
@ -4,5 +4,11 @@ SUBDIRS = 3rdparty src
|
||||
|
||||
CONFIG += ordered
|
||||
|
||||
src.depends = 3rdparty
|
||||
TRANSLATIONS += \
|
||||
Translations/Nederlands.nl_NL.ts \
|
||||
Translations/Francais.fr.ts \
|
||||
Translations/Svenska.se.ts \
|
||||
Translations/Deutsch.de_DE.ts \
|
||||
Translations/Espaniol.es.ts
|
||||
|
||||
src.depends = 3rdparty
|
||||
|
@ -205,7 +205,11 @@ int main(int argc, char *argv[])
|
||||
lang_layout.addWidget(&lang_combo,1);
|
||||
lang_layout.addWidget(&lang_okbtn);
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
QString transdir=QCoreApplication::applicationDirPath()+"/Contents/Resources/Translations/";
|
||||
#else
|
||||
QString transdir=QCoreApplication::applicationDirPath()+"/Translations/";
|
||||
#endif
|
||||
QDir dir(transdir);
|
||||
qDebug() << "Scanning \"" << transdir << "\" for translations";
|
||||
dir.setFilter(QDir::Files);
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include <QCalendarWidget>
|
||||
#include <QTextCharFormat>
|
||||
|
||||
#include "qextserialport/src/qextserialenumerator.h"
|
||||
#include "src/qextserialenumerator.h"
|
||||
|
||||
#include "oximetry.h"
|
||||
#include "ui_oximetry.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <QMessageBox>
|
||||
#include <QMutex>
|
||||
|
||||
#include "qextserialport/src/qextserialport.h"
|
||||
#include "src/qextserialport.h"
|
||||
|
||||
#include "SleepLib/profiles.h"
|
||||
#include "SleepLib/day.h"
|
||||
|
55
src/src.pro
55
src/src.pro
@ -8,7 +8,7 @@ QT += core gui opengl network xml
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION,4) {
|
||||
QT += widgets webkitwidgets
|
||||
} else {
|
||||
} else { # qt4
|
||||
QT += webkit
|
||||
}
|
||||
|
||||
@ -41,8 +41,8 @@ unix:!macx:LIBS += -lX11 -lz -lGLU
|
||||
|
||||
macx {
|
||||
SOURCES +=
|
||||
LIBS += -framework IOKit -framework CoreFoundation -lz
|
||||
ICON = icons/iconfile.icns
|
||||
LIBS += -lz
|
||||
ICON = ../icons/iconfile.icns
|
||||
}
|
||||
|
||||
win32 {
|
||||
@ -182,13 +182,6 @@ OTHER_FILES += \
|
||||
docs/update_notes.html \
|
||||
qextserialport/qextserialport.pri
|
||||
|
||||
TRANSLATIONS += \
|
||||
../Translations/Nederlands.nl_NL.ts \
|
||||
../Translations/Francais.fr.ts \
|
||||
../Translations/Svenska.se.ts \
|
||||
../Translations/Deutsch.de_DE.ts \
|
||||
../Translations/Espaniol.es.ts
|
||||
|
||||
win32 {
|
||||
CONFIG(debug, debug|release) {
|
||||
DDIR = $$OUT_PWD/debug/Translations
|
||||
@ -210,30 +203,36 @@ win32 {
|
||||
}
|
||||
|
||||
mac {
|
||||
TransFiles.files = ../Translations
|
||||
TransFiles.path = Contents/MacOS
|
||||
TransFiles.files = $$files(../Translations/*.qm)
|
||||
TransFiles.path = Contents/Resources/Translations
|
||||
QMAKE_BUNDLE_DATA += TransFiles
|
||||
|
||||
# Precopy some frameworks
|
||||
# LibFiles.files = $$OUT_PWD/../3rdparty/qextserialport/qextserialport.framework
|
||||
# LibFiles.path = Contents/Frameworks
|
||||
# QMAKE_BUNDLE_DATA += LibFiles
|
||||
|
||||
#CONFIG(release, debug|release) {
|
||||
# TmpFiles.files = $$files($$OUT_PWD/../3rdparty/quazip/quazip/libquazip.1.dylib) \
|
||||
# $$files($$OUT_PWD/../3rdparty/qextserialport/libqextserialport.1.dylib)
|
||||
#} else: CONFIG(debug, debug|release) {
|
||||
# TmpFiles.files = $$files($$OUT_PWD/../3rdparty/quazip/quazip/libquazip.1.dylib) \
|
||||
# $$files($$OUT_PWD/../3rdparty/qextserialport/libqextserialport_debug.1.dylib)
|
||||
#}
|
||||
# TmpFiles.path = Contents/Frameworks
|
||||
# QMAKE_BUNDLE_DATA += TmpFiles
|
||||
}
|
||||
|
||||
|
||||
INCLUDEPATH += src \
|
||||
../3rdparty \
|
||||
../3rdparty/quazip
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/release/ -lquazip
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/debug/ -lquazip
|
||||
else:unix: LIBS += -L$$OUT_PWD/../3rdparty/quazip/quazip/ -lquazip
|
||||
else:unix: LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/ -lquazip
|
||||
|
||||
DEPENDPATH += $$PWD/../3rdparty/quazip/quazip
|
||||
INCLUDEPATH += $$PWD/../3rdparty/quazip
|
||||
DEPENDPATH += $$PWD/../3rdparty/quazip
|
||||
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/release/ -lqextserialport
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/debug/ -lqextserialport
|
||||
else:unix: LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/ -lqextserialport
|
||||
|
||||
greaterThan(QT_MAJOR_VERSION,4) {
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/release/ -lQt5ExtSerialPortd
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/debug/ -lQt5ExtSerialPortd
|
||||
else:unix: LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/ -lQt5ExtSerialPortd
|
||||
} else {
|
||||
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/release/ -lqextserialportd
|
||||
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/debug/ -lqextserialportd
|
||||
else:unix: LIBS += -L$$OUT_PWD/../3rdparty/qextserialport/ -lqextserialportd
|
||||
}
|
||||
INCLUDEPATH += $$PWD/../3rdparty/qextserialport
|
||||
DEPENDPATH += $$PWD/../3rdparty/qextserialport
|
||||
|
Loading…
Reference in New Issue
Block a user