Changeset 99 in pacpussensors
- Timestamp:
- Oct 15, 2015, 2:47:01 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Alasca/CMakeLists.txt
r37 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(Alasca) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DALASCAXT_EXPORTS ) 11 ################################################################################ 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 2 15 16 find_package(Qt5Network REQUIRED) 3 17 ################################################################################ 4 add_definitions( -DALASCAXT_EXPORTS ) 5 6 7 8 # ======================================== 9 # Configure qt4 10 # ======================================== 11 if(QT4_FOUND) 12 set(QT_USE_QTXML true) 13 set(QT_USE_QTNETWORK true) 14 include(${QT_USE_FILE}) 15 else() 16 message(ERROR "Qt4 needed") 17 endif() 18 19 # ======================================== 20 # Compiler definitions 21 # ======================================== 22 add_definitions( 23 ${QT_DEFINITIONS} 24 ) 25 26 # ======================================== 27 # Include directories 28 # ======================================== 29 include_directories( 30 ${PROJECT_BINARY_DIR} 31 ${QT_INCLUDE_DIR} 18 # DIRECTORIES 19 include_directories( 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 32 24 ) 33 25 … … 35 27 # Link directories 36 28 # ======================================== 37 link_directories( ${PACPUS_LIB_DIR} 29 link_directories( 30 ${PACPUS_LIB_DIR} 38 31 ) 39 32 40 33 41 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 42 43 # ======================================== 44 # List of sources 45 # ======================================== 46 set( 47 PROJECT_SRCS 48 AlascaComponent.cpp 49 AlascaComponent.h 50 AlascaSocket.cpp 51 AlascaSocket.h 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 AlascaComponent.h 39 AlascaSocket.h 40 xml/${PROJECT_NAME}.xml 41 xml/${PROJECT_NAME}_d.xml 42 ) 43 set(PROJECT_SRCS 52 44 ${PLUGIN_CPP} 45 AlascaComponent.cpp 46 AlascaSocket.cpp 53 47 ) 54 48 55 # ======================================== 56 # Files to MOC 57 # ======================================== 58 set( 59 FILES_TO_MOC 60 AlascaComponent.h 49 set(FILES_TO_MOC 50 ${PLUGIN_HDR} 51 AlascaComponent.h 61 52 AlascaSocket.h 62 ${PLUGIN_H}63 53 ) 64 54 65 set( 66 UI_FILES 67 55 set(UI_FILES 68 56 ) 69 57 70 # ======================================== 71 # Call MOC 72 # ======================================== 73 qt4_wrap_cpp( 74 PROJECT_MOC_SRCS 58 ################################################################################ 59 # Qt: call moc, uic 60 qt_wrap_cpp(PROJECT_MOC_SRCS 75 61 ${FILES_TO_MOC} 76 62 ) 77 63 78 qt4_wrap_ui( 79 PROJECT_UI_SRCS 64 qt_wrap_ui(PROJECT_UI_SRCS 80 65 ${UI_FILES} 81 66 ) 82 67 83 # ======================================== 84 # Build a library 85 # ======================================== 86 pacpus_add_library( 87 ${PROJECT_NAME} SHARED 68 ################################################################################ 69 # BUILD and LINK 70 pacpus_add_library(${PROJECT_NAME} SHARED 71 ${PROJECT_HDRS} 88 72 ${PROJECT_SRCS} 89 73 ${PROJECT_MOC_SRCS} … … 91 75 ) 92 76 93 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )94 77 78 # ======================================== 79 # Libraries 80 # ======================================== 95 81 set(LIBS 96 82 optimized FileLib debug FileLib_d … … 103 89 ) 104 90 endif() 105 106 # ======================================== 107 # Libraries 108 # ======================================== 109 # All the platform 110 target_link_libraries( 111 ${PROJECT_NAME} 112 ${PACPUS_LIBRARIES} 113 ${QT_LIBRARIES} 114 ${PACPUS_DEPENDENCIES_LIB} 115 ${LIBS} 116 ) 117 91 # LINK 92 target_link_libraries(${PROJECT_NAME} 93 ${PACPUS_LIBRARIES} 94 ${PACPUS_DEPENDENCIES_LIB} 95 ${LIBS} 96 ${QT_LIBRARIES} 97 ) 98 qt5_use_modules(${PROJECT_NAME} Network) 99 ################################################################################ 100 # FOLDERS 118 101 pacpus_folder(${PROJECT_NAME} "components") 119 120 # ======================================== 121 # Install 122 # ======================================== 123 pacpus_install(${PROJECT_NAME}) 102 ################################################################################ 103 # INSTALL 104 pacpus_install(${PROJECT_NAME}) -
trunk/CMakeLists.txt
r94 r99 12 12 project(PacpusSensors) 13 13 cmake_minimum_required(VERSION 2.8) 14 if(UNIX) 15 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x -fpermissive") #c++11 16 endif() 14 17 15 18 # ======================================== … … 60 63 61 64 # ======================================== 62 # Find dependencies65 # Build the ProjectExercise' modules 63 66 # ======================================== 64 #find_package(Qt4 REQUIRED) 65 #if(QT4_FOUND) 66 # set(QT_USE_QTNETWORK TRUE) 67 # set(QT_USE_QTOPENGL TRUE) 68 # set(QT_USE_QTXML TRUE) 69 # include(${QT_USE_FILE}) 70 # add_definitions( ${QT_DEFINITIONS} ) 71 # add_definitions( -DQT_PLUGIN ) 72 #endif(QT4_FOUND) 67 # 68 # In the following list add the plugin you want to build. 69 # Paths are relative to the root of the project. 70 # 73 71 74 #include_directories( 75 # ${PACPUS_DEPENDENCIES_INC} 76 # ${PACPUS_INCLUDE_DIR} 77 # ${PACPUS_INCLUDE_HINT} 78 # ${PACPUS_INCLUDE_HINT}/Pacpus 79 # ./PACPUS/include 80 #) 81 82 83 # ======================================== 84 # Build the PacpusSensors' modules 85 # ======================================== 86 # add_subdirectory(Alasca) 87 add_subdirectory(CanGateway) 88 # add_subdirectory(PtGreyCameras) 89 # add_subdirectory(Dualshock) 90 # add_subdirectory(PacpusSocket) 91 # add_subdirectory(Sick) 92 # add_subdirectory(StereoVisionDisparity) 93 # add_subdirectory(SensorsApplication) 72 #add_subdirectory(Alasca) 73 add_subdirectory(CanGateway) #require kvaser libcan 74 add_subdirectory(PtGreyCameras) 75 #add_subdirectory(Dualshock) 76 add_subdirectory(NMEA0183) 77 add_subdirectory(Gps) #require NMEA0183 78 add_subdirectory(SpanCPTComponent) #require NMEA0183 79 #add_subdirectory(Sick) 80 add_subdirectory(PacpusSocket) 81 #add_subdirectory(OpencvVideo) 82 #add_subdirectory(Wifibot) #depends on PacpusSocket, change PacpusSocket to PacpusUdpSocket 83 #add_subdirectory(Ladybug) #require Ladybug spherical camera's driver, not compiled yet 94 84 add_subdirectory(StdDbtPlayerComponents) 95 # add_subdirectory(Wifibot) 96 # add_subdirectory(Gps) 97 # add_subdirectory(SpanCPTComponent) 98 # add_subdirectory(NMEA0183) 99 # add_subdirectory(OpencvVideo) 100 # add_subdirectory(Ladybug) 85 #add_subdirectory(TelnetClient) 86 #add_subdirectory(VelodyneComponent) 101 87 102 88 # ======================================== -
trunk/CanGateway/CMakeLists.txt
r94 r99 8 8 # Configure qt4 9 9 # ======================================== 10 if(QT4_FOUND)11 set(QT_USE_QTXML true)12 set(QT_USE_QTNETWORK true)13 include(${QT_USE_FILE})14 else()15 message(ERROR "Qt4 needed")16 endif()10 #if(QT4_FOUND) 11 # set(QT_USE_QTXML true) 12 # set(QT_USE_QTNETWORK true) 13 # include(${QT_USE_FILE}) 14 #else() 15 # message(ERROR "Qt4 needed") 16 #endif() 17 17 18 18 # ======================================== … … 49 49 PROJECT_SRCS 50 50 CanFrameBase.h 51 CanDecoderBase.cpp52 CanDecoderBase.h53 CanGateway.cpp54 CanGateway.h55 CanSubscription.cpp56 CanSubscription.h57 Win32CanInterface.cpp58 Win32CanInterface.h51 CanDecoderBase.cpp 52 CanDecoderBase.h 53 CanGateway.cpp 54 CanGateway.h 55 CanSubscription.cpp 56 CanSubscription.h 57 Win32CanInterface.cpp 58 Win32CanInterface.h 59 59 DbtRawCanReader.h 60 DbtRawCanReader.cpp60 DbtRawCanReader.cpp 61 61 structureCan.h 62 62 driver/KVaserCanDriver.cpp … … 71 71 driver/XLVectorCanDriver.cpp 72 72 driver/XLVectorCanDriver.h 73 74 73 driver/PeakCanDriverWin.h 74 driver/PeakCanDriverWin.cpp 75 75 ) 76 76 endif(WIN32) … … 90 90 set( 91 91 FILES_TO_MOC 92 92 CanGateway.h 93 93 DbtRawCanReader.h 94 94 ${PLUGIN_H} … … 129 129 # add your specific libraries to link here 130 130 131 optimized vcandm32.libdebug vcandm32.lib132 optimized vxlapi.lib debug vxlapi.lib133 134 optimized canlib32.libdebug canlib32.lib131 optimized vcandm32.lib debug vcandm32.lib 132 optimized vxlapi.lib debug vxlapi.lib 133 optimized PCANBasic.lib debug PCANBasic.lib 134 optimized canlib32.lib debug canlib32.lib 135 135 ) 136 136 endif(WIN32) … … 149 149 ${PACPUS_LIBRARIES} 150 150 ${QT_LIBRARIES} 151 152 153 #optimized PacpusTools debug PacpusTools_d151 ${PACPUS_DEPENDENCIES_LIB} 152 ${LIBS} 153 #optimized PacpusTools debug PacpusTools_d 154 154 ) 155 155 pacpus_folder(${PROJECT_NAME} "components") … … 166 166 DESTINATION 167 167 ${PACPUS_INSTALL_DIR}/include 168 FILES_MATCHING PATTERN "*.h" 168 169 ) 169 170 # if WIN32 install driver dependencies -
trunk/Dualshock/CMakeLists.txt
r21 r99 1 project(Dualshock) 1 #########################quick start################################## 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 2 6 ################################################################################ 7 project(TestDualShock) 3 8 add_definitions( -DDUALSHOCKXT_EXPORTS ) 4 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 9 set(${PROJECT_NAME}_VERSION_MAJOR 0) 10 set(${PROJECT_NAME}_VERSION_MINOR 1) 11 ################################################################################ 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 ################################################################################ 15 # DIRECTORIES 26 16 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 17 ${PROJECT_BINARY_DIR} 18 ${QT_INCLUDE_DIR} 19 ${PACPUS_INCLUDE_DIR} 20 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 21 ) 30 22 … … 32 24 # Link directories 33 25 # ======================================== 34 link_directories( ${PACPUS_LIB_DIR} 26 link_directories( 27 ${PACPUS_LIB_DIR} 35 28 ) 36 29 37 message (STATUS ${PACPUS_LIB_DIR})38 30 39 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 40 41 # ======================================== 42 # List of sources 43 # ======================================== 44 set( 45 PROJECT_SRCS 46 controller.cpp 47 dualshock.cpp 31 ################################################################################ 32 # FILES 33 set(PROJECT_HDRS 34 ${EXPORT_HDR} 35 dualshock.h 36 controller.h 37 xml/${PROJECT_NAME}.xml 38 xml/${PROJECT_NAME}_d.xml 39 ) 40 set(PROJECT_SRCS 48 41 ${PLUGIN_CPP} 42 dualshock.cpp 43 controller.cpp 49 44 ) 50 45 51 # ======================================== 52 # Files to MOC 53 # ======================================== 54 set( 55 FILES_TO_MOC 56 controller.h 57 dualshock.h 58 ${PLUGIN_H} 46 set(FILES_TO_MOC 47 ${PLUGIN_HDR} 48 controller.h 59 49 ) 60 50 61 set( 62 UI_FILES 63 51 set(UI_FILES 64 52 ) 65 53 66 # ======================================== 67 # Call MOC 68 # ======================================== 69 qt4_wrap_cpp( 70 PROJECT_MOC_SRCS 54 ################################################################################ 55 # Qt: call moc, uic 56 qt_wrap_cpp(PROJECT_MOC_SRCS 71 57 ${FILES_TO_MOC} 72 58 ) 73 59 74 qt4_wrap_ui( 75 PROJECT_UI_SRCS 60 qt_wrap_ui(PROJECT_UI_SRCS 76 61 ${UI_FILES} 77 62 ) 78 63 79 # ======================================== 80 # Build a library 81 # ======================================== 82 pacpus_add_library( 83 ${PROJECT_NAME} SHARED 64 ################################################################################ 65 # BUILD and LINK 66 pacpus_add_library(${PROJECT_NAME} SHARED 67 ${PROJECT_HDRS} 84 68 ${PROJECT_SRCS} 85 69 ${PROJECT_MOC_SRCS} … … 87 71 ) 88 72 89 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )90 73 91 74 # ======================================== 92 75 # Libraries 93 76 # ======================================== 94 # All the platform 95 target_link_libraries( 96 ${PROJECT_NAME} 97 ${PACPUS_LIBRARIES} 98 ${QT_LIBRARIES} 99 ${PACPUS_DEPENDENCIES_LIB} 100 PacpusTools 77 set(LIBS 78 optimized FileLib debug FileLib_d 79 optimized PacpusLib debug PacpusLib_d 80 optimized PacpusTools debug PacpusTools_d 101 81 ) 82 if (WIN32) 83 list(APPEND LIBS 84 optimized ROAD_TIME debug ROAD_TIME_d 85 ) 86 endif() 102 87 103 # ======================================== 104 # Install 105 # ======================================== 106 pacpus_install(${PROJECT_NAME}) 88 # LINK 89 target_link_libraries(${PROJECT_NAME} 90 ${PACPUS_LIBRARIES} 91 ${PACPUS_DEPENDENCIES_LIB} 92 ${LIBS}) 107 93 94 ################################################################################ 95 # FOLDERS 96 pacpus_folder(${PROJECT_NAME} "components") 97 98 ################################################################################ 99 # INSTALL 100 pacpus_install(${PROJECT_NAME}) -
trunk/Dualshock/controller.h
r22 r99 24 24 # include <QThread> 25 25 26 # include "kernel/ComponentBase.h"27 # include "kernel/DbiteFile.h"28 # include "kernel/DbiteFileTypes.h"29 # include "PacpusTools/ShMem.h"26 # include <kernel/ComponentBase.h> 27 # include <kernel/DbiteFile.h> 28 # include <kernel/DbiteFileTypes.h> 29 # include <PacpusTools/ShMem.h> 30 30 31 31 # define L2CAP_PSM_HIDP_CTRL 0x11 -
trunk/Dualshock/dualshock.h
r22 r99 15 15 # define DUALSHOCK_H 16 16 17 # include "kernel/ComponentBase.h"18 # include "kernel/DbiteFile.h"17 # include <kernel/ComponentBase.h> 18 # include <kernel/DbiteFile.h> 19 19 # include "controller.h" 20 20 -
trunk/Gps/CMakeLists.txt
r59 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(Gps) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DGPS_EXPORTS ) 2 11 ################################################################################ 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 3 15 4 add_definitions( -DGPS_EXPORTS ) 5 6 # ======================================== 7 # Configure qt4 8 # ======================================== 9 if(QT4_FOUND) 10 set(QT_USE_QTXML true) 11 set(QT_USE_QTNETWORK true) 12 include(${QT_USE_FILE}) 13 else() 14 message(ERROR "Qt4 needed") 15 endif() 16 17 # ======================================== 18 # Compiler definitions 19 # ======================================== 20 add_definitions( 21 ${QT_DEFINITIONS} 22 ) 23 24 # ======================================== 25 # Include directories 26 # ======================================== 27 include_directories( 28 ${PROJECT_BINARY_DIR} 29 ${QT_INCLUDE_DIR} 16 find_package(Qt5Network REQUIRED) 17 find_package(Qt5Widgets REQUIRED) 18 ################################################################################ 19 # DIRECTORIES 20 include_directories( 21 ${PROJECT_BINARY_DIR} 22 ${QT_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR} 24 ${PACPUS_INCLUDE_DIR}/Pacpus/ 30 25 ) 31 26 … … 38 33 39 34 40 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 41 42 # ======================================== 43 # List of sources 44 # ======================================== 45 set( 46 PROJECT_SRCS 47 gpsComponent.cpp 48 gpsComponent.h 49 GpsFrames.h 50 # SeptentrioSocket.h 51 # SeptentrioSocket.cpp 52 # SeptentrioComponent.h 53 # SeptentrioComponent.cpp 54 #UbloxComponent.h 55 #UbloxComponent.cpp 56 #polarxGPSTKsolver.cpp 57 # ui/polarxmainwindow.hpp 58 # ui/polarxmainwindow.cpp 35 ################################################################################ 36 # FILES 37 set(PROJECT_HDRS 38 ${EXPORT_HDR} 39 gpsComponent.h 40 GpsFrames.h 41 SeptentrioSocket.h 42 SbfFrames.h 43 structure_gps.h 44 xml/gps_nmea.xml 45 ) 46 set(PROJECT_SRCS 59 47 ${PLUGIN_CPP} 48 gpsComponent.cpp 49 SeptentrioSocket.cpp 50 ui/polarxmainwindow.cpp 60 51 ) 61 52 … … 76 67 endif(UNIX) 77 68 78 79 # ========================================80 # Files to MOC81 # ========================================82 83 69 if(UNIX) 84 70 set(FILES_TO_MOC 85 71 # add here the header files that you want to MOC 86 72 gpsComponent.h 87 SeptentrioComponent.h 73 GpsFrames.h 74 #SeptentrioComponent.h 88 75 SeptentrioSocket.h 89 76 ../driver/PosixSerialPort.h 90 77 ui/polarxmainwindow.hpp 91 ${PLUGIN_H}78 ${PLUGIN_HDR} 92 79 ) 93 80 endif(UNIX) … … 97 84 # add here the header files that you want to MOC 98 85 gpsComponent.h 99 #SeptentrioComponent.h100 #SeptentrioSocket.h86 # SeptentrioComponent.h 87 # SeptentrioSocket.h 101 88 ../driver/Win32SerialPort.h 102 # ui/polarxmainwindow.hpp103 ${PLUGIN_H }89 # ui/polarxmainwindow.hpp 90 ${PLUGIN_HDR} 104 91 ) 105 92 endif(WIN32) 106 93 107 set( 108 UI_FILES 94 set(UI_FILES 109 95 ) 110 96 111 # ======================================== 112 # Call MOC 113 # ======================================== 114 qt4_wrap_cpp( 115 PROJECT_MOC_SRCS 97 ################################################################################ 98 # Qt: call moc, uic 99 qt_wrap_cpp(PROJECT_MOC_SRCS 116 100 ${FILES_TO_MOC} 117 101 ) 118 102 119 qt4_wrap_ui( 120 PROJECT_UI_SRCS 103 qt_wrap_ui(PROJECT_UI_SRCS 121 104 ${UI_FILES} 122 105 ) 123 106 124 # ======================================== 125 # Build a library 126 # ======================================== 127 pacpus_add_library( 128 ${PROJECT_NAME} SHARED 107 ################################################################################ 108 # BUILD and LINK 109 pacpus_add_library(${PROJECT_NAME} SHARED 110 ${PROJECT_HDRS} 129 111 ${PROJECT_SRCS} 130 112 ${PROJECT_MOC_SRCS} … … 132 114 ) 133 115 116 134 117 # ======================================== 135 118 # Libraries 136 119 # ======================================== 137 if(WIN32) 138 set(LIBS 139 # add your specific libraries to link here 140 optimized NMEA0183LIB debug NMEA0183LIB_d 120 set(LIBS 121 optimized FileLib debug FileLib_d 122 optimized PacpusLib debug PacpusLib_d 123 optimized PacpusTools debug PacpusTools_d 124 optimized NMEA0183LIB debug NMEA0183LIB_d 125 ) 126 if (WIN32) 127 list(APPEND LIBS 128 optimized ROAD_TIME debug ROAD_TIME_d 141 129 ) 142 endif(WIN32) 143 144 if(UNIX) 145 set(LIBS 146 # add your specific libraries to link here 147 148 ) 149 endif(UNIX) 150 151 # All the platform 152 target_link_libraries( 153 ${PROJECT_NAME} 154 ${PACPUS_LIBRARIES} 155 ${QT_LIBRARIES} 156 ${PACPUS_DEPENDENCIES_LIB} 157 ${LIBS} 158 # optimized PacpusTools debug PacpusTools_d 159 ) 130 endif() 131 # LINK 132 target_link_libraries(${PROJECT_NAME} 133 ${PACPUS_LIBRARIES} 134 ${PACPUS_DEPENDENCIES_LIB} 135 ${LIBS} 136 ${QT_LIBRARIES} 137 ) 138 qt5_use_modules(${PROJECT_NAME} Network) 139 ################################################################################ 140 # FOLDERS 160 141 pacpus_folder(${PROJECT_NAME} "components") 161 162 # ======================================== 163 # Install 164 # ======================================== 165 pacpus_install(${PROJECT_NAME}) 142 ################################################################################ 143 # INSTALL 144 pacpus_install(${PROJECT_NAME}) -
trunk/Gps/SeptentrioComponent.h
r59 r99 15 15 // #include "polarxGPSTKsolver.hpp" 16 16 17 #include "structure /structure_septentrio.h"17 #include "structure_gps.h" 18 18 #include "SerialCom/SerialCOM_Handle_Stream.hpp" 19 19 #include "SerialCom/SBF/SerialCOM_Protocol_SBF.hpp" -
trunk/Gps/SeptentrioSocket.cpp
r59 r99 15 15 16 16 #include "SeptentrioSocket.h" 17 #include "SeptentrioComponent.h"17 //#include "SeptentrioComponent.h" 18 18 #include <QApplication> 19 19 #include <QtDebug> -
trunk/Gps/gpsComponent.cpp
r77 r99 18 18 #include <iostream> 19 19 20 #define PACPUS_PI 3.1415926 21 20 22 namespace pacpus { 21 23 22 24 /// Construct the factory 23 ComponentFactory<GpsComponent> sFactory("GpsComponent"); 25 ComponentFactory<GpsComponent> sFactory("GpsComponent"); 24 26 25 27 DECLARE_STATIC_LOGGER("pacpus.base.GpsComponent"); … … 35 37 : semaphore_(0) 36 38 , ComponentBase(name) 37 38 { 39 40 ppsRecording = TRUE;41 ggaRecording = TRUE;42 gsaRecording = TRUE;43 gstRecording = TRUE;44 gsvRecording = TRUE;45 hdtRecording = TRUE;46 rmcRecording = TRUE;47 rotRecording = TRUE;48 vtgRecording = TRUE;49 zdaRecording = TRUE;50 51 /* ppshdFile = NULL; 52 ggahdFile = NULL; 53 gsahdFile = NULL; 54 gsthdFile = NULL; 55 gsvhdFile = NULL; 56 hdthdFile = NULL; 57 rmchdFile = NULL; 58 rothdFile = NULL; 59 vtghdFile = NULL; 60 zdahdFile = NULL; 39 40 { 41 42 ppsRecording = true;//TRUE 43 ggaRecording = true; 44 gsaRecording = true; 45 gstRecording = true; 46 gsvRecording = true; 47 hdtRecording = true; 48 rmcRecording = true; 49 rotRecording = true; 50 vtgRecording = true; 51 zdaRecording = true; 52 53 /* ppshdFile = NULL; 54 ggahdFile = NULL; 55 gsahdFile = NULL; 56 gsthdFile = NULL; 57 gsvhdFile = NULL; 58 hdthdFile = NULL; 59 rmchdFile = NULL; 60 rothdFile = NULL; 61 vtghdFile = NULL; 62 zdahdFile = NULL; 61 63 */ 62 63 64 65 64 66 nextByteToProcess_ = 0; 65 67 currentFrame_ = NULL; 66 newFrameToDecode_ = false; 67 startOfFrame_ = false; 68 newFrameToDecode_ = false; 69 startOfFrame_ = false; 68 70 endOfFrame_ = false; 69 71 } … … 81 83 ComponentBase::COMPONENT_CONFIGURATION GpsComponent::configureComponent(XmlComponentConfig config) 82 84 { 83 setPortCOM( config.getProperty("port").toLatin1() ); 85 setPortCOM( config.getProperty("port").toLatin1() ); 84 86 setRecording ((config.getProperty("recording") == "true" ? true : false)); 85 87 … … 90 92 void GpsComponent::setPortCOM(const char * port) 91 93 { 92 portName_ = port; 94 portName_ = port; 93 95 } 94 96 … … 111 113 void GpsComponent::run() 112 114 { 113 int type = -1; 114 115 int type = -1; 116 115 117 // parity:0-4=no,odd,even,mark,space 116 118 // byteSize:number of bits/byte, 4-8 117 // baudRate:port speed (ex:38400) 118 // stopBits:0,1,2 = 1, 1.5, 2 119 120 serialPort->configurePort(xmlParameters().getProperty("baudrate").toLong(), 119 // baudRate:port speed (ex:38400) 120 // stopBits:0,1,2 = 1, 1.5, 2 121 122 serialPort->configurePort(xmlParameters().getProperty("baudrate").toLong(), 121 123 xmlParameters().getProperty("bytesize").toUInt(), 122 124 // config.getProperty("parity").at(0).toLatin1(), 123 125 xmlParameters().getProperty("parity").toShort(), 124 xmlParameters().getProperty("stopbits").toUInt() - 1); 125 126 127 serialPort->start(); 128 126 xmlParameters().getProperty("stopbits").toUInt() - 1); 127 128 129 serialPort->start(); 130 129 131 while (isActive()) 130 { 132 { 131 133 // If there are no bytes remaining in the current frame, delete it 132 134 if ((currentFrame_ != NULL) && (nextByteToProcess_ >= currentFrame_->data.length())) { 133 delete currentFrame_; 135 delete currentFrame_; 134 136 currentFrame_ = NULL; 135 137 } … … 139 141 semaphore_.acquire(); 140 142 if ((currentFrame_ = serialPort->getNextFrame()) == NULL) { 141 // Should never get to this point as the semaphore counts the frames, unless 143 // Should never get to this point as the semaphore counts the frames, unless 142 144 // the thread is being stopped. 143 145 continue; … … 151 153 lastPpsTime_ = currentFrame_->t; 152 154 decodeFrame(SIGNAL_PPS); 153 } else if (analyzeFrame()) { 155 } else if (analyzeFrame()) { 154 156 // a new complete NMEA frame has arrived, decode it. 155 type = frameType(frameToDecode_.data); 157 type = frameType(frameToDecode_.data); 156 158 if (type != -1) { 157 159 if (decodeFrame(type) == -1) { 158 qWarning("Failed to decode the dataframe\n"); 160 qWarning("Failed to decode the dataframe\n"); 159 161 } 160 162 } … … 164 166 } 165 167 166 qDebug() << "The thread of " << name() << " GPS component is stopped"; 168 qDebug() << "The thread of " << name() << " GPS component is stopped"; 167 169 } 168 170 … … 174 176 void GpsComponent::stopActivity() 175 177 { 176 setActive( FALSE );178 setActive( false ); 177 179 unlockProcessing(1); // to unblock the thread that is waiting new data 178 179 serialPort->THREAD_ALIVE = FALSE;180 181 serialPort->THREAD_ALIVE = false; 180 182 181 183 if (!serialPort->wait(2000)) 182 184 { 183 serialPort->terminate(); 185 serialPort->terminate(); 184 186 qDebug("The Win32SerialPort thread blocks anormally, it has been killed !!"); 185 187 } 186 if ( !serialPort->closePort() ) 187 qDebug("Failed to close the port"); 188 if ( !serialPort->closePort() ) 189 qDebug("Failed to close the port"); 188 190 else 189 qDebug("The port is closed"); 191 qDebug("The port is closed"); 190 192 delete serialPort; 191 193 192 194 if (ppshdFile.isOpen()) 193 ppshdFile.close(); 195 ppshdFile.close(); 194 196 if (ggahdFile.isOpen()) 195 197 ggahdFile.close(); 196 198 if (gsahdFile.isOpen()) 197 gsahdFile.close(); 199 gsahdFile.close(); 198 200 if (gsthdFile.isOpen()) 199 201 gsthdFile.close(); … … 203 205 hdthdFile.close(); 204 206 if (rmchdFile.isOpen()) 205 rmchdFile.close(); 207 rmchdFile.close(); 206 208 if (rothdFile.isOpen()) 207 209 rothdFile.close(); 208 210 if (vtghdFile.isOpen()) 209 vtghdFile.close(); 211 vtghdFile.close(); 210 212 if (zdahdFile.isOpen()) 211 213 zdahdFile.close(); … … 219 221 { 220 222 ppsIndex_ = 0; 221 222 setActive( TRUE );223 223 224 setActive( true ); 225 224 226 #if WIN32 225 serialPort = new Win32SerialPort(portName_.toLatin1()); 227 serialPort = new Win32SerialPort(portName_.toLatin1()); 226 228 // Asynchrone 227 serialPort->setMode(FILE_FLAG_OVERLAPPED); 229 serialPort->setMode(FILE_FLAG_OVERLAPPED); 228 230 // Synchrone 229 //serialPort->setMode(0); 230 #else 231 serialPort = new PosixSerialPort(portName .toLatin1());231 //serialPort->setMode(0); 232 #else 233 serialPort = new PosixSerialPort(portName_.toLatin1()); 232 234 #endif 233 235 234 236 if (!serialPort->openPort(portName_.toLatin1())) 235 237 { 236 238 qDebug() << "Failed to open the port " << portName_; 237 239 qDebug() << "The GPS Component " << name() << " didn't start"; 238 return; 240 return; 239 241 } 240 241 serialPort->THREAD_ALIVE = TRUE;242 243 serialPort->THREAD_ALIVE = true; 242 244 if (!QApplication::connect(serialPort,SIGNAL(newDataAvailable(int)),this, SLOT(unlockProcessing(int)))) 243 qWarning("Failed to connect SIGNAL(newDataAvailable(int)) with SLOT(unlockProcessing(int)\n" ); 244 start(); 245 qWarning("Failed to connect SIGNAL(newDataAvailable(int)) with SLOT(unlockProcessing(int)\n" ); 246 start(); 245 247 qDebug() << "The Component " << name() << " is started"; 246 248 } … … 299 301 300 302 // first looking for start-of-frame 301 if (!startOfFrame_ && (currentChar == '$')) { 303 if (!startOfFrame_ && (currentChar == '$')) { 302 304 startOfFrame_ = true; 303 305 endOfFrame_ = false; … … 313 315 return true; // There is a new frame to decode 314 316 } 315 317 316 318 if ((startOfFrame_) && (!endOfFrame_)) { 317 frameToDecode_.data.append(currentChar); 319 frameToDecode_.data.append(currentChar); 318 320 } 319 321 } … … 325 327 { 326 328 // new frame available 327 semaphore_.release( v ); 329 semaphore_.release( v ); 328 330 } 329 331 … … 331 333 int GpsComponent::decodeFrame(int type) 332 334 { 333 double lat_rad = 0, lon_rad = 0; 334 int indexGSV = 0; 335 double lat_rad = 0, lon_rad = 0; 336 int indexGSV = 0; 335 337 int indexGSA = 0; 336 337 338 SENTENCE sentence; 339 sentence.Sentence = frameToDecode_.data; 340 341 switch(type) 338 339 340 SENTENCE sentence; 341 sentence.Sentence = frameToDecode_.data; 342 343 switch(type) 342 344 { 343 case UNKNOWN_NMEA_FRAME: 344 qDebug("Unknown frame received !"); 345 break; 345 case UNKNOWN_NMEA_FRAME: 346 qDebug("Unknown frame received !"); 347 break; 346 348 case SIGNAL_PPS: 347 349 ppsFrame.setRoadTime(lastPpsTime_); … … 351 353 { 352 354 if (!(ppshdFile.isOpen())) 353 ppshdFile.open((char *)(name() + "_pps.dbt").toLatin1().data(),WriteMode,TYPE_INT,sizeof(int)); 355 ppshdFile.open((char *)(name() + "_pps.dbt").toLatin1().data(),WriteMode,TYPE_INT,sizeof(int)); 354 356 if ( ppshdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ppsFrame.getFrameData(),sizeof(int)) == 0) 355 qWarning("Failed to record PPS data ...\n"); 357 qWarning("Failed to record PPS data ...\n"); 356 358 } 357 359 ppsFrame.notifyObservers(); 358 360 359 361 break; 360 361 case TRAME_GGA_DBL: 362 363 case TRAME_GGA_DBL: 362 364 if (!nmea0183_.Gga.Parse(sentence)) { 363 365 LOG_ERROR("Failed to parse the frame " << nmea0183_.Gga.ErrorMessage.toLatin1().data()); … … 377 379 ggaFrame.getFrameData()->d_geoidal = nmea0183_.Gga.GeoidalSeparationMeters; 378 380 ggaFrame.getFrameData()->age = nmea0183_.Gga.AgeOfDifferentialGPSDataSeconds; 379 ggaFrame.getFrameData()->dir_lat = ( (nmea0183_.Gga.Position.Latitude.Northing == North) ? 'N' : 'S' ); 380 ggaFrame.getFrameData()->dir_lon = ( (nmea0183_.Gga.Position.Longitude.Easting == East) ? 'E' : 'W' ); 381 ggaFrame.getFrameData()->ref_station_ID = nmea0183_.Gga.DifferentialReferenceStationID; 381 ggaFrame.getFrameData()->dir_lat = ( (nmea0183_.Gga.Position.Latitude.Northing == North) ? 'N' : 'S' ); 382 ggaFrame.getFrameData()->dir_lon = ( (nmea0183_.Gga.Position.Longitude.Easting == East) ? 'E' : 'W' ); 383 ggaFrame.getFrameData()->ref_station_ID = nmea0183_.Gga.DifferentialReferenceStationID; 382 384 ggaFrame.setRoadTime(frameToDecode_.t); 383 384 sendDataToServerSocket(*ggaFrame.getFrameData(),type); 385 386 sendDataToServerSocket(*ggaFrame.getFrameData(),type); 385 387 ggaFrame.notifyObservers(); 386 388 387 389 if ( (isRecording()) && (ggaRecording) ) { 388 390 if (!(ggahdFile.isOpen())) 389 ggahdFile.open((char *)(name() + "_gga.dbt").toLatin1().data(),WriteMode,TRAME_GGA_DBL,sizeof(trame_gga_dbl)); 390 if ( !ggahdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ggaFrame.getFrameData(),sizeof(trame_gga_dbl))) 391 qWarning("Failed to record GGA data ...\n"); 391 ggahdFile.open((char *)(name() + "_gga.dbt").toLatin1().data(),WriteMode,TRAME_GGA_DBL,sizeof(trame_gga_dbl)); 392 if ( !ggahdFile.writeRecord(frameToDecode_.t,frameToDecode_.tr,(char *) ggaFrame.getFrameData(),sizeof(trame_gga_dbl))) 393 qWarning("Failed to record GGA data ...\n"); 392 394 } 393 395 //printf("lon=%f lat=%f\n",ggaFrame.getFrameData()->lon, ggaFrame.getFrameData()->lat); 394 396 } 395 397 break; 396 398 397 399 case TRAME_GSA: 398 400 if (!nmea0183_.Gsa.Parse(sentence)) … … 401 403 gsaFrame.getFrameData()->mode_result = 0; 402 404 if (nmea0183_.Gsa.FixMode == GSA::FixUnavailable) 403 gsaFrame.getFrameData()->mode_result = 1; 405 gsaFrame.getFrameData()->mode_result = 1; 404 406 if (nmea0183_.Gsa.FixMode == GSA::TwoDimensional) 405 gsaFrame.getFrameData()->mode_result = 2; 407 gsaFrame.getFrameData()->mode_result = 2; 406 408 if (nmea0183_.Gsa.FixMode == GSA::ThreeDimensional) 407 gsaFrame.getFrameData()->mode_result = 3; 409 gsaFrame.getFrameData()->mode_result = 3; 408 410 for (indexGSA = 0 ; indexGSA<12 ; indexGSA++) 409 gsaFrame.getFrameData()->SV_PRN[indexGSA] = nmea0183_.Gsa.SatelliteNumber[indexGSA]; 410 gsaFrame.getFrameData()->pdop = nmea0183_.Gsa.PDOP; 411 gsaFrame.getFrameData()->hdop = nmea0183_.Gsa.HDOP; 412 gsaFrame.getFrameData()->vdop = nmea0183_.Gsa.VDOP; 411 gsaFrame.getFrameData()->SV_PRN[indexGSA] = nmea0183_.Gsa.SatelliteNumber[indexGSA]; 412 gsaFrame.getFrameData()->pdop = nmea0183_.Gsa.PDOP; 413 gsaFrame.getFrameData()->hdop = nmea0183_.Gsa.HDOP; 414 gsaFrame.getFrameData()->vdop = nmea0183_.Gsa.VDOP; 413 415 gsaFrame.setRoadTime(frameToDecode_.t); 414 416 415 417 gsaFrame.notifyObservers(); 416 417 sendDataToServerSocket(*gsaFrame.getFrameData(),type); 418 418 419 sendDataToServerSocket(*gsaFrame.getFrameData(),type); 420 419 421 if ( (isRecording()) && (gsaRecording) ) 420 422 { 421 423 if (!(gsahdFile.isOpen())) 422 424 gsahdFile.open((char *)(name() + "_gsa.dbt").toLatin1().data(),WriteMode, TRAME_GSA,sizeof(trame_gsa)); 423 if ( gsahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsaFrame.getFrameData(),sizeof(trame_gsa)) != 1) 424 qWarning("Failed to record GSA data ...\n"); 425 if ( gsahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsaFrame.getFrameData(),sizeof(trame_gsa)) != 1) 426 qWarning("Failed to record GSA data ...\n"); 425 427 } 426 428 break; 427 429 428 430 429 431 430 432 case TRAME_GST: 431 433 if (!nmea0183_.Gst.Parse( sentence )) … … 443 445 gstFrame.getFrameData()->Ms = nmea0183_.Gst.Time.time().msec(); 444 446 gstFrame.setRoadTime(frameToDecode_.t); 445 446 sendDataToServerSocket(*gstFrame.getFrameData(),type); 447 448 sendDataToServerSocket(*gstFrame.getFrameData(),type); 447 449 gstFrame.notifyObservers(); 448 450 449 451 450 452 if ( (isRecording()) && (gstRecording) ) { 451 if (!gsthdFile.isOpen()) 452 gsthdFile.open((char *)(name() + "_gst.dbt").toLatin1().data(),WriteMode,TRAME_GST,sizeof(trame_gst)); 453 if (!gsthdFile.isOpen()) 454 gsthdFile.open((char *)(name() + "_gst.dbt").toLatin1().data(),WriteMode,TRAME_GST,sizeof(trame_gst)); 453 455 if ( !gsthdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gstFrame.getFrameData(),sizeof(trame_gst)) ) 454 qWarning("Failed to record GST data ...\n"); 455 } 456 break; 457 456 qWarning("Failed to record GST data ...\n"); 457 } 458 break; 459 458 460 case TRAME_GSV: 459 461 indexGSV = 0; … … 462 464 break; 463 465 } 464 // it's a new frame, reset stored value in case of the number of satellites 466 // it's a new frame, reset stored value in case of the number of satellites 465 467 // in view has decreased 466 468 if (nmea0183_.Gsv.message_number == 1) … … 477 479 gsvFrame.getFrameData()->NumberOfSatellites = nmea0183_.Gsv.NumberOfSatellites; 478 480 gsvFrame.getFrameData()->Totalmessages = nmea0183_.Gsv.Totalmessages; 479 481 480 482 for ( indexGSV=4*(nmea0183_.Gsv.message_number-1); indexGSV<=(4*nmea0183_.Gsv.message_number)-1; indexGSV++ ) 481 483 { … … 487 489 488 490 if (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) { 489 sendDataToServerSocket(*gsvFrame.getFrameData(),type); 491 sendDataToServerSocket(*gsvFrame.getFrameData(),type); 490 492 gsvFrame.setRoadTime(frameToDecode_.t); 491 493 gsvFrame.notifyObservers(); … … 493 495 if ( (isRecording()) && (gsvRecording) && (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) ) 494 496 { 495 if (!gsvhdFile.isOpen()) 496 gsvhdFile.open((char *)(name() + "_gsv.dbt").toLatin1().data(),WriteMode,TRAME_GSV,sizeof(trame_gsv)); 497 if (!gsvhdFile.isOpen()) 498 gsvhdFile.open((char *)(name() + "_gsv.dbt").toLatin1().data(),WriteMode,TRAME_GSV,sizeof(trame_gsv)); 497 499 if ( gsvhdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) gsvFrame.getFrameData(),sizeof(trame_gsv)) == 0) 498 qWarning("Failed to record GSV data ...\n"); 499 } 500 break; 501 500 qWarning("Failed to record GSV data ...\n"); 501 } 502 break; 503 502 504 case TRAME_HDT: 503 505 if (!nmea0183_.Hdt.Parse( sentence )) … … 505 507 hdtFrame.getFrameData()->DegreesTrue = nmea0183_.Hdt.DegreesTrue; 506 508 hdtFrame.setRoadTime(frameToDecode_.t); 507 508 sendDataToServerSocket(hdtFrame,type); 509 510 sendDataToServerSocket(hdtFrame,type); 509 511 hdtFrame.notifyObservers(); 510 512 511 513 if ( (isRecording()) && (hdtRecording) ) 512 514 { 513 515 if (!hdthdFile.isOpen()) 514 hdthdFile.open((char *)(name() + "_hdt.dbt").toLatin1().data(),WriteMode,TRAME_HDT,sizeof(trame_hdt)); 516 hdthdFile.open((char *)(name() + "_hdt.dbt").toLatin1().data(),WriteMode,TRAME_HDT,sizeof(trame_hdt)); 515 517 if ( hdthdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) hdtFrame.getFrameData(),sizeof(trame_hdt)) == 0) 516 qWarning("Failed to record HDT data ...\n"); 517 } 518 break; 519 518 qWarning("Failed to record HDT data ...\n"); 519 } 520 break; 521 520 522 case TRAME_RMC: 521 523 if (!nmea0183_.Rmc.Parse( sentence )) … … 545 547 rmcFrame.getFrameData()->vitesse = nmea0183_.Rmc.SpeedOverGroundKnots * 1852.0 / 3600.0; // 1 knot = 1852 m/h 546 548 rmcFrame.setRoadTime(frameToDecode_.t); 547 548 sendDataToServerSocket(*rmcFrame.getFrameData(),type); 549 550 sendDataToServerSocket(*rmcFrame.getFrameData(),type); 549 551 rmcFrame.notifyObservers(); 550 552 551 553 if ( (isRecording()) && (rmcRecording) ) 552 554 { 553 555 if (!rmchdFile.isOpen()) 554 rmchdFile.open((char *)(name() + "_rmc.dbt").toLatin1().data(),WriteMode,TRAME_RMC,sizeof(trame_rmc)); 556 rmchdFile.open((char *)(name() + "_rmc.dbt").toLatin1().data(),WriteMode,TRAME_RMC,sizeof(trame_rmc)); 555 557 if (rmchdFile.writeRecord(frameToDecode_.t ,frameToDecode_.tr,(char *) rmcFrame.getFrameData(),sizeof(trame_rmc)) == 0) 556 qWarning("Failed to record RMC data ...\n"); 558 qWarning("Failed to record RMC data ...\n"); 557 559 } 558 560 break; 559 561 560 562 case TRAME_ROT: 561 563 if (!nmea0183_.Rot.Parse( sentence )) … … 564 566 rotFrame.getFrameData()->valid_data = ( (nmea0183_.Rot.IsDataValid == True) ? 1 : 0 ); 565 567 rotFrame.setRoadTime(frameToDecode_.t); 566 567 sendDataToServerSocket(*rotFrame.getFrameData(),type); 568 569 sendDataToServerSocket(*rotFrame.getFrameData(),type); 568 570 rotFrame.notifyObservers(); 569 571 570 572 if ( (isRecording()) && (rotRecording) ) 571 573 { 572 574 if (!rothdFile.isOpen()) 573 rothdFile.open((char *)(name() + "_rot.dbt").toLatin1().data(),WriteMode,TRAME_ROT,sizeof(trame_rot)); 575 rothdFile.open((char *)(name() + "_rot.dbt").toLatin1().data(),WriteMode,TRAME_ROT,sizeof(trame_rot)); 574 576 if ( rothdFile.writeRecord(frameToDecode_.t ,frameToDecode_.tr,(char *) rotFrame.getFrameData(),sizeof(trame_rot)) == 0) 575 qWarning("Failed to record ROT data ...\n"); 576 } 577 break; 578 577 qWarning("Failed to record ROT data ...\n"); 578 } 579 break; 580 579 581 case TRAME_VTG: 580 582 if (!nmea0183_.Vtg.Parse( sentence )) { … … 582 584 } else { 583 585 vtgFrame.getFrameData()->v = nmea0183_.Vtg.SpeedKilometersPerHour; 584 vtgFrame.getFrameData()->track_true_north = nmea0183_.Vtg.TrackDegreesTrue; 585 vtgFrame.getFrameData()->track_magnet_north = nmea0183_.Vtg.TrackDegreesMagnetic; 586 vtgFrame.getFrameData()->track_true_north = nmea0183_.Vtg.TrackDegreesTrue; 587 vtgFrame.getFrameData()->track_magnet_north = nmea0183_.Vtg.TrackDegreesMagnetic; 586 588 vtgFrame.setRoadTime(frameToDecode_.t); 587 589 588 590 sendDataToServerSocket(vtgFrame,type); 589 591 vtgFrame.notifyObservers(); 590 592 591 593 if (isRecording() && vtgRecording) { 592 if (!vtghdFile.isOpen()) 593 vtghdFile.open((char *)(name() + "_vtg.dbt").toLatin1().data(),WriteMode,TRAME_VTG,sizeof(trame_vtg)); 594 if (!vtghdFile.isOpen()) 595 vtghdFile.open((char *)(name() + "_vtg.dbt").toLatin1().data(),WriteMode,TRAME_VTG,sizeof(trame_vtg)); 594 596 if ( vtghdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) vtgFrame.getFrameData(),sizeof(trame_vtg)) == 0) 595 qWarning("Failed to record VTG data ...\n"); 597 qWarning("Failed to record VTG data ...\n"); 596 598 } 597 599 } 598 break; 599 600 break; 601 600 602 case TRAME_ZDA: 601 603 if (!nmea0183_.Zda.Parse( sentence )) { … … 609 611 zdaFrame.getFrameData()->MM = nmea0183_.Zda.Time.date().month(); 610 612 zdaFrame.getFrameData()->JJ = nmea0183_.Zda.Time.date().day(); 611 zdaFrame.getFrameData()->H_offset = nmea0183_.Zda.LocalHourDeviation; 612 zdaFrame.getFrameData()->Mi_offset = nmea0183_.Zda.LocalMinutesDeviation; 613 613 zdaFrame.getFrameData()->H_offset = nmea0183_.Zda.LocalHourDeviation; 614 zdaFrame.getFrameData()->Mi_offset = nmea0183_.Zda.LocalMinutesDeviation; 615 614 616 sendDataToServerSocket(*zdaFrame.getFrameData(), type); 615 617 zdaFrame.setRoadTime(frameToDecode_.t); 616 618 zdaFrame.notifyObservers(); 617 619 618 620 if ( (isRecording()) && (zdaRecording) ) { 619 if (!zdahdFile.isOpen()) 620 zdahdFile.open((char *)(name() + "_zda.dbt").toLatin1().data(),WriteMode,TRAME_ZDA,sizeof(trame_zda)); 621 if (!zdahdFile.isOpen()) 622 zdahdFile.open((char *)(name() + "_zda.dbt").toLatin1().data(),WriteMode,TRAME_ZDA,sizeof(trame_zda)); 621 623 if ( zdahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) zdaFrame.getFrameData(),sizeof(trame_zda)) == 0) { 622 624 LOG_WARN("Failed to record ZDA data ..."); … … 641 643 } 642 644 */ 643 644 break; 645 645 646 break; 647 646 648 default: 647 return 0; 649 return 0; 648 650 } 649 650 return 1; 651 652 return 1; 651 653 } 652 654 -
trunk/Gps/gpsComponent.h
r59 r99 21 21 #include <QSemaphore> 22 22 #include <QThread> 23 #include <QByteArray> 24 #include <QString> 23 25 24 26 #ifdef WIN32 25 27 # include "../driver/win32SerialPort.h" 26 28 //# include "network/gpsServerSocket.h" 27 #else 29 #else 28 30 # include "../driver/PosixSerialPort.h" 29 31 #endif … … 41 43 # endif 42 44 #else 43 // On other platforms, simply ignore this 45 // On other platforms, simply ignore this 44 46 # define GPS_API /* nothing */ 45 47 #endif … … 58 60 { 59 61 Q_OBJECT 60 62 61 63 public: 62 GpsComponent(QString name); 63 ~GpsComponent(); 64 64 GpsComponent(QString name); 65 ~GpsComponent(); 66 65 67 virtual void stopActivity(); /*!< to stop the processing thread */ 66 68 virtual void startActivity(); /*!< to start the processing thread */ 67 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 69 virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 68 70 69 71 … … 71 73 void disableSocketServer(); /*!< to disable the socket server interface */ 72 74 73 void setPortCOM(const char * port); 75 void setPortCOM(const char * port); 74 76 75 77 76 77 public slots: 78 79 public slots: 78 80 void unlockProcessing(int v); /*!< to unlock the processing thread */ 79 81 80 82 protected: 81 83 private: 82 void run(); /*!< the main loop of the thread */ 83 int frameType(const QByteArray& frame); /*!< to get the type of the frame */ 84 int decodeFrame(int type); /*!< parse the string in the NMEA0183 class to get the frame informations */ 84 void run(); /*!< the main loop of the thread */ 85 int frameType(const QByteArray& frame); /*!< to get the type of the frame */ 86 int decodeFrame(int type); /*!< parse the string in the NMEA0183 class to get the frame informations */ 85 87 bool currentFrameIsPps(); /*!< checks if a frame is an out-of-band pps signal */ 86 bool analyzeFrame(); /*!< reconstruct the entire frame starting from the received pieces */ 88 bool analyzeFrame(); /*!< reconstruct the entire frame starting from the received pieces */ 87 89 88 90 #ifdef WIN32 … … 104 106 static FrameTypeMap frameTypes[MAX_FRAMES]; 105 107 106 NMEA0183 nmea0183_; 107 QSemaphore semaphore_; 108 NMEA0183 nmea0183_; 109 QSemaphore semaphore_; 108 110 109 FRAME* currentFrame_; 111 FRAME* currentFrame_; 110 112 111 FRAME frameToDecode_; 113 FRAME frameToDecode_; 112 114 113 115 road_time_t lastPpsTime_; 114 116 115 bool newFrameToDecode_; 116 bool startOfFrame_; 117 bool endOfFrame_; 117 bool newFrameToDecode_; 118 bool startOfFrame_; 119 bool endOfFrame_; 118 120 int nextByteToProcess_; 119 121 120 122 121 123 unsigned int ppsIndex_; 122 124 123 125 DbiteFile ppshdFile; /*!< pointer to the pps dbt file */ 124 126 DbiteFile ggahdFile; /*!< pointer to the gga dbt file */ … … 139 141 bool ggaRecording; 140 142 bool gsaRecording; 141 bool gstRecording; 143 bool gstRecording; 142 144 bool gsvRecording; 143 145 bool hdtRecording; 144 bool rmcRecording; 145 bool rotRecording; 146 bool vtgRecording; 147 bool zdaRecording; 148 149 QString portName_; 146 bool rmcRecording; 147 bool rotRecording; 148 bool vtgRecording; 149 bool zdaRecording; 150 151 QString portName_; 150 152 151 153 ShMem * shMem_; 152 154 153 155 /// For the socket server 154 156 /* Qt3 version - 17/12/2007 155 BOOL socketServerEnabled; 156 void *frameToSend; 157 BOOL socketServerEnabled; 158 void *frameToSend; 157 159 QCustomEvent *evt; 158 160 */ 159 160 /* 161 * VC6 doesn't support out-of-class template defintions 162 * see on http://support.microsoft.com kb q243451 and more particulary 241949 161 162 /* 163 * VC6 doesn't support out-of-class template defintions 164 * see on http://support.microsoft.com kb q243451 and more particulary 241949 163 165 */ 164 166 template<typename T> … … 168 170 if (socketServerEnabled) 169 171 { 170 frameToSend = new T; 171 *(T*)frameToSend = frame; 172 evt = new QCustomEvent(QEvent::User + type); 173 evt->setData(frameToSend); 174 postEvent(serverSocket,evt); 172 frameToSend = new T; 173 *(T*)frameToSend = frame; 174 evt = new QCustomEvent(QEvent::User + type); 175 evt->setData(frameToSend); 176 postEvent(serverSocket,evt); 175 177 } 176 178 */ -
trunk/Gps/ui/polarxmainwindow.cpp
r59 r99 362 362 } 363 363 } 364 364 /* 365 365 void PolarxMainWindow::setReceiverStatus( SbfDataReceiverStatus * msg ) 366 366 { … … 479 479 } 480 480 } 481 */ -
trunk/Gps/ui/polarxmainwindow.hpp
r59 r99 2 2 #define __POLARXMAINWINDOW__ 3 3 4 #include <QtGui> 4 //#include <QtGui> 5 #include <QtWidgets> 5 6 #include <bitset> 6 #include " structure/structure_septentrio.h"7 #include "../structure_gps.h" 7 8 #include "../SeptentrioSocket.h" 8 9 #include "PacpusTools/BinaryDecoder.h" … … 17 18 18 19 void setData( unsigned char * data , int buf_size ) ; 19 void setReceiverStatus( SbfDataReceiverStatus * msg ) ;20 /*void setReceiverStatus( SbfDataReceiverStatus * msg ) ; 20 21 void setTrackingStatus( SbfDataTrackingStatus * msg ) ; 21 void setPVTGeodetic( SbfDataPVTGeodetic * msg ) ; 22 void setPVTGeodetic( SbfDataPVTGeodetic * msg ) ;*/ 22 23 void setSocket( SeptentrioSocket * socket ) ; 23 24 -
trunk/Ladybug/LadybugComponent.cpp
r98 r99 32 32 // Construct the factory 33 33 static ComponentFactory<LadybugComponent> sFactory("LadybugComponent"); 34 static const size_t kMaxFilepathLength = 128;35 34 36 35 /* *Constructor*/ … … 57 56 lbTotalNumberOfImagesWritten = 0; 58 57 lbNumOfFrames = 0; 59 60 if (lbSaveJPGImages)61 {62 try63 {64 QString dbtFileName_ = "Camera_1.dbt";65 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);66 } catch (DbiteException & e) {67 LOG_ERROR("error opening dbt file: " << e.what());68 }69 70 try71 {72 QString dbtFileName_ = "Camera_2.dbt";73 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);74 } catch (DbiteException & e) {75 LOG_ERROR("error opening dbt file: " << e.what());76 }77 78 try79 {80 QString dbtFileName_ = "Camera_3.dbt";81 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);82 } catch (DbiteException & e) {83 LOG_ERROR("error opening dbt file: " << e.what());84 }85 86 try87 {88 QString dbtFileName_ = "Camera_4.dbt";89 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);90 } catch (DbiteException & e) {91 LOG_ERROR("error opening dbt file: " << e.what());92 }93 94 try95 {96 QString dbtFileName_ = "Camera_5.dbt";97 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);98 } catch (DbiteException & e) {99 LOG_ERROR("error opening dbt file: " << e.what());100 }101 102 try103 {104 QString dbtFileName_ = "Camera_6.dbt";105 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);106 } catch (DbiteException & e) {107 LOG_ERROR("error opening dbt file: " << e.what());108 }109 }110 111 if (lbSavePanoImage)112 {113 try114 {115 QString dbtFileName_ = "CameraPano.dbt";116 mDbtImage1.open(dbtFileName_.toStdString(), WriteMode, FILE_DBT_UNKNOWN, kMaxFilepathLength);117 } catch (DbiteException & e) {118 LOG_ERROR("error opening dbt file: " << e.what());119 }120 }121 122 58 THREAD_ALIVE = true; 123 59 start(); … … 130 66 printf (" \n*** Stopping Activity ***\n"); 131 67 LadybugError error; 132 133 // Close DBT files134 if (lbSaveJPGImages) {135 mDbtImage1.close();136 mDbtImage2.close();137 mDbtImage3.close();138 mDbtImage4.close();139 mDbtImage5.close();140 mDbtImage6.close();141 }142 143 if (lbSavePanoImage) {144 mDbtImagePano.close();145 }146 68 147 69 lbIsRecording = false; … … 222 144 CreateImageBuffers(); 223 145 224 // Timestamp225 road_time_t timestamp = 0;226 road_timerange_t tr = 0;227 228 146 while (THREAD_ALIVE) 229 147 { 230 231 148 lbCurrentTime = GetTickCount(); // road_time_t timestamp = road_time(); // ui64 ; unit microsec ; Orig 01/01/1970 00:00 232 149 lbFrameCount++; … … 241 158 242 159 error = ladybugGrabImage( lbContext, &image ); 243 timestamp= road_time(); // timestamp160 // t = road_time(); // timestamp 244 161 HandleError(error); 245 162 … … 328 245 HandleError(error); 329 246 330 331 // Use it to trigger the camera with the gps signal332 247 /*// Initialize Trigger 333 248 error = ladybugGetTriggerModeInfo( lbContext, &triggerModeInfo ); … … 441 356 HandleError(error); 442 357 443 if (uiCamera == 0)444 {445 try {446 mDbtImage1.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);447 } catch (DbiteException & e) {448 LOG_ERROR("error writing data: " << e.what());449 }450 } else if (uiCamera == 1) {451 try {452 mDbtImage2.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);453 } catch (DbiteException & e) {454 LOG_ERROR("error writing data: " << e.what());455 }456 }else if (uiCamera == 2) {457 try {458 mDbtImage3.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);459 } catch (DbiteException & e) {460 LOG_ERROR("error writing data: " << e.what());461 }462 }else if (uiCamera == 3) {463 try {464 mDbtImage4.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);465 } catch (DbiteException & e) {466 LOG_ERROR("error writing data: " << e.what());467 }468 }else if (uiCamera == 4) {469 try {470 mDbtImage5.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);471 } catch (DbiteException & e) {472 LOG_ERROR("error writing data: " << e.what());473 }474 }else if (uiCamera == 5) {475 try {476 mDbtImage6.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);477 } catch (DbiteException & e) {478 LOG_ERROR("error writing data: " << e.what());479 }480 }481 482 358 //printf("Saved camera %u image to %s.\n", uiCamera, pszOutputFilePath); 483 359 … … 525 401 error = ladybugSaveImage(lbContext, &processedImage, pszOutputFilePath, LADYBUG_FILEFORMAT_JPG); 526 402 HandleError(error); 527 528 try {529 mDbtImagePano.writeRecord(time, tr, (char *) processedImage.pData, kMaxFilepathLength);530 } catch (DbiteException & e) {531 LOG_ERROR("error writing data: " << e.what());532 }533 403 534 404 } -
trunk/Ladybug/LadybugComponent.h
r98 r99 4 4 //#include "Pacpus/kernel/pacpus.h" 5 5 #include "Pacpus/kernel/ComponentBase.h" 6 #include "Pacpus/kernel/DbiteFile.h"6 //#include "Pacpus/kernel/DbiteFile.h" 7 7 //#include "../NMEA0183/include/nmea0183.h" 8 8 … … 121 121 int lbNumOfFrames; 122 122 123 DbiteFile mDbtImage1;124 DbiteFile mDbtImage2;125 DbiteFile mDbtImage3;126 DbiteFile mDbtImage4;127 DbiteFile mDbtImage5;128 DbiteFile mDbtImage6;129 DbiteFile mDbtImagePano;130 131 123 }; 132 124 } -
trunk/NMEA0183/CMakeLists.txt
r59 r99 1 1 project(NMEA0183LIB) 2 2 3 find_package(Qt4 REQUIRED) 4 include(${QT_USE_FILE}) 5 include_directories(${QT_INCLUDE_DIR}) 6 link_directories (${QT_LIBRARIES}) 3 #find_package(Qt4 REQUIRED) 4 #include(${QT_USE_FILE}) 5 7 6 add_definitions(${QT_DEFINITIONS}) 7 #link_directories (${QT_LIBRARIES}) 8 8 9 include_directories(include) 9 include_directories( 10 ${QT_INCLUDE_DIR} 11 include/ 12 ) 10 13 11 14 #protocole de la centrale IXSEA -
trunk/NMEA0183/include/HSATIT.hpp
r59 r99 5 5 #include "qstring.h" 6 6 #include "NMEA0183_slim.h" 7 #include "nmea0183.h" 7 8 #include "LatLong.hpp" 8 9 #include "Sentence.hpp" -
trunk/NMEA0183/include/NMEA0183_slim.h
r59 r99 17 17 18 18 /* 19 ** Updates : Maria Alwan & G�rald Dherbomez 19 ** Updates : Maria Alwan & G�rald Dherbomez 20 20 ** Date : 14/09/2005 21 21 ** purpose : use of Qt API instead of MFC … … 32 32 #include <QString> 33 33 #include <QVector> 34 #include <QDateTime> 34 #include <QDateTime> 35 35 36 36 … … 137 137 #endif 138 138 139 #ifndef TRUE 140 #define TRUE true 141 #endif 142 143 #ifndef FALSE 144 #define FALSE false 145 #endif 139 146 //#include "nmea0183.hpp" 140 147 -
trunk/NMEA0183/include/nmea0183.h
r59 r99 137 137 #endif 138 138 139 #ifndef TRUE 140 #define TRUE true 141 #endif 142 143 #ifndef FALSE 144 #define FALSE false 145 #endif 146 139 147 #include "nmea0183.hpp" 140 148 -
trunk/NMEA0183/src/HSATIT.cpp
r59 r99 1 1 #include "HSATIT.hpp" 2 2 #include "nmea0183.h" 3 3 4 4 … … 19 19 { 20 20 21 22 heading = 0.0; 23 roll = 0.0; 24 pitch = 0.0; 25 heave = 0.0; 26 yawRotationRate = 0.0; 27 rollRotationRate = 0.0; 21 22 heading = 0.0; 23 roll = 0.0; 24 pitch = 0.0; 25 heave = 0.0; 26 yawRotationRate = 0.0; 27 rollRotationRate = 0.0; 28 28 pitchRotationRate = 0.0; 29 courseMadeGood = 0.0; 29 courseMadeGood = 0.0; 30 30 speedOverGround = 0.0; 31 longitudinalVel = 0.0; 31 longitudinalVel = 0.0; 32 32 transveralVel = 0.0; 33 33 verticalVel = 0.0; … … 43 43 { 44 44 /* 45 ** HSATIT 45 ** HSATIT 46 46 ** 47 47 ** 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 … … 49 49 ** $HSATIT,h.hhh,r.rrr,p.ppp,h.h,a.aaa,b.bbb,c.ccc,d.ddd,e.eee,f.fff,g.ggg,h.hhh,i.ii,j.jj,k.kk,l.ll,m.mm,n.nn<CR><LF> 50 50 ** 51 ** Field Number: 51 ** Field Number: 52 52 ** 1) h.hhh is the heading in deg 53 53 2) r.rrr is the roll in deg … … 68 68 17) m.mm is the east speed Std in m/s 69 69 18) n.nn is the vertical speed Std in m/s 70 71 70 71 72 72 */ 73 73 74 heading = sentence.Double( 1 ); 75 roll = sentence.Double( 2 ); 76 pitch = sentence.Double( 3 ); 77 heave = sentence.Double( 4 ); 78 yawRotationRate = sentence.Double( 5 ); 79 rollRotationRate = sentence.Double( 6 ); 74 heading = sentence.Double( 1 ); 75 roll = sentence.Double( 2 ); 76 pitch = sentence.Double( 3 ); 77 heave = sentence.Double( 4 ); 78 yawRotationRate = sentence.Double( 5 ); 79 rollRotationRate = sentence.Double( 6 ); 80 80 pitchRotationRate = sentence.Double( 7 ); 81 courseMadeGood = sentence.Double( 8 ); 81 courseMadeGood = sentence.Double( 8 ); 82 82 speedOverGround = sentence.Double( 9 ); 83 longitudinalVel = sentence.Double( 10 ); 83 longitudinalVel = sentence.Double( 10 ); 84 84 transveralVel = sentence.Double( 11 ); 85 85 verticalVel = sentence.Double( 12 ); … … 89 89 northSpeedStdDev = sentence.Double( 16 ); 90 90 eastSpeeedStdDev = sentence.Double( 17 ); 91 verticalStdDev = sentence.Double( 18 ); 91 verticalStdDev = sentence.Double( 18 ); 92 92 93 93 return( TRUE ); … … 108 108 ** Let the parent do its thing 109 109 */ 110 110 111 111 RESPONSE::Write( sentence ); 112 112 … … 115 115 sentence += pitch; 116 116 sentence += sentence += sentence += heave; 117 sentence += yawRotationRate; 118 sentence += rollRotationRate; 117 sentence += yawRotationRate; 118 sentence += rollRotationRate; 119 119 sentence += pitchRotationRate; 120 sentence += courseMadeGood; 120 sentence += courseMadeGood; 121 121 sentence += speedOverGround; 122 sentence += longitudinalVel; 122 sentence += longitudinalVel; 123 123 sentence += transveralVel; 124 124 sentence += verticalVel; … … 128 128 sentence += sentence += northSpeedStdDev; 129 129 sentence += eastSpeeedStdDev; 130 sentence += verticalStdDev; 130 sentence += verticalStdDev; 131 131 132 132 sentence.Finish(); … … 138 138 { 139 139 140 heading = source.heading; 141 roll = source.roll; 142 pitch = source.pitch; 143 heave = source.heave; 144 yawRotationRate = source.yawRotationRate; 145 rollRotationRate = source.rollRotationRate; 140 heading = source.heading; 141 roll = source.roll; 142 pitch = source.pitch; 143 heave = source.heave; 144 yawRotationRate = source.yawRotationRate; 145 rollRotationRate = source.rollRotationRate; 146 146 pitchRotationRate = source.pitchRotationRate; 147 courseMadeGood = source.courseMadeGood; 147 courseMadeGood = source.courseMadeGood; 148 148 speedOverGround = source.speedOverGround; 149 longitudinalVel = source.longitudinalVel; 149 longitudinalVel = source.longitudinalVel; 150 150 transveralVel = source.transveralVel; 151 151 verticalVel = source.verticalVel; -
trunk/OpencvVideo/CMakeLists.txt
r60 r99 1 #########################quick start############################################ 2 # cmake ../ -G "CodeBlocks - Unix Makefiles" 3 # make 4 # make install 5 # make clean 6 # sudo apt-get install libopencv-dev 7 ################################################################################ 1 8 project(OpencvVideo) 2 ################################################################################ 3 9 set(${PROJECT_NAME}_VERSION_MAJOR 0) 10 set(${PROJECT_NAME}_VERSION_MINOR 1) 4 11 # Create a DLL 5 12 add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS) 6 13 add_definitions( -DVIDEO_EXPORTS ) 7 14 15 #include(FindOpenCV.cmake) 8 16 find_package(OpenCV REQUIRED) 9 17 … … 12 20 message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library") 13 21 endif() 14 15 # ======================================== 16 # Configure qt4 17 # ======================================== 18 if(QT4_FOUND) 19 set(QT_USE_QTXML true) 20 set(QT_USE_QTNETWORK true) 21 include(${QT_USE_FILE}) 22 else() 23 message(ERROR "Qt4 needed") 24 endif() 25 26 # ======================================== 27 # Compiler definitions 28 # ======================================== 29 add_definitions( 30 ${QT_DEFINITIONS} 31 ) 32 33 # ======================================== 34 # Include directories 35 # ======================================== 36 include_directories( 37 ${PROJECT_BINARY_DIR} 38 ${QT_INCLUDE_DIR} 22 ################################################################################ 23 create_export(EXPORT_HDR ${PROJECT_NAME}) 24 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 25 add_definitions (${QT_DEFINITIONS}) 26 find_package(Qt5Network REQUIRED) 27 ################################################################################ 28 # DIRECTORIES 29 include_directories( 30 ${PROJECT_BINARY_DIR} 31 ${QT_INCLUDE_DIR} 32 ${PACPUS_INCLUDE_DIR} 33 ${PACPUS_INCLUDE_DIR}/Pacpus/ 39 34 ) 40 35 … … 42 37 # Link directories 43 38 # ======================================== 44 link_directories( ${PACPUS_LIB_DIR} ) 39 link_directories( 40 ${PACPUS_LIB_DIR} 41 ) 45 42 46 message (STATUS ${PACPUS_LIB_DIR})47 43 48 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 44 ################################################################################ 45 # FILES 46 set(PROJECT_HDRS 47 ${EXPORT_HDR} 48 CVWebcamComponent.hpp 49 WebcamWorker.hpp 50 ) 51 set(PROJECT_SRCS 52 ${PLUGIN_CPP} 53 ) 49 54 50 # ======================================== 51 # List of sources 52 # ======================================== 53 if (UNIX) 54 set( 55 PROJECT_SRCS 56 ${PLUGIN_CPP} 57 ) 55 if(OpenCV_FOUND) 56 list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp) 58 57 endif() 59 58 60 if(WIN32) 61 set( 62 PROJECT_SRCS 63 ${PLUGIN_CPP} 64 ) 65 if(OpenCV_FOUND) 66 list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp) 67 endif() 68 endif() 69 70 71 # ======================================== 72 # Files to MOC 73 # ======================================== 74 set( 75 FILES_TO_MOC 76 ${PLUGIN_H} 77 CVWebcamComponent.hpp 78 WebcamWorker.hpp 59 set(FILES_TO_MOC 60 ${PLUGIN_HDR} 61 CVWebcamComponent.hpp 62 WebcamWorker.hpp 79 63 ) 80 64 81 set( 82 UI_FILES 83 65 set(UI_FILES 84 66 ) 85 67 86 # ======================================== 87 # Call MOC 88 # ======================================== 89 qt4_wrap_cpp( 90 PROJECT_MOC_SRCS 68 ################################################################################ 69 # Qt: call moc, uic 70 qt_wrap_cpp(PROJECT_MOC_SRCS 91 71 ${FILES_TO_MOC} 92 72 ) 93 73 94 qt4_wrap_ui( 95 PROJECT_UI_SRCS 74 qt_wrap_ui(PROJECT_UI_SRCS 96 75 ${UI_FILES} 97 76 ) 98 77 99 # ======================================== 100 # Build a library 101 # ======================================== 102 pacpus_add_library( 103 ${PROJECT_NAME} SHARED 78 ################################################################################ 79 # BUILD and LINK 80 pacpus_add_library(${PROJECT_NAME} SHARED 81 ${PROJECT_HDRS} 104 82 ${PROJECT_SRCS} 105 83 ${PROJECT_MOC_SRCS} … … 107 85 ) 108 86 109 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )110 87 111 88 # ======================================== 112 89 # Libraries 113 90 # ======================================== 114 # All the platform 115 target_link_libraries( 116 ${PROJECT_NAME} 117 ${PACPUS_LIBRARIES} 118 ${QT_LIBRARIES} 119 ${PACPUS_DEPENDENCIES_LIB} 120 ${OpenCV_LIBS} 121 PacpusTools 91 set(LIBS 92 optimized FileLib debug FileLib_d 93 optimized PacpusLib debug PacpusLib_d 94 optimized PacpusTools debug PacpusTools_d 122 95 ) 123 124 # ======================================== 125 # Install 126 # ======================================== 127 pacpus_install(${PROJECT_NAME}) 128 96 if (WIN32) 97 list(APPEND LIBS 98 optimized ROAD_TIME debug ROAD_TIME_d 99 ) 100 endif() 101 # LINK 102 target_link_libraries(${PROJECT_NAME} 103 ${PACPUS_LIBRARIES} 104 ${PACPUS_DEPENDENCIES_LIB} 105 ${LIBS} 106 ${QT_LIBRARIES} 107 ${OpenCV_LIBS} 108 ) 109 qt5_use_modules(${PROJECT_NAME} Network) 110 ################################################################################ 111 # FOLDERS 112 pacpus_folder(${PROJECT_NAME} "components") 113 ################################################################################ 114 # INSTALL 115 pacpus_install(${PROJECT_NAME}) -
trunk/PacpusSocket/CMakeLists.txt
r85 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(PacpusSocket) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DPACPUSSOCKET_EXPORTS ) 2 11 ################################################################################ 3 add_definitions(-DPACPUSSOCKET_EXPORTS) 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 4 15 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 26 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 16 find_package(Qt5Network REQUIRED) 17 ################################################################################ 18 # DIRECTORIES 19 include_directories( 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 24 ) 30 25 … … 32 27 # Link directories 33 28 # ======================================== 34 link_directories( 29 link_directories( 30 ${PACPUS_LIB_DIR} 35 31 ) 36 32 37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )38 33 39 # ======================================== 40 # List of sources 41 # ======================================== 42 set( 43 PROJECT_SRCS 44 PacpusSocketAirplug.cpp 45 PacpusSocketAirplug.h 46 PacpusUDPSocket.cpp 47 PacpusUDPSocket.h 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 PacpusSocketAirplug.h 39 PacpusUDPSocket.h 40 ) 41 set(PROJECT_SRCS 48 42 ${PLUGIN_CPP} 43 PacpusSocketAirplug.cpp 44 PacpusUDPSocket.cpp 49 45 ) 50 46 51 # ======================================== 52 # Files to MOC 53 # ======================================== 54 set( 55 FILES_TO_MOC 47 set(FILES_TO_MOC 48 ${PLUGIN_HDR} 56 49 PacpusSocketAirplug.h 57 PacpusUDPSocket.h 58 ${PLUGIN_H} 50 PacpusUDPSocket.h 59 51 ) 60 52 61 set( 62 UI_FILES 63 53 set(UI_FILES 64 54 ) 65 55 66 # ======================================== 67 # Call MOC 68 # ======================================== 69 qt4_wrap_cpp( 70 PROJECT_MOC_SRCS 56 ################################################################################ 57 # Qt: call moc, uic 58 qt_wrap_cpp(PROJECT_MOC_SRCS 71 59 ${FILES_TO_MOC} 72 60 ) 73 61 74 qt4_wrap_ui( 75 PROJECT_UI_SRCS 62 qt_wrap_ui(PROJECT_UI_SRCS 76 63 ${UI_FILES} 77 64 ) 78 65 79 # ======================================== 80 # Build a library 81 # ======================================== 82 pacpus_add_library( 83 ${PROJECT_NAME} SHARED 66 ################################################################################ 67 # BUILD and LINK 68 pacpus_add_library(${PROJECT_NAME} SHARED 69 ${PROJECT_HDRS} 84 70 ${PROJECT_SRCS} 85 71 ${PROJECT_MOC_SRCS} … … 87 73 ) 88 74 75 89 76 # ======================================== 90 77 # Libraries 91 78 # ======================================== 92 # All the platform 93 target_link_libraries( 94 ${PROJECT_NAME} 95 ${PACPUS_LIBRARIES} 96 ${QT_LIBRARIES} 97 ${PACPUS_DEPENDENCIES_LIB} 79 set(LIBS 80 optimized FileLib debug FileLib_d 81 optimized PacpusLib debug PacpusLib_d 82 optimized PacpusTools debug PacpusTools_d 98 83 ) 84 if (WIN32) 85 list(APPEND LIBS 86 optimized ROAD_TIME debug ROAD_TIME_d 87 ) 88 endif() 89 # LINK 90 target_link_libraries(${PROJECT_NAME} 91 ${PACPUS_LIBRARIES} 92 ${PACPUS_DEPENDENCIES_LIB} 93 ${LIBS} 94 ${QT_LIBRARIES} 95 ) 96 qt5_use_modules(${PROJECT_NAME} Network) 97 ################################################################################ 98 # FOLDERS 99 pacpus_folder(${PROJECT_NAME} "components") 100 ################################################################################ 101 # INSTALL 102 pacpus_install(${PROJECT_NAME}) 99 103 100 # ======================================== 101 # Install 102 # ======================================== 103 pacpus_install(${PROJECT_NAME}) 104 install( 105 DIRECTORY ${PacpusSocket_SOURCE_DIR} 106 DESTINATION ${PACPUS_INSTALL_DIR}/include 107 FILES_MATCHING PATTERN "*.h" 108 ) -
trunk/PacpusSocket/PacpusUDPSocket.cpp
r87 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 12 12 *********************************************************************/ 13 13 14 #include "PacpusUDPSocket.h" 14 #include "PacpusUDPSocket.h" 15 15 16 16 #include <qbuffer.h> … … 27 27 // Construct the factory 28 28 ////////////////////////////////////////////////////////////////////////// 29 static ComponentFactory <PacpusUDPSocket> sFactory("PacpusUDPSocket"); 29 static ComponentFactory <PacpusUDPSocket> sFactory("PacpusUDPSocket"); 30 30 31 31 … … 34 34 ////////////////////////////////////////////////////////////////////////// 35 35 PacpusUDPSocket::PacpusUDPSocket(QString name) 36 : ComponentBase(name) 37 { 38 } 36 : ComponentBase(name) 37 { 38 } 39 39 40 40 … … 42 42 // Destructor 43 43 ////////////////////////////////////////////////////////////////////////// 44 PacpusUDPSocket::~PacpusUDPSocket() 44 PacpusUDPSocket::~PacpusUDPSocket() 45 45 { 46 46 } … … 52 52 void PacpusUDPSocket::addOutputs() 53 53 { 54 addOutput<QString, PacpusUDPSocket>(" udpSocketOutput");54 addOutput<QString, PacpusUDPSocket>("string"); 55 55 } 56 56 … … 61 61 void PacpusUDPSocket::addInputs() 62 62 { 63 addInput<QString, PacpusUDPSocket>("udpSocketInput", &PacpusUDPSocket::sendDatagrams);64 } 65 66 67 ////////////////////////////////////////////////////////////////////////// 68 // Called by the ComponentManager to pass the XML parameters to the 69 // component 70 ////////////////////////////////////////////////////////////////////////// 71 ComponentBase::COMPONENT_CONFIGURATION PacpusUDPSocket::configureComponent(XmlComponentConfig config) 72 { 63 addInput<QString, PacpusUDPSocket>("string", &PacpusUDPSocket::sendQString); 64 } 65 66 67 ////////////////////////////////////////////////////////////////////////// 68 // Called by the ComponentManager to pass the XML parameters to the 69 // component 70 ////////////////////////////////////////////////////////////////////////// 71 ComponentBase::COMPONENT_CONFIGURATION PacpusUDPSocket::configureComponent(XmlComponentConfig config) 72 { 73 73 74 74 socketType_ = config.getProperty("typeSocket"); 75 75 76 76 if (socketType_ == "client" || socketType_ == "Client") 77 77 { 78 78 address2send_.setAddress(config.getProperty("address")); 79 79 port2send_ = config.getProperty("port").toUInt(); 80 socketType_ = "client"; 80 socketType_ = "client"; 81 81 } 82 82 else if (socketType_ == "server" || socketType_ == "Server") … … 92 92 socketType_ = "client"; 93 93 } 94 95 return ComponentBase::CONFIGURED_OK; 96 } 94 95 return ComponentBase::CONFIGURED_OK; 96 } 97 97 98 98 … … 100 100 // Called by the ComponentManager to start the component 101 101 ////////////////////////////////////////////////////////////////////////// 102 void PacpusUDPSocket::startActivity() 103 { 102 void PacpusUDPSocket::startActivity() 103 { 104 104 if (!(udpSocket_ = new QUdpSocket())) 105 105 qFatal("Failed to init UDP socket!"); 106 106 107 107 if (socketType_ == "server") 108 108 { … … 112 112 qWarning() << "Failed to bind socket for server on port" << port2bind_; 113 113 } 114 114 115 115 connect(udpSocket_, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams())); 116 117 u pdSocketOutput_ = getTypedOutput<QString, PacpusUDPSocket>("udpSocketOutput");116 117 udpSocketOutput_ = getTypedOutput<QString, PacpusUDPSocket>("string"); 118 118 } 119 119 … … 122 122 // Send datagram QString 123 123 ////////////////////////////////////////////////////////////////////////// 124 void PacpusUDPSocket::send Datagrams(QString frame)125 { 124 void PacpusUDPSocket::sendQString(const QString& frame) 125 { 126 126 int sent=0; 127 127 128 128 if (socketType_ == "client") 129 129 { 130 if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), address2send_, port2send_)) == -1) 131 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl; 130 if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), address2send_, port2send_)) == -1) 131 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl; 132 132 } 133 133 else if (socketType_ == "server") … … 135 135 for (int i = 0; i < listClients.size(); i++) 136 136 { 137 if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), listClients[i]->getAddress(), listClients[i]->getPort())) == -1) 138 qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl; 137 if ((sent = udpSocket_->writeDatagram(frame.toLocal8Bit(), listClients[i]->getAddress(), listClients[i]->getPort())) == -1) 138 qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl; 139 139 } 140 140 } 141 } 141 } 142 142 143 143 … … 145 145 // Send datagram QByteArray 146 146 ////////////////////////////////////////////////////////////////////////// 147 void PacpusUDPSocket::sendDatagrams(QByteArray frame) 148 { 147 void PacpusUDPSocket::sendDatagrams(QByteArray frame) 148 { 149 149 int sent=0; 150 150 151 151 if (socketType_ == "client") 152 152 { 153 if ((sent = udpSocket_->writeDatagram(frame, address2send_, port2send_)) == -1) 154 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl; 153 if ((sent = udpSocket_->writeDatagram(frame, address2send_, port2send_)) == -1) 154 qDebug() << "Failed to send the frame: " << address2send_ << port2send_ << frame << endl; 155 155 } 156 156 else if (socketType_ == "server") … … 158 158 for (int i = 0; i < listClients.size(); i++) 159 159 { 160 if ((sent = udpSocket_->writeDatagram(frame, listClients[i]->getAddress(), listClients[i]->getPort())) == -1) 161 qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl; 160 if ((sent = udpSocket_->writeDatagram(frame, listClients[i]->getAddress(), listClients[i]->getPort())) == -1) 161 qDebug() << "Failed to send the frame: " << listClients[i]->getAddress() << listClients[i]->getPort() << frame << endl; 162 162 } 163 163 } 164 } 165 166 167 ////////////////////////////////////////////////////////////////////////// 168 // Called when the socket receive a new datagram 164 } 165 166 167 ////////////////////////////////////////////////////////////////////////// 168 // Called when the socket receive a new datagram 169 169 ////////////////////////////////////////////////////////////////////////// 170 170 void PacpusUDPSocket::readPendingDatagrams() 171 171 { 172 while (udpSocket_->hasPendingDatagrams()) 173 { 174 QByteArray datagram; 175 datagram.resize(udpSocket_->pendingDatagramSize()); 176 QHostAddress sender; 172 while (udpSocket_->hasPendingDatagrams()) 173 { 174 QByteArray datagram; 175 datagram.resize(udpSocket_->pendingDatagramSize()); 176 QHostAddress sender; 177 177 quint16 senderPort; 178 178 179 179 if(udpSocket_->readDatagram(datagram.data(), datagram.size(), &sender, &senderPort) != -1) 180 { 180 { 181 181 if (socketType_ == "server") 182 182 { 183 183 bool flag = false; 184 185 for (int i = 0; i < listClients.size(); i++) 186 { 184 185 for (int i = 0; i < listClients.size(); i++) 186 { 187 187 if (listClients[i]->getAddress() == sender && listClients[i]->getPort() == senderPort) 188 188 flag = true; 189 189 } 190 190 191 191 if (flag == false) 192 192 listClients << new Client(sender, senderPort); 193 193 } 194 195 if (u pdSocketOutput_ && updSocketOutput_->hasConnection())196 u pdSocketOutput_->send(QString(datagram.data()));194 195 if (udpSocketOutput_ && udpSocketOutput_->hasConnection()) 196 udpSocketOutput_->send(QString(datagram.data())); 197 197 } 198 198 else -
trunk/PacpusSocket/PacpusUDPSocket.h
r87 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 15 15 16 16 #include "Pacpus/kernel/Log.h" 17 #include "Pacpus/kernel/ComponentBase.h" 18 #include "Pacpus/kernel/ComponentFactory.h" 17 #include "Pacpus/kernel/ComponentBase.h" 18 #include "Pacpus/kernel/ComponentFactory.h" 19 19 20 20 // Export macro for PacpusSocket DLL for Windows only … … 28 28 # endif 29 29 #else 30 // On other platforms, simply ignore this 31 # define PACPUSSOCKET_API 30 // On other platforms, simply ignore this 31 # define PACPUSSOCKET_API 32 32 #endif 33 33 … … 38 38 class PACPUSSOCKET_API Client 39 39 { 40 public: 40 public: 41 41 /// Constructor 42 42 Client(); … … 44 44 /// Destructor 45 45 ~Client(); 46 46 47 47 QHostAddress address_; 48 48 quint16 port_; 49 50 QHostAddress getAddress() {return address_;}; 49 50 QHostAddress getAddress() {return address_;}; 51 51 quint16 getPort() {return port_;}; 52 52 }; … … 54 54 class PACPUSSOCKET_API PacpusUDPSocket 55 55 : public QObject 56 , public ComponentBase 57 { 56 , public ComponentBase 57 { 58 58 Q_OBJECT 59 59 60 public: 60 public: 61 61 /// Constructor 62 62 PacpusUDPSocket(QString name); … … 71 71 72 72 /// Slot d'envoie des paquets 73 void send Datagrams(QStringframe);73 void sendQString(const QString& frame); 74 74 void sendDatagrams(QByteArray frame); 75 75 76 76 Q_SIGNALS: 77 77 void newDatagram(QByteArray datagram); … … 83 83 virtual void stopActivity(); 84 84 virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 85 86 85 86 virtual void addInputs(); 87 87 virtual void addOutputs(); 88 89 88 89 OutputInterface<QString, PacpusUDPSocket>* udpSocketOutput_; 90 90 91 91 QUdpSocket * udpSocket_; … … 94 94 quint16 port2send_; 95 95 QHostAddress address2send_; 96 QString socketType_; 97 96 QString socketType_; 97 98 98 QList <Client *> listClients; 99 99 }; -
trunk/PtGreyCameras/CMakeLists.txt
r64 r99 1 #########################quick start############################################ 2 # cmake ../ -G "CodeBlocks - Unix Makefiles" 3 # make 4 # make install 5 # make clean 6 # sudo apt-get install libopencv-dev 7 ################################################################################ 1 8 project(PtGreyCameras) 9 set(${PROJECT_NAME}_VERSION_MAJOR 0) 10 set(${PROJECT_NAME}_VERSION_MINOR 1) 11 # Create a DLL 12 add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS) 13 add_definitions( -DVIDEO_EXPORTS ) 14 15 #include(FindOpenCV.cmake) 16 find_package(OpenCV REQUIRED) 17 18 # Check for OpenCV 19 if(NOT OpenCV_FOUND) 20 message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library") 21 endif() 2 22 ################################################################################ 3 add_definitions(-DPTGREYCAMERAS_EXPORTS) 4 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Find dependencies 18 # ======================================== 19 find_package(OpenCV REQUIRED) 20 if(OpenCV_FOUND) 21 list(APPEND OpenCV_LIBS ${OpenCV_LIBRARIES}) 22 list(APPEND OpenCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS}) 23 include_directories(${OpenCV_INCLUDE_DIR}) 24 endif(OpenCV_FOUND) 25 26 27 # ======================================== 28 # Compiler definitions 29 # ======================================== 30 add_definitions( 31 ${QT_DEFINITIONS} 32 ) 23 create_export(EXPORT_HDR ${PROJECT_NAME}) 24 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 25 add_definitions (${QT_DEFINITIONS}) 33 26 # ======================================== 34 27 # Options … … 63 56 endif() 64 57 endif() 65 66 # ======================================== 67 # Include directories 68 # ======================================== 69 include_directories( 70 ${PACPUS_INCLUDE_HINT} 71 ${QT_INCLUDE_DIR} 72 ${OPT_INCLUDE_DIRS} 73 ${OpenCV_INCLUDE_DIR} 58 find_package(Qt5Network REQUIRED) 59 ################################################################################ 60 # DIRECTORIES 61 include_directories( 62 ${PROJECT_BINARY_DIR} 63 ${QT_INCLUDE_DIR} 64 ${PACPUS_INCLUDE_DIR} 65 ${PACPUS_INCLUDE_DIR}/Pacpus/ 74 66 ) 75 67 … … 77 69 # Link directories 78 70 # ======================================== 79 link_directories( 80 ${PACPUS_LIBRARY_HINT}71 link_directories( 72 ${PACPUS_LIB_DIR} 81 73 ) 82 74 83 message("Creating source files for the plugin(s)") 84 message(STATUS PLUGIN_H=${PLUGIN_H}) 85 message(STATUS PLUGIN_CPP=${PLUGIN_CPP}) 75 ################################################################################ 76 # FILES 77 set(PROJECT_HDRS 78 ${EXPORT_HDR} 79 PtGreyCamerasExp.h 80 #../../StdDbtPlayerComponents/ImageBaseStructure.h 81 ) 82 set(PROJECT_SRCS 83 ${PLUGIN_CPP} 84 ) 86 85 87 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 86 if(OpenCV_FOUND) 87 list(APPEND OpenCV_LIBS ${OpenCV_LIBRARIES}) 88 list(APPEND OpenCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS}) 89 include_directories(${OpenCV_INCLUDE_DIR}) 90 endif(OpenCV_FOUND) 88 91 89 # ========================================90 # List of sources91 # ========================================92 set(93 PROJECT_SRCS94 PtGreyCamerasExp.h95 #../../StdDbtPlayerComponents/ImageBaseStructure.h96 ${PLUGIN_CPP}97 )98 92 if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND ) 99 93 list(APPEND PROJECT_SRCS … … 112 106 endif() 113 107 114 # ======================================== 115 # Files to MOC 116 # ======================================== 117 set( 118 FILES_TO_MOC 119 ${PLUGIN_H} 108 set(FILES_TO_MOC 109 ${PLUGIN_HDR} 120 110 ) 121 111 if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND) … … 134 124 endif() 135 125 136 set( 137 UI_FILES 138 # WidgetIMU.ui 139 126 set(UI_FILES 140 127 ) 141 128 142 # ======================================== 143 # Directories architecture 144 # ======================================== 145 #SOURCE_GROUP(PtGreyCameras FILES ${PROJECT_SRCS} ) 146 SOURCE_GROUP(moc FILES ${PROJECT_MOC_SRCS}) 147 148 # ======================================== 149 # Call MOC 150 # ======================================== 151 qt4_wrap_cpp( 152 PROJECT_MOC_SRCS 129 ################################################################################ 130 # Qt: call moc, uic 131 qt_wrap_cpp(PROJECT_MOC_SRCS 153 132 ${FILES_TO_MOC} 154 133 ) 155 134 156 qt4_wrap_ui( 157 PROJECT_UI_SRCS 135 qt_wrap_ui(PROJECT_UI_SRCS 158 136 ${UI_FILES} 159 137 ) 160 138 161 # ======================================== 162 # Build a library 163 # ======================================== 164 pacpus_add_library( 165 ${PROJECT_NAME} SHARED 139 ################################################################################ 140 # BUILD and LINK 141 pacpus_add_library(${PROJECT_NAME} SHARED 142 ${PROJECT_HDRS} 166 143 ${PROJECT_SRCS} 167 144 ${PROJECT_MOC_SRCS} 168 145 ${PROJECT_UI_SRCS} 169 146 ) 147 148 170 149 # ======================================== 171 150 # Libraries 172 151 # ======================================== 173 # All the platform 174 message ( "\${VAR} = ${OPT_LIBRARIES}") 175 target_link_libraries( 176 ${PROJECT_NAME} 177 ${PACPUS_LIBRARIES} 178 ${QT_LIBRARIES} 179 optimized ${OPT_LIBRARIES} debug ${DBG_LIBRARIES} 180 ${PACPUS_DEPENDENCIES_LIB} 181 ${OpenCV_LIBS} 182 ${BumbleBeeXB3_PGR_LIBRARIES} 183 ${BumbleBeeXB3_TRICLOPS_LIBRARIES} 152 set(LIBS 153 optimized FileLib debug FileLib_d 154 optimized PacpusLib debug PacpusLib_d 155 optimized PacpusTools debug PacpusTools_d 184 156 ) 185 186 # ======================================== 187 # Install 188 # ======================================== 189 pacpus_install(${PROJECT_NAME}) 157 if (WIN32) 158 list(APPEND LIBS 159 optimized ROAD_TIME debug ROAD_TIME_d 160 ) 161 endif() 162 # LINK 163 target_link_libraries(${PROJECT_NAME} 164 ${PACPUS_LIBRARIES} 165 ${PACPUS_DEPENDENCIES_LIB} 166 ${LIBS} 167 ${QT_LIBRARIES} 168 ${OpenCV_LIBS} 169 ) 170 qt5_use_modules(${PROJECT_NAME} Network) 171 ################################################################################ 172 # FOLDERS 173 pacpus_folder(${PROJECT_NAME} "components") 174 ################################################################################ 175 # INSTALL 176 pacpus_install(${PROJECT_NAME}) -
trunk/PtGreyCameras/Flea3Grabber.h
r64 r99 5 5 // author: Danilo Alves de Lima 6 6 // Copyright Heudiasyc UMR UTC/CNRS 6599 7 // 7 // 8 8 // version: $Id: $ 9 9 // 10 // purpose: 10 // purpose: 11 11 *********************************************************************/ 12 12 … … 31 31 #include <string> 32 32 #include <vector> 33 #include "../ ../../Pacpussensors/trunk/StdDbtPlayerComponents/ImageBaseStructure.h"33 #include "../StdDbtPlayerComponents/ImageBaseStructure.h" 34 34 35 35 namespace pacpus { … … 58 58 unsigned int cam_trigger_mode; // Trigger mode 59 59 unsigned int cam_trigger_enable; // Trigger enable (1 on // 0 off) 60 unsigned int cam_trigger_parameter; 60 unsigned int cam_trigger_parameter; 61 61 unsigned int cam_trigger_polarity; // Trigger polarity (0 low // 1 high) 62 62 unsigned int cam_trigger_source; // Source (GPIO) … … 85 85 //---------------------------------------------------------------------------------------------------------------- 86 86 bool showdebug; // Show frame acquired 87 88 int mMaxImageOutputSize; // Size of the input image data in the memory 89 87 88 int mMaxImageOutputSize; // Size of the input image data in the memory 89 90 90 // Output directory 91 91 QDir mOutputDirectory; … … 98 98 99 99 /** Class to provide the obstacle detection from a disparity map data */ 100 class PTGREYCAMERAS_API Flea3Grabber: public QThread, 100 class PTGREYCAMERAS_API Flea3Grabber: public QThread, 101 101 public ComponentBase 102 102 { … … 114 114 //============================================================================================== 115 115 116 /** 116 /** 117 117 * Initialize default values 118 118 */ 119 119 void InitDefault(int indice); 120 120 121 int img2send_; 121 int img2send_; 122 122 123 123 protected: -
trunk/PtGreyCameras/PtGreyCamerasPlugin.cpp
r48 r99 1 // Autogenerated file by Pacpus Plugin.cmake1 // Autogenerated file by PacpusUtilities.cmake 2 2 // DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE 3 3 … … 17 17 } 18 18 19 Q_EXPORT_PLUGIN2(PtGreyCamerasPlugin, PtGreyCamerasPlugin) 19 //Qt4 Plugin Macro desactivated 20 //Q_EXPORT_PLUGIN2(PtGreyCamerasPlugin, PtGreyCamerasPlugin) -
trunk/PtGreyCameras/PtGreyCamerasPlugin.h
r48 r99 1 // Autogenerated file by Pacpus Plugin.cmake1 // Autogenerated file by PacpusUtilities.cmake 2 2 // DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE 3 3 … … 16 16 { 17 17 Q_OBJECT 18 //Qt5 Plugins Macro 19 Q_PLUGIN_METADATA(IID "pacpus.PtGreyCamerasPlugin" FILE "PtGreyCamerasPlugin.json") 18 20 Q_INTERFACES(PacpusPluginInterface) 19 21 -
trunk/Sick/CMakeLists.txt
r71 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(Sick) 2 3 ################################################################################ 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 4 10 add_definitions( -DSICK_EXPORTS ) 5 11 add_definitions( -DSICKLDMRS_EXPORTS ) 6 12 add_definitions( -DSICKLMS_EXPORTS ) 13 ################################################################################ 14 create_export(EXPORT_HDR ${PROJECT_NAME}) 15 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 16 add_definitions (${QT_DEFINITIONS}) 7 17 8 # ======================================== 9 # Configure qt4 10 # ======================================== 11 if(QT4_FOUND) 12 set(QT_USE_QTXML true) 13 set(QT_USE_QTNETWORK true) 14 include(${QT_USE_FILE}) 15 else() 16 message(ERROR "Qt4 needed") 17 endif() 18 find_package(OpenGL REQUIRED) 19 # ======================================== 20 # Compiler definitions 21 # ======================================== 22 add_definitions( 23 ${QT_DEFINITIONS} 24 ) 25 26 # ======================================== 27 # Include directories 28 # ======================================== 29 include_directories( 30 ${PROJECT_BINARY_DIR} 31 ${QT_INCLUDE_DIR} 18 find_package(Qt5Network REQUIRED) 19 ################################################################################ 20 # DIRECTORIES 21 include_directories( 22 ${PROJECT_BINARY_DIR} 23 ${QT_INCLUDE_DIR} 24 ${PACPUS_INCLUDE_DIR} 25 ${PACPUS_INCLUDE_DIR}/Pacpus/ 32 26 ) 33 27 … … 35 29 # Link directories 36 30 # ======================================== 37 link_directories( ${PACPUS_LIB_DIR} 31 link_directories( 32 ${PACPUS_LIB_DIR} 38 33 ) 39 34 40 35 41 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 42 43 # ======================================== 44 # List of sources 45 # ======================================== 46 set( 47 PROJECT_SRCS 48 SickComponent.h 49 SickComponent.cpp 50 AbstractSickSensor.h 51 AbstractSickSensor.cpp 52 SickLDMRSSensor.h 53 SickLDMRSSensor.cpp 54 SickLMSSensor.h 55 SickLMSSensor.cpp 56 SickSocket.h 57 SickSocket.cpp 36 ################################################################################ 37 # FILES 38 set(PROJECT_HDRS 39 ${EXPORT_HDR} 40 SickComponent.h 41 AbstractSickSensor.h 42 SickLDMRSSensor.h 43 SickLMSSensor.h 44 SickSocket.h 45 xml/${PROJECT_NAME}.xml 46 xml/${PROJECT_NAME}_d.xml 47 ) 48 set(PROJECT_SRCS 58 49 ${PLUGIN_CPP} 50 SickComponent.cpp 51 AbstractSickSensor.cpp 52 SickLDMRSSensor.cpp 53 SickLMSSensor.cpp 54 SickSocket.cpp 59 55 ) 60 56 61 # ======================================== 62 # Files to MOC 63 # ======================================== 64 set( 65 FILES_TO_MOC 66 SickComponent.h 67 SickLDMRSSensor.h 68 SickLMSSensor.h 69 AbstractSickSensor.h 70 SickSocket.h 71 ${PLUGIN_H} 57 set(FILES_TO_MOC 58 ${PLUGIN_HDR} 59 SickComponent.h 60 AbstractSickSensor.h 61 SickLDMRSSensor.h 62 SickLMSSensor.h 63 SickSocket.h 72 64 ) 73 65 74 set( 75 UI_FILES 76 66 set(UI_FILES 77 67 ) 78 68 79 # ======================================== 80 # Call MOC 81 # ======================================== 82 qt4_wrap_cpp( 83 PROJECT_MOC_SRCS 69 ################################################################################ 70 # Qt: call moc, uic 71 qt_wrap_cpp(PROJECT_MOC_SRCS 84 72 ${FILES_TO_MOC} 85 73 ) 86 74 87 qt4_wrap_ui( 88 PROJECT_UI_SRCS 75 qt_wrap_ui(PROJECT_UI_SRCS 89 76 ${UI_FILES} 90 77 ) 91 78 92 # ======================================== 93 # Build a library 94 # ======================================== 95 pacpus_add_library( 96 ${PROJECT_NAME} SHARED 79 ################################################################################ 80 # BUILD and LINK 81 pacpus_add_library(${PROJECT_NAME} SHARED 82 ${PROJECT_HDRS} 97 83 ${PROJECT_SRCS} 98 84 ${PROJECT_MOC_SRCS} … … 100 86 ) 101 87 102 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )103 88 89 # ======================================== 90 # Libraries 91 # ======================================== 104 92 set(LIBS 105 93 optimized FileLib debug FileLib_d … … 112 100 ) 113 101 endif() 114 115 # ======================================== 116 # Libraries 117 # ======================================== 118 # All the platform 119 target_link_libraries( 120 ${PROJECT_NAME} 121 ${PACPUS_LIBRARIES} 122 ${QT_LIBRARIES} 123 ${PACPUS_DEPENDENCIES_LIB} 124 ${OPENGL_LIBRARIES} 125 ${LIBS} 126 ) 127 102 # LINK 103 target_link_libraries(${PROJECT_NAME} 104 ${PACPUS_LIBRARIES} 105 ${PACPUS_DEPENDENCIES_LIB} 106 ${LIBS} 107 ${QT_LIBRARIES} 108 ) 109 qt5_use_modules(${PROJECT_NAME} Network) 110 ################################################################################ 111 # FOLDERS 128 112 pacpus_folder(${PROJECT_NAME} "components") 129 130 # ======================================== 131 # Install 132 # ======================================== 133 pacpus_install(${PROJECT_NAME}) 113 ################################################################################ 114 # INSTALL 115 pacpus_install(${PROJECT_NAME}) -
trunk/Sick/SickSocket.cpp
r72 r99 97 97 mutex.lock(); 98 98 QTextStream os(socket); 99 os << data.to Ascii() << endl;99 os << data.toLatin1() << endl;//change in qt5 100 100 mutex.unlock(); 101 qDebug() << "data sent to server: " << data.to Ascii() ; //a adapter aussi101 qDebug() << "data sent to server: " << data.toLatin1() ; //a adapter aussi 102 102 } 103 103 -
trunk/SpanCPTComponent/CMakeLists.txt
r59 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(SpanCPTComponent) 2 8 … … 4 10 add_definitions( -DCPTCOMPONENT_EXPORTS ) 5 11 add_definitions( -DPLUGINLIB_EXPORTS ) 12 ################################################################################ 13 create_export(EXPORT_HDR ${PROJECT_NAME}) 14 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 15 add_definitions (${QT_DEFINITIONS}) 6 16 7 8 # ======================================== 9 # Configure qt4 10 # ======================================== 11 if(QT4_FOUND) 12 set(QT_USE_QTXML true) 13 set(QT_USE_QTNETWORK true) 14 include(${QT_USE_FILE}) 15 else() 16 message(ERROR "Qt4 needed") 17 endif() 18 19 # ======================================== 20 # Compiler definitions 21 # ======================================== 22 add_definitions( 23 ${QT_DEFINITIONS} 24 ) 25 26 # ======================================== 27 # Include directories 28 # ======================================== 29 include_directories( 30 ${PROJECT_BINARY_DIR} 31 ${QT_INCLUDE_DIR} 17 find_package(Qt5Network REQUIRED) 18 ################################################################################ 19 # DIRECTORIES 20 include_directories( 21 ${PROJECT_BINARY_DIR} 22 ${QT_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR} 24 ${PACPUS_INCLUDE_DIR}/Pacpus/ 32 25 ) 33 26 … … 40 33 41 34 42 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 43 44 # ======================================== 45 # List of sources 46 # ======================================== 47 set( 48 PROJECT_SRCS 49 CPTComponent.h 50 CPTComponent.cpp 35 ################################################################################ 36 # FILES 37 set(PROJECT_HDRS 38 ${EXPORT_HDR} 39 CPTComponent.h 51 40 ../driver/AbstractSerialPort.h 52 ../driver/AbstractSerialPort.cpp 41 xml/spancpt.xml 42 ) 43 set(PROJECT_SRCS 53 44 ${PLUGIN_CPP} 45 CPTComponent.cpp 46 ../driver/AbstractSerialPort.cpp 54 47 ) 55 48 … … 70 63 endif(UNIX) 71 64 72 73 # ========================================74 # Files to MOC75 # ========================================76 77 65 if(UNIX) 78 66 set(FILES_TO_MOC … … 80 68 CPTComponent.h 81 69 ../driver/PosixSerialPort.h 82 ${PLUGIN_H }70 ${PLUGIN_HDR} 83 71 ) 84 72 endif(UNIX) … … 89 77 CPTComponent.h 90 78 ../driver/Win32SerialPort.h 91 ${PLUGIN_H }79 ${PLUGIN_HDR} 92 80 ) 93 81 endif(WIN32) 94 82 95 set( 96 UI_FILES 83 set(UI_FILES 97 84 ) 98 85 99 # ======================================== 100 # Call MOC 101 # ======================================== 102 qt4_wrap_cpp( 103 PROJECT_MOC_SRCS 86 ################################################################################ 87 # Qt: call moc, uic 88 qt_wrap_cpp(PROJECT_MOC_SRCS 104 89 ${FILES_TO_MOC} 105 90 ) 106 91 107 qt4_wrap_ui( 108 PROJECT_UI_SRCS 92 qt_wrap_ui(PROJECT_UI_SRCS 109 93 ${UI_FILES} 110 94 ) 111 95 112 # ======================================== 113 # Build a library 114 # ======================================== 115 pacpus_add_library( 116 ${PROJECT_NAME} SHARED 96 ################################################################################ 97 # BUILD and LINK 98 pacpus_add_library(${PROJECT_NAME} SHARED 99 ${PROJECT_HDRS} 117 100 ${PROJECT_SRCS} 118 101 ${PROJECT_MOC_SRCS} … … 120 103 ) 121 104 105 122 106 # ======================================== 123 107 # Libraries 124 108 # ======================================== 125 if(WIN32) 126 set(LIBS 127 # add your specific libraries to link here 128 optimized NMEA0183LIB debug NMEA0183LIB_d 129 optimized PacpusTools debug PacpusTools_d 109 set(LIBS 110 optimized FileLib debug FileLib_d 111 optimized PacpusLib debug PacpusLib_d 112 optimized PacpusTools debug PacpusTools_d 113 optimized NMEA0183LIB debug NMEA0183LIB_d 114 ) 115 if (WIN32) 116 list(APPEND LIBS 117 optimized ROAD_TIME debug ROAD_TIME_d 130 118 ) 131 endif(WIN32) 132 133 if(UNIX) 134 set(LIBS 135 # add your specific libraries to link here 136 137 ) 138 endif(UNIX) 139 140 # All the platform 141 target_link_libraries( 142 ${PROJECT_NAME} 143 ${PACPUS_LIBRARIES} 144 ${QT_LIBRARIES} 145 ${PACPUS_DEPENDENCIES_LIB} 146 ${LIBS} 147 # optimized PacpusTools debug PacpusTools_d 148 ) 119 endif() 120 # LINK 121 target_link_libraries(${PROJECT_NAME} 122 ${PACPUS_LIBRARIES} 123 ${PACPUS_DEPENDENCIES_LIB} 124 ${LIBS} 125 ${QT_LIBRARIES} 126 ) 127 qt5_use_modules(${PROJECT_NAME} Network) 128 ################################################################################ 129 # FOLDERS 149 130 pacpus_folder(${PROJECT_NAME} "components") 150 151 # ======================================== 152 # Install 153 # ======================================== 154 pacpus_install(${PROJECT_NAME}) 155 131 ################################################################################ 132 # INSTALL 133 pacpus_install(${PROJECT_NAME}) -
trunk/SpanCPTComponent/CPTComponent.cpp
r88 r99 183 183 memcpy(buffer, currentDataFrame, currentDataFrameLength_); 184 184 buffer[currentDataFrameLength_] = '\0'; // add a \0 to convert for the conversion in QString 185 currentDataFrame_ = QString::fromAscii(buffer); 185 currentDataFrame_ = ""; 186 currentDataFrame_.append(buffer); 186 187 187 188 delete[] buffer; -
trunk/SpanCPTComponent/CPTComponent.h
r88 r99 17 17 #include <fstream> 18 18 #include <qobject.h> 19 #include <QPointF> 19 20 #include <string> 20 21 … … 162 163 TimestampedInscovFrame*); 163 164 164 165 166 165 // component ouputs 166 void addOutputs(); 167 OutputInterface<QPointF, CPTComponent>* position2DENUOutput_; 167 168 }; 168 169 -
trunk/StdDbtPlayerComponents/CMakeLists.txt
r94 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(StdDbtPlayerComponents) 2 3 ################################################################################ 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 4 10 add_definitions( -DSTDDBTPLAYERCOMPONENTS_EXPORTS ) 5 11 add_definitions( -DDBTPLYSICK_EXPORTS) 6 12 add_definitions( -DDBTPLYSICK_EXPORTS) 7 # ======================================== 8 # Include directories 9 # ======================================== 10 include_directories( 11 ${PROJECT_BINARY_DIR} 12 ${QT_INCLUDE_DIR} 13 ################################################################################ 14 create_export(EXPORT_HDR ${PROJECT_NAME}) 15 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 16 add_definitions (${QT_DEFINITIONS}) 17 18 find_package(Qt5Network REQUIRED) 19 ################################################################################ 20 # DIRECTORIES 21 include_directories( 22 ${PROJECT_BINARY_DIR} 23 ${QT_INCLUDE_DIR} 24 ${PACPUS_INCLUDE_DIR} 25 ${PACPUS_INCLUDE_DIR}/Pacpus/ 13 26 ) 14 27 … … 16 29 # Link directories 17 30 # ======================================== 18 link_directories( ${PACPUS_LIB_DIR} 19 ) 20 21 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 22 23 set(HDRS 24 StdDbtPlayerComponentsConfig.h 25 DbtPlySickLMSManager.h 26 DbtPlySickLDMRSManager.h 31 link_directories( 32 ${PACPUS_LIB_DIR} 27 33 ) 28 34 29 35 30 # ======================================== 31 # List of sources 32 # ======================================== 33 set( 34 PROJECT_SRCS 36 ################################################################################ 37 # FILES 38 set(PROJECT_HDRS 39 ${EXPORT_HDR} 40 StdDbtPlayerComponentsConfig.h 41 DbtPlySickLMSManager.h 42 DbtPlySickLDMRSManager.h 43 ${PROJECT_NAME}.xml 44 ${PROJECT_NAME}_d.xml 45 ) 46 set(PROJECT_SRCS 47 ${PLUGIN_CPP} 35 48 DbtPlySickLMSManager.cpp 36 DbtPlySickLDMRSManager.cpp 37 ${HDRS} 38 ${PLUGIN_CPP} 49 DbtPlySickLDMRSManager.cpp 39 50 ) 40 51 41 # ======================================== 42 # Files to MOC 43 # ======================================== 44 set( 45 FILES_TO_MOC 52 set(FILES_TO_MOC 53 ${PLUGIN_HDR} 46 54 DbtPlySickLMSManager.h 47 DbtPlySickLDMRSManager.h 48 ${PLUGIN_H} 49 ) 50 51 52 set( 53 UI_FILES 54 55 DbtPlySickLDMRSManager.h 55 56 ) 56 57 57 # ======================================== 58 # Call MOC 59 # ======================================== 60 qt_wrap_cpp( 61 PROJECT_MOC_SRCS 58 set(UI_FILES 59 ) 60 61 ################################################################################ 62 # Qt: call moc, uic 63 qt_wrap_cpp(PROJECT_MOC_SRCS 62 64 ${FILES_TO_MOC} 63 65 ) 64 66 65 qt_wrap_ui( 66 PROJECT_UI_SRCS 67 qt_wrap_ui(PROJECT_UI_SRCS 67 68 ${UI_FILES} 68 69 ) 69 70 70 # ======================================== 71 # Build a library 72 # ======================================== 73 pacpus_add_library( 74 ${PROJECT_NAME} SHARED 71 ################################################################################ 72 # BUILD and LINK 73 pacpus_add_library(${PROJECT_NAME} SHARED 74 ${PROJECT_HDRS} 75 75 ${PROJECT_SRCS} 76 76 ${PROJECT_MOC_SRCS} … … 78 78 ) 79 79 80 81 # ======================================== 82 # Libraries 83 # ======================================== 80 84 set(LIBS 81 85 optimized FileLib debug FileLib_d … … 88 92 ) 89 93 endif() 94 # LINK 95 target_link_libraries(${PROJECT_NAME} 96 ${PACPUS_LIBRARIES} 97 ${PACPUS_DEPENDENCIES_LIB} 98 ${LIBS} 99 ${QT_LIBRARIES} 100 ) 101 qt5_use_modules(${PROJECT_NAME} Network) 102 ################################################################################ 103 # FOLDERS 104 pacpus_folder(${PROJECT_NAME} "components") 105 ################################################################################ 106 # INSTALL 107 pacpus_install(${PROJECT_NAME}) 90 108 91 # ======================================== 92 # Libraries 93 # ======================================== 94 # All the platform 95 target_link_libraries( 96 ${PROJECT_NAME} 97 ${PACPUS_LIBRARIES} 98 ${QT_LIBRARIES} 99 ${PACPUS_DEPENDENCIES_LIB} 100 ${LIBS} 109 # install headers 110 install( 111 DIRECTORY 112 ${StdDbtPlayerComponents_SOURCE_DIR} 113 DESTINATION 114 ${PACPUS_INSTALL_DIR}/include 115 FILES_MATCHING PATTERN "*.h" 101 116 ) 102 103 pacpus_folder(${PROJECT_NAME} "components")104 105 # ========================================106 # Install107 # ========================================108 pacpus_install(${PROJECT_NAME}) -
trunk/StdDbtPlayerComponents/DbtPlySickLDMRSManager.h
r50 r99 5 5 // author: Cyril Fougeray 6 6 // Copyright Heudiasyc UMR UTC/CNRS 6599 7 // 7 // 8 8 // version: $Id: $ 9 9 // 10 // purpose: 10 // purpose: 11 11 // ********************************************************************* 12 12 … … 29 29 # endif 30 30 #else 31 // On other platforms, simply ignore this 32 # define DBTPLYSICK_API 31 // On other platforms, simply ignore this 32 # define DBTPLYSICK_API 33 33 #endif 34 34 35 35 namespace pacpus { 36 36 37 37 class ShMem; 38 38 … … 64 64 } // namespace pacpus 65 65 66 #endif 66 #endif -
trunk/StdDbtPlayerComponents/StdDbtPlayerComponentsConfig.h
r16 r99 1 #ifndef __STDDBTPLAYERCOMPONENTS_H__ 2 #define __STDDBTPLAYERCOMPONENTS_H__ 1 // Autogenerated file by PacpusUtilities.cmake 2 // DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE 3 3 4 // Export macro for CanGateway DLL for Windows only 4 #ifndef __STDDBTPLAYERCOMPONENTS_CONFIG_H__ 5 #define __STDDBTPLAYERCOMPONENTS_CONFIG_H__ 6 7 // Export macro for use DLL for Windows only 5 8 #ifdef WIN32 6 #ifdef STDDBTPLAYERCOMPONENTS_EXPORTS7 //make DLL8 #define STDDBTPLAYERCOMPONENTS_API __declspec(dllexport)9 #else10 //use DLL11 #define STDDBTPLAYERCOMPONENTS_API __declspec(dllimport)12 #endif9 #ifdef STDDBTPLAYERCOMPONENTS_EXPORTS 10 // make DLL 11 #define STDDBTPLAYERCOMPONENTS_API __declspec(dllexport) 12 #else 13 // use DLL 14 #define STDDBTPLAYERCOMPONENTS_API __declspec(dllimport) 15 #endif 13 16 #else 14 // On other platforms, simply ignore this 15 # define STDDBTPLAYERCOMPONENTS_API 17 // On other platforms, simply ignore this 18 #define STDDBTPLAYERCOMPONENTS_API 16 19 #endif 17 20 18 #endif 21 #endif // __STDDBTPLAYERCOMPONENTS_CONFIG_H__ -
trunk/TelnetClient/CMakeLists.txt
r54 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(TelnetClient) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DTelnetClient_EXPORTS ) 2 11 ################################################################################ 3 add_definitions(-DTelnetClient_EXPORTS) 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 4 15 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 16 find_package(Qt5Network REQUIRED) 17 ################################################################################ 18 # DIRECTORIES 26 19 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 24 ) 30 25 … … 32 27 # Link directories 33 28 # ======================================== 34 link_directories( 29 link_directories( 30 ${PACPUS_LIB_DIR} 35 31 ) 36 32 37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )38 33 39 # ======================================== 40 # List of sources 41 # ======================================== 42 set( 43 PROJECT_SRCS 44 TelnetClient.cpp 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 TelnetClient.h 39 xml/${PROJECT_NAME}.xml 40 xml/${PROJECT_NAME}_d.xml 41 ) 42 set(PROJECT_SRCS 45 43 ${PLUGIN_CPP} 44 TelnetClient.cpp 46 45 ) 47 46 48 # ======================================== 49 # Files to MOC 50 # ======================================== 51 set( 52 FILES_TO_MOC 53 TelnetClient.h 54 ${PLUGIN_H} 47 set(FILES_TO_MOC 48 ${PLUGIN_HDR} 49 TelnetClient.h 55 50 ) 56 51 57 set( 58 UI_FILES 59 52 set(UI_FILES 60 53 ) 61 54 62 # ======================================== 63 # Call MOC 64 # ======================================== 65 qt4_wrap_cpp( 66 PROJECT_MOC_SRCS 55 ################################################################################ 56 # Qt: call moc, uic 57 qt_wrap_cpp(PROJECT_MOC_SRCS 67 58 ${FILES_TO_MOC} 68 59 ) 69 60 70 qt4_wrap_ui( 71 PROJECT_UI_SRCS 61 qt_wrap_ui(PROJECT_UI_SRCS 72 62 ${UI_FILES} 73 63 ) 74 64 75 # ======================================== 76 # Build a library 77 # ======================================== 78 pacpus_add_library( 79 ${PROJECT_NAME} SHARED 65 ################################################################################ 66 # BUILD and LINK 67 pacpus_add_library(${PROJECT_NAME} SHARED 68 ${PROJECT_HDRS} 80 69 ${PROJECT_SRCS} 81 70 ${PROJECT_MOC_SRCS} … … 83 72 ) 84 73 74 85 75 # ======================================== 86 76 # Libraries 87 77 # ======================================== 88 # All the platform 89 target_link_libraries( 90 ${PROJECT_NAME} 91 ${PACPUS_LIBRARIES} 92 ${QT_LIBRARIES} 93 ${PACPUS_DEPENDENCIES_LIB} 78 set(LIBS 79 optimized FileLib debug FileLib_d 80 optimized PacpusLib debug PacpusLib_d 81 optimized PacpusTools debug PacpusTools_d 94 82 ) 95 96 # ======================================== 97 # Install 98 # ======================================== 99 pacpus_install(${PROJECT_NAME}) 100 83 if (WIN32) 84 list(APPEND LIBS 85 optimized ROAD_TIME debug ROAD_TIME_d 86 ) 87 endif() 88 # LINK 89 target_link_libraries(${PROJECT_NAME} 90 ${PACPUS_LIBRARIES} 91 ${PACPUS_DEPENDENCIES_LIB} 92 ${LIBS} 93 ${QT_LIBRARIES} 94 ) 95 qt5_use_modules(${PROJECT_NAME} Network) 96 ################################################################################ 97 # FOLDERS 98 pacpus_folder(${PROJECT_NAME} "components") 99 ################################################################################ 100 # INSTALL 101 pacpus_install(${PROJECT_NAME}) -
trunk/TelnetClient/TelnetClient.cpp
r54 r99 13 13 14 14 #include "TelnetClient.h" 15 15 #include <string> 16 16 17 17 using namespace pacpus; 18 using namespace std; 18 19 20 /// Default host address = 0.0.0.0 (any address) 21 static const string kDefaultHostAddress = "127.0.0.1"; 22 /// Default host port = 2368 23 static const uint16_t kDefaultHostPort = 2368; 19 24 20 25 DECLARE_STATIC_LOGGER("pacpus.base.TelnetClient"); … … 33 38 : ComponentBase(name) 34 39 { 40 address_.setAddress(kDefaultHostAddress.c_str()); 41 port_ = kDefaultHostPort; 35 42 } 36 43 … … 50 57 ComponentBase::COMPONENT_CONFIGURATION TelnetClient::configureComponent(XmlComponentConfig config) 51 58 { 52 address_.setAddress(param.getProperty("address"));53 port_ = param.getProperty("port").toUInt();54 59 55 60 return ComponentBase::CONFIGURED_OK; -
trunk/VelodyneComponent/CMakeLists.txt
r66 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(Velodyne) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DVELODYNEHDL64S2_EXPORTS ) 11 ################################################################################ 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 2 15 16 find_package(Qt5Network REQUIRED) 3 17 ################################################################################ 4 add_definitions( -DVELODYNEHDL64S2_EXPORTS ) 5 6 7 8 # ======================================== 9 # Configure qt4 10 # ======================================== 11 if(QT4_FOUND) 12 set(QT_USE_QTXML true) 13 set(QT_USE_QTNETWORK true) 14 include(${QT_USE_FILE}) 15 else() 16 message(ERROR "Qt4 needed") 17 endif() 18 19 # ======================================== 20 # Compiler definitions 21 # ======================================== 22 add_definitions( 23 ${QT_DEFINITIONS} 24 ) 25 26 # ======================================== 27 # Include directories 28 # ======================================== 29 include_directories( 30 ${PROJECT_BINARY_DIR} 31 ${QT_INCLUDE_DIR} 18 # DIRECTORIES 19 include_directories( 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 32 24 ) 33 25 … … 35 27 # Link directories 36 28 # ======================================== 37 link_directories( ${PACPUS_LIB_DIR} 29 link_directories( 30 ${PACPUS_LIB_DIR} 38 31 ) 39 32 40 33 41 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 42 43 # ======================================== 44 # List of sources 45 # ======================================== 46 set( 47 PROJECT_SRCS 48 VelodyneComponent.cpp 49 VelodyneComponent.h 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 VelodyneComponent.h 39 structure_velodyne.h 40 ${PROJECT_NAME}.xml 41 ${PROJECT_NAME}_d.xml 42 ) 43 set(PROJECT_SRCS 50 44 ${PLUGIN_CPP} 45 VelodyneComponent.cpp 51 46 ) 52 47 53 # ======================================== 54 # Files to MOC 55 # ======================================== 56 set( 57 FILES_TO_MOC 58 VelodyneComponent.h 59 ${PLUGIN_H} 48 set(FILES_TO_MOC 49 ${PLUGIN_HDR} 50 VelodyneComponent.h 60 51 ) 61 52 62 set( 63 UI_FILES 64 53 set(UI_FILES 65 54 ) 66 55 67 # ======================================== 68 # Call MOC 69 # ======================================== 70 qt4_wrap_cpp( 71 PROJECT_MOC_SRCS 56 ################################################################################ 57 # Qt: call moc, uic 58 qt_wrap_cpp(PROJECT_MOC_SRCS 72 59 ${FILES_TO_MOC} 73 60 ) 74 61 75 qt4_wrap_ui( 76 PROJECT_UI_SRCS 62 qt_wrap_ui(PROJECT_UI_SRCS 77 63 ${UI_FILES} 78 64 ) 79 65 80 # ======================================== 81 # Build a library 82 # ======================================== 83 pacpus_add_library( 84 ${PROJECT_NAME} SHARED 66 ################################################################################ 67 # BUILD and LINK 68 pacpus_add_library(${PROJECT_NAME} SHARED 69 ${PROJECT_HDRS} 85 70 ${PROJECT_SRCS} 86 71 ${PROJECT_MOC_SRCS} … … 88 73 ) 89 74 90 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )91 75 76 # ======================================== 77 # Libraries 78 # ======================================== 92 79 set(LIBS 93 80 optimized FileLib debug FileLib_d … … 100 87 ) 101 88 endif() 102 103 # ======================================== 104 # Libraries 105 # ======================================== 106 # All the platform 107 target_link_libraries( 108 ${PROJECT_NAME} 109 ${PACPUS_LIBRARIES} 110 ${QT_LIBRARIES} 111 ${PACPUS_DEPENDENCIES_LIB} 112 ${LIBS} 113 ) 114 89 # LINK 90 target_link_libraries(${PROJECT_NAME} 91 ${PACPUS_LIBRARIES} 92 ${PACPUS_DEPENDENCIES_LIB} 93 ${LIBS} 94 ${QT_LIBRARIES} 95 ) 96 qt5_use_modules(${PROJECT_NAME} Network) 97 ################################################################################ 98 # FOLDERS 115 99 pacpus_folder(${PROJECT_NAME} "components") 116 117 # ======================================== 118 # Install 119 # ======================================== 120 pacpus_install(${PROJECT_NAME}) 100 ################################################################################ 101 # INSTALL 102 pacpus_install(${PROJECT_NAME}) -
trunk/VelodyneComponent/VelodyneComponent.cpp
r66 r99 5 5 // author: Gerald Dherbomez 6 6 // Copyright Heudiasyc UMR UTC/CNRS 6599 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 20 20 21 21 #include <QtEndian> 22 #include <Q UdpSocket>22 #include <QtNetwork/QUdpSocket> 23 23 #include <string> 24 24 … … 49 49 { 50 50 LOG_TRACE("constructor(" << name << ")"); 51 52 ComponentManager * mgr = ComponentManager::getInstance();53 LOG_DEBUG("manager = " << mgr);51 52 //ComponentManager * mgr = ComponentManager::getInstance(); 53 //LOG_DEBUG("manager = " << mgr); 54 54 55 55 setRecording (true); … … 86 86 /// TODO: doc 87 87 void VelodyneComponent::run() 88 { 88 { 89 89 initialize(); 90 90 exec(); // launch the exec loop, blocking until receiving exit() signal ... … … 197 197 ////////////////////////////////////////////////////////////////////////// 198 198 /// new data coming from Velodyne sensor 199 void VelodyneComponent::readPendingDatagrams() 199 void VelodyneComponent::readPendingDatagrams() 200 200 { 201 201 // get a timestamp … … 338 338 //*/ 339 339 } 340 340 341 341 mVelodyneData->range = mBlockIndex+(lastBlockIndex - 1); 342 342 LOG_DEBUG("range = " << mVelodyneData->range); -
trunk/VelodyneComponent/VelodyneComponent.h
r66 r99 7 7 #define VELODYNECOMPONENT_H 8 8 9 #include < qhostaddress.h>9 #include <QtNetwork/qhostaddress.h> 10 10 #include <qthread.h> 11 11 -
trunk/Wifibot/CMakeLists.txt
r21 r99 1 #########################quick start############################################ 2 #cmake ../ -G "CodeBlocks - Unix Makefiles" 3 #make 4 #make install 5 #make clean 6 ################################################################################ 1 7 project(Wifibot) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DWIFIBOTXT_EXPORTS ) 2 11 ################################################################################ 3 add_definitions( -DWIFIBOTXT_EXPORTS ) 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 4 15 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 26 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 16 find_package(Qt5Network REQUIRED) 17 ################################################################################ 18 # DIRECTORIES 19 include_directories( 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 24 ) 30 25 … … 32 27 # Link directories 33 28 # ======================================== 34 link_directories( ${PACPUS_LIB_DIR} 29 link_directories( 30 ${PACPUS_LIB_DIR} 35 31 ) 36 32 37 message (STATUS ${PACPUS_LIB_DIR})38 33 39 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 40 41 # ======================================== 42 # List of sources 43 # ======================================== 44 set( 45 PROJECT_SRCS 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 wifibot.h 39 ps3remote.h 40 ) 41 set(PROJECT_SRCS 42 ${PLUGIN_CPP} 46 43 wifibot.cpp 47 44 ps3remote.cpp 48 ${PLUGIN_CPP}49 45 ) 50 46 51 # ======================================== 52 # Files to MOC 53 # ======================================== 54 set( 55 FILES_TO_MOC 47 set(FILES_TO_MOC 48 ${PLUGIN_HDR} 56 49 wifibot.h 57 50 ps3remote.h 58 ${PLUGIN_H}59 51 ) 60 52 61 set( 62 UI_FILES 63 53 set(UI_FILES 64 54 ) 65 55 66 # ======================================== 67 # Call MOC 68 # ======================================== 69 qt4_wrap_cpp( 70 PROJECT_MOC_SRCS 56 ################################################################################ 57 # Qt: call moc, uic 58 qt_wrap_cpp(PROJECT_MOC_SRCS 71 59 ${FILES_TO_MOC} 72 60 ) 73 61 74 qt4_wrap_ui( 75 PROJECT_UI_SRCS 62 qt_wrap_ui(PROJECT_UI_SRCS 76 63 ${UI_FILES} 77 64 ) 78 65 79 # ======================================== 80 # Build a library 81 # ======================================== 82 pacpus_add_library( 83 ${PROJECT_NAME} SHARED 66 ################################################################################ 67 # BUILD and LINK 68 pacpus_add_library(${PROJECT_NAME} SHARED 69 ${PROJECT_HDRS} 84 70 ${PROJECT_SRCS} 85 71 ${PROJECT_MOC_SRCS} … … 87 73 ) 88 74 89 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )90 75 91 76 # ======================================== 92 77 # Libraries 93 78 # ======================================== 94 # All the platform 95 target_link_libraries( 96 ${PROJECT_NAME} 97 ${PACPUS_LIBRARIES} 98 ${QT_LIBRARIES} 99 ${PACPUS_DEPENDENCIES_LIB} 100 PacpusTools 101 PacpusSocket 79 set(LIBS 80 optimized FileLib debug FileLib_d 81 optimized PacpusLib debug PacpusLib_d 82 optimized PacpusTools debug PacpusTools_d 83 optimized PacpusSocket debug PacpusSocket_d 102 84 ) 103 104 # ======================================== 105 # Install 106 # ======================================== 107 pacpus_install(${PROJECT_NAME}) 108 85 if (WIN32) 86 list(APPEND LIBS 87 optimized ROAD_TIME debug ROAD_TIME_d 88 ) 89 endif() 90 # LINK 91 target_link_libraries(${PROJECT_NAME} 92 ${PACPUS_LIBRARIES} 93 ${PACPUS_DEPENDENCIES_LIB} 94 ${LIBS} 95 ${QT_LIBRARIES} 96 ) 97 qt5_use_modules(${PROJECT_NAME} Network) 98 ################################################################################ 99 # FOLDERS 100 pacpus_folder(${PROJECT_NAME} "components") 101 ################################################################################ 102 # INSTALL 103 pacpus_install(${PROJECT_NAME}) -
trunk/Wifibot/ps3remote.cpp
r24 r99 31 31 32 32 33 PS3remote::PS3remote(Pacpus Socket * socket)33 PS3remote::PS3remote(PacpusUDPSocket * socket) 34 34 { 35 35 quit = 0; -
trunk/Wifibot/ps3remote.h
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 18 18 # include <QThread> 19 19 # include <QTimer> 20 # include <QMutex> 20 21 21 22 # include "../Dualshock/controller.h" 22 # include "../ ../../pacpusbase/PacpusSocket/PacpusSocket.h"23 # include "../PacpusSocket/PacpusUDPSocket.h" 23 24 24 25 namespace pacpus { … … 29 30 public: 30 31 PS3remote(); 31 PS3remote(PacpusSocket *socket);32 PS3remote(PacpusUDPSocket *socket); 32 33 ~PS3remote(); 33 34 void run(); … … 38 39 void modeChar(); 39 40 void modeJoystick(); 40 void checkMode(); 41 41 void checkMode(); 42 42 43 private: 43 44 ShMem *shmem; … … 45 46 QMutex mutex; 46 47 int quit; 47 Pacpus Socket * socket_;48 PacpusUDPSocket * socket_; 48 49 QTimer * timer_; 49 50 char buf[4]; -
trunk/Wifibot/wifibot.cpp
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 22 22 // Construct the factory 23 23 ////////////////////////////////////////////////////////////////////////// 24 static ComponentFactory <Wifibot> sFactory("Wifibot"); 24 static ComponentFactory <Wifibot> sFactory("Wifibot"); 25 25 26 26 ////////////////////////////////////////////////////////////////////////// … … 28 28 ////////////////////////////////////////////////////////////////////////// 29 29 Wifibot::Wifibot(QString name) 30 : ComponentBase( name ) 30 : ComponentBase( name ) 31 31 { 32 33 } 32 33 } 34 34 35 35 … … 37 37 // Destructor 38 38 ////////////////////////////////////////////////////////////////////////// 39 Wifibot::~Wifibot() 39 Wifibot::~Wifibot() 40 40 { 41 41 42 42 } 43 43 44 44 ////////////////////////////////////////////////////////////////////////// 45 // Called by the ComponentManager to pass the XML parameters to the 46 // component 45 // Called by the ComponentManager to pass the XML parameters to the 46 // component 47 47 ////////////////////////////////////////////////////////////////////////// 48 ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config ) 49 { 48 ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config ) 49 { 50 50 QString pacpusSocket = config.getProperty("socketComponent"); 51 ComponentManager * mgr = ComponentManager::getInstance();52 pacpusSocket_ = dynamic_cast<Pacpus Socket *>(mgr->getComponent(pacpusSocket));51 //ComponentManager * mgr = ComponentManager::getInstance(); 52 pacpusSocket_ = dynamic_cast<PacpusUDPSocket *>(ComponentManager::getInstance()->getComponent(pacpusSocket).get()); 53 53 if (!pacpusSocket_) { 54 54 qWarning() << "Failed to get component " << pacpusSocket; 55 55 return ComponentBase::NOT_CONFIGURED; 56 56 } 57 58 return ComponentBase::CONFIGURED_OK; 59 } 57 58 return ComponentBase::CONFIGURED_OK; 59 } 60 60 61 61 … … 64 64 // Called by the ComponentManager to start the component 65 65 ////////////////////////////////////////////////////////////////////////// 66 void Wifibot::startActivity() 67 { 66 void Wifibot::startActivity() 67 { 68 68 dualshock = new PS3remote(pacpusSocket_); 69 69 dualshock->start(); -
trunk/Wifibot/wifibot.h
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 12 12 *********************************************************************/ 13 13 #ifndef WIFIBOT_API 14 # define WIFIBOT_API 14 # define WIFIBOT_API 15 15 16 16 #include "ps3remote.h" 17 17 #include "Pacpus/kernel/Log.h" 18 #include "Pacpus/kernel/ComponentBase.h" 19 #include "Pacpus/kernel/ComponentFactory.h" 20 18 #include "Pacpus/kernel/ComponentBase.h" 19 #include "Pacpus/kernel/ComponentFactory.h" 20 #include "Pacpus/kernel/ComponentManager.h" 21 21 22 22 namespace pacpus { … … 24 24 class WIFIBOT_API Wifibot 25 25 : public QObject 26 , public ComponentBase 27 { 26 , public ComponentBase 27 { 28 28 Q_OBJECT 29 29 30 public: 30 public: 31 31 /// Constructor 32 32 Wifibot (QString name); 33 33 /// Destructor 34 34 ~Wifibot(); 35 35 36 36 protected: 37 37 // The 3 virtual methods relative to the ComponentBase inheritance … … 39 39 virtual void stopActivity(); 40 40 virtual COMPONENT_CONFIGURATION configureComponent (XmlComponentConfig config); 41 41 42 42 private: 43 43 PS3remote * dualshock; 44 Pacpus Socket * pacpusSocket_;44 PacpusUDPSocket * pacpusSocket_; 45 45 }; 46 46 -
trunk/build/build_linux.sh
r95 r99 7 7 else 8 8 9 # the following line will create a folder like: build_opt_pacpus_0.2.0_ 9 10 BUILD_DIR=./build${PACPUS_ROOT////_} 10 11 echo Your files will be built in: $BUILD_DIR … … 25 26 cd $BUILD_DIR 26 27 27 cmake ../.. 28 cmake ../.. -G "CodeBlocks - Unix Makefiles" 28 29 29 30 make -j$J 30 31 make install 31 32 32 33 fi -
trunk/driver/PosixSerialPort.cpp
r59 r99 4 4 // 5 5 // author: Gerald Dherbomez 6 // 6 // 7 7 // version: $Id: $ 8 8 // … … 24 24 25 25 PosixSerialPort::~PosixSerialPort() { 26 qDebug() << "The win32serial port " << componentName << " was destroyed";26 qDebug() << "The Posix serial port " << componentName << " was destroyed"; 27 27 } 28 28 29 29 PosixSerialPort::PosixSerialPort(QString name) { 30 31 } 32 33 34 ////////////////////////////////////////////////////////////////////////// 35 // return the number of frames that have not been yet decoded 30 componentName = name; 31 qDebug() << "The Posix serial port " << componentName << " was created"; 32 } 33 34 35 ////////////////////////////////////////////////////////////////////////// 36 // return the number of frames that have not been yet decoded 36 37 ////////////////////////////////////////////////////////////////////////// 37 38 … … 45 46 46 47 ////////////////////////////////////////////////////////////////////////// 47 // return a pointer to the first frame in the list 48 // return a pointer to the first frame in the list 48 49 ////////////////////////////////////////////////////////////////////////// 49 50 … … 53 54 54 55 55 56 57 58 ////////////////////////////////////////////////////////////////////////// 59 // remove the first frame of the list 60 // use this function as soon as you copy the frame 56 ////////////////////////////////////////////////////////////////////////// 57 // return a pointer to the first frame in the queue and removes it 58 // The reader is responsible for deleting the frame. 59 ////////////////////////////////////////////////////////////////////////// 60 FRAME * PosixSerialPort::getNextFrame() 61 { 62 FRAME *frame = NULL; 63 frameLock_.lock(); 64 if (!dataFrameList.isEmpty()) { 65 frame = dataFrameList.takeFirst(); 66 } 67 frameLock_.unlock(); 68 return frame; 69 } 70 71 72 ////////////////////////////////////////////////////////////////////////// 73 // remove the first frame of the list 74 // use this function as soon as you copy the frame 61 75 ////////////////////////////////////////////////////////////////////////// 62 76 … … 70 84 } 71 85 dataFrameList.removeFirst(); 72 delete[] tmp->data;86 //delete[] tmp->data; 73 87 delete tmp; 74 88 tmp = NULL; … … 80 94 81 95 /*!< open the port 'name' 82 return true if success 96 return true if success 83 97 */ 84 98 bool PosixSerialPort::openPort(const char * name) { … … 96 110 97 111 /*!< close the port 98 return true if success 112 return true if success 99 113 */ 100 114 int PosixSerialPort::closePort() { … … 102 116 } 103 117 104 /*!< configure the port 105 return true if success 118 /*!< configure the port 119 return true if success 106 120 */ 107 121 int PosixSerialPort::configurePort(long baudRate, int byteSize, char parity, int stopBits) { … … 116 130 cfsetospeed(&port_settings, B4800); 117 131 break; 118 132 119 133 case 9600: 120 134 cfsetispeed(&port_settings, B9600); // set baud rates … … 145 159 146 160 ////////////////////////////////////////////////////////////////////////// 147 // Read 'maxLength' bytes on the port and copy them in buffer 161 // Read 'maxLength' bytes on the port and copy them in buffer 148 162 // return the number of bytes read 149 163 ////////////////////////////////////////////////////////////////////////// … … 167 181 memset(receivedBuffer_,0,numberBytesToRead); 168 182 numberBytesRead = readBuffer(receivedBuffer_,numberBytesToRead); 169 processIncomingData(); 183 processIncomingData(); 170 184 } 171 185 else 172 186 { 173 receivedBuffer_ = NULL; 174 // todo : trouver une autre methode plus efficace que le polling et le sleep ! 187 receivedBuffer_ = NULL; 188 // todo : trouver une autre methode plus efficace que le polling et le sleep ! 175 189 usleep(1000); 176 190 } … … 184 198 185 199 ioctl(handlePort, FIONREAD, &bytes); 186 200 187 201 return bytes; 188 202 } … … 195 209 // data frame 196 210 if (numberBytesRead > 0) { 197 FRAME * frame = new FRAME; 198 frame->t = t_; 199 frame->tr = 0; 200 frame->length = numberBytesRead; 201 frame->data = new char[frame->length]; 202 memcpy(frame->data, receivedBuffer_, frame->length); 203 204 frameLock_.lock(); 205 dataFrameList.append( frame ); 206 frameLock_.unlock(); 207 208 //printf(receivedBuffer_); 209 emit newDataAvailable(1); 210 delete[] receivedBuffer_; 211 FRAME * frame = new FRAME; 212 frame->t = t_; 213 frame->tr = 0; 214 frame->length = numberBytesRead; 215 frame->data = QByteArray(receivedBuffer_, frame->length); 216 217 frameLock_.lock(); 218 dataFrameList.append( frame ); 219 frameLock_.unlock(); 220 221 //printf(receivedBuffer_); 222 emit newDataAvailable(1); 223 delete[] receivedBuffer_; 211 224 receivedBuffer_ = NULL; 212 225 } … … 214 227 if (ringIndicatorDetected) { 215 228 ringIndicatorDetected = false; 216 FRAME * frame = new FRAME; 217 frame->t = t_; 218 frame->tr = 0; 219 frame->length = 3; 220 frame->data = new char[frame->length];221 memcpy(frame->data, "PPS", frame->length); 222 frameLock_.lock(); 223 dataFrameList.append(frame); 224 frameLock_.unlock(); 225 226 emit newDataAvailable(1); 229 FRAME * frame = new FRAME; 230 frame->t = t_; 231 frame->tr = 0; 232 frame->length = 3; 233 frame->data = frame->data = QByteArray("PPS", frame->length); 234 235 frameLock_.lock(); 236 dataFrameList.append(frame); 237 frameLock_.unlock(); 238 239 emit newDataAvailable(1); 227 240 } 228 241 229 242 // re-initialization 230 243 t_ = 0; 231 numberBytesToRead = 0; 232 } 244 numberBytesToRead = 0; 245 } -
trunk/driver/PosixSerialPort.h
r59 r99 34 34 road_timerange_t tr; 35 35 unsigned long length; 36 char * data;36 QByteArray data; //char * 37 37 }FRAME; 38 38 … … 51 51 /*!< return the first dataFrame in the list */ 52 52 FRAME* firstFrame(); 53 54 /*!< return the next dataFrame in the list and removes it */ 55 FRAME* getNextFrame(); 53 56 54 57 /*!< remove the first dataFrame in the list */
Note:
See TracChangeset
for help on using the changeset viewer.