ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/Display.hpp
(Generate patch)

Comparing DashInterface/Display.hpp (file contents):
Revision 31 by douglas, 2008-02-28T22:06:06-08:00 vs.
Revision 33 by douglas, 2008-02-29T19:05:18-08:00

# Line 15 | Line 15
15   class Display
16   {
17          int ucom;
18 +        Pthreads::ThreadMutex ucomLock;
19 +        Pthreads::ThreadCondition ucomCondition;
20 +        volatile bool running;
21          struct Packet
22          {
23                  enum Command
# Line 51 | Line 54 | class Display
54                          SetOrSetAndConfigureGPIOPin                             = 0x22,
55                          ReadGPIOPinLevelsAndConfigurationState  = 0x23,
56                          Response                                                                = 0x40,
57 +                        Report                                                                  = 0x80,
58                          KeyActivity                                                             = 0x80,
59                          FanSpeedReport                                                  = 0x81,
60                          TemperatureSensorReport                                 = 0x82,
# Line 67 | Line 71 | class Display
71  
72                  inline std::string GetData() const { return std::string(reinterpret_cast<const char *>(data), length); }
73          };
74 +        std::queue<Packet> responses;
75 +        Pthreads::ThreadMutex responsesLock;
76 +        Pthreads::ThreadCondition responsesCondition;
77          std::queue<Packet> keyActivity;
78 +        Pthreads::ThreadMutex keyActivityLock;
79          Pthreads::Thread thread;
80  
81          inline Packet Communicate(Packet::Command command) { return Communicate_(command, 0, reinterpret_cast<const uint8_t *>(NULL)); }
# Line 77 | Line 85 | class Display
85          Packet Communicate(Packet::Command command, Arg0 arg0, Arg1 arg1);
86          template <typename Arg0, typename Arg1, typename Arg2>
87          Packet Communicate(Packet::Command command, Arg0 arg0, Arg1 arg1, Arg2 arg2);
88 +        void Communicate_();
89          Packet Communicate_(Packet::Command command, uint8_t length, const uint8_t *data);
90  
91   public:
# Line 102 | Line 111 | public:
111                  Green   = 1,
112                  Red             = 0,
113          };
114 +        enum KeyActivity
115 +        {
116 +                None                    = 0,
117 +                UpPress                 = 1,
118 +                DownPress               = 2,
119 +                LeftPress               = 3,
120 +                RightPress              = 4,
121 +                EnterPress              = 5,
122 +                ExitPress               = 6,
123 +                UpRelease               = 7,
124 +                DownRelease             = 8,
125 +                LeftRelease             = 9,
126 +                RightRelease    = 10,
127 +                EnterRelease    = 11,
128 +                ExitRelease             = 12,
129 +        };
130  
131          Display(const std::string &device);
132 <        ~Display() { Posix::Close(ucom); }
132 >        ~Display();
133  
134          bool Ping(const std::string &data = std::string());
135          std::string Version();
# Line 117 | Line 142 | public:
142          inline void KeyReporting(uint8_t press, uint8_t release) { Communicate(Packet::ConfigureKeyReporting, press, release); }
143          void Set(uint8_t column, uint8_t row, const std::string &data);
144          void Set(uint8_t led, Color color, uint8_t brightness) { Communicate(Packet::SetOrSetAndConfigureGPIOPin, 12 - (led << 1) - color, brightness); }
145 +        KeyActivity GetKeyActivity();
146  
147          friend std::ostream &operator<<(std::ostream &output, const Packet &packet);
148          friend void operator<<(int fd, const Display::Packet &packet);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines