source: pacpussensors/trunk/Wifibot/wifibot.cpp@ 127

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

compilation under linux with 0.2.X framework

File size: 2.4 KB
Line 
1/*********************************************************************
2// created: 2012/03/01 - 14:06
3// filename: PacpusSocket.cpp
4//
5// author: Pierre Hudelaine
6// Copyright Heudiasyc UMR UTC/CNRS 7253
7//
8// version: $Id: $
9//
10// purpose: Control the wifibot with the dualshock 3
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//////////////////////////////////////////////////////////////////////////
24static ComponentFactory <Wifibot> sFactory("Wifibot");
25
26//////////////////////////////////////////////////////////////////////////
27// C
28//////////////////////////////////////////////////////////////////////////
29Wifibot::Wifibot(QString name)
30 : ComponentBase( name )
31{
32
33}
34
35
36//////////////////////////////////////////////////////////////////////////
37// Destructor
38//////////////////////////////////////////////////////////////////////////
39Wifibot::~Wifibot()
40{
41
42}
43
44//////////////////////////////////////////////////////////////////////////
45// Called by the ComponentManager to pass the XML parameters to the
46// component
47//////////////////////////////////////////////////////////////////////////
48ComponentBase::COMPONENT_CONFIGURATION Wifibot::configureComponent( XmlComponentConfig config )
49{
50 QString pacpusSocket = config.getProperty("socketComponent");
51 //ComponentManager * mgr = ComponentManager::getInstance();
52 pacpusSocket_ = dynamic_cast<PacpusUDPSocket *>(ComponentManager::getInstance()->getComponent(pacpusSocket).get());
53 if (!pacpusSocket_) {
54 qWarning() << "Failed to get component " << pacpusSocket;
55 return ComponentBase::NOT_CONFIGURED;
56 }
57
58 return ComponentBase::CONFIGURED_OK;
59}
60
61
62
63//////////////////////////////////////////////////////////////////////////
64// Called by the ComponentManager to start the component
65//////////////////////////////////////////////////////////////////////////
66void Wifibot::startActivity()
67{
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.