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 |
|
|
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> |
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_ |