Skip to content

Commit

Permalink
add MsgAcknowledge (#1263)
Browse files Browse the repository at this point in the history
  • Loading branch information
notoriaga authored Dec 13, 2022
1 parent 0611826 commit 6a57014
Show file tree
Hide file tree
Showing 42 changed files with 3,137 additions and 6 deletions.
32 changes: 32 additions & 0 deletions c/include/libsbp/cpp/message_traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,38 @@ namespace sbp {
template <typename>
struct MessageTraits;

template <>
struct MessageTraits<sbp_msg_acknowledge_t> {
static constexpr sbp_msg_type_t id = SbpMsgAcknowledge;
static const sbp_msg_acknowledge_t &get(const sbp_msg_t &msg) {
return msg.acknowledge;
}
static sbp_msg_acknowledge_t &get(sbp_msg_t &msg) { return msg.acknowledge; }
static void to_sbp_msg(const sbp_msg_acknowledge_t &msg, sbp_msg_t *sbp_msg) {
sbp_msg->acknowledge = msg;
}
static sbp_msg_t to_sbp_msg(const sbp_msg_acknowledge_t &msg) {
sbp_msg_t sbp_msg;
sbp_msg.acknowledge = msg;
return sbp_msg;
}
static s8 send(sbp_state_t *state, u16 sender_id,
const sbp_msg_acknowledge_t &msg, sbp_write_fn_t write) {
return sbp_msg_acknowledge_send(state, sender_id, &msg, write);
}
static s8 encode(uint8_t *buf, uint8_t len, uint8_t *n_written,
const sbp_msg_acknowledge_t &msg) {
return sbp_msg_acknowledge_encode(buf, len, n_written, &msg);
}
static s8 decode(const uint8_t *buf, uint8_t len, uint8_t *n_read,
sbp_msg_acknowledge_t *msg) {
return sbp_msg_acknowledge_decode(buf, len, n_read, msg);
}
static size_t encoded_len(const sbp_msg_acknowledge_t &msg) {
return sbp_msg_acknowledge_encoded_len(&msg);
}
};

template <>
struct MessageTraits<sbp_msg_acq_result_dep_a_t> {
static constexpr sbp_msg_type_t id = SbpMsgAcqResultDepA;
Expand Down
164 changes: 164 additions & 0 deletions c/include/libsbp/integrity_macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,168 @@
*/
#define SBP_MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS_ENCODED_OVERHEAD 17u

#define SBP_MSG_ACKNOWLEDGE 0x0BD2
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_MASK (0xffu)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_SHIFT (0u)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_GET(flags) \
((u8)((u8)((flags) >> SBP_ACKNOWLEDGE_RESPONSE_CODE_SHIFT) & \
SBP_ACKNOWLEDGE_RESPONSE_CODE_MASK))
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_SET(flags, val) \
do { \
(flags) = (u8)((flags & (~(SBP_ACKNOWLEDGE_RESPONSE_CODE_MASK \
<< SBP_ACKNOWLEDGE_RESPONSE_CODE_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_RESPONSE_CODE_MASK)) \
<< (SBP_ACKNOWLEDGE_RESPONSE_CODE_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_RESPONSE_CODE_OK (0)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_OUT_OF_COVERAGE (1)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_FORBIDDEN (2)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_INVALID_REQUEST (3)
#define SBP_ACKNOWLEDGE_RESPONSE_CODE_INVALID_AREA_ID (4)
#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_MASK (0x1u)
#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_SHIFT (0u)
#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_SHIFT) & \
SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_MASK))
#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_SET(flags, val) \
do { \
(flags) = \
(u16)((flags & (~(SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_MASK \
<< SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_MASK)) \
<< (SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_PUBLIC_SIGNING_KEY_REQUESTED (1)
#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_MASK (0x1u)
#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_SHIFT (1u)
#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_SHIFT) & \
SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_MASK))
#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_SET(flags, val) \
do { \
(flags) = \
(u16)((flags & (~(SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_MASK \
<< SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_MASK)) \
<< (SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_LOW_RATE_MESSAGES_REQUESTED (1)
#define SBP_ACKNOWLEDGE_EPHEMERIS_MASK (0x1u)
#define SBP_ACKNOWLEDGE_EPHEMERIS_SHIFT (2u)
#define SBP_ACKNOWLEDGE_EPHEMERIS_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_EPHEMERIS_SHIFT) & \
SBP_ACKNOWLEDGE_EPHEMERIS_MASK))
#define SBP_ACKNOWLEDGE_EPHEMERIS_SET(flags, val) \
do { \
(flags) = (u16)((flags & (~(SBP_ACKNOWLEDGE_EPHEMERIS_MASK \
<< SBP_ACKNOWLEDGE_EPHEMERIS_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_EPHEMERIS_MASK)) \
<< (SBP_ACKNOWLEDGE_EPHEMERIS_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_EPHEMERIS_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_EPHEMERIS_REQUESTED (1)
#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_MASK (0x1u)
#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_SHIFT (3u)
#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_SATELLITE_CLOCK_SHIFT) & \
SBP_ACKNOWLEDGE_SATELLITE_CLOCK_MASK))
#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_SET(flags, val) \
do { \
(flags) = (u16)((flags & (~(SBP_ACKNOWLEDGE_SATELLITE_CLOCK_MASK \
<< SBP_ACKNOWLEDGE_SATELLITE_CLOCK_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_SATELLITE_CLOCK_MASK)) \
<< (SBP_ACKNOWLEDGE_SATELLITE_CLOCK_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_SATELLITE_CLOCK_REQUESTED (1)
#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_MASK (0x1u)
#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_SHIFT (4u)
#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_SATELLITE_ORBIT_SHIFT) & \
SBP_ACKNOWLEDGE_SATELLITE_ORBIT_MASK))
#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_SET(flags, val) \
do { \
(flags) = (u16)((flags & (~(SBP_ACKNOWLEDGE_SATELLITE_ORBIT_MASK \
<< SBP_ACKNOWLEDGE_SATELLITE_ORBIT_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_SATELLITE_ORBIT_MASK)) \
<< (SBP_ACKNOWLEDGE_SATELLITE_ORBIT_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_SATELLITE_ORBIT_REQUESTED (1)
#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_MASK (0x1u)
#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_SHIFT (5u)
#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_SHIFT) & \
SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_MASK))
#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_SET(flags, val) \
do { \
(flags) = \
(u16)((flags & (~(SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_MASK \
<< SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_MASK)) \
<< (SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_SATELLITE_CODE_BIAS_REQUESTED (1)
#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_MASK (0x1u)
#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_SHIFT (6u)
#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_SHIFT) & \
SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_MASK))
#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_SET(flags, val) \
do { \
(flags) = \
(u16)((flags & (~(SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_MASK \
<< SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_MASK)) \
<< (SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_SATELLITE_PHASE_BIAS_REQUESTED (1)
#define SBP_ACKNOWLEDGE_ATMOSPHERICS_MASK (0x1u)
#define SBP_ACKNOWLEDGE_ATMOSPHERICS_SHIFT (7u)
#define SBP_ACKNOWLEDGE_ATMOSPHERICS_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_ATMOSPHERICS_SHIFT) & \
SBP_ACKNOWLEDGE_ATMOSPHERICS_MASK))
#define SBP_ACKNOWLEDGE_ATMOSPHERICS_SET(flags, val) \
do { \
(flags) = (u16)((flags & (~(SBP_ACKNOWLEDGE_ATMOSPHERICS_MASK \
<< SBP_ACKNOWLEDGE_ATMOSPHERICS_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_ATMOSPHERICS_MASK)) \
<< (SBP_ACKNOWLEDGE_ATMOSPHERICS_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_ATMOSPHERICS_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_ATMOSPHERICS_REQUESTED (1)
#define SBP_ACKNOWLEDGE_INTEGRITY_MASK (0x1u)
#define SBP_ACKNOWLEDGE_INTEGRITY_SHIFT (8u)
#define SBP_ACKNOWLEDGE_INTEGRITY_GET(flags) \
((u16)((u16)((flags) >> SBP_ACKNOWLEDGE_INTEGRITY_SHIFT) & \
SBP_ACKNOWLEDGE_INTEGRITY_MASK))
#define SBP_ACKNOWLEDGE_INTEGRITY_SET(flags, val) \
do { \
(flags) = (u16)((flags & (~(SBP_ACKNOWLEDGE_INTEGRITY_MASK \
<< SBP_ACKNOWLEDGE_INTEGRITY_SHIFT))) | \
(((val) & (SBP_ACKNOWLEDGE_INTEGRITY_MASK)) \
<< (SBP_ACKNOWLEDGE_INTEGRITY_SHIFT))); \
} while (0)

#define SBP_ACKNOWLEDGE_INTEGRITY_NOT_REQUESTED (0)
#define SBP_ACKNOWLEDGE_INTEGRITY_REQUESTED (1)
/**
* Encoded length of sbp_msg_acknowledge_t (V4 API) and
* msg_acknowledge_t (legacy API)
*/
#define SBP_MSG_ACKNOWLEDGE_ENCODED_LEN 11u

#endif /* LIBSBP_INTEGRITY_MACROS_H */
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 @@ -1136,6 +1136,12 @@ struct MessageTraits<msg_ssr_flag_iono_grid_point_sat_los_t> {
};


template<>
struct MessageTraits<msg_acknowledge_t> {
static constexpr u16 id = 3026;
};


template<>
struct MessageTraits<msg_ed25519_signature_dep_t> {
static constexpr u16 id = 3073;
Expand Down
18 changes: 18 additions & 0 deletions c/include/libsbp/legacy/integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,24 @@ typedef struct SBP_ATTR_PACKED {
sv_id_t faulty_los[0]; /**< List of faulty LOS */
} msg_ssr_flag_iono_grid_point_sat_los_t;

typedef struct SBP_ATTR_PACKED {
u8 request_id; /**< Echo of the request ID field from the
corresponding CRA message, or 255 if
no request ID was provided. */
u32 area_id; /**< Echo of the Area ID field from the
corresponding CRA message. */
u8 response_code; /**< Reported status of the request. */
u16 correction_mask_on_demand; /**< Contains the message group(s) that
will be sent in response from the
corresponding CRA correction mask. An
echo of the correction mask field
from the corresponding CRA message. */
u16 correction_mask_stream; /**< For future expansion. Always set to
0. */
u8 solution_id; /**< The solution ID of the instance
providing the corrections. */
} msg_acknowledge_t;

/** \} */

SBP_PACK_END
Expand Down
1 change: 1 addition & 0 deletions c/include/libsbp/sbp_msg_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ extern "C" {
#define SBP_MSG_ALL 0

typedef enum {
SbpMsgAcknowledge = SBP_MSG_ACKNOWLEDGE,
SbpMsgAcqResultDepA = SBP_MSG_ACQ_RESULT_DEP_A,
SbpMsgAcqResultDepB = SBP_MSG_ACQ_RESULT_DEP_B,
SbpMsgAcqResultDepC = SBP_MSG_ACQ_RESULT_DEP_C,
Expand Down
1 change: 1 addition & 0 deletions c/include/libsbp/v4/integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#ifndef LIBSBP_V4_INTEGRITY_MESSAGES_H
#define LIBSBP_V4_INTEGRITY_MESSAGES_H
#include <libsbp/v4/integrity/IntegritySSRHeader.h>
#include <libsbp/v4/integrity/MSG_ACKNOWLEDGE.h>
#include <libsbp/v4/integrity/MSG_SSR_FLAG_HIGH_LEVEL.h>
#include <libsbp/v4/integrity/MSG_SSR_FLAG_IONO_GRID_POINTS.h>
#include <libsbp/v4/integrity/MSG_SSR_FLAG_IONO_GRID_POINT_SAT_LOS.h>
Expand Down
Loading

0 comments on commit 6a57014

Please sign in to comment.