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

Last change on this file since 21 was 21, checked in by phudelai, 11 years ago

New component for the wifibot and the dualshock 3

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:
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<PacpusSocket *>(mgr->getComponent(pacpusSocket));
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
70 dualshock->start();
71}
72
73
74//////////////////////////////////////////////////////////////////////////
75// Called by the ComponentManager to stop the component
76//////////////////////////////////////////////////////////////////////////
77void Wifibot::stopActivity()
78{
79 dualshock->stop();
80}
81
Note: See TracBrowser for help on using the repository browser.