Skip to content
Permalink
Browse files
qextserialport update (improved device detection on Windows & OSX)
git-svn-id: http://svn.osgeo.org/qgis/trunk@12732 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 11, 2010
1 parent 2d2ffda commit 6ec0217c451ec357072362146aaad287653567ba
Showing with 23,954 additions and 2,972 deletions.
  1. +1 −1 scripts/prepare-commit.sh
  2. +3 −88 src/app/gps/qgsgpsinformationwidget.cpp
  3. +22 −8 src/core/CMakeLists.txt
  4. +0 −1,179 src/core/gps/posix_qextserialport.cpp
  5. +0 −57 src/core/gps/posix_qextserialport.h
  6. +0 −255 src/core/gps/qextserialbase.cpp
  7. +0 −204 src/core/gps/qextserialbase.h
  8. +0 −98 src/core/gps/qextserialport.cpp
  9. +0 −25 src/core/gps/qextserialport.h
  10. +245 −0 src/core/gps/qextserialport/ChangeLog
  11. +1,514 −0 src/core/gps/qextserialport/Doxyfile
  12. +12 −0 src/core/gps/qextserialport/doc/mainpage.dox
  13. +10 −0 src/core/gps/qextserialport/doc/qextbasetype.dox
  14. +216 −0 src/core/gps/qextserialport/doc/qiodevice.tag
  15. +26 −0 src/core/gps/qextserialport/examples/enumerator/enumerator.pro
  16. +21 −0 src/core/gps/qextserialport/examples/enumerator/main.cpp
  17. +99 −0 src/core/gps/qextserialport/examples/event/PortListener.cpp
  18. +58 −0 src/core/gps/qextserialport/examples/event/PortListener.h
  19. +29 −0 src/core/gps/qextserialport/examples/event/event.pro
  20. +81 −0 src/core/gps/qextserialport/examples/event/main.cpp
  21. +95 −0 src/core/gps/qextserialport/examples/qespta/MainWindow.cpp
  22. +64 −0 src/core/gps/qextserialport/examples/qespta/MainWindow.h
  23. +237 −0 src/core/gps/qextserialport/examples/qespta/Makefile
  24. +170 −0 src/core/gps/qextserialport/examples/qespta/Makefile.Debug
  25. +170 −0 src/core/gps/qextserialport/examples/qespta/Makefile.Release
  26. +136 −0 src/core/gps/qextserialport/examples/qespta/MessageWindow.cpp
  27. +83 −0 src/core/gps/qextserialport/examples/qespta/MessageWindow.h
  28. +32 −0 src/core/gps/qextserialport/examples/qespta/QESPTA.pro
  29. +129 −0 src/core/gps/qextserialport/examples/qespta/QespTest.cpp
  30. +36 −0 src/core/gps/qextserialport/examples/qespta/QespTest.h
  31. +4 −0 src/core/gps/qextserialport/examples/qespta/README
  32. +16 −0 src/core/gps/qextserialport/examples/qespta/defs.h
  33. +29 −0 src/core/gps/qextserialport/examples/qespta/main.cpp
  34. +37 −0 src/core/gps/qextserialport/html/annotated.html
  35. +118 −0 src/core/gps/qextserialport/html/classPosix__QextSerialPort-members.html
  36. +2,370 −0 src/core/gps/qextserialport/html/classPosix__QextSerialPort.html
  37. BIN src/core/gps/qextserialport/html/classPosix__QextSerialPort.png
  38. +201 −0 src/core/gps/qextserialport/html/classQextBaseType-members.html
  39. +3,755 −0 src/core/gps/qextserialport/html/classQextBaseType.html
  40. BIN src/core/gps/qextserialport/html/classQextBaseType.png
  41. +106 −0 src/core/gps/qextserialport/html/classQextSerialBase-members.html
  42. +1,279 −0 src/core/gps/qextserialport/html/classQextSerialBase.html
  43. BIN src/core/gps/qextserialport/html/classQextSerialBase.png
  44. +207 −0 src/core/gps/qextserialport/html/classQextSerialPort-members.html
  45. +3,944 −0 src/core/gps/qextserialport/html/classQextSerialPort.html
  46. BIN src/core/gps/qextserialport/html/classQextSerialPort.png
  47. +128 −0 src/core/gps/qextserialport/html/classWin__QextSerialPort-members.html
  48. +2,528 −0 src/core/gps/qextserialport/html/classWin__QextSerialPort.html
  49. BIN src/core/gps/qextserialport/html/classWin__QextSerialPort.png
  50. +32 −0 src/core/gps/qextserialport/html/classes.html
  51. +358 −0 src/core/gps/qextserialport/html/doxygen.css
  52. BIN src/core/gps/qextserialport/html/doxygen.png
  53. +36 −0 src/core/gps/qextserialport/html/files.html
  54. BIN src/core/gps/qextserialport/html/ftv2blank.png
  55. BIN src/core/gps/qextserialport/html/ftv2doc.png
  56. BIN src/core/gps/qextserialport/html/ftv2folderclosed.png
  57. BIN src/core/gps/qextserialport/html/ftv2folderopen.png
  58. BIN src/core/gps/qextserialport/html/ftv2lastnode.png
  59. BIN src/core/gps/qextserialport/html/ftv2link.png
  60. BIN src/core/gps/qextserialport/html/ftv2mlastnode.png
  61. BIN src/core/gps/qextserialport/html/ftv2mnode.png
  62. BIN src/core/gps/qextserialport/html/ftv2node.png
  63. BIN src/core/gps/qextserialport/html/ftv2plastnode.png
  64. BIN src/core/gps/qextserialport/html/ftv2pnode.png
  65. BIN src/core/gps/qextserialport/html/ftv2vertline.png
  66. +193 −0 src/core/gps/qextserialport/html/functions.html
  67. +153 −0 src/core/gps/qextserialport/html/functions_func.html
  68. +116 −0 src/core/gps/qextserialport/html/functions_vars.html
  69. +121 −0 src/core/gps/qextserialport/html/globals.html
  70. +42 −0 src/core/gps/qextserialport/html/globals_enum.html
  71. +111 −0 src/core/gps/qextserialport/html/globals_eval.html
  72. +49 −0 src/core/gps/qextserialport/html/hierarchy.html
  73. +8 −0 src/core/gps/qextserialport/html/index.html
  74. +117 −0 src/core/gps/qextserialport/html/installdox
  75. +24 −0 src/core/gps/qextserialport/html/main.html
  76. +27 −0 src/core/gps/qextserialport/html/mainpage_8dox.html
  77. +27 −0 src/core/gps/qextserialport/html/posix__qextserialport_8cpp.html
  78. +30 −0 src/core/gps/qextserialport/html/posix__qextserialport_8h.html
  79. +30 −0 src/core/gps/qextserialport/html/qextbasetype_8dox.html
  80. +27 −0 src/core/gps/qextserialport/html/qextserialbase_8cpp.html
  81. +373 −0 src/core/gps/qextserialport/html/qextserialbase_8h.html
  82. +27 −0 src/core/gps/qextserialport/html/qextserialport_8cpp.html
  83. +30 −0 src/core/gps/qextserialport/html/qextserialport_8h.html
  84. +34 −0 src/core/gps/qextserialport/html/structPortSettings-members.html
  85. +157 −0 src/core/gps/qextserialport/html/structPortSettings.html
  86. BIN src/core/gps/qextserialport/html/tab_b.gif
  87. BIN src/core/gps/qextserialport/html/tab_l.gif
  88. BIN src/core/gps/qextserialport/html/tab_r.gif
  89. +102 −0 src/core/gps/qextserialport/html/tabs.css
  90. +126 −0 src/core/gps/qextserialport/html/tree.html
  91. +27 −0 src/core/gps/qextserialport/html/win__qextserialport_8cpp.html
  92. +32 −0 src/core/gps/qextserialport/html/win__qextserialport_8h.html
  93. +958 −0 src/core/gps/qextserialport/posix_qextserialport.cpp
  94. +530 −0 src/core/gps/qextserialport/qextserialenumerator.cpp
  95. +197 −0 src/core/gps/qextserialport/qextserialenumerator.h
  96. +253 −0 src/core/gps/qextserialport/qextserialport.cpp
  97. +366 −0 src/core/gps/qextserialport/qextserialport.h
  98. +39 −0 src/core/gps/qextserialport/qextserialport.pro
  99. +872 −0 src/core/gps/qextserialport/win_qextserialport.cpp
  100. +109 −43 src/core/gps/qgsgpsconnection.cpp
  101. +5 −1 src/core/gps/qgsgpsconnection.h
  102. +4 −1 src/core/gps/qgsnmeaconnection.cpp
  103. +1 −0 src/core/gps/qgsnmeaconnection.h
  104. +0 −963 src/core/gps/win_qextserialport.cpp
  105. +0 −49 src/core/gps/win_qextserialport.h
@@ -34,7 +34,7 @@ ASTYLEDIFF=astyle.r$REV.diff
# reformat
for f in $MODIFIED; do
case "$f" in
src/core/spatialite/*)
src/core/spatialite/*|src/core/gps/qextserialport/*)
echo $f skipped
continue
;;
@@ -17,7 +17,6 @@
/* $Id: qgisapp.h 12390 2009-12-09 21:35:43Z jef $ */
#include "qgsgpsinformationwidget.h"
#include "qgsvectorlayer.h"
#include "qextserialport.h"
#include "qgsnmeaconnection.h"
#include "qgsgpstrackerthread.h"
#include "qgscoordinatetransform.h"
@@ -308,13 +307,7 @@ void QgsGPSInformationWidget::connectGps()
{
if ( !mCboDevices->currentText().isEmpty() )
{
mSerialPort = new QextSerialPort( mCboDevices->currentText() );
mSerialPort->setBaudRate( BAUD4800 );
mSerialPort->setFlowControl( FLOW_OFF );
mSerialPort->setParity( PAR_NONE );
mSerialPort->setDataBits( DATA_8 );
mSerialPort->setStopBits( STOP_2 );
mNmea = new QgsNMEAConnection( mSerialPort, 500 );
mNmea = new QgsNMEAConnection( mCboDevices->currentText(), 500 );
QObject::connect( mNmea, SIGNAL( stateChanged( const QgsGPSInformation& ) ),
this, SLOT( displayGPSInformation( const QgsGPSInformation& ) ) );
mThread = new QgsGPSTrackerThread( mNmea );
@@ -329,7 +322,7 @@ void QgsGPSInformationWidget::connectGps()
mConnectButton->setChecked( false );
}
}
else //autdetect
else //autodetect
{
mNmea = QgsGPSConnection::detectGPSConnection();
if ( !mNmea )
@@ -861,86 +854,8 @@ void QgsGPSInformationWidget::on_mBtnRefreshDevices_clicked( )
/* Copied from gps plugin */
void QgsGPSInformationWidget::populateDevices()
{

mCboDevices->clear();
#ifdef linux
// look for linux serial devices
QString linuxDev( "/dev/ttyS%1" );
for ( int i = 0; i < 10; ++i )
{
if ( QFileInfo( linuxDev.arg( i ) ).exists() )
{
mCboDevices->addItem( linuxDev.arg( i ) );
}
else
break;
}

// and the ttyUSB* devices (serial USB adaptor)
linuxDev = "/dev/ttyUSB%1";
for ( int i = 0; i < 10; ++i )
{
if ( QFileInfo( linuxDev.arg( i ) ).exists() )
{
mCboDevices->addItem( linuxDev.arg( i ) );
}
else
break;
}

mCboDevices->addItem( "usb:" );
#endif

#ifdef __FreeBSD__ // freebsd
// and freebsd devices (untested)
QString freebsdDev( "/dev/cuaa%1" );
for ( int i = 0; i < 10; ++i )
{
if ( QFileInfo( freebsdDev.arg( i ) ).exists() )
{
mCboDevices->addItem( freebsdDev.arg( i ) );
}
else
break;
}

// and the ucom devices (serial USB adaptors)
freebsdDev = "/dev/ucom%1";
for ( int i = 0; i < 10; ++i )
{
if ( QFileInfo( freebsdDev.arg( i ) ).exists() )
{
mCboDevices->addItem( freebsdDev.arg( i ) );
}
else
break;
}

#endif

#ifdef sparc
// and solaris devices (also untested)
QString solarisDev( "/dev/cua/%1" );
for ( int i = 'a'; i < 'k'; ++i )
{
if ( QFileInfo( solarisDev.arg( char( i ) ) ).exists() )
{
mCboDevices->addItem( solarisDev.arg( char( i ) ) );
}
else
break;
}
#endif

#ifdef WIN32
mCboDevices->addItem( "com1" );
mCboDevices->addItem( "com2" );
mCboDevices->addItem( "com3" );
mCboDevices->addItem( "com4" );
mCboDevices->addItem( "usb:" );
#endif

// OSX, OpenBSD, NetBSD etc? Anyone?
mCboDevices->addItems( QgsGPSConnection::availablePorts() );

// remember the last ports used
QSettings settings;
@@ -5,8 +5,9 @@

SET(QGIS_CORE_SRCS

gps/qextserialport.cpp
gps/qextserialbase.cpp
gps/qextserialport/qextserialport.cpp
gps/qextserialport/qextserialenumerator.cpp

gps/qgsgpsconnection.cpp
gps/qgsgpsconnectionregistry.cpp
gps/qgsgpstrackerthread.cpp
@@ -144,15 +145,25 @@ SET(QGIS_CORE_SRCS
spatialindex/qgsspatialindex.cpp

)

IF(WIN32)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
gps/win_qextserialport.cpp)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
gps/qextserialport/win_qextserialport.cpp
)
ADD_DEFINITIONS(-D_TTY_WIN_)
TARGET_LINK_LIBRARIES(qgis_core setupapi)
ELSE(WIN32)
SET(QGIS_CORE_SRCS
${QGIS_CORE_SRCS}
gps/posix_qextserialport.cpp)
${QGIS_CORE_SRCS}
gps/qextserialport/posix_qextserialport.cpp
)
ADD_DEFINITIONS(-D_TTY_POSIX_)

IF(APPLE)
FIND_LIBRARY(IOKIT_LIBRARY IOKit)
TARGET_LINK_LIBRARIES(qgis_core ${IOKIT_LIBRARY))
ENDIF(APPLE)
ENDIF(WIN32)
IF (WITH_INTERNAL_SPATIALITE)
@@ -233,6 +244,8 @@ composer/qgscomposition.h
composer/qgslegendmodel.h
gps/qgsgpsconnection.h
gps/qgsnmeaconnection.h
gps/qextserialport/qextserialenumerator.h
gps/qextserialport/qextserialport.h
symbology/qgsmarkercatalogue.h
raster/qgsrasterlayer.h
)
@@ -248,6 +261,7 @@ INCLUDE_DIRECTORIES(
symbology
spatialindex/include
symbology-ng
gps/qextserialport
${PROJ_INCLUDE_DIR}
${GEOS_INCLUDE_DIR}
${GDAL_INCLUDE_DIR}

0 comments on commit 6ec0217

Please sign in to comment.