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  FORMAT = 'F',
40  DATA = 'D',
41  INFO = 'I',
42  INFO_MULTIPLE = 'M',
43  PARAMETER = 'P',
44  ADD_LOGGED_MSG = 'A',
45  REMOVE_LOGGED_MSG = 'R',
46  SYNC = 'S',
47  DROPOUT = 'O',
48  LOGGING = 'L',
49  FLAG_BITS = 'B',
50 };
51 
52 
53 /* declare message data structs with byte alignment (no padding) */
54 #pragma pack(push, 1)
55 
58  uint8_t magic[8];
59  uint64_t timestamp;
60 };
61 
62 #define ULOG_MSG_HEADER_LEN 3 //accounts for msg_size and msg_type
64  uint16_t msg_size;
65  uint8_t msg_type;
66 };
67 
69  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
70  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::FORMAT);
71 
72  char format[1500];
73 };
74 
76  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
77  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::ADD_LOGGED_MSG);
78 
79  uint8_t multi_id;
80  uint16_t msg_id;
81  char message_name[255];
82 };
83 
85  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
86  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::REMOVE_LOGGED_MSG);
87 
88  uint16_t msg_id;
89 };
90 
92  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
93  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::SYNC);
94 
95  uint8_t sync_magic[8];
96 };
97 
99  uint16_t msg_size = sizeof(uint16_t); //size of message - ULOG_MSG_HEADER_LEN
100  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::DROPOUT);
101 
102  uint16_t duration; //in ms
103 };
104 
106  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
107  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::DATA);
108 
109  uint16_t msg_id;
110 };
111 
113  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
114  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::INFO);
115 
116  uint8_t key_len;
117  char key[255];
118 };
119 
121  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
122  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::INFO_MULTIPLE);
123 
124  uint8_t is_continued;
125  uint8_t key_len;
126  char key[255];
127 };
128 
130  uint16_t msg_size; //size of message - ULOG_MSG_HEADER_LEN
131  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::LOGGING);
132 
133  uint8_t log_level; //same levels as in the linux kernel
134  uint64_t timestamp;
135  char message[128]; //defines the maximum length of a logged message string
136 };
137 
139  uint16_t msg_size;
140  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::PARAMETER);
141 
142  uint8_t key_len;
143  char key[255];
144 };
145 
146 
147 #define ULOG_INCOMPAT_FLAG0_DATA_APPENDED_MASK (1<<0)
148 
150  uint16_t msg_size;
151  uint8_t msg_type = static_cast<uint8_t>(ULogMessageType::FLAG_BITS);
152 
153  uint8_t compat_flags[8];
154  uint8_t incompat_flags[8];
155  uint64_t appended_offsets[3];
156 };
157 
158 #pragma pack(pop)
uint8_t is_continued
can be used for arrays: set to 1, if this message is part of the previous with the same key ...
std::string format(const std::string &, const time_point< seconds > &, const femtoseconds &, const time_zone &)
ULogMessageType
Definition: ulog_messages.h:38
uintptr_t magic
def msg_type(f)


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18