MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / parse_message

Method parse_message

OpenHD/ohd_telemetry/src/mavsdk_temporary/mavlink_receiver.cpp:27–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25}
26
27bool MAVLinkReceiver::parse_message() {
28 // Note that one datagram can contain multiple mavlink messages.
29 for (unsigned i = 0; i < _datagram_len; ++i) {
30 if (mavlink_parse_char(_channel, _datagram[i], &_last_message, &_status) ==
31 1) {
32 // Move the pointer to the datagram forward by the amount parsed.
33 _datagram += (i + 1);
34 // And decrease the length, so we don't overshoot in the next round.
35 _datagram_len -= (i + 1);
36
37 if (_drop_debugging_on) {
38 debug_drop_rate();
39 }
40
41 // We have parsed one message, let's return, so it can be handled.
42 return true;
43 }
44 }
45
46 // No (more) messages, let's give up.
47 _datagram = nullptr;
48 _datagram_len = 0;
49 return false;
50}
51
52void MAVLinkReceiver::debug_drop_rate() {
53 if (_last_message.msgid == MAVLINK_MSG_ID_SYS_STATUS) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected