brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 1 | #ifndef _LIVE_WINDOW_H |
| 2 | #define _LIVE_WINDOW_H |
| 3 | |
| 4 | #include "LiveWindow/LiveWindowSendable.h" |
| 5 | #include "tables/ITable.h" |
| 6 | #include "Commands/Scheduler.h" |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 7 | #include "Synchronized.h" |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 8 | #include <vector> |
| 9 | #include <map> |
| 10 | |
| 11 | struct LiveWindowComponent |
| 12 | { |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 13 | #if 0 |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 14 | std::string subsystem; |
| 15 | std::string name; |
| 16 | bool isSensor; |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 17 | #endif |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 18 | |
| 19 | LiveWindowComponent() |
| 20 | {}//WTF? |
| 21 | LiveWindowComponent(std::string subsystem, std::string name, bool isSensor) |
| 22 | { |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 23 | #if 0 |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 24 | this->subsystem = subsystem; |
| 25 | this->name = name; |
| 26 | this->isSensor = isSensor; |
Brian Silverman | 9e967d8 | 2013-04-22 22:36:54 -0700 | [diff] [blame] | 27 | #else |
| 28 | (void)subsystem; |
| 29 | (void)name; |
| 30 | (void)isSensor; |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 31 | #endif |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 32 | } |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * The LiveWindow class is the public interface for putting sensors and actuators |
| 37 | * on the LiveWindow. |
| 38 | * |
| 39 | * @author Brad Miller |
| 40 | */ |
| 41 | class LiveWindow { |
| 42 | public: |
| 43 | static LiveWindow * GetInstance(); |
| 44 | void Run(); |
| 45 | void AddSensor(char *subsystem, char *name, LiveWindowSendable *component); |
| 46 | void AddActuator(char *subsystem, char *name, LiveWindowSendable *component); |
| 47 | void AddSensor(std::string type, int module, int channel, LiveWindowSendable *component); |
| 48 | void AddActuator(std::string type, int module, int channel, LiveWindowSendable *component); |
| 49 | |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 50 | bool IsEnabled() { return false; } |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 51 | void SetEnabled(bool enabled); |
| 52 | |
| 53 | protected: |
| 54 | LiveWindow(); |
| 55 | virtual ~LiveWindow(); |
| 56 | |
| 57 | private: |
| 58 | void UpdateValues(); |
| 59 | void Initialize(); |
| 60 | void InitializeLiveWindowComponents(); |
| 61 | |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 62 | #if 0 |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 63 | std::vector<LiveWindowSendable *> m_sensors; |
| 64 | std::map<LiveWindowSendable *, LiveWindowComponent> m_components; |
| 65 | |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 66 | #endif |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 67 | static LiveWindow *m_instance; |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 68 | static ReentrantSemaphore m_instanceLock; |
| 69 | #if 0 |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 70 | ITable *m_liveWindowTable; |
| 71 | ITable *m_statusTable; |
| 72 | |
| 73 | Scheduler *m_scheduler; |
| 74 | |
| 75 | bool m_enabled; |
| 76 | bool m_firstTime; |
brians | 759380a | 2013-03-03 05:31:52 +0000 | [diff] [blame] | 77 | #endif |
brians | ab45cad | 2013-03-03 05:31:33 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | #endif |
| 81 | |