00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __PLUGINS_PLAYER_PLAYERC_THREAD_H_
00024 #define __PLUGINS_PLAYER_PLAYERC_THREAD_H_
00025
00026 #include <core/threading/thread.h>
00027 #include <aspect/blocked_timing.h>
00028 #include <aspect/logging.h>
00029 #include <aspect/configurable.h>
00030 #include <aspect/clock.h>
00031 #include <aspect/blackboard.h>
00032 #include <aspect/network.h>
00033
00034 #include <string>
00035 #include <map>
00036 #include <list>
00037
00038 namespace PlayerCc {
00039 class PlayerClient;
00040 class ClientProxy;
00041 }
00042
00043 namespace fawkes {
00044 class ObjectPositionInterface;
00045 }
00046
00047 class PlayerProxyFawkesInterfaceMapper;
00048
00049 class PlayerClientThread
00050 : public fawkes::Thread,
00051 public fawkes::BlockedTimingAspect,
00052 public fawkes::LoggingAspect,
00053 public fawkes::ConfigurableAspect,
00054 public fawkes::ClockAspect,
00055 public fawkes::BlackBoardAspect,
00056 public fawkes::NetworkAspect
00057 {
00058 public:
00059
00060 typedef std::map<std::string, fawkes::Interface *> InterfaceMap;
00061
00062
00063 typedef std::map<std::string, PlayerCc::ClientProxy *> ProxyMap;
00064
00065
00066 typedef std::list<PlayerProxyFawkesInterfaceMapper *> MapperList;
00067
00068 PlayerClientThread();
00069
00070 virtual void init();
00071 virtual void finalize();
00072 virtual void loop();
00073
00074 void sync_fawkes_to_player();
00075
00076
00077 protected: virtual void run() { Thread::run(); }
00078
00079 private:
00080 void open_fawkes_interfaces();
00081 void open_player_proxies();
00082 void create_mappers();
00083
00084 void close_fawkes_interfaces();
00085 void close_player_proxies();
00086
00087 private:
00088 PlayerCc::PlayerClient *__client;
00089
00090 std::string __cfg_player_host;
00091 unsigned int __cfg_player_port;
00092
00093 InterfaceMap __imap;
00094 ProxyMap __pmap;
00095 MapperList __mappers;
00096 };
00097
00098
00099 #endif