Commit d7e07781 authored by James Goppert's avatar James Goppert

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.
parent e6d7778d
[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
......@@ -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)
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)
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})
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
#----------------------------------------------------------------------------
......
......@@ -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 {
......@@ -43,8 +42,8 @@ class SerialLinkInterface : public LinkInterface {
public:
virtual QString getPortName() = 0;
virtual int getBaudRate() = 0;
virtual int getDataBits() = 0;
virtual int getStopBits() = 0;
virtual int getDataBits() = 0;
virtual int getStopBits() = 0;
virtual int getBaudRateType() = 0;
virtual int getFlowType() = 0;
......@@ -60,8 +59,8 @@ public slots:
virtual bool setParityType(int parity) = 0;
virtual bool setDataBitsType(int dataBits) = 0;
virtual bool setStopBitsType(int stopBits) = 0;
virtual void loadSettings() = 0;
virtual void writeSettings() = 0;
virtual void loadSettings() = 0;
virtual void writeSettings() = 0;
};
......
......@@ -99,7 +99,7 @@ void SerialSimulationLink::run()
}
}
void SerialSimulationLink::enableLoopBackMode(SerialLink* loop)
void SerialSimulationLink::enableLoopBackMode(SerialLinkInterface* loop)
{
// Lock the data
readyBufferMutex.lock();
......
......@@ -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:
qint64 getBitsSent();
qint64 getBitsReceived();
void enableLoopBackMode(SerialLink* loop);
void enableLoopBackMode(SerialLinkInterface * loop);
QString getPortName();
int getBaudRate();
int getBaudRateType();
......@@ -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 **/
......
qserial @ 004e3de5
Subproject commit 004e3de552fe25fee593dfcb03e2ffa82cb0b152
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment