source: pacpussensors/trunk/Wifibot/wifibot.cpp

Last change on this file was 99, checked in by nguyenhu, 9 years ago

compilation under linux with 0.2.X framework

File size: 2.4 KB
RevLine 
[21]1/*********************************************************************
2// created: 2012/03/01 - 14:06
3// filename: PacpusSocket.cpp
4//
5// author: Pierre Hudelaine
6// Copyright Heudiasyc UMR UTC/CNRS 7253
[99]7//
[21]8// version: $Id: $
9//
[22]10// purpose: Control the wifibot with the dualshock 3
[21]11//
12*********************************************************************/
13
14#include "wifibot.h"
15
16using namespace pacpus;
17
18
19DECLARE_STATIC_LOGGER("pacpus.base.Wifibot");
20
21//////////////////////////////////////////////////////////////////////////
22// Construct the factory
23//////////////////////////////////////////////////////////////////////////
[99]24static ComponentFactory <Wifibot> sFactory("Wifibot");
[21]25
26//////////////////////////////////////////////////////////////////////////
27// C
28//////////////////////////////////////////////////////////////////////////
29Wifibot::Wifibot(QString name)
[99]30 : ComponentBase( name )
[21]31{
32
[99]33}
[21]34
[99]35
[21]36//////////////////////////////////////////////////////////////////////////
37// Destructor
38//////////////////////////////////////////////////////////////////////////
[99]39Wifibot::~Wifibot()
[21]40{
[99]41
[21]42}
43
44//////////////////////////////////////////////////////////////////////////
[99]45// Called by the ComponentManager to pass the XML parameters to the
46// component
[21]47//////////////////////////////////////////////////////////////////////////
[99]48ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config )
49{
[21]50 QString pacpusSocket = config.getProperty("socketComponent");
[99]51 //ComponentManager * mgr = ComponentManager::getInstance();
52 pacpusSocket_ = dynamic_cast<PacpusUDPSocket *>(ComponentManager::getInstance()->getComponent(pacpusSocket).get());
[21]53 if (!pacpusSocket_) {
54 qWarning() << "Failed to get component " << pacpusSocket;
55 return ComponentBase::NOT_CONFIGURED;
56 }
57
[99]58 return ComponentBase::CONFIGURED_OK;
59}
[21]60
61
[99]62
[21]63//////////////////////////////////////////////////////////////////////////
64// Called by the ComponentManager to start the component
65//////////////////////////////////////////////////////////////////////////
[99]66void Wifibot::startActivity()
67{
[21]68 dualshock = new PS3remote(pacpusSocket_);
69 dualshock->start();
70}
71
72
73//////////////////////////////////////////////////////////////////////////
74// Called by the ComponentManager to stop the component
75//////////////////////////////////////////////////////////////////////////
76void Wifibot::stopActivity()
77{
78 dualshock->stop();
79}
80
Note: See TracBrowser for help on using the repository browser.