blob: 92b9c8ffa886f7ca389fab16897ee8f78c865ab0 (
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
46
47
48
|
#ifndef ISO_TP_FRAME
#define ISO_TP_FRAME
#include <ostream>
enum FrameType {
SF = 0, FF = 1, CF = 2, FC = 3
};
class Frame {
FrameType type;
unsigned int size;
unsigned int data_size;
unsigned char* data;
void parse_frame_str(const unsigned char* iso_tp_frame);
public:
Frame(const char* iso_tp_frame) {
this->parse_frame_str((const unsigned char*)iso_tp_frame);
}
~Frame() {
delete[] this->data;
}
FrameType get_type() const {
return this->type;
}
unsigned int get_size() const {
return this->size;
}
unsigned int get_data_size() const {
return this->data_size;
}
const unsigned char* get_data() const {
return this->data;
}
friend std::ostream& operator<<(std::ostream& os, const Frame& f);
};
std::ostream& operator<<(std::ostream& os, const Frame& f);
#endif /* ISO_TP_FRAME */
|