blob: b3e620e0390ea54b7d6c8d56074759d5735b38f6 [file] [log] [blame]
briansab45cad2013-03-03 05:31:33 +00001#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"
brians759380a2013-03-03 05:31:52 +00007#include "Synchronized.h"
briansab45cad2013-03-03 05:31:33 +00008#include <vector>
9#include <map>
10
11struct LiveWindowComponent
12{
brians759380a2013-03-03 05:31:52 +000013#if 0
briansab45cad2013-03-03 05:31:33 +000014 std::string subsystem;
15 std::string name;
16 bool isSensor;
brians759380a2013-03-03 05:31:52 +000017#endif
briansab45cad2013-03-03 05:31:33 +000018
19 LiveWindowComponent()
20 {}//WTF?
21 LiveWindowComponent(std::string subsystem, std::string name, bool isSensor)
22 {
brians759380a2013-03-03 05:31:52 +000023#if 0
briansab45cad2013-03-03 05:31:33 +000024 this->subsystem = subsystem;
25 this->name = name;
26 this->isSensor = isSensor;
Brian Silverman9e967d82013-04-22 22:36:54 -070027#else
28 (void)subsystem;
29 (void)name;
30 (void)isSensor;
brians759380a2013-03-03 05:31:52 +000031#endif
briansab45cad2013-03-03 05:31:33 +000032 }
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 */
41class LiveWindow {
42public:
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
brians759380a2013-03-03 05:31:52 +000050 bool IsEnabled() { return false; }
briansab45cad2013-03-03 05:31:33 +000051 void SetEnabled(bool enabled);
52
53protected:
54 LiveWindow();
55 virtual ~LiveWindow();
56
57private:
58 void UpdateValues();
59 void Initialize();
60 void InitializeLiveWindowComponents();
61
brians759380a2013-03-03 05:31:52 +000062#if 0
briansab45cad2013-03-03 05:31:33 +000063 std::vector<LiveWindowSendable *> m_sensors;
64 std::map<LiveWindowSendable *, LiveWindowComponent> m_components;
65
brians759380a2013-03-03 05:31:52 +000066#endif
briansab45cad2013-03-03 05:31:33 +000067 static LiveWindow *m_instance;
brians759380a2013-03-03 05:31:52 +000068 static ReentrantSemaphore m_instanceLock;
69#if 0
briansab45cad2013-03-03 05:31:33 +000070 ITable *m_liveWindowTable;
71 ITable *m_statusTable;
72
73 Scheduler *m_scheduler;
74
75 bool m_enabled;
76 bool m_firstTime;
brians759380a2013-03-03 05:31:52 +000077#endif
briansab45cad2013-03-03 05:31:33 +000078};
79
80#endif
81