Changeset 99 in pacpussensors for trunk/Wifibot


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/Wifibot
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.