Skip to content

Commit

Permalink
Add a dummy message to try to affect code coverage %
Browse files Browse the repository at this point in the history
  • Loading branch information
woodfell committed Nov 14, 2023
1 parent f4c181b commit b55c8a2
Show file tree
Hide file tree
Showing 11 changed files with 659 additions and 0 deletions.
33 changes: 33 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -5287,6 +5287,39 @@ struct MessageTraits<sbp_msg_pps_time_t> {
}
};

template <>
struct MessageTraits<sbp_msg_print_dep_a_t> {
static constexpr sbp_msg_type_t id = SbpMsgPrintDepA;
static constexpr const char *name = "MSG_PRINT_DEP_A";
static const sbp_msg_print_dep_a_t &get(const sbp_msg_t &msg) {
return msg.print_dep_a;
}
static sbp_msg_print_dep_a_t &get(sbp_msg_t &msg) { return msg.print_dep_a; }
static void to_sbp_msg(const sbp_msg_print_dep_a_t &msg, sbp_msg_t *sbp_msg) {
sbp_msg->print_dep_a = msg;
}
static sbp_msg_t to_sbp_msg(const sbp_msg_print_dep_a_t &msg) {
sbp_msg_t sbp_msg;
sbp_msg.print_dep_a = msg;
return sbp_msg;
}
static s8 send(sbp_state_t *state, u16 sender_id,
const sbp_msg_print_dep_a_t &msg, sbp_write_fn_t write) {
return sbp_msg_print_dep_a_send(state, sender_id, &msg, write);
}
static s8 encode(uint8_t *buf, uint8_t len, uint8_t *n_written,
const sbp_msg_print_dep_a_t &msg) {
return sbp_msg_print_dep_a_encode(buf, len, n_written, &msg);
}
static s8 decode(const uint8_t *buf, uint8_t len, uint8_t *n_read,
sbp_msg_print_dep_a_t *msg) {
return sbp_msg_print_dep_a_decode(buf, len, n_read, msg);
}
static size_t encoded_len(const sbp_msg_print_dep_a_t &msg) {
return sbp_msg_print_dep_a_encoded_len(&msg);
}
};

template <>
struct MessageTraits<sbp_msg_print_dep_t> {
static constexpr sbp_msg_type_t id = SbpMsgPrintDep;
Expand Down
6 changes: 6 additions & 0 deletions c/include/libsbp/legacy/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -1299,6 +1299,12 @@ struct MessageTraits<msg_linux_sys_state_t> {
};


template<>
struct MessageTraits<msg_print_dep_a_t> {
static constexpr u16 id = 54340;
};


template<>
struct MessageTraits<msg_startup_t> {
static constexpr u16 id = 65280;
Expand Down
9 changes: 9 additions & 0 deletions c/include/libsbp/legacy/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,15 @@ typedef struct SBP_ATTR_PACKED {
char text[0]; /**< Human-readable string */
} msg_print_dep_t;

/** Deprecated
*
* Deprecated.
*/

typedef struct SBP_ATTR_PACKED {
char text[0]; /**< Human-readable string */
} msg_print_dep_a_t;

/** \} */

SBP_PACK_END
Expand Down
23 changes: 23 additions & 0 deletions c/include/libsbp/logging_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,27 @@
*/
#define SBP_MSG_PRINT_DEP_ENCODED_OVERHEAD 0u

#define SBP_MSG_PRINT_DEP_A 0xD444
/**
* The maximum number of items that can be stored in sbp_msg_print_dep_a_t::text
* (V4 API) or msg_print_dep_a_t::text (legacy API) before the maximum SBP
* message size is exceeded
*/
#define SBP_MSG_PRINT_DEP_A_TEXT_MAX 255u

/**
* Encoded length of sbp_msg_print_dep_a_t (V4 API) and
* msg_print_dep_a_t (legacy API)
*
* This type is not fixed size and an instance of this message may be longer
* than the value indicated by this symbol. Users of the V4 API should call
* #sbp_msg_print_dep_a_encoded_len to determine the actual size of an instance
* of this message. Users of the legacy API are required to track the encoded
* message length when interacting with the legacy type.
*
* See the documentation for libsbp for more details regarding the message
* structure and its variable length component(s)
*/
#define SBP_MSG_PRINT_DEP_A_ENCODED_OVERHEAD 0u

#endif /* LIBSBP_LOGGING_MACROS_H */
3 changes: 3 additions & 0 deletions c/include/libsbp/sbp_msg_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ typedef enum {
SbpMsgPosLlh = SBP_MSG_POS_LLH,
SbpMsgPoseRelative = SBP_MSG_POSE_RELATIVE,
SbpMsgPpsTime = SBP_MSG_PPS_TIME,
SbpMsgPrintDepA = SBP_MSG_PRINT_DEP_A,
SbpMsgPrintDep = SBP_MSG_PRINT_DEP,
SbpMsgProtectionLevelDepA = SBP_MSG_PROTECTION_LEVEL_DEP_A,
SbpMsgProtectionLevel = SBP_MSG_PROTECTION_LEVEL,
Expand Down Expand Up @@ -584,6 +585,8 @@ static inline const char *sbp_msg_type_to_string(sbp_msg_type_t msg_type) {
return "MSG_POSE_RELATIVE";
case SbpMsgPpsTime:
return "MSG_PPS_TIME";
case SbpMsgPrintDepA:
return "MSG_PRINT_DEP_A";
case SbpMsgPrintDep:
return "MSG_PRINT_DEP";
case SbpMsgProtectionLevelDepA:
Expand Down
1 change: 1 addition & 0 deletions c/include/libsbp/v4/logging.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,6 @@
#include <libsbp/v4/logging/MSG_FWD.h>
#include <libsbp/v4/logging/MSG_LOG.h>
#include <libsbp/v4/logging/MSG_PRINT_DEP.h>
#include <libsbp/v4/logging/MSG_PRINT_DEP_A.h>

#endif /* LIBSBP_V4_LOGGING_MESSAGES_H */
Loading

0 comments on commit b55c8a2

Please sign in to comment.