Commit 6565af00 authored by Bernhard Beschow's avatar Bernhard Beschow

use Qt Serial Port rather than QextSerialPort for simplicity of dependencies

Qt already comes with a serial port module which is most likely provided by distributions shipping Qt. For QextSerialPort, however, this doesn't seem to be the case, e.g. ArchLinux. Therefore, Qt's serial port module seems to be the better alternative.
parent a3258025
......@@ -33,7 +33,7 @@
#include <aprsconfig.h>
#ifdef HAVE_QEXTSERIALPORT
#ifdef HAVE_QTSERIALPORT
#include "AprsTTY.h"
#endif
......@@ -172,7 +172,7 @@ void AprsPlugin::stopGatherers()
if ( m_tcpipGatherer )
m_tcpipGatherer->shutDown();
#ifdef HAVE_QEXTSERIALPORT
#ifdef HAVE_QTSERIALPORT
if ( m_ttyGatherer )
m_ttyGatherer->shutDown();
#endif
......@@ -185,7 +185,7 @@ void AprsPlugin::stopGatherers()
if ( m_tcpipGatherer->wait(2000) )
delete m_tcpipGatherer;
#ifdef HAVE_QEXTSERIALPORT
#ifdef HAVE_QTSERIALPORT
if ( m_ttyGatherer )
if ( m_ttyGatherer->wait(2000) )
delete m_ttyGatherer;
......@@ -215,7 +215,7 @@ void AprsPlugin::restartGatherers()
mDebug() << "started TCPIP gatherer";
}
#ifdef HAVE_QEXTSERIALPORT
#ifdef HAVE_QTSERIALPORT
if ( m_useTty ) {
m_ttyGatherer =
new AprsGatherer( new AprsTTY( m_tncTty ),
......@@ -278,7 +278,7 @@ void AprsPlugin::readSettings()
return;
}
#ifndef HAVE_QEXTSERIALPORT
#ifndef HAVE_QTSERIALPORT
ui_configWidget->tabWidget->setTabEnabled( ui_configWidget->tabWidget->indexOf(
ui_configWidget->Device ), false );
#endif
......
......@@ -10,7 +10,7 @@
#include "AprsTTY.h"
#include <qextserialport.h>
#include <QSerialPort>
#include "MarbleDebug.h"
......@@ -18,7 +18,7 @@
using namespace Marble;
AprsTTY::AprsTTY( QString ttyName )
AprsTTY::AprsTTY( const QString &ttyName )
: m_ttyName( ttyName ),
m_numErrors( 0 )
{
......@@ -43,14 +43,13 @@ AprsTTY::canDoDirect() const
QIODevice *
AprsTTY::openSocket()
{
QextSerialPort *m_port =
new QextSerialPort( m_ttyName, QextSerialPort::Polling );
m_port->setBaudRate( BAUD9600 );
m_port->setParity( PAR_NONE );
m_port->setDataBits( DATA_8 );
m_port->setStopBits( STOP_1 );
m_port->setTimeout( 60000 ); // ms
m_port->open( QIODevice::ReadWrite );
QSerialPort *m_port = new QSerialPort( m_ttyName );
m_port->setBaudRate( QSerialPort::Baud9600, QSerialPort::Input );
m_port->setParity( QSerialPort::NoParity );
m_port->setDataBits( QSerialPort::Data8 );
m_port->setStopBits( QSerialPort::OneStop );
// m_port->setTimeout( 60000 ); // ms
m_port->open( QIODevice::ReadOnly );
mDebug() << "opened TTY socket";
if ( m_port->isOpen() ) {
mDebug() << "connected to " << m_ttyName.toLocal8Bit().data();
......
......@@ -18,7 +18,7 @@ namespace Marble {
class AprsTTY : public AprsSource
{
public:
explicit AprsTTY( QString ttyName );
explicit AprsTTY( const QString &ttyName );
~AprsTTY();
QString sourceName() const;
......
PROJECT(AprsPlugin)
macro_optional_find_package(QextSerialPort)
marble_set_package_properties( QextSerialPort PROPERTIES DESCRIPTION "access to serial ports" )
marble_set_package_properties( QextSerialPort PROPERTIES URL "http://code.google.com/p/qextserialport/" )
marble_set_package_properties( QextSerialPort PROPERTIES TYPE OPTIONAL PURPOSE "Reading from serial port in APRS plugin" )
macro_optional_find_package(Qt5SerialPort)
marble_set_package_properties( Qt5SerialPort PROPERTIES DESCRIPTION "Provides access to hardware and virtual serial ports." )
marble_set_package_properties( Qt5SerialPort PROPERTIES TYPE OPTIONAL PURPOSE "Reading from serial port in APRS plugin" )
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
if (QEXTSERIALPORT_FOUND)
include_directories (${QEXTSERIALPORT_INCLUDE_DIR})
if (Qt5SerialPort_FOUND)
include_directories (${Qt5SerialPort_INCLUDE_DIR})
set (serial_src AprsTTY.cpp)
list (APPEND AprsPlugin_LIBS ${QEXTSERIALPORT_LIBRARIES})
set (HAVE_QEXTSERIALPORT TRUE)
list (APPEND AprsPlugin_LIBS ${Qt5SerialPort_LIBRARIES})
set (HAVE_QTSERIALPORT TRUE)
endif ()
set( aprs_SRCS AprsPlugin.cpp
......
/* Defined when QextSerialPort is available */
#cmakedefine HAVE_QEXTSERIALPORT 1
#cmakedefine HAVE_QTSERIALPORT 1
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