Messages logging

Introduction

The methods used to send and received messages (PROTOBUF_UTILS::sendMessages(), PROTOBUF_UTILS::updateReceivedMessages()) include logging mecanism that can be used to log the protobuf sent or received messages.

Activation

The only method that has to be called is PROTOBUF_UTILS::initiateLogging() :

1PROTOBUF_UTILS protobuf(&streamObj, &myTimer);
2protobuf.initiateLogging();

The use of libDM_msg_center does call this method automatically.

Location and structure of the logging file

From June 2024, the protobuf events are logged inside the unique protobuf encoded binary file. The file is located in the SD card in local_folder/log.binDM.

  • The logging binary file is located in the SD card in local_folder/log.binDM.

More information about the general logging mechanism at libDM_stream_logger

Body

Inside the LoggerFrame structure, a field containing the protobuf events exists, encoded as a ProtoFrame.

  • The logged frame the common structure of ProtoFrame with the addition of direction and frame size.

Message structure

Direction

Frame size

Protobuf message

With direction being 0 for messages received and 1 for messages sent.

Decoding the logged events

The general log extraction tool will extract and decode the protobuf events from the binary file. More informations about the general log extraction tool at libDM_processing_tools

  • Run the script:

python decode_protobuf_log.py log.binDM

The script will read and extract the data from the logging file and create a new file protobufEventsLog_decoded.json inside the output folder, with the messages sent or received presented with json format, for example:

 1[
 2    {
 3        "startByte": 1437226410,
 4        "timestamp": "1333291054",
 5        "attitude": {
 6            "attitudeLocal": {
 7                "ypr": {
 8                    "pitch": 0.2,
 9                    "yaw": 0.1
10                }
11            }
12        },
13        "endByte": 2857740885,
14        "direction": "RX"
15    },
16    {
17        "startByte": 1437226410,
18        "timestamp": "1333341049",
19        "attitude": {
20            "attitudeLocal": {
21                "ypr": {
22                    "pitch": 0.2,
23                    "yaw": 0.1
24                }
25            }
26        },
27        "endByte": 2857740885,
28        "direction": "RX"
29    }
30]