Fawkes API  Fawkes Development Version
remote_bb_poster.h
00001 
00002 /***************************************************************************
00003  *  remote_bb_poster.h - Joystick handler writing to remote blackboard
00004  *
00005  *  Created: Sat Jan 29 12:10:53 2011
00006  *  Copyright  2006-2011  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version.
00014  *
00015  *  This program is distributed in the hope that it will be useful,
00016  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  *  GNU Library General Public License for more details.
00019  *
00020  *  Read the full text in the LICENSE.GPL file in the doc directory.
00021  */
00022 
00023 #ifndef __PLUGINS_JOYSTICK_REMOTE_BB_POSTER_H_
00024 #define __PLUGINS_JOYSTICK_REMOTE_BB_POSTER_H_
00025 
00026 #include "acquisition_thread.h"
00027 #include <utils/system/argparser.h>
00028 
00029 namespace fawkes {
00030   class Logger;
00031   class BlackBoard;
00032   class JoystickInterface;
00033 }
00034 
00035 class JoystickRemoteBlackBoardPoster : public JoystickBlackBoardHandler
00036 {
00037  public:
00038   JoystickRemoteBlackBoardPoster(const char *host, unsigned short int port,
00039                                  fawkes::Logger *logger);
00040   ~JoystickRemoteBlackBoardPoster();
00041 
00042   /** Get blackboard.
00043    * @return blackboard instance
00044    */
00045   fawkes::BlackBoard * blackboard() { return __bb; }
00046 
00047   /** Get joystick interface.
00048    * @return joystick interface
00049    */
00050   fawkes::JoystickInterface * joystick_if() { return __joystick_if; }
00051   
00052 
00053   virtual void joystick_changed(unsigned int pressed_buttons, float *axis_values);
00054   virtual void joystick_plugged(char num_axes, char num_buttons);
00055   virtual void joystick_unplugged();
00056 
00057  private:
00058   bool __warning_printed;
00059   fawkes::BlackBoard *__bb;
00060   fawkes::JoystickInterface *__joystick_if;
00061   fawkes::Logger *__logger;
00062 };
00063 
00064 #endif