blob: 07ddab265e4883ecbf2fa0a0b9257e1a16f936dc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#ifndef ISO_TP_FRAME
#define ISO_TP_FRAME
#include <ostream>
enum FrameType {
// Explicit values, so it is apparent they correspond to the appropriate type values
SF = 0, FF = 1, CF = 2, FC = 3
};
class Frame {
FrameType type;
unsigned char index;
unsigned int size;
unsigned int data_size;
unsigned char* data;
void parse_frame_str(const unsigned char* iso_tp_frame);
void free();
void copyFrom(const Frame& other);
public:
Frame(const char* iso_tp_frame);
/* Rule of 4 */
Frame() = default;
~Frame();
Frame(const Frame& other);
Frame& operator=(const Frame& other);
/* Getters */
FrameType get_type() const;
unsigned char get_index() const;
unsigned int get_size() const;
unsigned int get_data_size() const;
const unsigned char* get_data() const;
/* IO */
friend std::ostream& operator<<(std::ostream& os, const Frame& f);
};
std::ostream& operator<<(std::ostream& os, const Frame& f);
#endif /* ISO_TP_FRAME */
|