Browse Source

Added qserial library.

qextserial library is no longer maintained, suggest we move
to this library, also greater chance for thread safety,
library now builds in cmake, will add Serial2 sources to
handle the new qserial, should easily plug into serial interface
now.
QGC4.4
James Goppert 14 years ago
parent
commit
d7e0778108
  1. 3
      .gitmodules
  2. 74
      CMakeLists.txt
  3. 1
      src/comm/SerialLinkInterface.h
  4. 2
      src/comm/SerialSimulationLink.cc
  5. 5
      src/comm/SerialSimulationLink.h
  6. 1
      thirdParty/qserial

3
.gitmodules vendored

@ -1,3 +1,6 @@ @@ -1,3 +1,6 @@
[submodule "thirdParty/mavlink"]
path = thirdParty/mavlink
url = https://github.com/pixhawk/mavlink.git
[submodule "thirdParty/qserial"]
path = thirdParty/qserial
url = git://gitorious.org/inbiza-labs/qserialport.git

74
CMakeLists.txt

@ -132,6 +132,7 @@ else() @@ -132,6 +132,7 @@ else()
endif()
find_or_build_from_source(MAVLINK thirdParty/mavlink FOUND_GIT_REPO)
find_or_build_from_source(QSERIAL thirdParty/qserial FOUND_GIT_REPO)
# build libraries from source if not found on system
if(MAVLINK_BUILD_FROM_SOURCE)
@ -148,6 +149,16 @@ if(MAVLINK_BUILD_FROM_SOURCE) @@ -148,6 +149,16 @@ if(MAVLINK_BUILD_FROM_SOURCE)
COMMAND touch MAVLINK_BUILD.stamp)
endif()
if(QSERIAL_BUILD_FROM_SOURCE)
set(QSERIAL_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/thirdParty/qserial/include
${PROJECT_SOURCE_DIR}/thirdParty/qserial/include/QtSerialPort
${PROJECT_SOURCE_DIR}/thirdParty/qserial/src
)
add_custom_command(OUTPUT QSERIAL_BUILD.stamp
COMMAND touch QSERIAL_BUILD.stamp)
endif()
# data directory
if(IN_SRC_BUILD)
message(STATUS "configuring for in source build")
@ -202,6 +213,11 @@ if (MAVLINK_FOUND) @@ -202,6 +213,11 @@ if (MAVLINK_FOUND)
list(APPEND qgroundcontrolIncludes ${MAVLINK_INCLUDE_DIRS})
endif()
message(STATUS "\t\tQSERIAL\t\t${QSERIAL_FOUND}")
if (QSERIAL_FOUND)
list(APPEND qgroundcontrolIncludes ${QSERIAL_INCLUDE_DIRS})
endif()
message(STATUS "\t\tOpenSceneGraph\t${OPENSCENEGRAPH_FOUND}")
if (OPENSCENEGRAPH_FOUND)
list(APPEND qgroundcontrolIncludes ${OPENSCENEGRAPH_INCLUDE_DIRS})
@ -766,6 +782,64 @@ qt4_wrap_cpp(qextserialportMoc ${qextserialportMocSrc}) @@ -766,6 +782,64 @@ qt4_wrap_cpp(qextserialportMoc ${qextserialportMocSrc})
add_library(qextserialport ${qextserialportMoc} ${qextserialportSrc})
target_link_libraries(qextserialport ${QT_LIBRARIES})
# qserial library
#----------------------------------------------------------------------------
# qserial headers without Q_OBJECT
# r !grep -RL Q_OBJECT thirdParty/qserial/include
set (qserialHdrs
thirdParty/qserial/include/QtSerialPort/qserialport_export.h
thirdParty/qserial/include/QtSerialPort/QSerialPort
thirdParty/qserial/include/QtSerialPort/qportsettings.h
)
# qserial headers with Q_OBJECT
# r !grep -Rl Q_OBJECT thirdParty/qserial
set (qserialMocSrc
thirdParty/qserial/include/QtSerialPort/qserialport.h
thirdParty/qserial/include/QtSerialPort/qserialportnative.h
)
# qserial src
set (qserialSrc
thirdParty/qserial/src/common/qserialport.cpp
thirdParty/qserial/src/common/qportsettings.cpp
)
# qserial resources
set(qserialRscSrc
thirdParty/qserial/src/QtSerialPortd_resource.rc
thirdParty/qserial/src/QtSerialPort_resource.rc
)
# qserial native code
if (WIN32)
list(APPEND qSerialMocSrc
thirdParty/qserial/src/win32/qwincommevtnotifier.h
thirdParty/qserial/src/win32/wincommevtbreaker.h
)
list(APPEND qSerialSrc
thirdParty/qserial/src/win32/qserialportnative_win32.cpp
thirdParty/qserial/src/win32/commdcbhelper.h
thirdParty/qserial/src/win32/commdcbhelper.cpp
thirdParty/qserial/src/win32/qserialportnative_wince.cpp
thirdParty/qserial/src/win32/wincommevtbreaker.cpp
thirdParty/qserial/src/win32/qwincommevtnotifier.cpp
)
elseif(UNIX OR APPLE)
list(APPEND qSerialSrc
thirdParty/qserial/src/posix/termioshelper.h
thirdParty/qserial/src/posix/termioshelper.cpp
thirdParty/qserial/src/posix/qserialportnative_posix.cpp
)
else()
message(FATAL_ERROR "unknown OS")
endif()
# qserial linking
qt4_wrap_cpp(qserialMoc ${qserialMocSrc})
qt4_add_resources(qserialRsc ${qserialRscSrc})
add_library(qserial ${qserialMoc} ${qserialSrc})
target_link_libraries(qserial ${QT_LIBRARIES})
# qmapcontrol library
#----------------------------------------------------------------------------

1
src/comm/SerialLinkInterface.h

@ -34,7 +34,6 @@ This file is part of the QGROUNDCONTROL project @@ -34,7 +34,6 @@ This file is part of the QGROUNDCONTROL project
#include <QObject>
#include <QString>
#include <qextserialport.h>
#include <LinkInterface.h>
class SerialLinkInterface : public LinkInterface {

2
src/comm/SerialSimulationLink.cc

@ -99,7 +99,7 @@ void SerialSimulationLink::run() @@ -99,7 +99,7 @@ void SerialSimulationLink::run()
}
}
void SerialSimulationLink::enableLoopBackMode(SerialLink* loop)
void SerialSimulationLink::enableLoopBackMode(SerialLinkInterface* loop)
{
// Lock the data
readyBufferMutex.lock();

5
src/comm/SerialSimulationLink.h

@ -39,7 +39,6 @@ This file is part of the QGROUNDCONTROL project @@ -39,7 +39,6 @@ This file is part of the QGROUNDCONTROL project
#include <QTextStream>
#include <QMutex>
#include <SerialLinkInterface.h>
#include <SerialLink.h>
/**
* The serial simulation link class simulates a robot connected to the groundstation.
@ -72,7 +71,7 @@ public: @@ -72,7 +71,7 @@ public:
qint64 getBitsSent();
qint64 getBitsReceived();
void enableLoopBackMode(SerialLink* loop);
void enableLoopBackMode(SerialLinkInterface * loop);
QString getPortName();
int getBaudRate();
int getBaudRateType();
@ -104,7 +103,7 @@ public slots: @@ -104,7 +103,7 @@ public slots:
protected:
QTimer* timer;
SerialLink* loopBack;
SerialLinkInterface* loopBack;
/** File which contains the input data (simulated robot messages) **/
QFile* simulationFile;
/** File where the commands sent by the groundstation are stored **/

1
thirdParty/qserial vendored

@ -0,0 +1 @@ @@ -0,0 +1 @@
Subproject commit 004e3de552fe25fee593dfcb03e2ffa82cb0b152
Loading…
Cancel
Save