Fawkes API Fawkes Development Version
led_thread.h
1
2/***************************************************************************
3 * led_thread.h - Provide NaoQi LEDs to Fawkes
4 *
5 * Created: Thu Jun 30 19:49:00 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#ifndef _PLUGINS_NAO_LED_THREAD_H_
24#define _PLUGINS_NAO_LED_THREAD_H_
25
26#include <aspect/blackboard.h>
27#include <aspect/blocked_timing.h>
28#include <aspect/configurable.h>
29#include <aspect/logging.h>
30#include <blackboard/interface_listener.h>
31#include <core/threading/thread.h>
32#include <core/utils/lock_multimap.h>
33#include <plugins/nao/aspect/naoqi.h>
34
35#include <string>
36#include <utility>
37
38namespace fawkes {
39class LedInterface;
40}
41namespace AL {
42class ALMemoryFastAccess;
43}
44
52{
53public:
55 virtual ~NaoQiLedThread();
56
57 virtual void init();
58 virtual void loop();
59 virtual void finalize();
60
61 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
62protected:
63 virtual void
65 {
66 Thread::run();
67 }
68
69protected:
71 fawkes::Message * message) noexcept;
72
73private:
74 AL::ALPtr<AL::DCMProxy> dcm_;
75 AL::ALPtr<AL::ALMemoryProxy> almem_;
76 AL::ALPtr<AL::ALMemoryFastAccess> memfa_;
77
78 std::vector<float> values_;
79
80 typedef std::multimap<fawkes::LedInterface *, unsigned int> LedMemMap;
81 LedMemMap memids_;
82
84 LedMap leds_;
85
86 bool cfg_verbose_face_;
87 std::string subd_prefix_;
88};
89
90#endif
Thread to synchronize with LEDs.
Definition: led_thread.h:52
virtual void finalize()
Finalize the thread.
Definition: led_thread.cpp:387
virtual ~NaoQiLedThread()
Destructor.
Definition: led_thread.cpp:138
bool bb_interface_message_received(fawkes::Interface *interface, fawkes::Message *message) noexcept
BlackBoard message received notification.
Definition: led_thread.cpp:432
NaoQiLedThread()
Constructor.
Definition: led_thread.cpp:130
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: led_thread.h:64
virtual void loop()
Code to execute in the thread.
Definition: led_thread.cpp:405
virtual void init()
Initialize the thread.
Definition: led_thread.cpp:143
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
BlackBoard interface listener.
Thread aspect to use blocked timing.
Thread aspect to access configuration data.
Definition: configurable.h:33
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
Thread aspect to log output.
Definition: logging.h:33
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
Thread aspect to get access to NaoQi broker.
Definition: naoqi.h:36
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.