Fawkes API  Fawkes Development Version
act_thread.h
1 
2 /***************************************************************************
3  * act_thread.h - Joystick thread to execute force feedback
4  *
5  * Created: Mon Feb 07 19:52:48 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_JOYSTICK_ACT_THREAD_H_
24 #define _PLUGINS_JOYSTICK_ACT_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 <core/threading/thread.h>
31 
32 namespace fawkes {
33 class JoystickInterface;
34 }
35 
38 
41  public fawkes::LoggingAspect,
44 {
45 public:
47  {
48  public:
50 
51  void process();
53 
54  private:
56  fawkes::JoystickInterface *joystick_if_;
57  bool joystick_connected_;
58  };
59 
60 public:
62 
63  virtual void init();
64  virtual void finalize();
65  virtual void loop();
66 
67  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
68 protected:
69  virtual void
70  run()
71  {
72  Thread::run();
73  }
74 
75 private:
76  fawkes::JoystickInterface *joystick_if_;
77 
79  JoystickSensorThread * senst_;
80 
81  MessageProcessor *msgproc_;
82 };
83 
84 #endif
Joystick acqusition thread for Linux joystick API.
Process incoming messages.
Definition: act_thread.h:47
void process_message(fawkes::Message *msg)
Process a single message.
Definition: act_thread.cpp:93
void process()
Process message currently in the queue.
Definition: act_thread.cpp:129
MessageProcessor(JoystickAcquisitionThread *aqt, fawkes::JoystickInterface *joystick_if)
Constructor.
Definition: act_thread.cpp:81
Joystick force feedback actuation thread.
Definition: act_thread.h:44
virtual void finalize()
Finalize the thread.
Definition: act_thread.cpp:60
virtual void loop()
Code to execute in the thread.
Definition: act_thread.cpp:66
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: act_thread.h:70
JoystickActThread(JoystickAcquisitionThread *aqt, JoystickSensorThread *senst)
Constructor.
Definition: act_thread.cpp:44
virtual void init()
Initialize the thread.
Definition: act_thread.cpp:53
Joystick sensor thread.
Definition: sensor_thread.h:43
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to use blocked timing.
Thread aspect to access configuration data.
Definition: configurable.h:33
JoystickInterface Fawkes BlackBoard Interface.
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 class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.