jerrym | f157933 | 2013-02-07 01:56:28 +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"
|
| 7 | #include <vector>
|
| 8 | #include <map>
|
| 9 |
|
| 10 | struct LiveWindowComponent
|
| 11 | {
|
| 12 | std::string subsystem;
|
| 13 | std::string name;
|
| 14 | bool isSensor;
|
| 15 |
|
| 16 | LiveWindowComponent()
|
| 17 | {}//WTF?
|
| 18 | LiveWindowComponent(std::string subsystem, std::string name, bool isSensor)
|
| 19 | {
|
| 20 | this->subsystem = subsystem;
|
| 21 | this->name = name;
|
| 22 | this->isSensor = isSensor;
|
| 23 | }
|
| 24 | };
|
| 25 |
|
| 26 | /**
|
| 27 | * The LiveWindow class is the public interface for putting sensors and actuators
|
| 28 | * on the LiveWindow.
|
| 29 | *
|
| 30 | * @author Brad Miller
|
| 31 | */
|
| 32 | class LiveWindow {
|
| 33 | public:
|
| 34 | static LiveWindow * GetInstance();
|
| 35 | void Run();
|
| 36 | void AddSensor(char *subsystem, char *name, LiveWindowSendable *component);
|
| 37 | void AddActuator(char *subsystem, char *name, LiveWindowSendable *component);
|
| 38 | void AddSensor(std::string type, int module, int channel, LiveWindowSendable *component);
|
| 39 | void AddActuator(std::string type, int module, int channel, LiveWindowSendable *component);
|
| 40 |
|
| 41 | bool IsEnabled() { return m_enabled; }
|
| 42 | void SetEnabled(bool enabled);
|
| 43 |
|
| 44 | protected:
|
| 45 | LiveWindow();
|
| 46 | virtual ~LiveWindow();
|
| 47 |
|
| 48 | private:
|
| 49 | void UpdateValues();
|
| 50 | void Initialize();
|
| 51 | void InitializeLiveWindowComponents();
|
| 52 |
|
| 53 | std::vector<LiveWindowSendable *> m_sensors;
|
| 54 | std::map<LiveWindowSendable *, LiveWindowComponent> m_components;
|
| 55 |
|
| 56 | static LiveWindow *m_instance;
|
| 57 | ITable *m_liveWindowTable;
|
| 58 | ITable *m_statusTable;
|
| 59 |
|
| 60 | Scheduler *m_scheduler;
|
| 61 |
|
| 62 | bool m_enabled;
|
| 63 | bool m_firstTime;
|
| 64 | };
|
| 65 |
|
| 66 | #endif
|
| 67 |
|