knx
ETS configurable knx-stack
npdu.cpp
Go to the documentation of this file.
1 #include "npdu.h"
2 #include "cemi_frame.h"
3 #include <string.h>
4 
5 
6 NPDU::NPDU(uint8_t* data, CemiFrame& frame): _data(data), _frame(frame)
7 {
8 }
9 
10 
11 uint8_t NPDU::octetCount() const
12 {
13  return _data[0];
14 }
15 
16 void NPDU::octetCount(uint8_t value)
17 {
18  _data[0] = value;
19 }
20 
21 uint8_t NPDU::length() const
22 {
23  return _data[0] + 2; // +1 for length field, +1 for TCPI
24 }
25 
26 uint8_t NPDU::hopCount() const
27 {
28  return _frame.hopCount();
29 }
30 
31 void NPDU::hopCount(uint8_t value)
32 {
33  _frame.hopCount(value);
34 }
35 
37 {
38  return _frame;
39 }
40 
42 {
43  return _frame.tpdu();
44 }
TPDU & tpdu()
Definition: cemi_frame.cpp:362
uint8_t hopCount() const
Definition: cemi_frame.cpp:292
NPDU(uint8_t *data, CemiFrame &frame)
Definition: npdu.cpp:6
uint8_t octetCount() const
Definition: npdu.cpp:11
TPDU & tpdu()
Definition: npdu.cpp:41
CemiFrame & frame()
Definition: npdu.cpp:36
uint8_t length() const
Definition: npdu.cpp:21
uint8_t hopCount() const
Definition: npdu.cpp:26
Definition: tpdu.h:9