Changeset 99 in pacpussensors for trunk/Wifibot
- Timestamp:
- Oct 15, 2015, 2:47:01 PM (9 years ago)
- 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 ################################################################################ 1 7 project(Wifibot) 8 set(${PROJECT_NAME}_VERSION_MAJOR 0) 9 set(${PROJECT_NAME}_VERSION_MINOR 1) 10 add_definitions( -DWIFIBOTXT_EXPORTS ) 2 11 ################################################################################ 3 add_definitions( -DWIFIBOTXT_EXPORTS ) 12 create_export(EXPORT_HDR ${PROJECT_NAME}) 13 pacpus_plugin(PLUGIN_CPP PLUGIN_HDR ${PROJECT_NAME}) 14 add_definitions (${QT_DEFINITIONS}) 4 15 5 # ======================================== 6 # Configure qt4 7 # ======================================== 8 if(QT4_FOUND) 9 set(QT_USE_QTXML true) 10 set(QT_USE_QTNETWORK true) 11 include(${QT_USE_FILE}) 12 else() 13 message(ERROR "Qt4 needed") 14 endif() 15 16 # ======================================== 17 # Compiler definitions 18 # ======================================== 19 add_definitions( 20 ${QT_DEFINITIONS} 21 ) 22 23 # ======================================== 24 # Include directories 25 # ======================================== 26 include_directories( 27 ${PROJECT_BINARY_DIR} 28 ${QT_INCLUDE_DIR} 16 find_package(Qt5Network REQUIRED) 17 ################################################################################ 18 # DIRECTORIES 19 include_directories( 20 ${PROJECT_BINARY_DIR} 21 ${QT_INCLUDE_DIR} 22 ${PACPUS_INCLUDE_DIR} 23 ${PACPUS_INCLUDE_DIR}/Pacpus/ 29 24 ) 30 25 … … 32 27 # Link directories 33 28 # ======================================== 34 link_directories( ${PACPUS_LIB_DIR} 29 link_directories( 30 ${PACPUS_LIB_DIR} 35 31 ) 36 32 37 message (STATUS ${PACPUS_LIB_DIR})38 33 39 pacpus_plugin(PLUGIN_CPP PLUGIN_H ${PROJECT_NAME} ) 40 41 # ======================================== 42 # List of sources 43 # ======================================== 44 set( 45 PROJECT_SRCS 34 ################################################################################ 35 # FILES 36 set(PROJECT_HDRS 37 ${EXPORT_HDR} 38 wifibot.h 39 ps3remote.h 40 ) 41 set(PROJECT_SRCS 42 ${PLUGIN_CPP} 46 43 wifibot.cpp 47 44 ps3remote.cpp 48 ${PLUGIN_CPP}49 45 ) 50 46 51 # ======================================== 52 # Files to MOC 53 # ======================================== 54 set( 55 FILES_TO_MOC 47 set(FILES_TO_MOC 48 ${PLUGIN_HDR} 56 49 wifibot.h 57 50 ps3remote.h 58 ${PLUGIN_H}59 51 ) 60 52 61 set( 62 UI_FILES 63 53 set(UI_FILES 64 54 ) 65 55 66 # ======================================== 67 # Call MOC 68 # ======================================== 69 qt4_wrap_cpp( 70 PROJECT_MOC_SRCS 56 ################################################################################ 57 # Qt: call moc, uic 58 qt_wrap_cpp(PROJECT_MOC_SRCS 71 59 ${FILES_TO_MOC} 72 60 ) 73 61 74 qt4_wrap_ui( 75 PROJECT_UI_SRCS 62 qt_wrap_ui(PROJECT_UI_SRCS 76 63 ${UI_FILES} 77 64 ) 78 65 79 # ======================================== 80 # Build a library 81 # ======================================== 82 pacpus_add_library( 83 ${PROJECT_NAME} SHARED 66 ################################################################################ 67 # BUILD and LINK 68 pacpus_add_library(${PROJECT_NAME} SHARED 69 ${PROJECT_HDRS} 84 70 ${PROJECT_SRCS} 85 71 ${PROJECT_MOC_SRCS} … … 87 73 ) 88 74 89 message(STATUS ${PACPUS_DEPENDENCIES_LIB} )90 75 91 76 # ======================================== 92 77 # Libraries 93 78 # ======================================== 94 # All the platform 95 target_link_libraries( 96 ${PROJECT_NAME} 97 ${PACPUS_LIBRARIES} 98 ${QT_LIBRARIES} 99 ${PACPUS_DEPENDENCIES_LIB} 100 PacpusTools 101 PacpusSocket 79 set(LIBS 80 optimized FileLib debug FileLib_d 81 optimized PacpusLib debug PacpusLib_d 82 optimized PacpusTools debug PacpusTools_d 83 optimized PacpusSocket debug PacpusSocket_d 102 84 ) 103 104 # ======================================== 105 # Install 106 # ======================================== 107 pacpus_install(${PROJECT_NAME}) 108 85 if (WIN32) 86 list(APPEND LIBS 87 optimized ROAD_TIME debug ROAD_TIME_d 88 ) 89 endif() 90 # LINK 91 target_link_libraries(${PROJECT_NAME} 92 ${PACPUS_LIBRARIES} 93 ${PACPUS_DEPENDENCIES_LIB} 94 ${LIBS} 95 ${QT_LIBRARIES} 96 ) 97 qt5_use_modules(${PROJECT_NAME} Network) 98 ################################################################################ 99 # FOLDERS 100 pacpus_folder(${PROJECT_NAME} "components") 101 ################################################################################ 102 # INSTALL 103 pacpus_install(${PROJECT_NAME}) -
trunk/Wifibot/ps3remote.cpp
r24 r99 31 31 32 32 33 PS3remote::PS3remote(Pacpus Socket * socket)33 PS3remote::PS3remote(PacpusUDPSocket * socket) 34 34 { 35 35 quit = 0; -
trunk/Wifibot/ps3remote.h
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 18 18 # include <QThread> 19 19 # include <QTimer> 20 # include <QMutex> 20 21 21 22 # include "../Dualshock/controller.h" 22 # include "../ ../../pacpusbase/PacpusSocket/PacpusSocket.h"23 # include "../PacpusSocket/PacpusUDPSocket.h" 23 24 24 25 namespace pacpus { … … 29 30 public: 30 31 PS3remote(); 31 PS3remote(PacpusSocket *socket);32 PS3remote(PacpusUDPSocket *socket); 32 33 ~PS3remote(); 33 34 void run(); … … 38 39 void modeChar(); 39 40 void modeJoystick(); 40 void checkMode(); 41 41 void checkMode(); 42 42 43 private: 43 44 ShMem *shmem; … … 45 46 QMutex mutex; 46 47 int quit; 47 Pacpus Socket * socket_;48 PacpusUDPSocket * socket_; 48 49 QTimer * timer_; 49 50 char buf[4]; -
trunk/Wifibot/wifibot.cpp
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 22 22 // Construct the factory 23 23 ////////////////////////////////////////////////////////////////////////// 24 static ComponentFactory <Wifibot> sFactory("Wifibot"); 24 static ComponentFactory <Wifibot> sFactory("Wifibot"); 25 25 26 26 ////////////////////////////////////////////////////////////////////////// … … 28 28 ////////////////////////////////////////////////////////////////////////// 29 29 Wifibot::Wifibot(QString name) 30 : ComponentBase( name ) 30 : ComponentBase( name ) 31 31 { 32 33 } 32 33 } 34 34 35 35 … … 37 37 // Destructor 38 38 ////////////////////////////////////////////////////////////////////////// 39 Wifibot::~Wifibot() 39 Wifibot::~Wifibot() 40 40 { 41 41 42 42 } 43 43 44 44 ////////////////////////////////////////////////////////////////////////// 45 // Called by the ComponentManager to pass the XML parameters to the 46 // component 45 // Called by the ComponentManager to pass the XML parameters to the 46 // component 47 47 ////////////////////////////////////////////////////////////////////////// 48 ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config ) 49 { 48 ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config ) 49 { 50 50 QString pacpusSocket = config.getProperty("socketComponent"); 51 ComponentManager * mgr = ComponentManager::getInstance();52 pacpusSocket_ = dynamic_cast<Pacpus Socket *>(mgr->getComponent(pacpusSocket));51 //ComponentManager * mgr = ComponentManager::getInstance(); 52 pacpusSocket_ = dynamic_cast<PacpusUDPSocket *>(ComponentManager::getInstance()->getComponent(pacpusSocket).get()); 53 53 if (!pacpusSocket_) { 54 54 qWarning() << "Failed to get component " << pacpusSocket; 55 55 return ComponentBase::NOT_CONFIGURED; 56 56 } 57 58 return ComponentBase::CONFIGURED_OK; 59 } 57 58 return ComponentBase::CONFIGURED_OK; 59 } 60 60 61 61 … … 64 64 // Called by the ComponentManager to start the component 65 65 ////////////////////////////////////////////////////////////////////////// 66 void Wifibot::startActivity() 67 { 66 void Wifibot::startActivity() 67 { 68 68 dualshock = new PS3remote(pacpusSocket_); 69 69 dualshock->start(); -
trunk/Wifibot/wifibot.h
r22 r99 5 5 // author: Pierre Hudelaine 6 6 // Copyright Heudiasyc UMR UTC/CNRS 7253 7 // 7 // 8 8 // version: $Id: $ 9 9 // … … 12 12 *********************************************************************/ 13 13 #ifndef WIFIBOT_API 14 # define WIFIBOT_API 14 # define WIFIBOT_API 15 15 16 16 #include "ps3remote.h" 17 17 #include "Pacpus/kernel/Log.h" 18 #include "Pacpus/kernel/ComponentBase.h" 19 #include "Pacpus/kernel/ComponentFactory.h" 20 18 #include "Pacpus/kernel/ComponentBase.h" 19 #include "Pacpus/kernel/ComponentFactory.h" 20 #include "Pacpus/kernel/ComponentManager.h" 21 21 22 22 namespace pacpus { … … 24 24 class WIFIBOT_API Wifibot 25 25 : public QObject 26 , public ComponentBase 27 { 26 , public ComponentBase 27 { 28 28 Q_OBJECT 29 29 30 public: 30 public: 31 31 /// Constructor 32 32 Wifibot (QString name); 33 33 /// Destructor 34 34 ~Wifibot(); 35 35 36 36 protected: 37 37 // The 3 virtual methods relative to the ComponentBase inheritance … … 39 39 virtual void stopActivity(); 40 40 virtual COMPONENT_CONFIGURATION configureComponent (XmlComponentConfig config); 41 41 42 42 private: 43 43 PS3remote * dualshock; 44 Pacpus Socket * pacpusSocket_;44 PacpusUDPSocket * pacpusSocket_; 45 45 }; 46 46
Note:
See TracChangeset
for help on using the changeset viewer.