libknx
dpt.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "debug.hpp"
4 
5 #include <stdint.h>
6 #include <sstream>
7 
12 #pragma pack(1)
13 
14 namespace knx
15 {
16 
17 enum dpt_index
18 {
19  DPT_1_001,
20  DPT_2_001,
21  DPT_3_007,
22  DPT_4_001,
23  DPT_5_001,
24  DPT_6_001,
25  DPT_7_001,
26  DPT_8_001,
27  DPT_9_001,
28  DPT_10_001,
29  DPT_11_001,
30  DPT_12_001,
31  DPT_13_001,
32  DPT_14_000,
33  DPT_15_000,
34  DPT_16_000,
35  DPT_17_001,
36  DPT_18_001,
37  DPT_19_001,
38  DPT_20_011,
39  DPT_21_001,
40  DPT_26_001,
41  DPT_219_001,
42  DPT_232_600
43 };
44 
45 class dpt
46 {
47 public:
48  template<typename data_type>
49  static std::string describe ( const typename data_type::major_type::set_type & data );
50 };
51 
55 class KNX_IMPORT_EXPORT dpt_1
56 {
57 public:
58  typedef uint8_t data_type;
59  typedef bool set_type;
60  static void set ( set_type value, data_type & data );
61  static set_type get ( const data_type & data );
62 };
63 
67 class KNX_IMPORT_EXPORT dpt_1_001
68 {
69 public:
70  static const int INDEX = DPT_1_001;
71  typedef dpt_1 major_type;
72  static const major_type::set_type ON;
73  static const major_type::set_type OFF;
74  static std::string describe ( const major_type::set_type & data );
75 };
76 
79 
83 class KNX_IMPORT_EXPORT dpt_2
84 {
85 public:
86  typedef uint8_t data_type;
87  typedef std::pair<bool,bool> set_type;
88  static void set ( set_type value, data_type & data );
89  static set_type get ( const data_type & data );
90 };
91 
95 class KNX_IMPORT_EXPORT dpt_2_001
96 {
97 public:
98  static const int INDEX = DPT_2_001;
99  typedef dpt_2 major_type;
100  static const major_type::set_type NO_CONTROL;
101  static const major_type::set_type CONTROL_VALUE_ZERO;
102  static const major_type::set_type CONTROL_VALUE_ONE;
103  static std::string describe ( const major_type::set_type & data );
104 };
105 
109 class KNX_IMPORT_EXPORT dpt_3
110 {
111 public:
112  typedef uint8_t data_type;
113  typedef std::pair<bool,uint8_t> set_type;
114  static void set ( set_type value, data_type & data );
115  static set_type get ( const data_type & data );
116 };
117 
121 class KNX_IMPORT_EXPORT dpt_3_007
122 {
123 public:
124  static const int INDEX = DPT_3_007;
125  typedef dpt_3 major_type;
126  static std::string describe ( const major_type::set_type & data );
127 };
128 
132 class KNX_IMPORT_EXPORT dpt_4
133 {
134 public:
135  class data
136  {
137  private:
138  uint8_t static_part;
139  public:
140  data ( uint8_t character = 0 ) :static_part ( 0 ),character ( character ) {}
141  uint8_t character;
142  };
143  typedef data data_type;
144  typedef uint8_t set_type;
145  static void set ( set_type value, data_type & data );
146  static set_type get ( const data_type & data );
147 };
148 
152 class KNX_IMPORT_EXPORT dpt_4_001
153 {
154 public:
155  static const int INDEX = DPT_4_001;
156  typedef dpt_4 major_type;
157  static std::string describe ( const major_type::set_type & data );
158 };
159 
163 class KNX_IMPORT_EXPORT dpt_5
164 {
165 public:
166  class data
167  {
168  private:
169  uint8_t static_part;
170  public:
171  data ( uint8_t unsigned_value = 0 );
172  uint8_t unsigned_value;
173  };
174  typedef data data_type;
175  typedef uint8_t set_type;
176  static void set ( set_type value, data_type & data );
177  static set_type get ( const data_type & data );
178 };
179 
183 class KNX_IMPORT_EXPORT dpt_5_001
184 {
185 public:
186  static const int INDEX = DPT_5_001;
187  typedef dpt_5 major_type;
188  typedef TYPENAME major_type::set_type set_type;
189  static std::string describe ( const major_type::set_type & data );
190 };
191 
194 
198 class KNX_IMPORT_EXPORT dpt_6
199 {
200 public:
201  class data
202  {
203  private:
204  uint8_t static_part;
205  public:
206  data ( int8_t real_signed_value = 0 ) :static_part ( 0 ),real_signed_value ( real_signed_value ) {}
207  int8_t real_signed_value;
208  };
209  typedef data data_type;
210  typedef int8_t set_type;
211  static void set ( set_type value, data_type & data );
212  static set_type get ( const data_type & data );
213 };
214 
218 class KNX_IMPORT_EXPORT dpt_6_001
219 {
220 public:
221  static const int INDEX = DPT_6_001;
222  typedef dpt_6 major_type;
223  typedef TYPENAME major_type::set_type set_type;
224  static std::string describe ( const major_type::set_type & data );
225 };
226 
230 class KNX_IMPORT_EXPORT dpt_7
231 {
232 public:
233  class data
234  {
235  private:
236  uint8_t static_part;
237  public:
238  data ( ) : static_part ( 0 ), value ( 0 ) {}
239  uint16_t value;
240  };
241  typedef data data_type;
242  typedef uint16_t set_type;
243  static void set ( set_type value, data_type & data );
244  static set_type get ( const data_type & data );
245 };
246 
250 class KNX_IMPORT_EXPORT dpt_7_001
251 {
252 public:
253  static const int INDEX = DPT_7_001;
254  typedef dpt_7 major_type;
255  typedef TYPENAME major_type::set_type set_type;
256  static std::string describe ( const major_type::set_type & data );
257 };
258 
262 class KNX_IMPORT_EXPORT dpt_8
263 {
264 public:
265  class data
266  {
267  private:
268  uint8_t static_part;
269  public:
270  data ( ) : static_part ( 0 ), value ( 0 ) {}
271  int16_t value;
272  };
273  typedef data data_type;
274  typedef int16_t set_type;
275  static void set ( set_type value, data_type & data );
276  static set_type get ( const data_type & data );
277 };
278 
282 class KNX_IMPORT_EXPORT dpt_8_001
283 {
284 public:
285  static const int INDEX = DPT_8_001;
286  typedef dpt_8 major_type;
287  typedef TYPENAME major_type::set_type set_type;
288  static std::string describe ( const major_type::set_type & data );
289 };
290 
294 class KNX_IMPORT_EXPORT dpt_9
295 {
296 public:
297  static const uint16_t INVALID_DATA = 0x7fff;
298  static const uint16_t MAX = 0x7ffe;
299  static const uint16_t MIN = 0xf800;
300  static const float MAX_FLOAT; //= 670760.96f;
301  static const float MIN_FLOAT; // = -671088.64f;
302  class KNX_IMPORT_EXPORT data
303  {
304  private:
305  uint8_t static_part;
306  public:
307  data ( float float_value = 0.f );
308  uint16_t value;
309  };
310  typedef data data_type;
311  typedef float set_type;
312  static void set ( set_type value, data_type & data );
313  static set_type get ( const data_type & data );
314 };
315 
319 class KNX_IMPORT_EXPORT dpt_9_001
320 {
321 public:
322  static const int INDEX = DPT_9_001;
323  typedef dpt_9 major_type;
324  static std::string describe ( const major_type::set_type & data );
325 };
326 
330 class KNX_IMPORT_EXPORT dpt_10
331 {
332 public:
334  class KNX_IMPORT_EXPORT time
335  {
336  KNX_IMPORT_EXPORT friend std::ostream & operator << (std::ostream & os, const time & time);
337  public:
338  inline bool operator== ( const time & other )
339  {
340  return ( ( this->day == other.day ) && ( this->hour == other.hour ) && ( this->minutes == other.minutes ) && ( this->seconds == other.seconds ) );
341  }
343  time();
344  uint8_t day;
345  uint8_t hour;
346  uint8_t minutes;
347  uint8_t seconds;
348  static const uint8_t NODAY = 0;
349  static const uint8_t MONDAY = 1;
350  static const uint8_t TUESDAY = 2;
351  static const uint8_t WEDNESDAY = 3;
352  static const uint8_t THURSDAY = 4;
353  static const uint8_t FRIDAY = 5;
354  static const uint8_t SATURDAY = 6;
355  static const uint8_t SUNDAY = 7;
356  };
357  typedef uint32_t data_type;
358  typedef time set_type;
359  static void set ( set_type value, data_type & data );
360  static set_type get ( const data_type & data );
361 };
362 
363 KNX_IMPORT_EXPORT std::ostream & operator << (std::ostream & os, const dpt_10::time & time);
364 
368 class KNX_IMPORT_EXPORT dpt_10_001
369 {
370 public:
371  static const int INDEX = DPT_10_001;
372  typedef dpt_10 major_type;
373  static std::string describe ( const major_type::set_type & data );
374  static major_type::time now();
375 };
376 
379 
383 class KNX_IMPORT_EXPORT dpt_11
384 {
385 public:
387  class KNX_IMPORT_EXPORT date
388  {
389  public:
390  inline bool operator== ( const date & other )
391  {
392  return ( ( this->day == other.day ) && ( this->month == other.month ) && ( this->year == other.year ) );
393  }
395  date();
396  uint8_t day;
397  uint8_t month;
398  uint8_t year;
399  };
400  typedef uint32_t data_type;
401  typedef date set_type;
402  static void set ( set_type value, data_type & data );
403  static set_type get ( const data_type & data );
404 };
405 
409 class KNX_IMPORT_EXPORT dpt_11_001
410 {
411 public:
412  static const int INDEX = DPT_11_001;
413  typedef dpt_11 major_type;
414  static std::string describe ( const major_type::set_type & data );
415 };
416 
420 class KNX_IMPORT_EXPORT dpt_12
421 {
422 public:
423  class KNX_IMPORT_EXPORT data
424  {
425  private:
426  uint8_t static_part;
427  public:
428  data ( ) : static_part ( 0 ), value ( 0 ) {}
429  uint32_t value;
430  };
431  typedef data data_type;
432  typedef uint32_t set_type;
433  static void set ( set_type value, data_type & data );
434  static set_type get ( const data_type & data );
435 };
436 
440 class KNX_IMPORT_EXPORT dpt_12_001
441 {
442 public:
443  static const int INDEX = DPT_12_001;
444  typedef dpt_12 major_type;
445  static std::string describe ( const major_type::set_type & data );
446 };
447 
451 class KNX_IMPORT_EXPORT dpt_13
452 {
453 public:
454  class KNX_IMPORT_EXPORT data
455  {
456  private:
457  uint8_t static_part;
458  public:
459  data ( ) : static_part ( 0 ), value ( 0 ) {}
460  int32_t value;
461  };
462  typedef data data_type;
463  typedef uint32_t set_type;
464  static void set ( set_type value, data_type & data );
465  static set_type get ( const data_type & data );
466 };
467 
471 class KNX_IMPORT_EXPORT dpt_13_001
472 {
473 public:
474  static const int INDEX = DPT_13_001;
475  typedef dpt_13 major_type;
476  static std::string describe ( const major_type::set_type & data );
477 };
478 
482 class KNX_IMPORT_EXPORT dpt_14
483 {
484 public:
485  class KNX_IMPORT_EXPORT data
486  {
487  private:
488  uint8_t static_part;
489  public:
490  data ( ) : static_part ( 0 ), value ( 0 ) {}
491  float value;
492  };
493  typedef data data_type;
494  typedef uint32_t set_type;
495  static void set ( set_type value, data_type & data );
496  static set_type get ( const data_type & data );
497 };
498 
502 class KNX_IMPORT_EXPORT dpt_14_000
503 {
504 public:
505  static const int INDEX = DPT_14_000;
506  typedef dpt_14 major_type;
507  static std::string describe ( const major_type::set_type & data );
508 };
509 
513 class KNX_IMPORT_EXPORT dpt_15
514 {
515 public:
516  class KNX_IMPORT_EXPORT data
517  {
518  private:
519  uint8_t static_part;
520  public:
521  uint8_t d65,d43,d21;
522  uint8_t epdc_index;
523  };
525  class KNX_IMPORT_EXPORT set_data
526  {
527  public:
528  uint8_t d6,d5,d4,d3,d2,d1;
529  bool e,p,d,c;
530  uint8_t index;
531  };
532  typedef data data_type;
533  typedef set_data set_type;
534  static void set ( set_type value, data_type & data );
535  static set_type get ( const data_type & data );
536 };
537 
541 class KNX_IMPORT_EXPORT dpt_15_000
542 {
543 public:
544  static const int INDEX = DPT_15_000;
545  typedef dpt_15 major_type;
546  static std::string describe ( const major_type::set_type & data );
547 };
548 
552 class KNX_IMPORT_EXPORT dpt_16
553 {
554 public:
555  class KNX_IMPORT_EXPORT data
556  {
557  private:
558  uint8_t static_part;
559  public:
560  char text[14];
561  };
562  typedef data data_type;
563  typedef std::string set_type;
564  static void set ( set_type value, data_type & data );
565  static set_type get ( const data_type & data );
566 };
567 
571 class KNX_IMPORT_EXPORT dpt_16_000
572 {
573 public:
574  static const int INDEX = DPT_16_000;
575  typedef dpt_16 major_type;
576  static std::string describe ( const major_type::set_type & data );
577 };
578 
582 class KNX_IMPORT_EXPORT dpt_17
583 {
584 public:
585  class KNX_IMPORT_EXPORT data
586  {
587  private:
588  uint8_t static_part;
589  public:
590  uint8_t value;
591  };
592  typedef data data_type;
593  typedef uint8_t set_type;
594  static void set ( set_type value, data_type & data );
595  static set_type get ( const data_type & data );
596 };
597 
601 class KNX_IMPORT_EXPORT dpt_17_001
602 {
603 public:
604  static const int INDEX = DPT_17_001;
605  typedef dpt_17 major_type;
606  static std::string describe ( const major_type::set_type & data );
607 };
608 
612 class KNX_IMPORT_EXPORT dpt_18
613 {
614 public:
615  class KNX_IMPORT_EXPORT data
616  {
617  private:
618  uint8_t static_part;
619  public:
620  uint8_t value;
621  };
622  class KNX_IMPORT_EXPORT set_data
623  {
624  public:
626  bool c;
627  uint8_t scene_number;
628  };
629  typedef data data_type;
630  typedef set_data set_type;
631  static void set ( set_type value, data_type & data );
632  static set_type get ( const data_type & data );
633 };
634 
638 class KNX_IMPORT_EXPORT dpt_18_001
639 {
640 public:
641  static const int INDEX = DPT_18_001;
642  typedef dpt_18 major_type;
643  static std::string describe ( const major_type::set_type & data );
644 };
645 
649 class KNX_IMPORT_EXPORT dpt_19
650 {
651 public:
652  class KNX_IMPORT_EXPORT data
653  {
654  private:
655  uint8_t static_part;
656  public:
657  uint32_t date;
658  uint32_t time;
659  };
661  class KNX_IMPORT_EXPORT set_data
662  {
663  public:
664  uint8_t year, month, day_of_month, day_of_week, hour_of_day, minutes, seconds;
665  bool f, wd, nwd, ny, nd, ndow, nt, suti, clq;
666  };
667  typedef data data_type;
668  typedef set_data set_type;
669  static void set ( set_type value, data_type & data );
670  static set_type get ( const data_type & data );
671 };
672 
676 class KNX_IMPORT_EXPORT dpt_19_001
677 {
678 public:
679  static const int INDEX = DPT_19_001;
680  typedef dpt_19 major_type;
681  static std::string describe ( const major_type::set_type & data );
682 };
683 
687 class KNX_IMPORT_EXPORT dpt_20
688 {
689 public:
690  typedef uint16_t data_type;
691  typedef uint8_t set_type;
692  static void set ( set_type value, data_type & data );
693  static set_type get ( const data_type & data );
694 };
695 
699 class KNX_IMPORT_EXPORT dpt_20_011
700 {
701 public:
702  enum {
703  NO_FAULT,
704  GENERAL_DEVICE_FAULT,
705  COMMUNICATION_FAULT,
706  CONFIGURATION_FAULT,
707  HARDWARE_FAULT,
708  SOFTWARE_FAULT
709  };
710  static const int INDEX = DPT_20_011;
711  typedef dpt_20 major_type;
712  static std::string describe ( const major_type::set_type & data );
713 };
714 
718 class KNX_IMPORT_EXPORT dpt_21
719 {
720 public:
721  class KNX_IMPORT_EXPORT data
722  {
723  private:
724  uint8_t static_part;
725  public:
726  uint8_t value;
727  };
728  class KNX_IMPORT_EXPORT set_data
729  {
730  public:
731  bool out_of_service;
732  bool fault;
733  bool overridden;
734  bool in_alarm;
735  bool alarm_un_ack;
736  };
737  typedef data data_type;
738  typedef set_data set_type;
739  static void set ( set_type value, data_type & data );
740  static set_type get ( const data_type & data );
741 };
742 
746 class KNX_IMPORT_EXPORT dpt_21_001
747 {
748 public:
749  static const int INDEX = DPT_21_001;
750  typedef dpt_21 major_type;
751  static std::string describe ( const major_type::set_type & data );
752 };
753 
754 // TODO VARSTRING 24.001 -- BAD THING
755 
759 class KNX_IMPORT_EXPORT dpt_26
760 {
761 public:
762  class KNX_IMPORT_EXPORT data
763  {
764  private:
765  uint8_t static_part;
766  public:
767  uint8_t value;
768  };
769  class KNX_IMPORT_EXPORT set_data
770  {
771  public:
772  uint8_t scene_number;
773  bool b;
774  };
775  typedef data data_type;
776  typedef set_data set_type;
777  static void set ( set_type value, data_type & data );
778  static set_type get ( const data_type & data );
779 };
780 
784 class KNX_IMPORT_EXPORT dpt_26_001
785 {
786 public:
787  static const int INDEX = DPT_26_001;
788  typedef dpt_26 major_type;
789  static std::string describe ( const major_type::set_type & data );
790 };
791 
795 class KNX_IMPORT_EXPORT dpt_219
796 {
797 public:
798  class KNX_IMPORT_EXPORT data
799  {
800  private:
801  uint8_t static_part;
802  public:
803  uint8_t log_number;
804  uint8_t alarm_priority;
805  uint8_t application_area;
806  uint8_t error_class;
807  uint8_t attributes;
808  uint8_t alarm_status_attributes;
809  };
810  typedef data data_type;
811  typedef data set_type;
812  static void set ( set_type value, data_type & data );
813  static set_type get ( const data_type & data );
814 };
815 
819 class KNX_IMPORT_EXPORT dpt_219_001
820 {
821 public:
822  static const int INDEX = DPT_219_001;
823  typedef dpt_219 major_type;
824  static std::string describe ( const major_type::set_type & data );
825 };
826 
830 class KNX_IMPORT_EXPORT dpt_232
831 {
832 public:
833  class KNX_IMPORT_EXPORT data
834  {
835  private:
836  uint8_t static_part;
837  public:
838  uint8_t r;
839  uint8_t g;
840  uint8_t b;
841  };
842  typedef data data_type;
843  typedef data set_type;
844  static void set ( set_type value, data_type & data );
845  static set_type get ( const data_type & data );
846 };
847 
851 class KNX_IMPORT_EXPORT dpt_232_600
852 {
853 public:
854  static const int INDEX = DPT_232_600;
855  typedef dpt_232 major_type;
856  static std::string describe ( const major_type::set_type & data );
857 };
858 
859 }
860 
861 #pragma pack()
862 
863 
864 
865 
internal class storing a time value
Definition: dpt.hpp:335
time()
creates a current time value
class holding a time value
Definition: dpt.hpp:369
major class for all 10.XXX data point types
Definition: dpt.hpp:331
internal class storing a date value
Definition: dpt.hpp:388
date()
creates a current date value
class holding a date value
Definition: dpt.hpp:410
major class for all 11.XXX data point types
Definition: dpt.hpp:384
Definition: dpt.hpp:424
class holding a 32 bit unsigned value
Definition: dpt.hpp:441
major class for all 12.XXX data point types
Definition: dpt.hpp:421
Definition: dpt.hpp:455
class holding a 32 bit signed value
Definition: dpt.hpp:472
major class for all 13.XXX data point types
Definition: dpt.hpp:452
Definition: dpt.hpp:486
class holding a 32 bit float value
Definition: dpt.hpp:503
major class for all 14.XXX data point types
Definition: dpt.hpp:483
Definition: dpt.hpp:517
TODO add documentation.
Definition: dpt.hpp:526
class holding a access data type
Definition: dpt.hpp:542
major class for all 15.XXX data point types
Definition: dpt.hpp:514
Definition: dpt.hpp:556
class holding a fixed length string of up to 14 chars in ASCII
Definition: dpt.hpp:572
major class for all 16.XXX data point types
Definition: dpt.hpp:553
Definition: dpt.hpp:586
class holding a scene number
Definition: dpt.hpp:602
major class for all 17.XXX data point types
Definition: dpt.hpp:583
Definition: dpt.hpp:616
Definition: dpt.hpp:623
bool c
false corresponds to activate and true to learn the scene number
Definition: dpt.hpp:626
class holding a scene control value
Definition: dpt.hpp:639
major class for all 18.XXX data point types
Definition: dpt.hpp:613
Definition: dpt.hpp:653
TODO.
Definition: dpt.hpp:662
class holding a date time value
Definition: dpt.hpp:677
major class for all 19.XXX data point types
Definition: dpt.hpp:650
data point type 1.001 simple boolean value
Definition: dpt.hpp:68
major class for all 1.XXX data point types
Definition: dpt.hpp:56
class holding a error class system value
Definition: dpt.hpp:700
major class for all 20.XXX data point types
Definition: dpt.hpp:688
Definition: dpt.hpp:799
class holding a alarm info
Definition: dpt.hpp:820
major class for all 219.XXX data point types
Definition: dpt.hpp:796
Definition: dpt.hpp:722
Definition: dpt.hpp:729
class holding a status gen value
Definition: dpt.hpp:747
major class for all 21.XXX data point types
Definition: dpt.hpp:719
Definition: dpt.hpp:834
class holding rgb color value
Definition: dpt.hpp:852
major class for all 232.XXX data point types
Definition: dpt.hpp:831
Definition: dpt.hpp:763
Definition: dpt.hpp:770
class holding a scene info value
Definition: dpt.hpp:785
major class for all 26.XXX data point types
Definition: dpt.hpp:760
data point type 2.001 control value
Definition: dpt.hpp:96
major class for all 2.XXX data point types
Definition: dpt.hpp:84
data point type 3.007 dimming control
Definition: dpt.hpp:122
major class for all 3.XXX data point types
Definition: dpt.hpp:110
Definition: dpt.hpp:136
data point type 4.001 char ascii
Definition: dpt.hpp:153
major class for all 4.XXX data point types
Definition: dpt.hpp:133
Definition: dpt.hpp:167
data point type 5.001 unsigned 8 bit
Definition: dpt.hpp:184
major class for all 5.XXX data point types
Definition: dpt.hpp:164
Definition: dpt.hpp:202
data point type 6.001 percent v8
Definition: dpt.hpp:219
major class for all 6.XXX signed 8 bit value
Definition: dpt.hpp:199
Definition: dpt.hpp:234
data point type 7.001 unsigned 16bit pulse counter
Definition: dpt.hpp:251
major class for all 7.XXX unsigned signed 16 bit value
Definition: dpt.hpp:231
Definition: dpt.hpp:266
data point type 8.001 16bit signed pulse counter
Definition: dpt.hpp:283
major class for all 8.XXX signed 16 bit value
Definition: dpt.hpp:263
Definition: dpt.hpp:303
data point type 9.001 value temp
Definition: dpt.hpp:320
major class for all 9.XXX data point types
Definition: dpt.hpp:295
Definition: dpt.hpp:46
separated namespace to embed all libknx related classes
Definition: config.hpp:13
dpt_10_001 dpt_timeofday
10.001 is known as time of day value including hours. minutes, seconds and day of the week
Definition: dpt.hpp:378
dpt_5_001 dpt_scaling
5.001 is better known as scaling value
Definition: dpt.hpp:193
dpt_1_001 dpt_switch
data point type 1.001 is better known as switch
Definition: dpt.hpp:78