Changeset 99 in pacpussensors


Ignore:
Timestamp:
Oct 15, 2015, 2:47:01 PM (9 years ago)
Author:
nguyenhu
Message:

compilation under linux with 0.2.X framework

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################################################################################
    17project(Alasca)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DALASCAXT_EXPORTS )
     11################################################################################
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    215
     16find_package(Qt5Network REQUIRED)
    317################################################################################
    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
     19include_directories(
     20    ${PROJECT_BINARY_DIR}
     21    ${QT_INCLUDE_DIR}
     22    ${PACPUS_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3224)
    3325
     
    3527# Link directories
    3628# ========================================
    37 link_directories( ${PACPUS_LIB_DIR}
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3831)
    3932
    4033
    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
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    AlascaComponent.h
     39    AlascaSocket.h
     40    xml/${PROJECT_NAME}.xml
     41    xml/${PROJECT_NAME}_d.xml
     42)
     43set(PROJECT_SRCS
    5244    ${PLUGIN_CPP}
     45    AlascaComponent.cpp
     46    AlascaSocket.cpp
    5347)
    5448
    55 # ========================================
    56 # Files to MOC
    57 # ========================================
    58 set(
    59     FILES_TO_MOC
    60      AlascaComponent.h
     49set(FILES_TO_MOC
     50    ${PLUGIN_HDR}
     51    AlascaComponent.h
    6152    AlascaSocket.h
    62     ${PLUGIN_H}
    6353)
    6454
    65 set(
    66     UI_FILES
    67 
     55set(UI_FILES
    6856)
    6957
    70 # ========================================
    71 # Call MOC
    72 # ========================================
    73 qt4_wrap_cpp(
    74     PROJECT_MOC_SRCS
     58################################################################################
     59# Qt: call moc, uic
     60qt_wrap_cpp(PROJECT_MOC_SRCS
    7561    ${FILES_TO_MOC}
    7662)
    7763
    78 qt4_wrap_ui(
    79     PROJECT_UI_SRCS
     64qt_wrap_ui(PROJECT_UI_SRCS
    8065    ${UI_FILES}
    8166)
    8267
    83 # ========================================
    84 # Build a library
    85 # ========================================
    86 pacpus_add_library(
    87     ${PROJECT_NAME} SHARED
     68################################################################################
     69# BUILD and LINK
     70pacpus_add_library(${PROJECT_NAME} SHARED
     71    ${PROJECT_HDRS}
    8872    ${PROJECT_SRCS}
    8973    ${PROJECT_MOC_SRCS}
     
    9175)
    9276
    93 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    9477
     78# ========================================
     79# Libraries
     80# ========================================
    9581set(LIBS
    9682    optimized FileLib debug FileLib_d
     
    10389    )
    10490endif()
    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
     92target_link_libraries(${PROJECT_NAME}
     93                      ${PACPUS_LIBRARIES}
     94                      ${PACPUS_DEPENDENCIES_LIB}
     95                      ${LIBS}
     96                      ${QT_LIBRARIES}
     97                     )
     98qt5_use_modules(${PROJECT_NAME} Network)
     99################################################################################
     100# FOLDERS
    118101pacpus_folder(${PROJECT_NAME} "components")
    119 
    120 # ========================================
    121 # Install
    122 # ========================================
    123 pacpus_install(${PROJECT_NAME})
     102################################################################################
     103# INSTALL
     104pacpus_install(${PROJECT_NAME})
  • trunk/CMakeLists.txt

    r94 r99  
    1212project(PacpusSensors)
    1313cmake_minimum_required(VERSION 2.8)
     14if(UNIX)
     15    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x -fpermissive") #c++11
     16endif()
    1417
    1518# ========================================
     
    6063
    6164# ========================================
    62 # Find dependencies
     65# Build the ProjectExercise' modules
    6366# ========================================
    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#
    7371
    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)
     73add_subdirectory(CanGateway)       #require kvaser libcan
     74add_subdirectory(PtGreyCameras)
     75#add_subdirectory(Dualshock)
     76add_subdirectory(NMEA0183)
     77add_subdirectory(Gps)              #require NMEA0183
     78add_subdirectory(SpanCPTComponent) #require NMEA0183
     79#add_subdirectory(Sick)
     80add_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
    9484add_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)
    10187
    10288# ========================================
  • trunk/CanGateway/CMakeLists.txt

    r94 r99  
    88# Configure qt4
    99# ========================================
    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()
    1717
    1818# ========================================
     
    4949    PROJECT_SRCS
    5050        CanFrameBase.h
    51     CanDecoderBase.cpp
    52     CanDecoderBase.h
    53     CanGateway.cpp
    54     CanGateway.h
    55     CanSubscription.cpp
    56     CanSubscription.h
    57     Win32CanInterface.cpp
    58     Win32CanInterface.h
     51        CanDecoderBase.cpp
     52        CanDecoderBase.h
     53        CanGateway.cpp
     54        CanGateway.h
     55        CanSubscription.cpp
     56        CanSubscription.h
     57        Win32CanInterface.cpp
     58        Win32CanInterface.h
    5959        DbtRawCanReader.h
    60     DbtRawCanReader.cpp
     60        DbtRawCanReader.cpp
    6161        structureCan.h
    6262        driver/KVaserCanDriver.cpp
     
    7171        driver/XLVectorCanDriver.cpp
    7272        driver/XLVectorCanDriver.h
    73                 driver/PeakCanDriverWin.h
    74                 driver/PeakCanDriverWin.cpp
     73        driver/PeakCanDriverWin.h
     74        driver/PeakCanDriverWin.cpp
    7575    )
    7676endif(WIN32)
     
    9090set(
    9191    FILES_TO_MOC
    92         CanGateway.h
     92    CanGateway.h
    9393    DbtRawCanReader.h
    9494    ${PLUGIN_H}
     
    129129        # add your specific libraries to link here
    130130       
    131                 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
     131        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
    135135    )
    136136endif(WIN32)
     
    149149    ${PACPUS_LIBRARIES}
    150150    ${QT_LIBRARIES}
    151         ${PACPUS_DEPENDENCIES_LIB}
    152         ${LIBS}
    153 #       optimized PacpusTools debug PacpusTools_d
     151    ${PACPUS_DEPENDENCIES_LIB}
     152    ${LIBS}
     153    #optimized PacpusTools debug PacpusTools_d
    154154)
    155155pacpus_folder(${PROJECT_NAME} "components")
     
    166166    DESTINATION
    167167        ${PACPUS_INSTALL_DIR}/include
     168    FILES_MATCHING PATTERN "*.h"
    168169)
    169170# 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
    26################################################################################
     7project(TestDualShock)
    38add_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 # ========================================
     9set(${PROJECT_NAME}_VERSION_MAJOR 0)
     10set(${PROJECT_NAME}_VERSION_MINOR 1)
     11################################################################################
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14################################################################################
     15# DIRECTORIES
    2616include_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/
    2921)
    3022
     
    3224# Link directories
    3325# ========================================
    34 link_directories( ${PACPUS_LIB_DIR}
     26link_directories(
     27        ${PACPUS_LIB_DIR}
    3528)
    3629
    37 message (STATUS ${PACPUS_LIB_DIR})
    3830
    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
     33set(PROJECT_HDRS
     34    ${EXPORT_HDR}
     35    dualshock.h
     36    controller.h
     37    xml/${PROJECT_NAME}.xml
     38    xml/${PROJECT_NAME}_d.xml
     39)
     40set(PROJECT_SRCS
    4841    ${PLUGIN_CPP}
     42    dualshock.cpp
     43    controller.cpp
    4944)
    5045
    51 # ========================================
    52 # Files to MOC
    53 # ========================================
    54 set(
    55     FILES_TO_MOC
    56     controller.h
    57     dualshock.h
    58     ${PLUGIN_H}
     46set(FILES_TO_MOC
     47    ${PLUGIN_HDR}
     48    controller.h
    5949)
    6050
    61 set(
    62     UI_FILES
    63 
     51set(UI_FILES
    6452)
    6553
    66 # ========================================
    67 # Call MOC
    68 # ========================================
    69 qt4_wrap_cpp(
    70     PROJECT_MOC_SRCS
     54################################################################################
     55# Qt: call moc, uic
     56qt_wrap_cpp(PROJECT_MOC_SRCS
    7157    ${FILES_TO_MOC}
    7258)
    7359
    74 qt4_wrap_ui(
    75     PROJECT_UI_SRCS
     60qt_wrap_ui(PROJECT_UI_SRCS
    7661    ${UI_FILES}
    7762)
    7863
    79 # ========================================
    80 # Build a library
    81 # ========================================
    82 pacpus_add_library(
    83     ${PROJECT_NAME} SHARED
     64################################################################################
     65# BUILD and LINK
     66pacpus_add_library(${PROJECT_NAME} SHARED
     67    ${PROJECT_HDRS}
    8468    ${PROJECT_SRCS}
    8569    ${PROJECT_MOC_SRCS}
     
    8771)
    8872
    89 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    9073
    9174# ========================================
    9275# Libraries
    9376# ========================================
    94 # All the platform
    95 target_link_libraries(
    96     ${PROJECT_NAME}
    97     ${PACPUS_LIBRARIES}
    98     ${QT_LIBRARIES}
    99         ${PACPUS_DEPENDENCIES_LIB}
    100         PacpusTools
     77set(LIBS
     78    optimized FileLib debug FileLib_d
     79    optimized PacpusLib debug PacpusLib_d
     80    optimized PacpusTools debug PacpusTools_d
    10181)
     82if (WIN32)
     83    list(APPEND LIBS
     84        optimized ROAD_TIME debug ROAD_TIME_d
     85    )
     86endif()
    10287
    103 # ========================================
    104 # Install
    105 # ========================================
    106 pacpus_install(${PROJECT_NAME})
     88# LINK
     89target_link_libraries(${PROJECT_NAME}
     90                      ${PACPUS_LIBRARIES}
     91                      ${PACPUS_DEPENDENCIES_LIB}
     92                      ${LIBS})
    10793
     94################################################################################
     95# FOLDERS
     96pacpus_folder(${PROJECT_NAME} "components")
     97
     98################################################################################
     99# INSTALL
     100pacpus_install(${PROJECT_NAME})
  • trunk/Dualshock/controller.h

    r22 r99  
    2424# include <QThread>
    2525
    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>
    3030
    3131# define L2CAP_PSM_HIDP_CTRL 0x11
  • trunk/Dualshock/dualshock.h

    r22 r99  
    1515# define DUALSHOCK_H
    1616
    17 # include "kernel/ComponentBase.h"
    18 # include "kernel/DbiteFile.h"
     17# include <kernel/ComponentBase.h>
     18# include <kernel/DbiteFile.h>
    1919# include "controller.h"
    2020
  • trunk/Gps/CMakeLists.txt

    r59 r99  
     1#########################quick start############################################
     2#cmake ../ -G "CodeBlocks - Unix Makefiles"
     3#make
     4#make install
     5#make clean
     6################################################################################
    17project(Gps)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DGPS_EXPORTS )
    211################################################################################
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    315
    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}
     16find_package(Qt5Network REQUIRED)
     17find_package(Qt5Widgets REQUIRED)
     18################################################################################
     19# DIRECTORIES
     20include_directories(
     21    ${PROJECT_BINARY_DIR}
     22    ${QT_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}
     24    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3025)
    3126
     
    3833
    3934
    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
     37set(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)
     46set(PROJECT_SRCS
    5947    ${PLUGIN_CPP}
     48    gpsComponent.cpp
     49    SeptentrioSocket.cpp
     50    ui/polarxmainwindow.cpp
    6051)
    6152
     
    7667endif(UNIX)
    7768
    78 
    79 # ========================================
    80 # Files to MOC
    81 # ========================================
    82 
    8369if(UNIX)
    8470set(FILES_TO_MOC
    8571  # add here the header files that you want to MOC
    8672  gpsComponent.h
    87   SeptentrioComponent.h
     73  GpsFrames.h
     74  #SeptentrioComponent.h
    8875  SeptentrioSocket.h 
    8976  ../driver/PosixSerialPort.h
    9077  ui/polarxmainwindow.hpp
    91     ${PLUGIN_H}
     78  ${PLUGIN_HDR}
    9279  )
    9380endif(UNIX)
     
    9784  # add here the header files that you want to MOC
    9885  gpsComponent.h
    99 # SeptentrioComponent.h
    100 # SeptentrioSocket.h   
     86  # SeptentrioComponent.h
     87  # SeptentrioSocket.h   
    10188  ../driver/Win32SerialPort.h
    102 #  ui/polarxmainwindow.hpp
    103   ${PLUGIN_H}
     89  #  ui/polarxmainwindow.hpp
     90  ${PLUGIN_HDR}
    10491  )
    10592endif(WIN32)
    10693
    107 set(
    108     UI_FILES
     94set(UI_FILES
    10995)
    11096
    111 # ========================================
    112 # Call MOC
    113 # ========================================
    114 qt4_wrap_cpp(
    115     PROJECT_MOC_SRCS
     97################################################################################
     98# Qt: call moc, uic
     99qt_wrap_cpp(PROJECT_MOC_SRCS
    116100    ${FILES_TO_MOC}
    117101)
    118102
    119 qt4_wrap_ui(
    120     PROJECT_UI_SRCS
     103qt_wrap_ui(PROJECT_UI_SRCS
    121104    ${UI_FILES}
    122105)
    123106
    124 # ========================================
    125 # Build a library
    126 # ========================================
    127 pacpus_add_library(
    128     ${PROJECT_NAME} SHARED
     107################################################################################
     108# BUILD and LINK
     109pacpus_add_library(${PROJECT_NAME} SHARED
     110    ${PROJECT_HDRS}
    129111    ${PROJECT_SRCS}
    130112    ${PROJECT_MOC_SRCS}
     
    132114)
    133115
     116
    134117# ========================================
    135118# Libraries
    136119# ========================================
    137 if(WIN32)
    138     set(LIBS
    139         # add your specific libraries to link here
    140         optimized NMEA0183LIB debug NMEA0183LIB_d
     120set(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)
     126if (WIN32)
     127    list(APPEND LIBS
     128        optimized ROAD_TIME debug ROAD_TIME_d
    141129    )
    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 )
     130endif()
     131# LINK
     132target_link_libraries(${PROJECT_NAME}
     133                      ${PACPUS_LIBRARIES}
     134                      ${PACPUS_DEPENDENCIES_LIB}
     135                      ${LIBS}
     136                      ${QT_LIBRARIES} 
     137                     )
     138qt5_use_modules(${PROJECT_NAME} Network)
     139################################################################################
     140# FOLDERS
    160141pacpus_folder(${PROJECT_NAME} "components")
    161 
    162 # ========================================
    163 # Install
    164 # ========================================
    165 pacpus_install(${PROJECT_NAME})
     142################################################################################
     143# INSTALL
     144pacpus_install(${PROJECT_NAME})
  • trunk/Gps/SeptentrioComponent.h

    r59 r99  
    1515// #include "polarxGPSTKsolver.hpp"
    1616
    17 #include "structure/structure_septentrio.h"
     17#include "structure_gps.h"
    1818#include "SerialCom/SerialCOM_Handle_Stream.hpp"
    1919#include "SerialCom/SBF/SerialCOM_Protocol_SBF.hpp"
  • trunk/Gps/SeptentrioSocket.cpp

    r59 r99  
    1515
    1616#include "SeptentrioSocket.h"
    17 #include "SeptentrioComponent.h"
     17//#include "SeptentrioComponent.h"
    1818#include <QApplication>
    1919#include <QtDebug>
  • trunk/Gps/gpsComponent.cpp

    r77 r99  
    1818#include <iostream>
    1919
     20#define PACPUS_PI 3.1415926
     21
    2022namespace pacpus {
    2123
    2224/// Construct the factory
    23 ComponentFactory<GpsComponent> sFactory("GpsComponent"); 
     25ComponentFactory<GpsComponent> sFactory("GpsComponent");
    2426
    2527DECLARE_STATIC_LOGGER("pacpus.base.GpsComponent");
     
    3537    : semaphore_(0)
    3638    , 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;
    6163*/
    62  
    63  
     64
     65
    6466  nextByteToProcess_ = 0;
    6567  currentFrame_ = NULL;
    66   newFrameToDecode_ = false; 
    67   startOfFrame_ = false; 
     68  newFrameToDecode_ = false;
     69  startOfFrame_ = false;
    6870  endOfFrame_ = false;
    6971}
     
    8183ComponentBase::COMPONENT_CONFIGURATION GpsComponent::configureComponent(XmlComponentConfig config)
    8284{
    83   setPortCOM( config.getProperty("port").toLatin1() );   
     85  setPortCOM( config.getProperty("port").toLatin1() );
    8486  setRecording ((config.getProperty("recording") == "true" ? true : false));
    8587
     
    9092void GpsComponent::setPortCOM(const char * port)
    9193{
    92   portName_ = port; 
     94  portName_ = port;
    9395}
    9496
     
    111113void GpsComponent::run()
    112114{
    113   int type = -1; 
    114  
     115  int type = -1;
     116
    115117  // parity:0-4=no,odd,even,mark,space
    116118  // 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(),
    121123    xmlParameters().getProperty("bytesize").toUInt(),
    122124    //  config.getProperty("parity").at(0).toLatin1(),
    123125    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
    129131  while (isActive())
    130   { 
     132  {
    131133    // If there are no bytes remaining in the current frame, delete it
    132134    if ((currentFrame_ != NULL) && (nextByteToProcess_ >= currentFrame_->data.length())) {
    133       delete currentFrame_; 
     135      delete currentFrame_;
    134136      currentFrame_ = NULL;
    135137    }
     
    139141      semaphore_.acquire();
    140142      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
    142144        // the thread is being stopped.
    143145        continue;
     
    151153      lastPpsTime_ = currentFrame_->t;
    152154      decodeFrame(SIGNAL_PPS);
    153     } else if (analyzeFrame()) { 
     155    } else if (analyzeFrame()) {
    154156      // a new complete NMEA frame has arrived, decode it.
    155       type = frameType(frameToDecode_.data); 
     157      type = frameType(frameToDecode_.data);
    156158      if (type != -1) {
    157159        if (decodeFrame(type) == -1) {
    158             qWarning("Failed to decode the dataframe\n"); 
     160            qWarning("Failed to decode the dataframe\n");
    159161        }
    160162      }
     
    164166  }
    165167
    166   qDebug() << "The thread of " << name() << " GPS component is stopped"; 
     168  qDebug() << "The thread of " << name() << " GPS component is stopped";
    167169}
    168170
     
    174176void GpsComponent::stopActivity()
    175177{
    176   setActive( FALSE );
     178  setActive( false );
    177179  unlockProcessing(1); // to unblock the thread that is waiting new data
    178  
    179   serialPort->THREAD_ALIVE = FALSE;
     180
     181  serialPort->THREAD_ALIVE = false;
    180182
    181183  if (!serialPort->wait(2000))
    182184  {
    183     serialPort->terminate(); 
     185    serialPort->terminate();
    184186    qDebug("The Win32SerialPort thread blocks anormally, it has been killed !!");
    185187  }
    186   if ( !serialPort->closePort() ) 
    187     qDebug("Failed to close the port"); 
     188  if ( !serialPort->closePort() )
     189    qDebug("Failed to close the port");
    188190  else
    189     qDebug("The port is closed"); 
     191    qDebug("The port is closed");
    190192  delete serialPort;
    191193
    192194  if (ppshdFile.isOpen())
    193           ppshdFile.close(); 
     195          ppshdFile.close();
    194196  if (ggahdFile.isOpen())
    195197          ggahdFile.close();
    196198  if (gsahdFile.isOpen())
    197     gsahdFile.close(); 
     199    gsahdFile.close();
    198200  if (gsthdFile.isOpen())
    199201    gsthdFile.close();
     
    203205    hdthdFile.close();
    204206  if (rmchdFile.isOpen())
    205           rmchdFile.close(); 
     207          rmchdFile.close();
    206208  if (rothdFile.isOpen())
    207209          rothdFile.close();
    208210  if (vtghdFile.isOpen())
    209           vtghdFile.close(); 
     211          vtghdFile.close();
    210212  if (zdahdFile.isOpen())
    211213          zdahdFile.close();
     
    219221{
    220222  ppsIndex_ = 0;
    221  
    222   setActive( TRUE );   
    223  
     223
     224  setActive( true );
     225
    224226#if WIN32
    225   serialPort = new Win32SerialPort(portName_.toLatin1()); 
     227  serialPort = new Win32SerialPort(portName_.toLatin1());
    226228  // Asynchrone
    227   serialPort->setMode(FILE_FLAG_OVERLAPPED); 
     229  serialPort->setMode(FILE_FLAG_OVERLAPPED);
    228230  // 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());
    232234#endif
    233  
     235
    234236  if (!serialPort->openPort(portName_.toLatin1()))
    235237  {
    236238    qDebug() << "Failed to open the port " << portName_;
    237239    qDebug() << "The GPS Component " << name() << " didn't start";
    238     return; 
     240    return;
    239241  }
    240  
    241   serialPort->THREAD_ALIVE = TRUE;
     242
     243  serialPort->THREAD_ALIVE = true;
    242244  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();
    245247  qDebug() << "The Component " << name() << " is started";
    246248}
     
    299301
    300302    // first looking for start-of-frame
    301     if (!startOfFrame_ && (currentChar == '$')) { 
     303    if (!startOfFrame_ && (currentChar == '$')) {
    302304      startOfFrame_ = true;
    303305      endOfFrame_ = false;
     
    313315      return true;  // There is a new frame to decode
    314316    }
    315    
     317
    316318    if ((startOfFrame_) && (!endOfFrame_)) {
    317       frameToDecode_.data.append(currentChar); 
     319      frameToDecode_.data.append(currentChar);
    318320    }
    319321  }
     
    325327{
    326328  // new frame available
    327   semaphore_.release( v ); 
     329  semaphore_.release( v );
    328330}
    329331
     
    331333int GpsComponent::decodeFrame(int type)
    332334{
    333   double lat_rad = 0, lon_rad = 0; 
    334   int indexGSV = 0; 
     335  double lat_rad = 0, lon_rad = 0;
     336  int indexGSV = 0;
    335337  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)
    342344  {
    343   case UNKNOWN_NMEA_FRAME: 
    344     qDebug("Unknown frame received !"); 
    345     break; 
     345  case UNKNOWN_NMEA_FRAME:
     346    qDebug("Unknown frame received !");
     347    break;
    346348  case SIGNAL_PPS:
    347349    ppsFrame.setRoadTime(lastPpsTime_);
     
    351353    {
    352354                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));
    354356    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");
    356358    }
    357359    ppsFrame.notifyObservers();
    358360
    359361    break;
    360    
    361   case TRAME_GGA_DBL:   
     362
     363  case TRAME_GGA_DBL:
    362364    if (!nmea0183_.Gga.Parse(sentence)) {
    363365      LOG_ERROR("Failed to parse the frame " << nmea0183_.Gga.ErrorMessage.toLatin1().data());
     
    377379      ggaFrame.getFrameData()->d_geoidal = nmea0183_.Gga.GeoidalSeparationMeters;
    378380      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;
    382384      ggaFrame.setRoadTime(frameToDecode_.t);
    383      
    384       sendDataToServerSocket(*ggaFrame.getFrameData(),type); 
     385
     386      sendDataToServerSocket(*ggaFrame.getFrameData(),type);
    385387      ggaFrame.notifyObservers();
    386388
    387389      if ( (isRecording()) && (ggaRecording) ) {
    388390                    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");
    392394      }
    393395      //printf("lon=%f lat=%f\n",ggaFrame.getFrameData()->lon, ggaFrame.getFrameData()->lat);
    394396    }
    395397    break;
    396    
     398
    397399  case TRAME_GSA:
    398400    if (!nmea0183_.Gsa.Parse(sentence))
     
    401403    gsaFrame.getFrameData()->mode_result = 0;
    402404    if (nmea0183_.Gsa.FixMode == GSA::FixUnavailable)
    403       gsaFrame.getFrameData()->mode_result = 1; 
     405      gsaFrame.getFrameData()->mode_result = 1;
    404406    if (nmea0183_.Gsa.FixMode == GSA::TwoDimensional)
    405       gsaFrame.getFrameData()->mode_result = 2; 
     407      gsaFrame.getFrameData()->mode_result = 2;
    406408    if (nmea0183_.Gsa.FixMode == GSA::ThreeDimensional)
    407       gsaFrame.getFrameData()->mode_result = 3; 
     409      gsaFrame.getFrameData()->mode_result = 3;
    408410    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;
    413415    gsaFrame.setRoadTime(frameToDecode_.t);
    414416
    415417    gsaFrame.notifyObservers();
    416    
    417     sendDataToServerSocket(*gsaFrame.getFrameData(),type); 
    418    
     418
     419    sendDataToServerSocket(*gsaFrame.getFrameData(),type);
     420
    419421    if ( (isRecording()) && (gsaRecording) )
    420422    {
    421423                if (!(gsahdFile.isOpen()))
    422424                  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");
    425427    }
    426428    break;
    427429
    428430
    429    
     431
    430432  case TRAME_GST:
    431433    if (!nmea0183_.Gst.Parse( sentence ))
     
    443445    gstFrame.getFrameData()->Ms = nmea0183_.Gst.Time.time().msec();
    444446    gstFrame.setRoadTime(frameToDecode_.t);
    445    
    446     sendDataToServerSocket(*gstFrame.getFrameData(),type); 
     447
     448    sendDataToServerSocket(*gstFrame.getFrameData(),type);
    447449    gstFrame.notifyObservers();
    448450
    449451
    450452    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));
    453455      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
    458460  case TRAME_GSV:
    459461    indexGSV = 0;
     
    462464      break;
    463465    }
    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
    465467    // in view has decreased
    466468    if (nmea0183_.Gsv.message_number == 1)
     
    477479    gsvFrame.getFrameData()->NumberOfSatellites = nmea0183_.Gsv.NumberOfSatellites;
    478480    gsvFrame.getFrameData()->Totalmessages = nmea0183_.Gsv.Totalmessages;
    479    
     481
    480482    for  ( indexGSV=4*(nmea0183_.Gsv.message_number-1); indexGSV<=(4*nmea0183_.Gsv.message_number)-1; indexGSV++ )
    481483    {
     
    487489
    488490    if (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) {
    489       sendDataToServerSocket(*gsvFrame.getFrameData(),type); 
     491      sendDataToServerSocket(*gsvFrame.getFrameData(),type);
    490492      gsvFrame.setRoadTime(frameToDecode_.t);
    491493      gsvFrame.notifyObservers();
     
    493495    if ( (isRecording()) && (gsvRecording) && (nmea0183_.Gsv.Totalmessages == nmea0183_.Gsv.message_number) )
    494496    {
    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));
    497499                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
    502504    case TRAME_HDT:
    503505      if (!nmea0183_.Hdt.Parse( sentence ))
     
    505507      hdtFrame.getFrameData()->DegreesTrue = nmea0183_.Hdt.DegreesTrue;
    506508      hdtFrame.setRoadTime(frameToDecode_.t);
    507      
    508       sendDataToServerSocket(hdtFrame,type); 
     509
     510      sendDataToServerSocket(hdtFrame,type);
    509511      hdtFrame.notifyObservers();
    510      
     512
    511513      if ( (isRecording()) && (hdtRecording) )
    512514      {
    513515                  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));
    515517      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
    520522    case TRAME_RMC:
    521523      if (!nmea0183_.Rmc.Parse( sentence ))
     
    545547      rmcFrame.getFrameData()->vitesse = nmea0183_.Rmc.SpeedOverGroundKnots * 1852.0 / 3600.0; // 1 knot = 1852 m/h
    546548      rmcFrame.setRoadTime(frameToDecode_.t);
    547      
    548       sendDataToServerSocket(*rmcFrame.getFrameData(),type); 
     549
     550      sendDataToServerSocket(*rmcFrame.getFrameData(),type);
    549551      rmcFrame.notifyObservers();
    550      
     552
    551553      if ( (isRecording()) && (rmcRecording) )
    552554      {
    553555        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));
    555557        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");
    557559      }
    558560      break;
    559      
     561
    560562    case TRAME_ROT:
    561563      if (!nmea0183_.Rot.Parse( sentence ))
     
    564566      rotFrame.getFrameData()->valid_data = ( (nmea0183_.Rot.IsDataValid == True) ? 1 : 0 );
    565567      rotFrame.setRoadTime(frameToDecode_.t);
    566      
    567       sendDataToServerSocket(*rotFrame.getFrameData(),type); 
     568
     569      sendDataToServerSocket(*rotFrame.getFrameData(),type);
    568570      rotFrame.notifyObservers();
    569      
     571
    570572      if ( (isRecording()) && (rotRecording) )
    571573      {
    572574        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));
    574576        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
    579581    case TRAME_VTG:
    580582      if (!nmea0183_.Vtg.Parse( sentence )) {
     
    582584      } else {
    583585        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;
    586588        vtgFrame.setRoadTime(frameToDecode_.t);
    587      
     589
    588590        sendDataToServerSocket(vtgFrame,type);
    589591        vtgFrame.notifyObservers();
    590      
     592
    591593        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));
    594596                      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");
    596598        }
    597599      }
    598       break; 
    599      
     600      break;
     601
    600602    case TRAME_ZDA:
    601603      if (!nmea0183_.Zda.Parse( sentence )) {
     
    609611      zdaFrame.getFrameData()->MM = nmea0183_.Zda.Time.date().month();
    610612      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
    614616      sendDataToServerSocket(*zdaFrame.getFrameData(), type);
    615617      zdaFrame.setRoadTime(frameToDecode_.t);
    616618      zdaFrame.notifyObservers();
    617      
     619
    618620      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));
    621623      if ( zdahdFile.writeRecord(frameToDecode_.t, frameToDecode_.tr,(char *) zdaFrame.getFrameData(),sizeof(trame_zda)) == 0) {
    622624            LOG_WARN("Failed to record ZDA data ...");
     
    641643      }
    642644      */
    643      
    644       break; 
    645      
     645
     646      break;
     647
    646648    default:
    647       return 0; 
     649      return 0;
    648650  }
    649  
    650   return 1; 
     651
     652  return 1;
    651653}
    652654
  • trunk/Gps/gpsComponent.h

    r59 r99  
    2121#include <QSemaphore>
    2222#include <QThread>
     23#include <QByteArray>
     24#include <QString>
    2325
    2426#ifdef WIN32
    2527#   include "../driver/win32SerialPort.h"
    2628//#   include "network/gpsServerSocket.h"
    27 #else 
     29#else
    2830#   include "../driver/PosixSerialPort.h"
    2931#endif
     
    4143#   endif
    4244#else
    43     // On other platforms, simply ignore this 
     45    // On other platforms, simply ignore this
    4446#   define GPS_API /* nothing */
    4547#endif
     
    5860{
    5961  Q_OBJECT
    60    
     62
    6163public:
    62   GpsComponent(QString name); 
    63   ~GpsComponent(); 
    64  
     64  GpsComponent(QString name);
     65  ~GpsComponent();
     66
    6567  virtual void stopActivity(); /*!< to stop the processing thread */
    6668  virtual void startActivity(); /*!< to start the processing thread */
    67   virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config); 
     69  virtual ComponentBase::COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    6870
    6971
     
    7173  void disableSocketServer(); /*!< to disable the socket server interface */
    7274
    73   void setPortCOM(const char * port); 
     75  void setPortCOM(const char * port);
    7476
    7577
    76  
    77 public slots: 
     78
     79public slots:
    7880  void unlockProcessing(int v); /*!< to unlock the processing thread */
    7981
    8082protected:
    8183private:
    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 */
    8587  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 */
    8789
    8890#ifdef WIN32
     
    104106  static FrameTypeMap frameTypes[MAX_FRAMES];
    105107
    106   NMEA0183 nmea0183_; 
    107   QSemaphore semaphore_; 
     108  NMEA0183 nmea0183_;
     109  QSemaphore semaphore_;
    108110
    109   FRAME* currentFrame_; 
     111  FRAME* currentFrame_;
    110112
    111   FRAME frameToDecode_; 
     113  FRAME frameToDecode_;
    112114
    113115  road_time_t lastPpsTime_;
    114116
    115   bool newFrameToDecode_; 
    116   bool startOfFrame_; 
    117   bool endOfFrame_; 
     117  bool newFrameToDecode_;
     118  bool startOfFrame_;
     119  bool endOfFrame_;
    118120  int nextByteToProcess_;
    119121
    120122
    121123  unsigned int ppsIndex_;
    122  
     124
    123125  DbiteFile ppshdFile; /*!< pointer to the pps dbt file */
    124126  DbiteFile ggahdFile; /*!< pointer to the gga dbt file */
     
    139141  bool ggaRecording;
    140142  bool gsaRecording;
    141   bool gstRecording; 
     143  bool gstRecording;
    142144  bool gsvRecording;
    143145  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_;
    150152
    151153  ShMem * shMem_;
    152  
     154
    153155  /// For the socket server
    154156  /* Qt3 version - 17/12/2007
    155   BOOL socketServerEnabled; 
    156   void *frameToSend; 
     157  BOOL socketServerEnabled;
     158  void *frameToSend;
    157159  QCustomEvent *evt;
    158160  */
    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
    163165  */
    164166  template<typename T>
     
    168170    if (socketServerEnabled)
    169171    {
    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);
    175177    }
    176178    */
  • trunk/Gps/ui/polarxmainwindow.cpp

    r59 r99  
    362362    }
    363363}
    364 
     364/*
    365365void PolarxMainWindow::setReceiverStatus( SbfDataReceiverStatus * msg )
    366366{
     
    479479    }
    480480}
     481*/
  • trunk/Gps/ui/polarxmainwindow.hpp

    r59 r99  
    22#define __POLARXMAINWINDOW__
    33
    4 #include <QtGui>
     4//#include <QtGui>
     5#include <QtWidgets>
    56#include <bitset>
    6 #include "structure/structure_septentrio.h"
     7#include "../structure_gps.h"
    78#include "../SeptentrioSocket.h"
    89#include "PacpusTools/BinaryDecoder.h"
     
    1718
    1819      void setData( unsigned char * data , int buf_size ) ;
    19       void setReceiverStatus( SbfDataReceiverStatus * msg ) ;
     20      /*void setReceiverStatus( SbfDataReceiverStatus * msg ) ;
    2021      void setTrackingStatus( SbfDataTrackingStatus * msg ) ;
    21       void setPVTGeodetic( SbfDataPVTGeodetic * msg ) ;
     22      void setPVTGeodetic( SbfDataPVTGeodetic * msg ) ;*/
    2223      void setSocket( SeptentrioSocket * socket ) ;
    2324
  • trunk/Ladybug/LadybugComponent.cpp

    r98 r99  
    3232// Construct the factory
    3333static ComponentFactory<LadybugComponent> sFactory("LadybugComponent");
    34 static const size_t kMaxFilepathLength = 128;
    3534
    3635/* *Constructor*/
     
    5756        lbTotalNumberOfImagesWritten = 0;
    5857        lbNumOfFrames = 0;
    59 
    60         if (lbSaveJPGImages)
    61         {
    62                 try
    63                 {
    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                 try
    71                 {
    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                 try
    79                 {
    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                 try
    87                 {
    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                 try
    95                 {
    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                 try
    103                 {
    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                 try
    114                 {
    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 
    12258        THREAD_ALIVE = true;
    12359        start();
     
    13066        printf (" \n*** Stopping Activity ***\n");
    13167        LadybugError error;
    132 
    133             // Close DBT files
    134     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         }
    14668
    14769        lbIsRecording = false;
     
    222144        CreateImageBuffers();
    223145
    224         // Timestamp
    225     road_time_t timestamp = 0;
    226     road_timerange_t tr = 0;
    227 
    228146        while (THREAD_ALIVE)
    229147        {
    230 
    231148                lbCurrentTime = GetTickCount(); // road_time_t timestamp = road_time(); // ui64 ; unit microsec ; Orig 01/01/1970 00:00
    232149                lbFrameCount++;
     
    241158
    242159                error = ladybugGrabImage( lbContext, &image );
    243                 timestamp = road_time(); // timestamp
     160                // t = road_time(); // timestamp
    244161                HandleError(error);
    245162
     
    328245        HandleError(error);
    329246
    330 
    331         // Use it to trigger the camera with the gps signal
    332247        /*// Initialize Trigger
    333248        error = ladybugGetTriggerModeInfo( lbContext, &triggerModeInfo );
     
    441356                HandleError(error);
    442357
    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 
    482358                //printf("Saved camera %u image to %s.\n", uiCamera, pszOutputFilePath);
    483359
     
    525401        error = ladybugSaveImage(lbContext, &processedImage, pszOutputFilePath, LADYBUG_FILEFORMAT_JPG);
    526402        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         }
    533403
    534404}
  • trunk/Ladybug/LadybugComponent.h

    r98 r99  
    44//#include "Pacpus/kernel/pacpus.h"
    55#include "Pacpus/kernel/ComponentBase.h"
    6 #include "Pacpus/kernel/DbiteFile.h"
     6//#include "Pacpus/kernel/DbiteFile.h"
    77//#include "../NMEA0183/include/nmea0183.h"
    88
     
    121121                                int lbNumOfFrames;
    122122
    123                                 DbiteFile mDbtImage1;
    124                                 DbiteFile mDbtImage2;
    125                                 DbiteFile mDbtImage3;
    126                                 DbiteFile mDbtImage4;
    127                                 DbiteFile mDbtImage5;
    128                                 DbiteFile mDbtImage6;
    129                                 DbiteFile mDbtImagePano;
    130 
    131123        };
    132124}
  • trunk/NMEA0183/CMakeLists.txt

    r59 r99  
    11project(NMEA0183LIB)
    22
    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
    76add_definitions(${QT_DEFINITIONS})
     7#link_directories (${QT_LIBRARIES})
    88
    9 include_directories(include)
     9include_directories(
     10                    ${QT_INCLUDE_DIR}
     11                    include/
     12                   )
    1013
    1114#protocole de la centrale IXSEA
  • trunk/NMEA0183/include/HSATIT.hpp

    r59 r99  
    55#include "qstring.h"
    66#include "NMEA0183_slim.h"
     7#include "nmea0183.h"
    78#include "LatLong.hpp"
    89#include "Sentence.hpp"
  • trunk/NMEA0183/include/NMEA0183_slim.h

    r59 r99  
    1717
    1818/*
    19 ** Updates : Maria Alwan & G�rald Dherbomez 
     19** Updates : Maria Alwan & G�rald Dherbomez
    2020** Date :    14/09/2005
    2121** purpose : use of Qt API instead of MFC
     
    3232#include <QString>
    3333#include <QVector>
    34 #include <QDateTime> 
     34#include <QDateTime>
    3535
    3636
     
    137137#endif
    138138
     139#ifndef TRUE
     140#define TRUE true
     141#endif
     142
     143#ifndef FALSE
     144#define FALSE false
     145#endif
    139146//#include "nmea0183.hpp"
    140147
  • trunk/NMEA0183/include/nmea0183.h

    r59 r99  
    137137#endif
    138138
     139#ifndef TRUE
     140#define TRUE true
     141#endif
     142
     143#ifndef FALSE
     144#define FALSE false
     145#endif
     146
    139147#include "nmea0183.hpp"
    140148
  • trunk/NMEA0183/src/HSATIT.cpp

    r59 r99  
    11#include "HSATIT.hpp"
    2 
     2#include "nmea0183.h"
    33
    44
     
    1919{
    2020
    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;
    2828        pitchRotationRate       = 0.0;
    29         courseMadeGood          = 0.0;         
     29        courseMadeGood          = 0.0;
    3030        speedOverGround         = 0.0;
    31         longitudinalVel         = 0.0;         
     31        longitudinalVel         = 0.0;
    3232        transveralVel           = 0.0;
    3333        verticalVel                     = 0.0;
     
    4343{
    4444   /*
    45    ** HSATIT 
     45   ** HSATIT
    4646   **
    4747   **               1     2     3     4   5     6     7     8     9    10    11    12    13   14   15   16   17   18
     
    4949   ** $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>
    5050   **
    51    ** Field Number: 
     51   ** Field Number:
    5252   **   1)  h.hhh               is the heading in deg
    5353                2)  r.rrr               is the roll in deg
     
    6868                17) m.mm                is the east speed Std in m/s
    6969                18) n.nn                is the vertical speed Std in m/s
    70                
    71                
     70
     71
    7272   */
    7373
    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 );
    8080        pitchRotationRate       = sentence.Double( 7 );
    81         courseMadeGood          = sentence.Double( 8 );         
     81        courseMadeGood          = sentence.Double( 8 );
    8282        speedOverGround         = sentence.Double( 9 );
    83         longitudinalVel         = sentence.Double( 10 );               
     83        longitudinalVel         = sentence.Double( 10 );
    8484        transveralVel           = sentence.Double( 11 );
    8585        verticalVel                     = sentence.Double( 12 );
     
    8989        northSpeedStdDev        = sentence.Double( 16 );
    9090        eastSpeeedStdDev        = sentence.Double( 17 );
    91         verticalStdDev          = sentence.Double( 18 ); 
     91        verticalStdDev          = sentence.Double( 18 );
    9292
    9393   return( TRUE );
     
    108108   ** Let the parent do its thing
    109109   */
    110    
     110
    111111   RESPONSE::Write( sentence );
    112112
     
    115115        sentence += pitch;
    116116        sentence += sentence += sentence += heave;
    117         sentence += yawRotationRate;           
    118         sentence += rollRotationRate;   
     117        sentence += yawRotationRate;
     118        sentence += rollRotationRate;
    119119        sentence += pitchRotationRate;
    120         sentence += courseMadeGood;             
     120        sentence += courseMadeGood;
    121121        sentence += speedOverGround;
    122         sentence += longitudinalVel;           
     122        sentence += longitudinalVel;
    123123        sentence += transveralVel;
    124124        sentence += verticalVel;
     
    128128        sentence += sentence += northSpeedStdDev;
    129129        sentence += eastSpeeedStdDev;
    130         sentence += verticalStdDev; 
     130        sentence += verticalStdDev;
    131131
    132132   sentence.Finish();
     
    138138{
    139139
    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;
    146146        pitchRotationRate       = source.pitchRotationRate;
    147         courseMadeGood          = source.courseMadeGood;               
     147        courseMadeGood          = source.courseMadeGood;
    148148        speedOverGround         = source.speedOverGround;
    149         longitudinalVel         = source.longitudinalVel;               
     149        longitudinalVel         = source.longitudinalVel;
    150150        transveralVel           = source.transveralVel;
    151151        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################################################################################
    18project(OpencvVideo)
    2 ################################################################################
    3 
     9set(${PROJECT_NAME}_VERSION_MAJOR 0)
     10set(${PROJECT_NAME}_VERSION_MINOR 1)
    411# Create a DLL
    512add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
    613add_definitions( -DVIDEO_EXPORTS )
    714
     15#include(FindOpenCV.cmake)
    816find_package(OpenCV REQUIRED)
    917
     
    1220    message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
    1321endif()
    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################################################################################
     23create_export(EXPORT_HDR ${PROJECT_NAME})
     24pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     25add_definitions (${QT_DEFINITIONS})
     26find_package(Qt5Network REQUIRED)
     27################################################################################
     28# DIRECTORIES
     29include_directories(
     30    ${PROJECT_BINARY_DIR}
     31    ${QT_INCLUDE_DIR}
     32    ${PACPUS_INCLUDE_DIR}
     33    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3934)
    4035
     
    4237# Link directories
    4338# ========================================
    44 link_directories( ${PACPUS_LIB_DIR} )
     39link_directories(
     40        ${PACPUS_LIB_DIR}
     41)
    4542
    46 message (STATUS ${PACPUS_LIB_DIR})
    4743
    48 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
     44################################################################################
     45# FILES
     46set(PROJECT_HDRS
     47    ${EXPORT_HDR}
     48    CVWebcamComponent.hpp
     49    WebcamWorker.hpp
     50)
     51set(PROJECT_SRCS
     52    ${PLUGIN_CPP}
     53)
    4954
    50 # ========================================
    51 # List of sources
    52 # ========================================
    53 if (UNIX)
    54         set(
    55                 PROJECT_SRCS
    56                 ${PLUGIN_CPP}
    57         )
     55if(OpenCV_FOUND)
     56    list(APPEND PROJECT_SRCS CVWebcamComponent.cpp WebcamWorker.cpp)
    5857endif()
    5958
    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
     59set(FILES_TO_MOC
     60    ${PLUGIN_HDR}
     61    CVWebcamComponent.hpp
     62    WebcamWorker.hpp
    7963)
    8064
    81 set(
    82     UI_FILES
    83 
     65set(UI_FILES
    8466)
    8567
    86 # ========================================
    87 # Call MOC
    88 # ========================================
    89 qt4_wrap_cpp(
    90     PROJECT_MOC_SRCS
     68################################################################################
     69# Qt: call moc, uic
     70qt_wrap_cpp(PROJECT_MOC_SRCS
    9171    ${FILES_TO_MOC}
    9272)
    9373
    94 qt4_wrap_ui(
    95     PROJECT_UI_SRCS
     74qt_wrap_ui(PROJECT_UI_SRCS
    9675    ${UI_FILES}
    9776)
    9877
    99 # ========================================
    100 # Build a library
    101 # ========================================
    102 pacpus_add_library(
    103     ${PROJECT_NAME} SHARED
     78################################################################################
     79# BUILD and LINK
     80pacpus_add_library(${PROJECT_NAME} SHARED
     81    ${PROJECT_HDRS}
    10482    ${PROJECT_SRCS}
    10583    ${PROJECT_MOC_SRCS}
     
    10785)
    10886
    109 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    11087
    11188# ========================================
    11289# Libraries
    11390# ========================================
    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
     91set(LIBS
     92    optimized FileLib debug FileLib_d
     93    optimized PacpusLib debug PacpusLib_d
     94    optimized PacpusTools debug PacpusTools_d
    12295)
    123 
    124 # ========================================
    125 # Install
    126 # ========================================
    127 pacpus_install(${PROJECT_NAME})
    128 
     96if (WIN32)
     97    list(APPEND LIBS
     98        optimized ROAD_TIME debug ROAD_TIME_d
     99    )
     100endif()
     101# LINK
     102target_link_libraries(${PROJECT_NAME}
     103                      ${PACPUS_LIBRARIES}
     104                      ${PACPUS_DEPENDENCIES_LIB}
     105                      ${LIBS}
     106                      ${QT_LIBRARIES}
     107                      ${OpenCV_LIBS}
     108                     )
     109qt5_use_modules(${PROJECT_NAME} Network)
     110################################################################################
     111# FOLDERS
     112pacpus_folder(${PROJECT_NAME} "components")
     113################################################################################
     114# INSTALL
     115pacpus_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################################################################################
    17project(PacpusSocket)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DPACPUSSOCKET_EXPORTS )
    211################################################################################
    3 add_definitions(-DPACPUSSOCKET_EXPORTS)
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    415
    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}
     16find_package(Qt5Network REQUIRED)
     17################################################################################
     18# DIRECTORIES
     19include_directories(
     20    ${PROJECT_BINARY_DIR}
     21    ${QT_INCLUDE_DIR}
     22    ${PACPUS_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}/Pacpus/
    2924)
    3025
     
    3227# Link directories
    3328# ========================================
    34 link_directories(
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3531)
    3632
    37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
    3833
    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
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    PacpusSocketAirplug.h
     39    PacpusUDPSocket.h
     40)
     41set(PROJECT_SRCS
    4842    ${PLUGIN_CPP}
     43    PacpusSocketAirplug.cpp
     44    PacpusUDPSocket.cpp
    4945)
    5046
    51 # ========================================
    52 # Files to MOC
    53 # ========================================
    54 set(
    55     FILES_TO_MOC
     47set(FILES_TO_MOC
     48    ${PLUGIN_HDR}
    5649    PacpusSocketAirplug.h
    57         PacpusUDPSocket.h
    58     ${PLUGIN_H}
     50    PacpusUDPSocket.h
    5951)
    6052
    61 set(
    62     UI_FILES
    63 
     53set(UI_FILES
    6454)
    6555
    66 # ========================================
    67 # Call MOC
    68 # ========================================
    69 qt4_wrap_cpp(
    70     PROJECT_MOC_SRCS
     56################################################################################
     57# Qt: call moc, uic
     58qt_wrap_cpp(PROJECT_MOC_SRCS
    7159    ${FILES_TO_MOC}
    7260)
    7361
    74 qt4_wrap_ui(
    75     PROJECT_UI_SRCS
     62qt_wrap_ui(PROJECT_UI_SRCS
    7663    ${UI_FILES}
    7764)
    7865
    79 # ========================================
    80 # Build a library
    81 # ========================================
    82 pacpus_add_library(
    83     ${PROJECT_NAME} SHARED
     66################################################################################
     67# BUILD and LINK
     68pacpus_add_library(${PROJECT_NAME} SHARED
     69    ${PROJECT_HDRS}
    8470    ${PROJECT_SRCS}
    8571    ${PROJECT_MOC_SRCS}
     
    8773)
    8874
     75
    8976# ========================================
    9077# Libraries
    9178# ========================================
    92 # All the platform
    93 target_link_libraries(
    94     ${PROJECT_NAME}
    95     ${PACPUS_LIBRARIES}
    96     ${QT_LIBRARIES}
    97         ${PACPUS_DEPENDENCIES_LIB}
     79set(LIBS
     80    optimized FileLib debug FileLib_d
     81    optimized PacpusLib debug PacpusLib_d
     82    optimized PacpusTools debug PacpusTools_d
    9883)
     84if (WIN32)
     85    list(APPEND LIBS
     86        optimized ROAD_TIME debug ROAD_TIME_d
     87    )
     88endif()
     89# LINK
     90target_link_libraries(${PROJECT_NAME}
     91                      ${PACPUS_LIBRARIES}
     92                      ${PACPUS_DEPENDENCIES_LIB}
     93                      ${LIBS}
     94                      ${QT_LIBRARIES}
     95                     )
     96qt5_use_modules(${PROJECT_NAME} Network)
     97################################################################################
     98# FOLDERS
     99pacpus_folder(${PROJECT_NAME} "components")
     100################################################################################
     101# INSTALL
     102pacpus_install(${PROJECT_NAME})
    99103
    100 # ========================================
    101 # Install
    102 # ========================================
    103 pacpus_install(${PROJECT_NAME})
     104install(
     105    DIRECTORY   ${PacpusSocket_SOURCE_DIR}
     106    DESTINATION ${PACPUS_INSTALL_DIR}/include
     107    FILES_MATCHING PATTERN "*.h"
     108)
  • trunk/PacpusSocket/PacpusUDPSocket.cpp

    r87 r99  
    55//  author:     Pierre Hudelaine
    66//              Copyright Heudiasyc UMR UTC/CNRS 7253
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    1212*********************************************************************/
    1313
    14 #include "PacpusUDPSocket.h" 
     14#include "PacpusUDPSocket.h"
    1515
    1616#include <qbuffer.h>
     
    2727// Construct the factory
    2828//////////////////////////////////////////////////////////////////////////
    29 static ComponentFactory <PacpusUDPSocket> sFactory("PacpusUDPSocket"); 
     29static ComponentFactory <PacpusUDPSocket> sFactory("PacpusUDPSocket");
    3030
    3131
     
    3434//////////////////////////////////////////////////////////////////////////
    3535PacpusUDPSocket::PacpusUDPSocket(QString name)
    36     : ComponentBase(name) 
    37 {
    38 } 
     36    : ComponentBase(name)
     37{
     38}
    3939
    4040
     
    4242// Destructor
    4343//////////////////////////////////////////////////////////////////////////
    44 PacpusUDPSocket::~PacpusUDPSocket() 
     44PacpusUDPSocket::~PacpusUDPSocket()
    4545{
    4646}
     
    5252void PacpusUDPSocket::addOutputs()
    5353{
    54         addOutput<QString, PacpusUDPSocket>("udpSocketOutput");
     54        addOutput<QString, PacpusUDPSocket>("string");
    5555}
    5656
     
    6161void PacpusUDPSocket::addInputs()
    6262{
    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//////////////////////////////////////////////////////////////////////////
     71ComponentBase::COMPONENT_CONFIGURATION  PacpusUDPSocket::configureComponent(XmlComponentConfig config)
     72{
    7373
    7474        socketType_ = config.getProperty("typeSocket");
    75        
     75
    7676        if (socketType_ == "client" || socketType_ == "Client")
    7777        {
    7878            address2send_.setAddress(config.getProperty("address"));
    7979            port2send_ = config.getProperty("port").toUInt();
    80             socketType_ = "client";             
     80            socketType_ = "client";
    8181        }
    8282        else if (socketType_ == "server" || socketType_ == "Server")
     
    9292            socketType_ = "client";
    9393        }
    94        
    95         return ComponentBase::CONFIGURED_OK; 
    96 } 
     94
     95        return ComponentBase::CONFIGURED_OK;
     96}
    9797
    9898
     
    100100// Called by the ComponentManager to start the component
    101101//////////////////////////////////////////////////////////////////////////
    102 void PacpusUDPSocket::startActivity() 
    103 { 
     102void PacpusUDPSocket::startActivity()
     103{
    104104        if (!(udpSocket_ = new QUdpSocket()))
    105105                qFatal("Failed to init UDP socket!");
    106  
     106
    107107        if (socketType_ == "server")
    108108        {
     
    112112                        qWarning() << "Failed to bind socket for server on port" << port2bind_;
    113113        }
    114            
     114
    115115        connect(udpSocket_, SIGNAL(readyRead()), this, SLOT(readPendingDatagrams()));
    116        
    117         updSocketOutput_ = getTypedOutput<QString, PacpusUDPSocket>("udpSocketOutput");
     116
     117        udpSocketOutput_ = getTypedOutput<QString, PacpusUDPSocket>("string");
    118118}
    119119
     
    122122// Send datagram QString
    123123//////////////////////////////////////////////////////////////////////////
    124 void PacpusUDPSocket::sendDatagrams(QString frame)
    125 { 
     124void PacpusUDPSocket::sendQString(const QString& frame)
     125{
    126126        int sent=0;
    127        
     127
    128128        if (socketType_ == "client")
    129129        {
    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;
    132132        }
    133133        else if (socketType_ == "server")
     
    135135            for (int i = 0; i < listClients.size(); i++)
    136136            {
    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;
    139139            }
    140140        }
    141 } 
     141}
    142142
    143143
     
    145145// Send datagram QByteArray
    146146//////////////////////////////////////////////////////////////////////////
    147 void PacpusUDPSocket::sendDatagrams(QByteArray frame) 
    148 { 
     147void PacpusUDPSocket::sendDatagrams(QByteArray frame)
     148{
    149149        int sent=0;
    150        
     150
    151151        if (socketType_ == "client")
    152152        {
    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;
    155155        }
    156156        else if (socketType_ == "server")
     
    158158            for (int i = 0; i < listClients.size(); i++)
    159159            {
    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;
    162162            }
    163163        }
    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
    169169//////////////////////////////////////////////////////////////////////////
    170170void PacpusUDPSocket::readPendingDatagrams()
    171171{
    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;
    177177                quint16 senderPort;
    178    
     178
    179179                if(udpSocket_->readDatagram(datagram.data(), datagram.size(),  &sender, &senderPort) != -1)
    180                 {                   
     180                {
    181181                    if (socketType_ == "server")
    182182                    {
    183183                                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                                {
    187187                                        if (listClients[i]->getAddress() == sender && listClients[i]->getPort() == senderPort)
    188188                                                flag = true;
    189189                                }
    190                        
     190
    191191                                if (flag == false)
    192192                                        listClients << new Client(sender, senderPort);
    193193                        }
    194                        
    195                         if (updSocketOutput_ && updSocketOutput_->hasConnection())
    196                                 updSocketOutput_->send(QString(datagram.data()));
     194
     195                        if (udpSocketOutput_ && udpSocketOutput_->hasConnection())
     196                                udpSocketOutput_->send(QString(datagram.data()));
    197197                }
    198198                else
  • trunk/PacpusSocket/PacpusUDPSocket.h

    r87 r99  
    55//  author:     Pierre Hudelaine
    66//              Copyright Heudiasyc UMR UTC/CNRS 7253
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    1515
    1616#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"
    1919
    2020// Export macro for PacpusSocket DLL for Windows only
     
    2828#   endif
    2929#else
    30     // On other platforms, simply ignore this 
    31 #   define PACPUSSOCKET_API 
     30    // On other platforms, simply ignore this
     31#   define PACPUSSOCKET_API
    3232#endif
    3333
     
    3838class PACPUSSOCKET_API Client
    3939{
    40 public: 
     40public:
    4141    /// Constructor
    4242    Client();
     
    4444    /// Destructor
    4545    ~Client();
    46    
     46
    4747    QHostAddress address_;
    4848    quint16 port_;
    49    
    50     QHostAddress getAddress() {return address_;};   
     49
     50    QHostAddress getAddress() {return address_;};
    5151    quint16 getPort() {return port_;};
    5252};
     
    5454class PACPUSSOCKET_API PacpusUDPSocket
    5555        : public QObject
    56         , public ComponentBase 
    57 { 
     56        , public ComponentBase
     57{
    5858  Q_OBJECT
    5959
    60 public: 
     60public:
    6161    /// Constructor
    6262    PacpusUDPSocket(QString name);
     
    7171
    7272    /// Slot d'envoie des paquets
    73     void sendDatagrams(QString frame);
     73    void sendQString(const QString& frame);
    7474    void sendDatagrams(QByteArray frame);
    75    
     75
    7676Q_SIGNALS:
    7777    void newDatagram(QByteArray datagram);
     
    8383    virtual void stopActivity();
    8484    virtual COMPONENT_CONFIGURATION configureComponent(XmlComponentConfig config);
    85        
    86         virtual void addInputs();
     85
     86    virtual void addInputs();
    8787    virtual void addOutputs();
    88        
    89         OutputInterface<QString, PacpusUDPSocket>* udpSocketOutput_;
     88
     89    OutputInterface<QString, PacpusUDPSocket>* udpSocketOutput_;
    9090
    9191    QUdpSocket * udpSocket_;
     
    9494    quint16 port2send_;
    9595    QHostAddress address2send_;
    96     QString socketType_;         
    97      
     96    QString socketType_;
     97
    9898    QList <Client *> listClients;
    9999};
  • 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################################################################################
    18project(PtGreyCameras)
     9set(${PROJECT_NAME}_VERSION_MAJOR 0)
     10set(${PROJECT_NAME}_VERSION_MINOR 1)
     11# Create a DLL
     12add_definitions(-DCVWEBCAM_COMPONENT_EXPORTS)
     13add_definitions( -DVIDEO_EXPORTS )
     14
     15#include(FindOpenCV.cmake)
     16find_package(OpenCV REQUIRED)
     17
     18# Check for OpenCV
     19if(NOT OpenCV_FOUND)
     20    message(FATAL_ERROR "Project ${PROJECT_NAME} requires OpenCV library")
     21endif()
    222################################################################################
    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 )
     23create_export(EXPORT_HDR ${PROJECT_NAME})
     24pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     25add_definitions (${QT_DEFINITIONS})
    3326# ========================================
    3427# Options
     
    6356        endif()
    6457endif()
    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} 
     58find_package(Qt5Network REQUIRED)
     59################################################################################
     60# DIRECTORIES
     61include_directories(
     62    ${PROJECT_BINARY_DIR}
     63    ${QT_INCLUDE_DIR}
     64    ${PACPUS_INCLUDE_DIR}
     65    ${PACPUS_INCLUDE_DIR}/Pacpus/
    7466)
    7567
     
    7769# Link directories
    7870# ========================================
    79 link_directories(
    80   ${PACPUS_LIBRARY_HINT}
     71link_directories( 
     72        ${PACPUS_LIB_DIR}
    8173)
    8274
    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
     77set(PROJECT_HDRS
     78    ${EXPORT_HDR}
     79    PtGreyCamerasExp.h
     80    #../../StdDbtPlayerComponents/ImageBaseStructure.h
     81)
     82set(PROJECT_SRCS
     83    ${PLUGIN_CPP}
     84)
    8685
    87 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
     86if(OpenCV_FOUND)
     87    list(APPEND OpenCV_LIBS ${OpenCV_LIBRARIES})
     88    list(APPEND OpenCV_INCLUDE_DIR ${OpenCV_INCLUDE_DIRS})
     89    include_directories(${OpenCV_INCLUDE_DIR})
     90endif(OpenCV_FOUND)
    8891
    89 # ========================================
    90 # List of sources
    91 # ========================================
    92 set(
    93         PROJECT_SRCS
    94         PtGreyCamerasExp.h
    95         #../../StdDbtPlayerComponents/ImageBaseStructure.h
    96         ${PLUGIN_CPP}
    97 )
    9892if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND )
    9993        list(APPEND PROJECT_SRCS
     
    112106endif()
    113107
    114 # ========================================
    115 # Files to MOC
    116 # ========================================
    117 set(
    118         FILES_TO_MOC
    119         ${PLUGIN_H}
     108set(FILES_TO_MOC
     109    ${PLUGIN_HDR}
    120110)
    121111if(BUILD_PtGreyCameras AND BumbleBeeXB3_FOUND)
     
    134124endif()
    135125
    136 set(
    137     UI_FILES
    138 #    WidgetIMU.ui
    139 
     126set(UI_FILES
    140127)
    141128
    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
     131qt_wrap_cpp(PROJECT_MOC_SRCS
    153132    ${FILES_TO_MOC}
    154133)
    155134
    156 qt4_wrap_ui(
    157     PROJECT_UI_SRCS
     135qt_wrap_ui(PROJECT_UI_SRCS
    158136    ${UI_FILES}
    159137)
    160138
    161 # ========================================
    162 # Build a library
    163 # ========================================
    164 pacpus_add_library(
    165     ${PROJECT_NAME} SHARED
     139################################################################################
     140# BUILD and LINK
     141pacpus_add_library(${PROJECT_NAME} SHARED
     142    ${PROJECT_HDRS}
    166143    ${PROJECT_SRCS}
    167144    ${PROJECT_MOC_SRCS}
    168145    ${PROJECT_UI_SRCS}
    169146)
     147
     148
    170149# ========================================
    171150# Libraries
    172151# ========================================
    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}     
     152set(LIBS
     153    optimized FileLib debug FileLib_d
     154    optimized PacpusLib debug PacpusLib_d
     155    optimized PacpusTools debug PacpusTools_d
    184156)
    185 
    186 # ========================================
    187 # Install
    188 # ========================================
    189 pacpus_install(${PROJECT_NAME})
     157if (WIN32)
     158    list(APPEND LIBS
     159        optimized ROAD_TIME debug ROAD_TIME_d
     160    )
     161endif()
     162# LINK
     163target_link_libraries(${PROJECT_NAME}
     164                      ${PACPUS_LIBRARIES}
     165                      ${PACPUS_DEPENDENCIES_LIB}
     166                      ${LIBS}
     167                      ${QT_LIBRARIES}
     168                      ${OpenCV_LIBS}
     169                     )
     170qt5_use_modules(${PROJECT_NAME} Network)
     171################################################################################
     172# FOLDERS
     173pacpus_folder(${PROJECT_NAME} "components")
     174################################################################################
     175# INSTALL
     176pacpus_install(${PROJECT_NAME})
  • trunk/PtGreyCameras/Flea3Grabber.h

    r64 r99  
    55//  author:     Danilo Alves de Lima
    66//              Copyright Heudiasyc UMR UTC/CNRS 6599
    7 // 
     7//
    88//  version:    $Id: $
    99//
    10 //  purpose:   
     10//  purpose:
    1111*********************************************************************/
    1212
     
    3131#include <string>
    3232#include <vector>
    33 #include "../../../Pacpussensors/trunk/StdDbtPlayerComponents/ImageBaseStructure.h"
     33#include "../StdDbtPlayerComponents/ImageBaseStructure.h"
    3434
    3535namespace pacpus {
     
    5858        unsigned int cam_trigger_mode;          // Trigger mode
    5959        unsigned int cam_trigger_enable;        // Trigger enable (1 on // 0 off)
    60         unsigned int cam_trigger_parameter;     
     60        unsigned int cam_trigger_parameter;
    6161        unsigned int cam_trigger_polarity;      // Trigger polarity (0 low // 1 high)
    6262        unsigned int cam_trigger_source;        // Source (GPIO)
     
    8585        //----------------------------------------------------------------------------------------------------------------
    8686        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
    9090        // Output directory
    9191        QDir mOutputDirectory;
     
    9898
    9999/** Class to provide the obstacle detection from a disparity map data */
    100 class PTGREYCAMERAS_API Flea3Grabber:   public QThread, 
     100class PTGREYCAMERAS_API Flea3Grabber:   public QThread,
    101101                                                                                public ComponentBase
    102102{
     
    114114        //==============================================================================================
    115115
    116         /** 
     116        /**
    117117        * Initialize default values
    118118        */
    119119        void InitDefault(int indice);
    120120
    121         int img2send_; 
     121        int img2send_;
    122122
    123123protected:
  • trunk/PtGreyCameras/PtGreyCamerasPlugin.cpp

    r48 r99  
    1 // Autogenerated file by PacpusPlugin.cmake
     1// Autogenerated file by PacpusUtilities.cmake
    22// DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE
    33
     
    1717}
    1818
    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 PacpusPlugin.cmake
     1// Autogenerated file by PacpusUtilities.cmake
    22// DO NOT EDIT!!! ALL CHANGES WOULD BE REMOVED BY THE NEXT CALL OF CMAKE
    33
     
    1616{
    1717    Q_OBJECT
     18    //Qt5 Plugins Macro
     19    Q_PLUGIN_METADATA(IID "pacpus.PtGreyCamerasPlugin" FILE "PtGreyCamerasPlugin.json")
    1820    Q_INTERFACES(PacpusPluginInterface)
    1921
  • trunk/Sick/CMakeLists.txt

    r71 r99  
     1#########################quick start############################################
     2#cmake ../ -G "CodeBlocks - Unix Makefiles"
     3#make
     4#make install
     5#make clean
     6################################################################################
    17project(Sick)
    2 
    3 ################################################################################
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
    410add_definitions( -DSICK_EXPORTS )
    511add_definitions( -DSICKLDMRS_EXPORTS )
    612add_definitions( -DSICKLMS_EXPORTS )
     13################################################################################
     14create_export(EXPORT_HDR ${PROJECT_NAME})
     15pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     16add_definitions (${QT_DEFINITIONS})
    717
    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}
     18find_package(Qt5Network REQUIRED)
     19################################################################################
     20# DIRECTORIES
     21include_directories(
     22    ${PROJECT_BINARY_DIR}
     23    ${QT_INCLUDE_DIR}
     24    ${PACPUS_INCLUDE_DIR}
     25    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3226)
    3327
     
    3529# Link directories
    3630# ========================================
    37 link_directories( ${PACPUS_LIB_DIR}
     31link_directories(
     32        ${PACPUS_LIB_DIR}
    3833)
    3934
    4035
    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
     38set(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)
     48set(PROJECT_SRCS
    5849    ${PLUGIN_CPP}
     50    SickComponent.cpp
     51    AbstractSickSensor.cpp
     52    SickLDMRSSensor.cpp
     53    SickLMSSensor.cpp
     54    SickSocket.cpp
    5955)
    6056
    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}
     57set(FILES_TO_MOC
     58    ${PLUGIN_HDR}
     59    SickComponent.h
     60    AbstractSickSensor.h
     61    SickLDMRSSensor.h
     62    SickLMSSensor.h
     63    SickSocket.h
    7264)
    7365
    74 set(
    75     UI_FILES
    76 
     66set(UI_FILES
    7767)
    7868
    79 # ========================================
    80 # Call MOC
    81 # ========================================
    82 qt4_wrap_cpp(
    83     PROJECT_MOC_SRCS
     69################################################################################
     70# Qt: call moc, uic
     71qt_wrap_cpp(PROJECT_MOC_SRCS
    8472    ${FILES_TO_MOC}
    8573)
    8674
    87 qt4_wrap_ui(
    88     PROJECT_UI_SRCS
     75qt_wrap_ui(PROJECT_UI_SRCS
    8976    ${UI_FILES}
    9077)
    9178
    92 # ========================================
    93 # Build a library
    94 # ========================================
    95 pacpus_add_library(
    96     ${PROJECT_NAME} SHARED
     79################################################################################
     80# BUILD and LINK
     81pacpus_add_library(${PROJECT_NAME} SHARED
     82    ${PROJECT_HDRS}
    9783    ${PROJECT_SRCS}
    9884    ${PROJECT_MOC_SRCS}
     
    10086)
    10187
    102 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    10388
     89# ========================================
     90# Libraries
     91# ========================================
    10492set(LIBS
    10593    optimized FileLib debug FileLib_d
     
    112100    )
    113101endif()
    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
     103target_link_libraries(${PROJECT_NAME}
     104                      ${PACPUS_LIBRARIES}
     105                      ${PACPUS_DEPENDENCIES_LIB}
     106                      ${LIBS}
     107                      ${QT_LIBRARIES}
     108                     )
     109qt5_use_modules(${PROJECT_NAME} Network)
     110################################################################################
     111# FOLDERS
    128112pacpus_folder(${PROJECT_NAME} "components")
    129 
    130 # ========================================
    131 # Install
    132 # ========================================
    133 pacpus_install(${PROJECT_NAME})
     113################################################################################
     114# INSTALL
     115pacpus_install(${PROJECT_NAME})
  • trunk/Sick/SickSocket.cpp

    r72 r99  
    9797  mutex.lock();
    9898  QTextStream os(socket);
    99   os << data.toAscii() << endl;
     99  os << data.toLatin1() << endl;//change in qt5
    100100  mutex.unlock();
    101   qDebug() << "data sent to server: " << data.toAscii() ; //a adapter aussi
     101  qDebug() << "data sent to server: " << data.toLatin1() ; //a adapter aussi
    102102}
    103103
  • trunk/SpanCPTComponent/CMakeLists.txt

    r59 r99  
     1#########################quick start############################################
     2#cmake ../ -G "CodeBlocks - Unix Makefiles"
     3#make
     4#make install
     5#make clean
     6################################################################################
    17project(SpanCPTComponent)
    28
     
    410add_definitions( -DCPTCOMPONENT_EXPORTS )
    511add_definitions( -DPLUGINLIB_EXPORTS )
     12################################################################################
     13create_export(EXPORT_HDR ${PROJECT_NAME})
     14pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     15add_definitions (${QT_DEFINITIONS})
    616
    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}
     17find_package(Qt5Network REQUIRED)
     18################################################################################
     19# DIRECTORIES
     20include_directories(
     21    ${PROJECT_BINARY_DIR}
     22    ${QT_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}
     24    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3225)
    3326
     
    4033
    4134
    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
     37set(PROJECT_HDRS
     38    ${EXPORT_HDR}
     39    CPTComponent.h 
    5140    ../driver/AbstractSerialPort.h
    52     ../driver/AbstractSerialPort.cpp
     41    xml/spancpt.xml
     42)
     43set(PROJECT_SRCS
    5344    ${PLUGIN_CPP}
     45    CPTComponent.cpp
     46    ../driver/AbstractSerialPort.cpp
    5447)
    5548
     
    7063endif(UNIX)
    7164
    72 
    73 # ========================================
    74 # Files to MOC
    75 # ========================================
    76 
    7765if(UNIX)
    7866set(FILES_TO_MOC
     
    8068  CPTComponent.h
    8169  ../driver/PosixSerialPort.h
    82     ${PLUGIN_H}
     70    ${PLUGIN_HDR}
    8371  )
    8472endif(UNIX)
     
    8977  CPTComponent.h
    9078  ../driver/Win32SerialPort.h
    91     ${PLUGIN_H}
     79    ${PLUGIN_HDR}
    9280  )
    9381endif(WIN32)
    9482
    95 set(
    96     UI_FILES
     83set(UI_FILES
    9784)
    9885
    99 # ========================================
    100 # Call MOC
    101 # ========================================
    102 qt4_wrap_cpp(
    103     PROJECT_MOC_SRCS
     86################################################################################
     87# Qt: call moc, uic
     88qt_wrap_cpp(PROJECT_MOC_SRCS
    10489    ${FILES_TO_MOC}
    10590)
    10691
    107 qt4_wrap_ui(
    108     PROJECT_UI_SRCS
     92qt_wrap_ui(PROJECT_UI_SRCS
    10993    ${UI_FILES}
    11094)
    11195
    112 # ========================================
    113 # Build a library
    114 # ========================================
    115 pacpus_add_library(
    116     ${PROJECT_NAME} SHARED
     96################################################################################
     97# BUILD and LINK
     98pacpus_add_library(${PROJECT_NAME} SHARED
     99    ${PROJECT_HDRS}
    117100    ${PROJECT_SRCS}
    118101    ${PROJECT_MOC_SRCS}
     
    120103)
    121104
     105
    122106# ========================================
    123107# Libraries
    124108# ========================================
    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
     109set(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)
     115if (WIN32)
     116    list(APPEND LIBS
     117        optimized ROAD_TIME debug ROAD_TIME_d
    130118    )
    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 )
     119endif()
     120# LINK
     121target_link_libraries(${PROJECT_NAME}
     122                      ${PACPUS_LIBRARIES}
     123                      ${PACPUS_DEPENDENCIES_LIB}
     124                      ${LIBS}
     125                      ${QT_LIBRARIES}
     126                     )
     127qt5_use_modules(${PROJECT_NAME} Network)
     128################################################################################
     129# FOLDERS
    149130pacpus_folder(${PROJECT_NAME} "components")
    150 
    151 # ========================================
    152 # Install
    153 # ========================================
    154 pacpus_install(${PROJECT_NAME})
    155 
     131################################################################################
     132# INSTALL
     133pacpus_install(${PROJECT_NAME})
  • trunk/SpanCPTComponent/CPTComponent.cpp

    r88 r99  
    183183    memcpy(buffer, currentDataFrame, currentDataFrameLength_);
    184184    buffer[currentDataFrameLength_] = '\0'; // add a \0 to convert for the conversion in QString
    185     currentDataFrame_ = QString::fromAscii(buffer);
     185    currentDataFrame_ = "";
     186    currentDataFrame_.append(buffer);
    186187
    187188        delete[] buffer;
  • trunk/SpanCPTComponent/CPTComponent.h

    r88 r99  
    1717#include <fstream>
    1818#include <qobject.h>
     19#include <QPointF>
    1920#include <string>
    2021
     
    162163                     TimestampedInscovFrame*);
    163164
    164         // component ouputs
    165         void addOutputs();
    166         OutputInterface<QPointF, CPTComponent>* position2DENUOutput_;
     165    // component ouputs
     166    void addOutputs();
     167    OutputInterface<QPointF, CPTComponent>* position2DENUOutput_;
    167168};
    168169
  • trunk/StdDbtPlayerComponents/CMakeLists.txt

    r94 r99  
     1#########################quick start############################################
     2#cmake ../ -G "CodeBlocks - Unix Makefiles"
     3#make
     4#make install
     5#make clean
     6################################################################################
    17project(StdDbtPlayerComponents)
    2 
    3 ################################################################################
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
    410add_definitions( -DSTDDBTPLAYERCOMPONENTS_EXPORTS )
    511add_definitions( -DDBTPLYSICK_EXPORTS)
    612add_definitions( -DDBTPLYSICK_EXPORTS)
    7 # ========================================
    8 # Include directories
    9 # ========================================
    10 include_directories(
    11   ${PROJECT_BINARY_DIR}
    12   ${QT_INCLUDE_DIR}
     13################################################################################
     14create_export(EXPORT_HDR ${PROJECT_NAME})
     15pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     16add_definitions (${QT_DEFINITIONS})
     17
     18find_package(Qt5Network REQUIRED)
     19################################################################################
     20# DIRECTORIES
     21include_directories(
     22    ${PROJECT_BINARY_DIR}
     23    ${QT_INCLUDE_DIR}
     24    ${PACPUS_INCLUDE_DIR}
     25    ${PACPUS_INCLUDE_DIR}/Pacpus/
    1326)
    1427
     
    1629# Link directories
    1730# ========================================
    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
     31link_directories(
     32        ${PACPUS_LIB_DIR}
    2733)
    2834
    2935
    30 # ========================================
    31 # List of sources
    32 # ========================================
    33 set(
    34     PROJECT_SRCS
     36################################################################################
     37# FILES
     38set(PROJECT_HDRS
     39    ${EXPORT_HDR}
     40    StdDbtPlayerComponentsConfig.h
     41    DbtPlySickLMSManager.h
     42    DbtPlySickLDMRSManager.h
     43    ${PROJECT_NAME}.xml
     44    ${PROJECT_NAME}_d.xml
     45)
     46set(PROJECT_SRCS
     47    ${PLUGIN_CPP}
    3548    DbtPlySickLMSManager.cpp
    36     DbtPlySickLDMRSManager.cpp
    37         ${HDRS}
    38     ${PLUGIN_CPP}
     49    DbtPlySickLDMRSManager.cpp 
    3950)
    4051
    41 # ========================================
    42 # Files to MOC
    43 # ========================================
    44 set(
    45     FILES_TO_MOC
     52set(FILES_TO_MOC
     53    ${PLUGIN_HDR}
    4654    DbtPlySickLMSManager.h
    47     DbtPlySickLDMRSManager.h
    48         ${PLUGIN_H}
    49         )   
    50 
    51 
    52 set(
    53     UI_FILES
    54 
     55    DbtPlySickLDMRSManager.h
    5556)
    5657
    57 # ========================================
    58 # Call MOC
    59 # ========================================
    60 qt_wrap_cpp(
    61     PROJECT_MOC_SRCS
     58set(UI_FILES
     59)
     60
     61################################################################################
     62# Qt: call moc, uic
     63qt_wrap_cpp(PROJECT_MOC_SRCS
    6264    ${FILES_TO_MOC}
    6365)
    6466
    65 qt_wrap_ui(
    66     PROJECT_UI_SRCS
     67qt_wrap_ui(PROJECT_UI_SRCS
    6768    ${UI_FILES}
    6869)
    6970
    70 # ========================================
    71 # Build a library
    72 # ========================================
    73 pacpus_add_library(
    74     ${PROJECT_NAME} SHARED
     71################################################################################
     72# BUILD and LINK
     73pacpus_add_library(${PROJECT_NAME} SHARED
     74    ${PROJECT_HDRS}
    7575    ${PROJECT_SRCS}
    7676    ${PROJECT_MOC_SRCS}
     
    7878)
    7979
     80
     81# ========================================
     82# Libraries
     83# ========================================
    8084set(LIBS
    8185    optimized FileLib debug FileLib_d
     
    8892    )
    8993endif()
     94# LINK
     95target_link_libraries(${PROJECT_NAME}
     96                      ${PACPUS_LIBRARIES}
     97                      ${PACPUS_DEPENDENCIES_LIB}
     98                      ${LIBS}
     99                      ${QT_LIBRARIES}
     100                     )
     101qt5_use_modules(${PROJECT_NAME} Network)
     102################################################################################
     103# FOLDERS
     104pacpus_folder(${PROJECT_NAME} "components")
     105################################################################################
     106# INSTALL
     107pacpus_install(${PROJECT_NAME})
    90108
    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
     110install(
     111    DIRECTORY
     112        ${StdDbtPlayerComponents_SOURCE_DIR}
     113    DESTINATION
     114        ${PACPUS_INSTALL_DIR}/include
     115    FILES_MATCHING PATTERN "*.h"
    101116)
    102 
    103 pacpus_folder(${PROJECT_NAME} "components")
    104 
    105 # ========================================
    106 # Install
    107 # ========================================
    108 pacpus_install(${PROJECT_NAME})
  • trunk/StdDbtPlayerComponents/DbtPlySickLDMRSManager.h

    r50 r99  
    55//  author:     Cyril Fougeray
    66//              Copyright Heudiasyc UMR UTC/CNRS 6599
    7 // 
     7//
    88//  version:    $Id: $
    99//
    10 //  purpose:   
     10//  purpose:
    1111// *********************************************************************
    1212
     
    2929#   endif
    3030#else
    31     // On other platforms, simply ignore this 
    32 #   define DBTPLYSICK_API 
     31    // On other platforms, simply ignore this
     32#   define DBTPLYSICK_API
    3333#endif
    3434
    3535namespace pacpus {
    36    
     36
    3737class ShMem;
    3838
     
    6464} // namespace pacpus
    6565
    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
    33
    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
    58#ifdef WIN32
    6 #   ifdef STDDBTPLAYERCOMPONENTS_EXPORTS
    7         // make DLL
    8 #       define STDDBTPLAYERCOMPONENTS_API __declspec(dllexport)
    9 #   else
    10         // use DLL
    11 #       define STDDBTPLAYERCOMPONENTS_API __declspec(dllimport)
    12 #   endif
     9   #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
    1316#else
    14     // On other platforms, simply ignore this
    15 #   define STDDBTPLAYERCOMPONENTS_API
     17//      On other platforms, simply ignore this
     18   #define STDDBTPLAYERCOMPONENTS_API
    1619#endif
    1720
    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################################################################################
    17project(TelnetClient)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DTelnetClient_EXPORTS )
    211################################################################################
    3 add_definitions(-DTelnetClient_EXPORTS)
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    415
    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 # ========================================
     16find_package(Qt5Network REQUIRED)
     17################################################################################
     18# DIRECTORIES
    2619include_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/
    2924)
    3025
     
    3227# Link directories
    3328# ========================================
    34 link_directories(
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3531)
    3632
    37 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
    3833
    39 # ========================================
    40 # List of sources
    41 # ========================================
    42 set(
    43     PROJECT_SRCS
    44     TelnetClient.cpp   
     34################################################################################
     35# FILES
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    TelnetClient.h 
     39    xml/${PROJECT_NAME}.xml
     40    xml/${PROJECT_NAME}_d.xml
     41)
     42set(PROJECT_SRCS
    4543    ${PLUGIN_CPP}
     44    TelnetClient.cpp 
    4645)
    4746
    48 # ========================================
    49 # Files to MOC
    50 # ========================================
    51 set(
    52     FILES_TO_MOC
    53     TelnetClient.h
    54     ${PLUGIN_H}
     47set(FILES_TO_MOC
     48    ${PLUGIN_HDR}
     49    TelnetClient.h
    5550)
    5651
    57 set(
    58     UI_FILES
    59 
     52set(UI_FILES
    6053)
    6154
    62 # ========================================
    63 # Call MOC
    64 # ========================================
    65 qt4_wrap_cpp(
    66     PROJECT_MOC_SRCS
     55################################################################################
     56# Qt: call moc, uic
     57qt_wrap_cpp(PROJECT_MOC_SRCS
    6758    ${FILES_TO_MOC}
    6859)
    6960
    70 qt4_wrap_ui(
    71     PROJECT_UI_SRCS
     61qt_wrap_ui(PROJECT_UI_SRCS
    7262    ${UI_FILES}
    7363)
    7464
    75 # ========================================
    76 # Build a library
    77 # ========================================
    78 pacpus_add_library(
    79     ${PROJECT_NAME} SHARED
     65################################################################################
     66# BUILD and LINK
     67pacpus_add_library(${PROJECT_NAME} SHARED
     68    ${PROJECT_HDRS}
    8069    ${PROJECT_SRCS}
    8170    ${PROJECT_MOC_SRCS}
     
    8372)
    8473
     74
    8575# ========================================
    8676# Libraries
    8777# ========================================
    88 # All the platform
    89 target_link_libraries(
    90     ${PROJECT_NAME}
    91     ${PACPUS_LIBRARIES}
    92     ${QT_LIBRARIES}
    93         ${PACPUS_DEPENDENCIES_LIB}
     78set(LIBS
     79    optimized FileLib debug FileLib_d
     80    optimized PacpusLib debug PacpusLib_d
     81    optimized PacpusTools debug PacpusTools_d
    9482)
    95 
    96 # ========================================
    97 # Install
    98 # ========================================
    99 pacpus_install(${PROJECT_NAME})
    100 
     83if (WIN32)
     84    list(APPEND LIBS
     85        optimized ROAD_TIME debug ROAD_TIME_d
     86    )
     87endif()
     88# LINK
     89target_link_libraries(${PROJECT_NAME}
     90                      ${PACPUS_LIBRARIES}
     91                      ${PACPUS_DEPENDENCIES_LIB}
     92                      ${LIBS}
     93                      ${QT_LIBRARIES}
     94                     )
     95qt5_use_modules(${PROJECT_NAME} Network)
     96################################################################################
     97# FOLDERS
     98pacpus_folder(${PROJECT_NAME} "components")
     99################################################################################
     100# INSTALL
     101pacpus_install(${PROJECT_NAME})
  • trunk/TelnetClient/TelnetClient.cpp

    r54 r99  
    1313
    1414#include "TelnetClient.h"
    15 
     15#include <string>
    1616
    1717using namespace pacpus;
     18using namespace std;
    1819
     20/// Default host address = 0.0.0.0 (any address)
     21static const string kDefaultHostAddress = "127.0.0.1";
     22/// Default host port = 2368
     23static const uint16_t kDefaultHostPort = 2368;
    1924
    2025DECLARE_STATIC_LOGGER("pacpus.base.TelnetClient");
     
    3338    : ComponentBase(name)
    3439{
     40    address_.setAddress(kDefaultHostAddress.c_str());
     41    port_ = kDefaultHostPort;
    3542}
    3643
     
    5057ComponentBase::COMPONENT_CONFIGURATION  TelnetClient::configureComponent(XmlComponentConfig config)
    5158{
    52         address_.setAddress(param.getProperty("address"));
    53         port_ = param.getProperty("port").toUInt();
    5459
    5560        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################################################################################
    17project(Velodyne)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DVELODYNEHDL64S2_EXPORTS )
     11################################################################################
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    215
     16find_package(Qt5Network REQUIRED)
    317################################################################################
    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
     19include_directories(
     20    ${PROJECT_BINARY_DIR}
     21    ${QT_INCLUDE_DIR}
     22    ${PACPUS_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}/Pacpus/
    3224)
    3325
     
    3527# Link directories
    3628# ========================================
    37 link_directories( ${PACPUS_LIB_DIR}
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3831)
    3932
    4033
    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
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    VelodyneComponent.h
     39    structure_velodyne.h
     40    ${PROJECT_NAME}.xml
     41    ${PROJECT_NAME}_d.xml
     42)
     43set(PROJECT_SRCS
    5044    ${PLUGIN_CPP}
     45    VelodyneComponent.cpp 
    5146)
    5247
    53 # ========================================
    54 # Files to MOC
    55 # ========================================
    56 set(
    57     FILES_TO_MOC
    58     VelodyneComponent.h
    59     ${PLUGIN_H}
     48set(FILES_TO_MOC
     49    ${PLUGIN_HDR}
     50    VelodyneComponent.h
    6051)
    6152
    62 set(
    63     UI_FILES
    64 
     53set(UI_FILES
    6554)
    6655
    67 # ========================================
    68 # Call MOC
    69 # ========================================
    70 qt4_wrap_cpp(
    71     PROJECT_MOC_SRCS
     56################################################################################
     57# Qt: call moc, uic
     58qt_wrap_cpp(PROJECT_MOC_SRCS
    7259    ${FILES_TO_MOC}
    7360)
    7461
    75 qt4_wrap_ui(
    76     PROJECT_UI_SRCS
     62qt_wrap_ui(PROJECT_UI_SRCS
    7763    ${UI_FILES}
    7864)
    7965
    80 # ========================================
    81 # Build a library
    82 # ========================================
    83 pacpus_add_library(
    84     ${PROJECT_NAME} SHARED
     66################################################################################
     67# BUILD and LINK
     68pacpus_add_library(${PROJECT_NAME} SHARED
     69    ${PROJECT_HDRS}
    8570    ${PROJECT_SRCS}
    8671    ${PROJECT_MOC_SRCS}
     
    8873)
    8974
    90 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    9175
     76# ========================================
     77# Libraries
     78# ========================================
    9279set(LIBS
    9380    optimized FileLib debug FileLib_d
     
    10087    )
    10188endif()
    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
     90target_link_libraries(${PROJECT_NAME}
     91                      ${PACPUS_LIBRARIES}
     92                      ${PACPUS_DEPENDENCIES_LIB}
     93                      ${LIBS}
     94                      ${QT_LIBRARIES}
     95                     )
     96qt5_use_modules(${PROJECT_NAME} Network)
     97################################################################################
     98# FOLDERS
    11599pacpus_folder(${PROJECT_NAME} "components")
    116 
    117 # ========================================
    118 # Install
    119 # ========================================
    120 pacpus_install(${PROJECT_NAME})
     100################################################################################
     101# INSTALL
     102pacpus_install(${PROJECT_NAME})
  • trunk/VelodyneComponent/VelodyneComponent.cpp

    r66 r99  
    55//  author:     Gerald Dherbomez
    66//              Copyright Heudiasyc UMR UTC/CNRS 6599
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    2020
    2121#include <QtEndian>
    22 #include <QUdpSocket>
     22#include <QtNetwork/QUdpSocket>
    2323#include <string>
    2424
     
    4949{
    5050    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);
    5454
    5555    setRecording (true);
     
    8686/// TODO: doc
    8787void VelodyneComponent::run()
    88 { 
     88{
    8989    initialize();
    9090    exec(); // launch the exec loop, blocking until receiving exit() signal ...
     
    197197//////////////////////////////////////////////////////////////////////////
    198198/// new data coming from Velodyne sensor
    199 void VelodyneComponent::readPendingDatagrams() 
     199void VelodyneComponent::readPendingDatagrams()
    200200{
    201201    // get a timestamp
     
    338338            //*/
    339339                        }
    340                        
     340
    341341            mVelodyneData->range = mBlockIndex+(lastBlockIndex - 1);
    342342            LOG_DEBUG("range = " << mVelodyneData->range);
  • trunk/VelodyneComponent/VelodyneComponent.h

    r66 r99  
    77#define VELODYNECOMPONENT_H
    88
    9 #include <qhostaddress.h>
     9#include <QtNetwork/qhostaddress.h>
    1010#include <qthread.h>
    1111
  • trunk/Wifibot/CMakeLists.txt

    r21 r99  
     1#########################quick start############################################
     2#cmake ../ -G "CodeBlocks - Unix Makefiles"
     3#make
     4#make install
     5#make clean
     6################################################################################
    17project(Wifibot)
     8set(${PROJECT_NAME}_VERSION_MAJOR 0)
     9set(${PROJECT_NAME}_VERSION_MINOR 1)
     10add_definitions( -DWIFIBOTXT_EXPORTS )
    211################################################################################
    3 add_definitions( -DWIFIBOTXT_EXPORTS )
     12create_export(EXPORT_HDR ${PROJECT_NAME})
     13pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME})
     14add_definitions (${QT_DEFINITIONS})
    415
    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}
     16find_package(Qt5Network REQUIRED)
     17################################################################################
     18# DIRECTORIES
     19include_directories(
     20    ${PROJECT_BINARY_DIR}
     21    ${QT_INCLUDE_DIR}
     22    ${PACPUS_INCLUDE_DIR}
     23    ${PACPUS_INCLUDE_DIR}/Pacpus/
    2924)
    3025
     
    3227# Link directories
    3328# ========================================
    34 link_directories( ${PACPUS_LIB_DIR}
     29link_directories(
     30        ${PACPUS_LIB_DIR}
    3531)
    3632
    37 message (STATUS ${PACPUS_LIB_DIR})
    3833
    39 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} )
    40 
    41 # ========================================
    42 # List of sources
    43 # ========================================
    44 set(
    45     PROJECT_SRCS
     34################################################################################
     35# FILES
     36set(PROJECT_HDRS
     37    ${EXPORT_HDR}
     38    wifibot.h
     39    ps3remote.h
     40)
     41set(PROJECT_SRCS
     42    ${PLUGIN_CPP}
    4643    wifibot.cpp
    4744    ps3remote.cpp
    48     ${PLUGIN_CPP}
    4945)
    5046
    51 # ========================================
    52 # Files to MOC
    53 # ========================================
    54 set(
    55     FILES_TO_MOC
     47set(FILES_TO_MOC
     48    ${PLUGIN_HDR}
    5649    wifibot.h
    5750    ps3remote.h
    58     ${PLUGIN_H}
    5951)
    6052
    61 set(
    62     UI_FILES
    63 
     53set(UI_FILES
    6454)
    6555
    66 # ========================================
    67 # Call MOC
    68 # ========================================
    69 qt4_wrap_cpp(
    70     PROJECT_MOC_SRCS
     56################################################################################
     57# Qt: call moc, uic
     58qt_wrap_cpp(PROJECT_MOC_SRCS
    7159    ${FILES_TO_MOC}
    7260)
    7361
    74 qt4_wrap_ui(
    75     PROJECT_UI_SRCS
     62qt_wrap_ui(PROJECT_UI_SRCS
    7663    ${UI_FILES}
    7764)
    7865
    79 # ========================================
    80 # Build a library
    81 # ========================================
    82 pacpus_add_library(
    83     ${PROJECT_NAME} SHARED
     66################################################################################
     67# BUILD and LINK
     68pacpus_add_library(${PROJECT_NAME} SHARED
     69    ${PROJECT_HDRS}
    8470    ${PROJECT_SRCS}
    8571    ${PROJECT_MOC_SRCS}
     
    8773)
    8874
    89 message(STATUS  ${PACPUS_DEPENDENCIES_LIB} )
    9075
    9176# ========================================
    9277# Libraries
    9378# ========================================
    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
     79set(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
    10284)
    103 
    104 # ========================================
    105 # Install
    106 # ========================================
    107 pacpus_install(${PROJECT_NAME})
    108 
     85if (WIN32)
     86    list(APPEND LIBS
     87        optimized ROAD_TIME debug ROAD_TIME_d
     88    )
     89endif()
     90# LINK
     91target_link_libraries(${PROJECT_NAME}
     92                      ${PACPUS_LIBRARIES}
     93                      ${PACPUS_DEPENDENCIES_LIB}
     94                      ${LIBS}
     95                      ${QT_LIBRARIES} 
     96                     )
     97qt5_use_modules(${PROJECT_NAME} Network)
     98################################################################################
     99# FOLDERS
     100pacpus_folder(${PROJECT_NAME} "components")
     101################################################################################
     102# INSTALL
     103pacpus_install(${PROJECT_NAME})
  • trunk/Wifibot/ps3remote.cpp

    r24 r99  
    3131
    3232
    33 PS3remote::PS3remote(PacpusSocket * socket)
     33PS3remote::PS3remote(PacpusUDPSocket * socket)
    3434{
    3535    quit = 0;
  • trunk/Wifibot/ps3remote.h

    r22 r99  
    55//  author:     Pierre Hudelaine
    66//              Copyright Heudiasyc UMR UTC/CNRS 7253
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    1818# include <QThread>
    1919# include <QTimer>
     20# include <QMutex>
    2021
    2122# include "../Dualshock/controller.h"
    22 # include "../../../pacpusbase/PacpusSocket/PacpusSocket.h"
     23# include "../PacpusSocket/PacpusUDPSocket.h"
    2324
    2425namespace pacpus {
     
    2930        public:
    3031            PS3remote();
    31             PS3remote(PacpusSocket * socket);
     32        PS3remote(PacpusUDPSocket *socket);
    3233            ~PS3remote();
    3334            void run();
     
    3839            void modeChar();
    3940            void modeJoystick();
    40             void checkMode();       
    41            
     41            void checkMode();
     42
    4243        private:
    4344            ShMem *shmem;
     
    4546            QMutex mutex;
    4647            int quit;
    47             PacpusSocket * socket_;
     48            PacpusUDPSocket * socket_;
    4849            QTimer * timer_;
    4950            char buf[4];
  • trunk/Wifibot/wifibot.cpp

    r22 r99  
    55//  author:     Pierre Hudelaine
    66//              Copyright Heudiasyc UMR UTC/CNRS 7253
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    2222// Construct the factory
    2323//////////////////////////////////////////////////////////////////////////
    24 static ComponentFactory <Wifibot> sFactory("Wifibot"); 
     24static ComponentFactory <Wifibot> sFactory("Wifibot");
    2525
    2626//////////////////////////////////////////////////////////////////////////
     
    2828//////////////////////////////////////////////////////////////////////////
    2929Wifibot::Wifibot(QString name)
    30     : ComponentBase( name ) 
     30    : ComponentBase( name )
    3131{
    32  
    33 } 
     32
     33}
    3434
    3535
     
    3737// Destructor
    3838//////////////////////////////////////////////////////////////////////////
    39 Wifibot::~Wifibot() 
     39Wifibot::~Wifibot()
    4040{
    41  
     41
    4242}
    4343
    4444//////////////////////////////////////////////////////////////////////////
    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
    4747//////////////////////////////////////////////////////////////////////////
    48 ComponentBase::COMPONENT_CONFIGURATION  Wifibot::configureComponent( XmlComponentConfig config ) 
    49 { 
     48ComponentBase::COMPONENT_CONFIGURATION  Wifibot::configureComponent( XmlComponentConfig config )
     49{
    5050    QString pacpusSocket = config.getProperty("socketComponent");
    51     ComponentManager * mgr = ComponentManager::getInstance();
    52     pacpusSocket_ = dynamic_cast<PacpusSocket *>(mgr->getComponent(pacpusSocket));
     51    //ComponentManager * mgr = ComponentManager::getInstance();
     52    pacpusSocket_ = dynamic_cast<PacpusUDPSocket *>(ComponentManager::getInstance()->getComponent(pacpusSocket).get());
    5353    if (!pacpusSocket_) {
    5454            qWarning() << "Failed to get component " << pacpusSocket;
    5555            return ComponentBase::NOT_CONFIGURED;
    5656    }
    57  
    58     return ComponentBase::CONFIGURED_OK; 
    59 } 
     57
     58    return ComponentBase::CONFIGURED_OK;
     59}
    6060
    6161
     
    6464// Called by the ComponentManager to start the component
    6565//////////////////////////////////////////////////////////////////////////
    66 void Wifibot::startActivity() 
    67 { 
     66void Wifibot::startActivity()
     67{
    6868    dualshock = new PS3remote(pacpusSocket_);
    6969    dualshock->start();
  • trunk/Wifibot/wifibot.h

    r22 r99  
    55//  author:     Pierre Hudelaine
    66//              Copyright Heudiasyc UMR UTC/CNRS 7253
    7 // 
     7//
    88//  version:    $Id: $
    99//
     
    1212*********************************************************************/
    1313#ifndef WIFIBOT_API
    14 # define WIFIBOT_API 
     14# define WIFIBOT_API
    1515
    1616#include "ps3remote.h"
    1717#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"
    2121
    2222namespace pacpus {
     
    2424class WIFIBOT_API Wifibot
    2525        : public QObject
    26         , public ComponentBase 
    27 { 
     26        , public ComponentBase
     27{
    2828  Q_OBJECT
    2929
    30 public: 
     30public:
    3131    /// Constructor
    3232    Wifibot (QString name);
    3333    /// Destructor
    3434    ~Wifibot();
    35    
     35
    3636protected:
    3737    // The 3 virtual methods relative to the ComponentBase inheritance
     
    3939    virtual void stopActivity();
    4040    virtual COMPONENT_CONFIGURATION configureComponent (XmlComponentConfig config);
    41    
     41
    4242private:
    4343    PS3remote * dualshock;
    44     PacpusSocket * pacpusSocket_;
     44    PacpusUDPSocket * pacpusSocket_;
    4545};
    4646
  • trunk/build/build_linux.sh

    r95 r99  
    77else
    88
     9        # the following line will create a folder like: build_opt_pacpus_0.2.0_
    910        BUILD_DIR=./build${PACPUS_ROOT////_}
    1011        echo Your files will be built in: $BUILD_DIR
     
    2526        cd $BUILD_DIR
    2627
    27         cmake ../..
     28        cmake ../.. -G "CodeBlocks - Unix Makefiles"
    2829
    2930        make -j$J
    30         make install
     31  make install
    3132
    3233fi
  • trunk/driver/PosixSerialPort.cpp

    r59 r99  
    44//
    55// author:     Gerald Dherbomez
    6 // 
     6//
    77// version:    $Id: $
    88//
     
    2424
    2525PosixSerialPort::~PosixSerialPort() {
    26     qDebug() << "The win32 serial port " << componentName << " was destroyed";
     26    qDebug() << "The Posix serial port " << componentName << " was destroyed";
    2727}
    2828
    2929PosixSerialPort::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
    3637//////////////////////////////////////////////////////////////////////////
    3738
     
    4546
    4647//////////////////////////////////////////////////////////////////////////
    47 // return a pointer to the first frame in the list 
     48// return a pointer to the first frame in the list
    4849//////////////////////////////////////////////////////////////////////////
    4950
     
    5354
    5455
    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//////////////////////////////////////////////////////////////////////////
     60FRAME * 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
    6175//////////////////////////////////////////////////////////////////////////
    6276
     
    7084    }
    7185    dataFrameList.removeFirst();
    72     delete[] tmp->data;
     86    //delete[] tmp->data;
    7387    delete tmp;
    7488    tmp = NULL;
     
    8094
    8195/*!< open the port 'name'
    82 return true if success 
     96return true if success
    8397 */
    8498bool PosixSerialPort::openPort(const char * name) {
     
    96110
    97111/*!< close the port
    98 return true if success 
     112return true if success
    99113 */
    100114int PosixSerialPort::closePort() {
     
    102116}
    103117
    104 /*!< configure the port 
    105 return true if success 
     118/*!< configure the port
     119return true if success
    106120 */
    107121int PosixSerialPort::configurePort(long baudRate, int byteSize, char parity, int stopBits) {
     
    116130            cfsetospeed(&port_settings, B4800);
    117131            break;
    118          
     132
    119133        case 9600:
    120134            cfsetispeed(&port_settings, B9600); // set baud rates
     
    145159
    146160//////////////////////////////////////////////////////////////////////////
    147 // Read 'maxLength' bytes on the port and copy them in buffer 
     161// Read 'maxLength' bytes on the port and copy them in buffer
    148162// return the number of bytes read
    149163//////////////////////////////////////////////////////////////////////////
     
    167181      memset(receivedBuffer_,0,numberBytesToRead);
    168182      numberBytesRead = readBuffer(receivedBuffer_,numberBytesToRead);
    169       processIncomingData(); 
     183      processIncomingData();
    170184    }
    171185    else
    172186    {
    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 !
    175189      usleep(1000);
    176190    }
     
    184198
    185199    ioctl(handlePort, FIONREAD, &bytes);
    186    
     200
    187201    return bytes;
    188202}
     
    195209    // data frame
    196210    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_;
    211224    receivedBuffer_ = NULL;
    212225  }
     
    214227  if (ringIndicatorDetected) {
    215228    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);
    227240  }
    228241
    229242  // re-initialization
    230243  t_ = 0;
    231   numberBytesToRead = 0; 
    232 } 
     244  numberBytesToRead = 0;
     245}
  • trunk/driver/PosixSerialPort.h

    r59 r99  
    3434  road_timerange_t tr;
    3535  unsigned long length;
    36   char * data;
     36  QByteArray data; //char *
    3737}FRAME;
    3838
     
    5151  /*!< return the first dataFrame in the list */
    5252  FRAME* firstFrame();
     53
     54  /*!< return the next dataFrame in the list and removes it */
     55  FRAME* getNextFrame();
    5356
    5457  /*!< remove the first dataFrame in the list */
Note: See TracChangeset for help on using the changeset viewer.