Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * thread_roomba_500.h - Roomba 500 thread 00004 * 00005 * Created: Sun Jan 02 12:47:35 2011 00006 * Copyright 2006-2010 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_ROOMBA_THREAD_ROOMBA_500_H_ 00024 #define __PLUGINS_ROOMBA_THREAD_ROOMBA_500_H_ 00025 00026 #include "roomba_500.h" 00027 00028 #include <core/threading/thread.h> 00029 #include <aspect/blocked_timing.h> 00030 #include <aspect/logging.h> 00031 #include <aspect/configurable.h> 00032 #include <aspect/clock.h> 00033 #include <aspect/blackboard.h> 00034 #include <aspect/thread_producer.h> 00035 #include <core/utils/refptr.h> 00036 00037 namespace fawkes { 00038 class LedInterface; 00039 class SwitchInterface; 00040 class MotorInterface; 00041 class BatteryInterface; 00042 class Roomba500Interface; 00043 } 00044 00045 class Roomba500Thread 00046 : public fawkes::Thread, 00047 public fawkes::BlockedTimingAspect, 00048 public fawkes::LoggingAspect, 00049 public fawkes::ConfigurableAspect, 00050 public fawkes::ClockAspect, 00051 public fawkes::BlackBoardAspect 00052 { 00053 public: 00054 Roomba500Thread(); 00055 00056 virtual void init(); 00057 virtual void finalize(); 00058 virtual void loop(); 00059 00060 void write_blackboard(); 00061 00062 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */ 00063 protected: virtual void run() { Thread::run(); } 00064 00065 private: 00066 void close_interfaces(); 00067 float led_process(fawkes::LedInterface *iface); 00068 void set_mode(Roomba500::Mode mode); 00069 00070 private: 00071 fawkes::LedInterface *__led_if_debris; 00072 fawkes::LedInterface *__led_if_spot; 00073 fawkes::LedInterface *__led_if_dock; 00074 fawkes::LedInterface *__led_if_check_robot; 00075 fawkes::LedInterface *__led_if_clean_color; 00076 fawkes::LedInterface *__led_if_clean_intensity; 00077 fawkes::SwitchInterface *__switch_if_vacuuming; 00078 fawkes::SwitchInterface *__switch_if_but_clean; 00079 fawkes::SwitchInterface *__switch_if_but_spot; 00080 fawkes::SwitchInterface *__switch_if_but_dock; 00081 fawkes::SwitchInterface *__switch_if_but_minute; 00082 fawkes::SwitchInterface *__switch_if_but_hour; 00083 fawkes::SwitchInterface *__switch_if_but_day; 00084 fawkes::SwitchInterface *__switch_if_but_schedule; 00085 fawkes::SwitchInterface *__switch_if_but_clock; 00086 //fawkes::MotorInterface *__motor_if; 00087 fawkes::BatteryInterface *__battery_if; 00088 fawkes::Roomba500Interface *__roomba500_if; 00089 00090 fawkes::RefPtr<Roomba500> __roomba; 00091 00092 std::string __cfg_conntype; 00093 std::string __cfg_mode; 00094 std::string __cfg_device; 00095 std::string __cfg_bttype; 00096 bool __cfg_btsave; 00097 bool __cfg_btfast; 00098 bool __cfg_query_mode; 00099 bool __cfg_play_fanfare; 00100 00101 unsigned int __greeting_loop_count; 00102 00103 int __battery_percent; 00104 00105 class WorkerThread; 00106 WorkerThread *__wt; 00107 }; 00108 00109 #endif