PX4 Firmware
PX4 Autopilot Software http://px4.io
messages.h
Go to the documentation of this file.
1
/****************************************************************************
2
*
3
* Copyright (c) 2016 PX4 Development Team. All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
*
9
* 1. Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* 2. Redistributions in binary form must reproduce the above copyright
12
* notice, this list of conditions and the following disclaimer in
13
* the documentation and/or other materials provided with the
14
* distribution.
15
* 3. Neither the name PX4 nor the names of its contributors may be
16
* used to endorse or promote products derived from this software
17
* without specific prior written permission.
18
*
19
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
26
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30
* POSSIBILITY OF SUCH DAMAGE.
31
*
32
****************************************************************************/
33
34
#pragma once
35
36
enum class
ULogMessageType
: uint8_t {
37
FORMAT
=
'F'
,
38
DATA
=
'D'
,
39
INFO
=
'I'
,
40
INFO_MULTIPLE
=
'M'
,
41
PARAMETER
=
'P'
,
42
ADD_LOGGED_MSG
=
'A'
,
43
REMOVE_LOGGED_MSG
=
'R'
,
44
SYNC
=
'S'
,
45
DROPOUT
=
'O'
,
46
LOGGING
=
'L'
,
47
LOGGING_TAGGED
=
'C'
,
48
FLAG_BITS
=
'B'
,
49
};
50
51
52
/* declare message data structs with byte alignment (no padding) */
53
#pragma pack(push, 1)
54
55
/** first bytes of the file */
56
struct
ulog_file_header_s
{
57
uint8_t magic[8];
58
uint64_t
timestamp
;
59
};
60
61
#define ULOG_MSG_HEADER_LEN 3 //accounts for msg_size and msg_type
62
struct
ulog_message_header_s
{
63
uint16_t
msg_size
;
64
uint8_t
msg_type
;
65
};
66
67
struct
ulog_message_format_s
{
68
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
69
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::FORMAT
);
70
71
char
format[1500];
72
};
73
74
struct
ulog_message_add_logged_s
{
75
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
76
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::ADD_LOGGED_MSG
);
77
78
uint8_t
multi_id
;
79
uint16_t
msg_id
;
80
char
message_name[255];
81
};
82
83
struct
ulog_message_remove_logged_s
{
84
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
85
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::REMOVE_LOGGED_MSG
);
86
87
uint16_t
msg_id
;
88
};
89
90
struct
ulog_message_sync_s
{
91
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
92
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::SYNC
);
93
94
uint8_t sync_magic[8];
95
};
96
97
struct
ulog_message_dropout_s
{
98
uint16_t msg_size =
sizeof
(uint16_t);
//size of message - ULOG_MSG_HEADER_LEN
99
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::DROPOUT
);
100
101
uint16_t
duration
;
//in ms
102
};
103
104
struct
ulog_message_data_header_s
{
105
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
106
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::DATA
);
107
108
uint16_t
msg_id
;
109
};
110
111
struct
ulog_message_info_header_s
{
112
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
113
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::INFO
);
114
115
uint8_t
key_len
;
116
char
key[255];
117
};
118
119
struct
ulog_message_info_multiple_header_s
{
120
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
121
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::INFO_MULTIPLE
);
122
123
uint8_t
is_continued
;
///< can be used for arrays: set to 1, if this message is part of the previous with the same key
124
uint8_t
key_len
;
125
char
key[255];
126
};
127
128
struct
ulog_message_logging_s
{
129
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
130
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::LOGGING
);
131
132
uint8_t
log_level
;
//same levels as in the linux kernel
133
uint64_t
timestamp
;
134
char
message[128];
//defines the maximum length of a logged message string
135
};
136
137
struct
ulog_message_logging_tagged_s
{
138
uint16_t
msg_size
;
//size of message - ULOG_MSG_HEADER_LEN
139
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::LOGGING_TAGGED
);
140
141
uint8_t
log_level
;
//same levels as in the linux kernel
142
uint16_t
tag
;
143
uint64_t
timestamp
;
144
char
message[128];
//defines the maximum length of a logged message string
145
};
146
147
struct
ulog_message_parameter_header_s
{
148
uint16_t
msg_size
;
149
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::PARAMETER
);
150
151
uint8_t
key_len
;
152
char
key[255];
153
};
154
155
156
#define ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK (1<<0)
157
158
struct
ulog_message_flag_bits_s
{
159
uint16_t
msg_size
;
160
uint8_t msg_type =
static_cast<
uint8_t
>
(
ULogMessageType::FLAG_BITS
);
161
162
uint8_t compat_flags[8];
163
uint8_t incompat_flags[8];
///< @see ULOG_INCOMPAT_FLAG_*
164
uint64_t appended_offsets[3];
///< file offset(s) for appended data if ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK is set
165
};
166
167
#pragma pack(pop)
ulog_message_logging_s::log_level
uint8_t log_level
Definition:
messages.h:132
ulog_file_header_s::timestamp
uint64_t timestamp
Definition:
messages.h:58
ulog_message_add_logged_s::msg_id
uint16_t msg_id
Definition:
messages.h:79
ulog_message_format_s::msg_size
uint16_t msg_size
Definition:
messages.h:68
ulog_message_logging_s
Definition:
messages.h:128
ulog_message_add_logged_s::msg_size
uint16_t msg_size
Definition:
messages.h:75
ulog_message_logging_s::timestamp
uint64_t timestamp
Definition:
messages.h:133
ULogMessageType::SYNC
ULogMessageType::INFO
ulog_message_format_s
Definition:
messages.h:67
ulog_message_add_logged_s::multi_id
uint8_t multi_id
Definition:
messages.h:78
ULogMessageType::DATA
ulog_message_parameter_header_s::msg_size
uint16_t msg_size
Definition:
messages.h:148
ULogMessageType::FORMAT
ULogMessageType::LOGGING_TAGGED
ulog_message_info_multiple_header_s::is_continued
uint8_t is_continued
can be used for arrays: set to 1, if this message is part of the previous with the same key ...
Definition:
messages.h:123
ulog_message_add_logged_s
Definition:
messages.h:74
ULogMessageType::LOGGING
ulog_message_logging_tagged_s::tag
uint16_t tag
Definition:
messages.h:142
ulog_message_dropout_s
Definition:
messages.h:97
ulog_message_info_multiple_header_s::key_len
uint8_t key_len
Definition:
messages.h:124
ulog_message_header_s::msg_type
uint8_t msg_type
Definition:
messages.h:64
ulog_message_data_header_s
Definition:
messages.h:104
ULogMessageType::ADD_LOGGED_MSG
ulog_message_flag_bits_s
Definition:
messages.h:158
ulog_message_remove_logged_s
Definition:
messages.h:83
ulog_message_dropout_s::duration
uint16_t duration
Definition:
messages.h:101
ulog_file_header_s
first bytes of the file
Definition:
messages.h:56
ULogMessageType::PARAMETER
ulog_message_info_multiple_header_s::msg_size
uint16_t msg_size
Definition:
messages.h:120
ulog_message_logging_tagged_s::log_level
uint8_t log_level
Definition:
messages.h:141
ulog_message_remove_logged_s::msg_size
uint16_t msg_size
Definition:
messages.h:84
ulog_message_sync_s::msg_size
uint16_t msg_size
Definition:
messages.h:91
ulog_message_info_header_s::msg_size
uint16_t msg_size
Definition:
messages.h:112
ulog_message_parameter_header_s::key_len
uint8_t key_len
Definition:
messages.h:151
ulog_message_flag_bits_s::msg_size
uint16_t msg_size
Definition:
messages.h:159
ulog_message_info_header_s
Definition:
messages.h:111
ulog_message_logging_tagged_s::timestamp
uint64_t timestamp
Definition:
messages.h:143
ulog_message_data_header_s::msg_size
uint16_t msg_size
Definition:
messages.h:105
ulog_message_info_header_s::key_len
uint8_t key_len
Definition:
messages.h:115
ulog_message_parameter_header_s
Definition:
messages.h:147
ULogMessageType::INFO_MULTIPLE
ulog_message_info_multiple_header_s
Definition:
messages.h:119
ULogMessageType::REMOVE_LOGGED_MSG
ulog_message_data_header_s::msg_id
uint16_t msg_id
Definition:
messages.h:108
ulog_message_header_s
Definition:
messages.h:62
ulog_message_sync_s
Definition:
messages.h:90
ulog_message_logging_tagged_s::msg_size
uint16_t msg_size
Definition:
messages.h:138
ULogMessageType::FLAG_BITS
ULogMessageType
ULogMessageType
Definition:
messages.h:36
ulog_message_logging_tagged_s
Definition:
messages.h:137
ulog_message_remove_logged_s::msg_id
uint16_t msg_id
Definition:
messages.h:87
ULogMessageType::DROPOUT
ulog_message_logging_s::msg_size
uint16_t msg_size
Definition:
messages.h:129
ulog_message_header_s::msg_size
uint16_t msg_size
Definition:
messages.h:63
src
modules
logger
messages.h
Generated by
1.8.13