Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
broker_thread.cpp
1
2
/***************************************************************************
3
* broker_thread.cpp - NaoQi broker providing Thread
4
*
5
* Created: Thu May 12 19:03:40 2011
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#include "broker_thread.h"
24
#include "naoqi_broker.h"
25
26
#include <cerrno>
27
#include <csignal>
28
#include <unistd.h>
29
#include <sys/wait.h>
30
31
#include <alcommon/albrokermanager.h>
32
#include <alcore/alerror.h>
33
34
using namespace
fawkes;
35
36
/** @class NaoQiBrokerThread "broker_thread.h"
37
* NaoQi Broker Thread.
38
* This thread maintains a NaoQi broker which can be used by other
39
* threads and is provided via the NaoQiAspect.
40
*
41
* @author Tim Niemueller
42
*/
43
44
/** Constructor. */
45
NaoQiBrokerThread::NaoQiBrokerThread
()
46
:
Thread
(
"NaoQiBrokerThread"
,
Thread
::OPMODE_WAITFORWAKEUP),
47
AspectProviderAspect
(
"NaoQiAspect"
, &__naoqi_aspect_inifin)
48
{
49
}
50
51
52
/** Destructor. */
53
NaoQiBrokerThread::~NaoQiBrokerThread
()
54
{
55
}
56
57
58
void
59
NaoQiBrokerThread::init
()
60
{
61
if
(fawkes::naoqi::broker) {
62
__broker = fawkes::naoqi::broker;
63
logger
->
log_debug
(
name
(),
"Using NaoQi Module broker"
);
64
}
else
{
65
throw
Exception
(
"NaoQi broker not set, embedding of NaoQi "
66
"not implemented, yet"
);
67
}
68
69
/*
70
std::vector<AL::ALModuleInfo>::iterator m;
71
AL::ALPtr<std::vector<AL::ALModuleInfo> >
72
modules(new std::vector<AL::ALModuleInfo>);
73
74
__broker->getModuleList(modules);
75
for (m = modules->begin(); m != modules->end(); ++m) {
76
printf("Module: %s @ %s:%i\n", m->name.c_str(), m->ip.c_str(), m->port);
77
}
78
79
modules->clear();
80
__broker->getGlobalModuleList(modules);
81
for (m = modules->begin(); m != modules->end(); ++m) {
82
printf("Global Module: %s @ %s:%i\n", m->name.c_str(), m->ip.c_str(), m->port);
83
}
84
*/
85
86
__naoqi_aspect_inifin.
set_naoqi_broker
(__broker);
87
}
88
89
90
void
91
NaoQiBrokerThread::finalize
()
92
{
93
__broker.reset();
94
__naoqi_aspect_inifin.
set_naoqi_broker
(__broker);
95
}
96
97
98
void
99
NaoQiBrokerThread::loop
()
100
{
101
}
src
plugins
nao
broker_thread.cpp
Generated by
1.8.3.1