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_parameter_default_type_t operator|(ulog_parameter_default_type_t a, ulog_parameter_default_type_t b)
ULogMessageType
Definition: ulog_messages.h:38
def msg_type(f)
ulog_parameter_default_type_t
std::basic_string< Char > format(const text_style &ts, const S &format_str, const Args &... args)
Definition: color.h:583
ulog_parameter_default_type_t default_types


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Jun 19 2023 03:12:53