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 29 by douglas, 2008-02-27T16:09:18-08:00 vs.
Revision 30 by douglas, 2008-02-28T17:01:10-08:00

# Line 65 | Line 65 | class Display
65                  inline Packet() {}
66                  Packet(Command command, uint8_t length, const uint8_t *data);
67  
68 <                inline std::string GetData() { return std::string(reinterpret_cast<char *>(data), length); }
68 >                inline std::string GetData() const { return std::string(reinterpret_cast<const char *>(data), length); }
69          };
70          std::queue<Packet> keyActivity;
71  
# Line 116 | Line 116 | public:
116          inline void KeyReporting(uint8_t press, uint8_t release) { Communicate(Packet::ConfigureKeyReporting, press, release); }
117          void Set(uint8_t column, uint8_t row, const std::string &data);
118          void Set(uint8_t led, Color color, uint8_t brightness) { Communicate(Packet::SetOrSetAndConfigureGPIOPin, 12 - (led << 1) - color, brightness); }
119 +
120 +        friend std::ostream &operator<<(std::ostream &output, const Packet &packet);
121 +        friend void operator<<(int fd, const Display::Packet &packet);
122 +        friend void operator>>(int fd, Display::Packet &packet);
123   };
124  
125   template <typename Arg0>
# Line 149 | Line 153 | inline Display::Packet Display::Communic
153   }
154  
155   template <>
156 < inline Display::Packet Display::Communicate(Packet::Command command, uint8_t arg0, uint8_t arg1, const std::string &string)
156 > inline Display::Packet Display::Communicate(Packet::Command command, uint8_t arg0, uint8_t arg1, std::string string)
157   {
158 <        uint8_t data[] = { arg0, arg1 };
158 >        string.insert(0, 1, arg0);
159 >        string.insert(1, 1, arg1);
160  
161 <        return Communicate_(command, 2 + string.size(), reinterpret_cast<const uint8_t *>((reinterpret_cast<const char *>(data) + string).data()));
161 >        return Communicate<const std::string &>(command, string);
162   }
163  
164   #endif//_Display_hpp_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines