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 <core/threading/thread.h>
27 #include <aspect/logging.h>
28 #include <aspect/configurable.h>
29 #include <aspect/blackboard.h>
30 #include <aspect/blocked_timing.h>
31 #include <plugins/nao/aspect/naoqi.h>
32 #include <blackboard/interface_listener.h>
33 
34 #include <core/utils/lock_multimap.h>
35 #include <string>
36 #include <utility>
37 
38 namespace fawkes {
39  class LedInterface;
40 }
41 namespace AL {
42  class ALMemoryFastAccess;
43 }
44 
46 : public fawkes::Thread,
47  public fawkes::LoggingAspect,
51  public fawkes::NaoQiAspect,
53 {
54  public:
56  virtual ~NaoQiLedThread();
57 
58  virtual void init();
59  virtual void loop();
60  virtual void finalize();
61 
62  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
63  protected: virtual void run() { Thread::run(); }
64 
65  protected:
66  bool bb_interface_message_received(fawkes::Interface *interface,
67  fawkes::Message *message) throw();
68 
69  private:
70  AL::ALPtr<AL::DCMProxy> __dcm;
71  AL::ALPtr<AL::ALMemoryProxy> __almem;
72  AL::ALPtr<AL::ALMemoryFastAccess> __memfa;
73 
74  std::vector<float> __values;
75 
76  typedef std::multimap<fawkes::LedInterface *, unsigned int> LedMemMap;
77  LedMemMap __memids;
78 
80  LedMap __leds;
81 
82  bool __cfg_verbose_face;
83  std::string __subd_prefix;
84 };
85 
86 #endif
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: led_thread.h:63
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:79
Thread aspect to use blocked timing.
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to get access to NaoQi broker.
Definition: naoqi.h:36
Thread aspect to access configuration data.
Definition: configurable.h:35
Thread to synchronize with LEDs.
Definition: led_thread.h:45
BlackBoard interface listener.