libknx
dpt_types.hpp
1 #pragma once
2 
3 #include "debug.hpp"
4 
5 namespace knx {
6 
8 class KNX_IMPORT_EXPORT dpt_2 {
9 public:
11  class KNX_IMPORT_EXPORT data {
12  public:
14  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & time);
16  data(bool c, bool v);
18  data();
20  bool control;
22  bool value;
23  };
24 };
25 
27 class dpt_3 {
28 public:
30  class data {
31  public:
33  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & time);
35  KNX_IMPORT_EXPORT data(bool c, uint8_t v);
37  KNX_IMPORT_EXPORT data();
39  bool control;
41  uint8_t value;
42  };
43 };
44 
46 class dpt_10 {
47 public:
49  class KNX_IMPORT_EXPORT data
50  {
51  public:
53  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & time);
55  bool operator== ( const data & other );
57  data();
59  uint8_t day;
61  uint8_t hour;
63  uint8_t minutes;
65  uint8_t seconds;
67  static const uint8_t NODAY = 0;
69  static const uint8_t MONDAY = 1;
71  static const uint8_t TUESDAY = 2;
73  static const uint8_t WEDNESDAY = 3;
75  static const uint8_t THURSDAY = 4;
77  static const uint8_t FRIDAY = 5;
79  static const uint8_t SATURDAY = 6;
81  static const uint8_t SUNDAY = 7;
82  };
83 };
84 
86 class dpt_11 {
87 public:
89  class KNX_IMPORT_EXPORT data
90  {
91  public:
93  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & date);
95  bool operator== ( const data & other );
97  data();
99  uint8_t day;
101  uint8_t month;
103  uint8_t year;
104  };
105 };
106 
108 class dpt_15 {
109 public:
111  class KNX_IMPORT_EXPORT data
112  {
113  public:
115  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
117  bool operator== ( const data & other );
119  data();
121  struct {
123  unsigned int d6 : 4;
125  unsigned int d5 : 4;
127  unsigned int d4 : 4;
129  unsigned int d3 : 4;
131  unsigned int d2 : 4;
133  unsigned int d1 : 4;
135  bool e : 1;
137  bool p : 1;
139  bool c : 1;
141  bool d : 1;
143  unsigned int index : 4;
144  } storage;
145  };
146 };
147 
149 class dpt_16 {
150 public:
152  class KNX_IMPORT_EXPORT data
153  {
154  public:
156  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
158  bool operator== ( const data & other );
160  data();
162  struct {
164  char ascii[14];
165  } storage;
166  };
167 };
168 
170 class dpt_17 {
171 public:
173  class KNX_IMPORT_EXPORT data
174  {
175  public:
177  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
179  bool operator== ( const data & other );
181  data();
183  struct {
185  unsigned int r : 2;
187  unsigned int number : 6;
188  } storage;
189  };
190 };
191 
193 class dpt_18 {
194 public:
196  class KNX_IMPORT_EXPORT data
197  {
198  public:
200  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
202  bool operator== ( const data & other );
204  data();
206  struct {
208  unsigned int c : 1;
210  unsigned int r : 1;
212  unsigned int number : 6;
213  } storage;
214  };
215 };
216 
218 class dpt_19 {
219 public:
221  class KNX_IMPORT_EXPORT data
222  {
223  public:
225  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
227  bool operator== ( const data & other );
229  data();
231  struct {
233  unsigned int year : 8;
234 
236  unsigned int res0 : 4;
238  unsigned int month : 4;
239 
241  unsigned int res1 : 3;
243  unsigned int day_of_month : 5;
244 
246  unsigned int day_of_week : 3;
248  unsigned int hour_of_day : 5;
249 
251  unsigned int res2 : 2;
253  unsigned int minutes : 6;
254 
256  unsigned int res3 : 2;
258  unsigned int seconds : 6;
259 
261  unsigned int f : 1;
263  unsigned int wd : 1;
265  unsigned int nwd : 1;
267  unsigned int ny : 1;
269  unsigned int nd : 1;
271  unsigned int ndow : 1;
273  unsigned int nt : 1;
275  unsigned int suti : 1;
276 
278  unsigned int clq : 1;
280  unsigned int res4 : 7;
281  } storage;
282  };
283 };
284 
286 class dpt_26 {
287 public:
289  class KNX_IMPORT_EXPORT data
290  {
291  public:
293  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
295  bool operator== ( const data & other );
297  data();
299  struct {
301  unsigned int reserved : 1;
303  unsigned int active : 1;
305  unsigned int scene_number : 6;
306  } storage;
307  };
308 };
309 
311 class dpt_219 {
312 public:
314  class KNX_IMPORT_EXPORT data
315  {
316  public:
318  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
320  bool operator== ( const data & other );
322  data();
324  struct {
326  unsigned char log_number;
328  unsigned char alarm_priority;
330  unsigned char application_area;
332  unsigned char error_class;
334  unsigned int reserverd0 : 2;
336  unsigned int attributes : 6;
338  unsigned int reserverd1 : 5;
340  unsigned int alarm_status_attributes : 3;
341  } storage;
342  };
343 };
344 
346 class dpt_232 {
347 public:
349  class KNX_IMPORT_EXPORT data
350  {
351  public:
353  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const data & data);
355  bool operator== ( const data & other );
357  data();
359  struct {
360  // red color from 0 to 255
361  unsigned char red;
362  // green color from 0 to 255
363  unsigned char green;
364  // blue color from 0 to 255
365  unsigned char blue;
366  } storage;
367  };
368 };
369 
370 }
uint8_t day
Day of month.
Definition: dpt_types.hpp:99
uint8_t minutes
From 0 to 59.
Definition: dpt_types.hpp:63
unsigned int alarm_status_attributes
Alarm status attributes with 0 (inalarm), 1 (alarmunack) and 2 (locked)
Definition: dpt_types.hpp:340
unsigned int f
Fault with 1 is true.
Definition: dpt_types.hpp:261
unsigned int reserverd0
Do not use.
Definition: dpt_types.hpp:334
unsigned int res4
do not use
Definition: dpt_types.hpp:280
unsigned int month
January is 1, February 2, ...
Definition: dpt_types.hpp:238
Base class container.
Definition: dpt_types.hpp:86
unsigned int reserverd1
Do not use.
Definition: dpt_types.hpp:338
bool e
Error detection (0 is no error).
Definition: dpt_types.hpp:135
unsigned int day_of_month
From 1st to 31st day.
Definition: dpt_types.hpp:243
bool control
Control bit.
Definition: dpt_types.hpp:39
bool c
Encryption (1 is yes).
Definition: dpt_types.hpp:139
unsigned int index
Index of access identification code.
Definition: dpt_types.hpp:143
unsigned int wd
Set to 1 if it is a working day.
Definition: dpt_types.hpp:263
Data container for this dpt.
Definition: dpt_types.hpp:173
Data container for this dpt.
Definition: dpt_types.hpp:49
Data container for this dpt.
Definition: dpt_types.hpp:89
unsigned char application_area
Area of error (there is a table where 0 is no fault and 20 is lighting (for example) ...
Definition: dpt_types.hpp:330
Data container for this dpt.
Definition: dpt_types.hpp:111
Data container for this dpt.
Definition: dpt_types.hpp:152
Data container for this dpt.
Definition: dpt_types.hpp:196
Data container for this dpt.
Definition: dpt_types.hpp:221
uint8_t year
Year with two digits. >=90 is expected to start with 19XX.
Definition: dpt_types.hpp:103
unsigned int nt
Set to one if time is not valid.
Definition: dpt_types.hpp:273
Data container for this dpt.
Definition: dpt_types.hpp:289
unsigned int d4
digit4
Definition: dpt_types.hpp:127
unsigned int r
do not use
Definition: dpt_types.hpp:210
unsigned int clq
Quality of clock. 1 says with external signal.
Definition: dpt_types.hpp:278
unsigned int res0
do not use
Definition: dpt_types.hpp:236
uint8_t value
Control field.
Definition: dpt_types.hpp:41
unsigned int r
Reserved do not use!.
Definition: dpt_types.hpp:185
Data container for this dpt.
Definition: dpt_types.hpp:11
unsigned char error_class
Class of error. 0 is no fault. 4 is hw fault (table exists)
Definition: dpt_types.hpp:332
Base class for dpt 3.
Definition: dpt_types.hpp:27
Data container for this dpt.
Definition: dpt_types.hpp:30
unsigned int attributes
Bit field with 0 (ack), 1 (timestamp), 2 (alarmtext), 3 (errorcode) supressed.
Definition: dpt_types.hpp:336
uint8_t seconds
From 0 to 59.
Definition: dpt_types.hpp:65
unsigned int d5
digit5
Definition: dpt_types.hpp:125
uint8_t month
Month of year.
Definition: dpt_types.hpp:101
Base class container.
Definition: dpt_types.hpp:170
unsigned int res2
do not use
Definition: dpt_types.hpp:251
unsigned int ny
Set to one if year is not valid.
Definition: dpt_types.hpp:267
bool d
Read direction (0 is left to right).
Definition: dpt_types.hpp:141
bool value
Value bit.
Definition: dpt_types.hpp:22
Base class container.
Definition: dpt_types.hpp:286
unsigned int seconds
Seconds till 59.
Definition: dpt_types.hpp:258
unsigned int res3
do not use
Definition: dpt_types.hpp:256
Base class container.
Definition: dpt_types.hpp:346
separated namespace to embed all libknx related classes
Definition: connection.hpp:14
unsigned int d6
digit6
Definition: dpt_types.hpp:123
unsigned int suti
Summer time field. Add one hour if set to one.
Definition: dpt_types.hpp:275
Base class container.
Definition: dpt_types.hpp:193
unsigned int d3
digit3
Definition: dpt_types.hpp:129
unsigned char log_number
Number of the current log.
Definition: dpt_types.hpp:326
unsigned int d2
digit2
Definition: dpt_types.hpp:131
unsigned int c
0 means activate and 1 learn the scene
Definition: dpt_types.hpp:208
Base class for dpt 2.
Definition: dpt_types.hpp:8
Base class container.
Definition: dpt_types.hpp:108
unsigned int minutes
Minutes till 59.
Definition: dpt_types.hpp:253
Base class container.
Definition: dpt_types.hpp:311
unsigned int day_of_week
Monday is 1, Tuesday is 2, ..
Definition: dpt_types.hpp:246
Data container for this dpt.
Definition: dpt_types.hpp:349
unsigned int res1
do not use
Definition: dpt_types.hpp:241
std::ostream & operator<<(std::ostream &os, dpt< MAJOR, MINOR > &data)
Major function to output the value of a dpt. (see template of dpt)
bool p
Permission (1 is accepted).
Definition: dpt_types.hpp:137
unsigned int number
scene nuber
Definition: dpt_types.hpp:212
Data container for this dpt.
Definition: dpt_types.hpp:314
unsigned int number
Scene number with 6 bits.
Definition: dpt_types.hpp:187
unsigned int scene_number
The number of the scene.
Definition: dpt_types.hpp:305
unsigned int nwd
Indicates if wd field is valid. 1 means not valid.
Definition: dpt_types.hpp:265
unsigned int year
Add 1900 to get real year.
Definition: dpt_types.hpp:233
Base class container.
Definition: dpt_types.hpp:218
unsigned int active
1 says scene is inactive.
Definition: dpt_types.hpp:303
unsigned int hour_of_day
As usual.
Definition: dpt_types.hpp:248
unsigned char alarm_priority
Priority with 0 is highest.
Definition: dpt_types.hpp:328
bool control
Control bit.
Definition: dpt_types.hpp:20
uint8_t day
day of the week monday (1) till sunday (7)
Definition: dpt_types.hpp:59
unsigned int d1
digit1
Definition: dpt_types.hpp:133
Base class container.
Definition: dpt_types.hpp:46
unsigned int ndow
Set to one if day of week is not valid.
Definition: dpt_types.hpp:271
Base class container.
Definition: dpt_types.hpp:149
uint8_t hour
From 0 to 23.
Definition: dpt_types.hpp:61
unsigned int nd
Set to one if day and month are not valid.
Definition: dpt_types.hpp:269
unsigned int reserved
Do not use.
Definition: dpt_types.hpp:301