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 
39 class JoystickActThread : public fawkes::Thread,
41  public fawkes::LoggingAspect,
44 {
45 public:
46  class MessageProcessor
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
JoystickActThread::MessageProcessor::MessageProcessor
MessageProcessor(JoystickAcquisitionThread *aqt, fawkes::JoystickInterface *joystick_if)
Constructor.
Definition: act_thread.cpp:81
fawkes::Message
Definition: message.h:40
JoystickActThread::init
virtual void init()
Initialize the thread.
Definition: act_thread.cpp:53
JoystickActThread::loop
virtual void loop()
Code to execute in the thread.
Definition: act_thread.cpp:66
JoystickSensorThread
Definition: sensor_thread.h:37
fawkes::BlockedTimingAspect
Definition: blocked_timing.h:54
JoystickAcquisitionThread
Definition: acquisition_thread.h:41
JoystickActThread::finalize
virtual void finalize()
Finalize the thread.
Definition: act_thread.cpp:60
JoystickActThread::MessageProcessor::process
void process()
Process message currently in the queue.
Definition: act_thread.cpp:129
fawkes::BlackBoardAspect
Definition: blackboard.h:36
fawkes
fawkes::LoggingAspect
Definition: logging.h:36
JoystickActThread
Definition: act_thread.h:38
JoystickActThread::MessageProcessor
Definition: act_thread.h:45
JoystickActThread::JoystickActThread
JoystickActThread(JoystickAcquisitionThread *aqt, JoystickSensorThread *senst)
Constructor.
Definition: act_thread.cpp:44
fawkes::Thread
Definition: thread.h:44
JoystickActThread::MessageProcessor::process_message
void process_message(fawkes::Message *msg)
Process a single message.
Definition: act_thread.cpp:93
fawkes::ConfigurableAspect
Definition: configurable.h:36
JoystickActThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: act_thread.h:69
fawkes::JoystickInterface
Definition: JoystickInterface.h:37