ulog_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 #include <cstdint>
37 
38 enum class ULogMessageType : uint8_t
39 {
40  FORMAT = 'F',
41  DATA = 'D',
42  INFO = 'I',
43  INFO_MULTIPLE = 'M',
44  PARAMETER = 'P',
45  PARAMETER_DEFAULT = 'Q',
46  ADD_LOGGED_MSG = 'A',
47  REMOVE_LOGGED_MSG = 'R',
48  SYNC = 'S',
49  DROPOUT = 'O',
50  LOGGING = 'L',
51  LOGGING_TAGGED = 'C',
52  FLAG_BITS = 'B',
53 };
54 
55 /* declare message data structs with byte alignment (no padding) */
56 #pragma pack(push, 1)
57 
60 {
61  uint8_t magic[8];
62  uint64_t timestamp;
63 };
64 
65 #define ULOG_MSG_HEADER_LEN 3 // accounts for msg_size and msg_type
67 {
68  uint16_t msg_size;
69  uint8_t msg_type;
70 };
71 
73 {
74  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
75  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::FORMAT);
76 
77  char format[1500];
78 };
79 
81 {
82  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
83  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::ADD_LOGGED_MSG);
84 
85  uint8_t multi_id;
86  uint16_t msg_id;
87  char message_name[255];
88 };
89 
91 {
92  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
93  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::REMOVE_LOGGED_MSG);
94 
95  uint16_t msg_id;
96 };
97 
99 {
100  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
101  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::SYNC);
102 
103  uint8_t sync_magic[8];
104 };
105 
107 {
108  uint16_t msg_size = sizeof(uint16_t); // size of message - ULOG_MSG_HEADER_LEN
109  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::DROPOUT);
110 
111  uint16_t duration; // in ms
112 };
113 
115 {
116  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
117  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::DATA);
118 
119  uint16_t msg_id;
120 };
121 
123 {
124  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
125  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::INFO);
126 
127  uint8_t key_len;
128  char key[255];
129 };
130 
132 {
133  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
134  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::INFO_MULTIPLE);
135 
136  uint8_t is_continued;
137  uint8_t key_len;
139  char key[255];
140 };
141 
143 {
144  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
145  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::LOGGING);
146 
147  uint8_t log_level; // same levels as in the linux kernel
148  uint64_t timestamp;
149  char message[128]; // defines the maximum length of a logged message string
150 };
151 
153 {
154  uint16_t msg_size; // size of message - ULOG_MSG_HEADER_LEN
155  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::LOGGING_TAGGED);
156 
157  uint8_t log_level; // same levels as in the linux kernel
158  uint16_t tag;
159  uint64_t timestamp;
160  char message[128]; // defines the maximum length of a logged message string
161 };
162 
164 {
165  uint16_t msg_size;
166  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::PARAMETER);
167 
168  uint8_t key_len;
169  char key[255];
170 };
171 
172 enum class ulog_parameter_default_type_t : uint8_t
173 {
174  system = (1 << 0),
175  current_setup = (1 << 1) // airframe default
176 };
177 
180 {
181  return static_cast<ulog_parameter_default_type_t>(static_cast<uint8_t>(a) |
182  static_cast<uint8_t>(b));
183 }
184 
186 {
187  uint16_t msg_size;
188  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::PARAMETER_DEFAULT);
189 
191  uint8_t key_len;
192  char key[255];
193 };
194 
195 #define ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK (1 << 0)
196 
197 #define ULOG_COMPAT_FLAG0_DEFAULT_PARAMETERS_MASK (1 << 0)
198 
200 {
201  uint16_t msg_size;
202  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::FLAG_BITS);
203 
204  uint8_t compat_flags[8];
205  uint8_t incompat_flags[8];
206  uint64_t appended_offsets[3];
207 };
209 
210 #pragma pack(pop)
ulog_message_parameter_header_s
Definition: ulog_messages.h:163
ulog_message_dropout_s
Definition: ulog_messages.h:106
ulog_message_dropout_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:108
ulog_message_parameter_default_header_s::key_len
uint8_t key_len
Definition: ulog_messages.h:191
ulog_message_logging_tagged_s
Definition: ulog_messages.h:152
ULogMessageType::ADD_LOGGED_MSG
@ ADD_LOGGED_MSG
ulog_message_logging_s::message
char message[128]
Definition: ulog_messages.h:149
ulog_message_logging_tagged_s::log_level
uint8_t log_level
Definition: ulog_messages.h:157
ulog_message_sync_s
Definition: ulog_messages.h:98
ulog_message_logging_s::timestamp
uint64_t timestamp
Definition: ulog_messages.h:148
ULogMessageType::LOGGING_TAGGED
@ LOGGING_TAGGED
ulog_parameter_default_type_t::current_setup
@ current_setup
ulog_message_add_logged_s::message_name
char message_name[255]
Definition: ulog_messages.h:87
ulog_message_logging_tagged_s::message
char message[128]
Definition: ulog_messages.h:160
ulog_message_info_multiple_header_s
Definition: ulog_messages.h:131
ulog_message_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:69
ulog_message_add_logged_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:82
ulog_message_logging_tagged_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:154
ulog_message_flag_bits_s
Definition: ulog_messages.h:199
ulog_message_format_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:74
ulog_message_remove_logged_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:93
ulog_message_add_logged_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:83
ulog_file_header_s::timestamp
uint64_t timestamp
Definition: ulog_messages.h:62
ulog_message_add_logged_s::multi_id
uint8_t multi_id
Definition: ulog_messages.h:85
ulog_message_format_s
Definition: ulog_messages.h:72
ulog_message_flag_bits_s::appended_offsets
uint64_t appended_offsets[3]
Definition: ulog_messages.h:206
ulog_message_dropout_s::duration
uint16_t duration
Definition: ulog_messages.h:111
ulog_message_parameter_default_header_s::default_types
ulog_parameter_default_type_t default_types
Definition: ulog_messages.h:190
ulog_message_add_logged_s
Definition: ulog_messages.h:80
ulog_message_parameter_default_header_s
Definition: ulog_messages.h:185
ulog_message_flag_bits_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:202
ulog_message_parameter_default_header_s::key
char key[255]
Definition: ulog_messages.h:192
ulog_message_dropout_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:109
ulog_message_header_s
Definition: ulog_messages.h:66
ulog_message_remove_logged_s
Definition: ulog_messages.h:90
ULogMessageType::DROPOUT
@ DROPOUT
ulog_message_sync_s::sync_magic
uint8_t sync_magic[8]
Definition: ulog_messages.h:103
ulog_message_info_multiple_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:134
ulog_message_sync_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:100
ulog_message_data_header_s
Definition: ulog_messages.h:114
ulog_message_logging_tagged_s::tag
uint16_t tag
Definition: ulog_messages.h:158
ulog_message_data_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:116
ulog_message_data_header_s::msg_id
uint16_t msg_id
Definition: ulog_messages.h:119
ulog_message_remove_logged_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:92
ULogMessageType::INFO
@ INFO
ulog_message_logging_tagged_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:155
ULogMessageType::SYNC
@ SYNC
ulog_message_info_multiple_header_s::is_continued
uint8_t is_continued
Definition: ulog_messages.h:136
ulog_message_format_s::format
char format[1500]
Definition: ulog_messages.h:77
operator|
ulog_parameter_default_type_t operator|(ulog_parameter_default_type_t a, ulog_parameter_default_type_t b)
Definition: ulog_messages.h:178
ulog_message_data_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:117
ulog_parameter_default_type_t::system
@ system
ulog_message_parameter_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:166
ULogMessageType::LOGGING
@ LOGGING
ulog_message_info_header_s::key
char key[255]
Definition: ulog_messages.h:128
ulog_message_info_multiple_header_s::key_len
uint8_t key_len
Definition: ulog_messages.h:138
ULogMessageType::PARAMETER_DEFAULT
@ PARAMETER_DEFAULT
ulog_message_flag_bits_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:201
ULogMessageType::REMOVE_LOGGED_MSG
@ REMOVE_LOGGED_MSG
ulog_message_flag_bits_s::incompat_flags
uint8_t incompat_flags[8]
Definition: ulog_messages.h:205
ULogMessageType::FORMAT
@ FORMAT
ulog_message_info_header_s::key_len
uint8_t key_len
Definition: ulog_messages.h:127
ulog_message_parameter_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:165
ULogMessageType::FLAG_BITS
@ FLAG_BITS
ulog_message_info_multiple_header_s::key
char key[255]
Definition: ulog_messages.h:139
ulog_message_parameter_default_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:187
ulog_message_info_multiple_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:133
ulog_message_info_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:125
ulog_message_sync_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:101
ULogMessageType::INFO_MULTIPLE
@ INFO_MULTIPLE
ulog_message_parameter_header_s::key_len
uint8_t key_len
Definition: ulog_messages.h:168
ulog_file_header_s::magic
uint8_t magic[8]
Definition: ulog_messages.h:61
ulog_message_parameter_default_header_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:188
ulog_message_info_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:124
ulog_message_logging_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:144
ulog_message_remove_logged_s::msg_id
uint16_t msg_id
Definition: ulog_messages.h:95
ulog_message_flag_bits_s::compat_flags
uint8_t compat_flags[8]
Definition: ulog_messages.h:204
ulog_message_logging_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:145
ULogMessageType::PARAMETER
@ PARAMETER
ULogMessageType
ULogMessageType
Definition: ulog_messages.h:38
ulog_message_parameter_header_s::key
char key[255]
Definition: ulog_messages.h:169
ULogMessageType::DATA
@ DATA
ulog_message_logging_tagged_s::timestamp
uint64_t timestamp
Definition: ulog_messages.h:159
ulog_parameter_default_type_t
ulog_parameter_default_type_t
Definition: ulog_messages.h:172
ulog_message_format_s::msg_type
uint8_t msg_type
Definition: ulog_messages.h:75
ulog_message_logging_s::log_level
uint8_t log_level
Definition: ulog_messages.h:147
ulog_file_header_s
Definition: ulog_messages.h:59
ulog_message_add_logged_s::msg_id
uint16_t msg_id
Definition: ulog_messages.h:86
ulog_message_info_header_s
Definition: ulog_messages.h:122
ulog_message_header_s::msg_size
uint16_t msg_size
Definition: ulog_messages.h:68
ulog_message_logging_s
Definition: ulog_messages.h:142


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:48