Rev 1601 | Rev 1604 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1601 | Rev 1602 | ||
|---|---|---|---|
| Line 20... | Line 20... | ||
| 20 | 20 | ||
| 21 | #ifndef CAN_MANAGER_H |
21 | #ifndef CAN_MANAGER_H |
| 22 | #define CAN_MANAGER_H |
22 | #define CAN_MANAGER_H |
| 23 | 23 | ||
| 24 | #include <map> |
24 | #include <map> |
| - | 25 | #include <string> |
|
| 25 | 26 | ||
| 26 | #include <boost/shared_ptr.hpp> |
27 | #include <boost/shared_ptr.hpp> |
| 27 | #include <boost/signals2.hpp> |
28 | #include <boost/signals2.hpp> |
| 28 | 29 | ||
| 29 | #include "logging/Logger.h" |
30 | #include "logging/Logger.h" |
| 30 | #include "broker/Subscriber.h" |
31 | #include "broker/Subscriber.h" |
| 31 | 32 | ||
| 32 | #include "timer/Subscriber.h" |
33 | #include "timer/Subscriber.h" |
| - | 34 | #include "type/common.h" |
|
| 33 | 35 | ||
| 34 | #include "Node.h" |
36 | #include "Node.h" |
| 35 | #include "Module.h" |
37 | #include "Module.h" |
| - | 38 | #include "Message.h" |
|
| 36 | 39 | ||
| 37 | namespace atom { |
40 | namespace atom { |
| 38 | namespace can { |
41 | namespace can { |
| 39 | 42 | ||
| 40 | class Manager : public broker::Subscriber, public timer::Subscriber |
43 | class Manager : public broker::Subscriber, public timer::Subscriber |
| 41 | { |
44 | { |
| 42 | public: |
45 | public: |
| 43 | typedef boost::shared_ptr<Manager> Pointer; |
46 | typedef boost::shared_ptr<Manager> Pointer; |
| 44 | typedef std::map<Node::Id, Node::Pointer> NodeList; |
47 | typedef std::map<Node::Id, Node::Pointer> NodeList; |
| 45 | typedef std::map<Module::FullId, Module::Pointer> ModuleList; |
48 | typedef std::map<Module::FullId, Module::Pointer> ModuleList; |
| - | 49 | typedef boost::signals2::signal<void(std::string full_id, bool available)> SignalOnModuleChange; |
|
| - | 50 | typedef boost::signals2::signal<void(std::string full_id, std::string command, type::StringMap variables)> SignalOnModuleMessage; |
|
| 46 | 51 | ||
| 47 | virtual ~Manager(); |
52 | virtual ~Manager(); |
| 48 | 53 | ||
| 49 | static Pointer Instance(); |
54 | static Pointer Instance(); |
| 50 | static void Create(); |
55 | static void Create(); |
| 51 | static void Delete(); |
56 | static void Delete(); |
| - | 57 | ||
| - | 58 | void ConnectSlots(const SignalOnModuleChange::slot_type& slot_on_module_change, const SignalOnModuleMessage::slot_type& slot_on_module_message); |
|
| - | 59 | ||
| - | 60 | void SendMessage(std::string full_id, std::string command, type::StringMap variables); |
|
| 52 | 61 | ||
| 53 | private: |
62 | private: |
| 54 | static Pointer instance_; |
63 | static Pointer instance_; |
| 55 | 64 | ||
| 56 | timer::TimerId timer_id_; |
65 | timer::TimerId timer_id_; |
| 57 | 66 | ||
| 58 | NodeList nodes_; |
67 | NodeList nodes_; |
| 59 | ModuleList modules_; |
68 | ModuleList modules_; |
| - | 69 | ||
| - | 70 | SignalOnModuleChange signal_on_module_change_; |
|
| - | 71 | SignalOnModuleMessage signal_on_module_message_; |
|
| 60 | 72 | ||
| 61 | Manager(); |
73 | Manager(); |
| 62 | 74 | ||
| 63 | void SlotOnMessageHandler(broker::Message::Pointer message); |
75 | void SlotOnMessageHandler(broker::Message::Pointer message); |
| 64 | void SlotOnTimeoutHandler(timer::TimerId timer_id, bool repeat); |
76 | void SlotOnTimeoutHandler(timer::TimerId timer_id, bool repeat); |