Skip to content

Commit

Permalink
more
Browse files Browse the repository at this point in the history
  • Loading branch information
woodfell committed Nov 20, 2023
1 parent d7f625f commit ee0b25c
Show file tree
Hide file tree
Showing 1,379 changed files with 366,276 additions and 226,040 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ gen-c:
cd $(SWIFTNAV_ROOT)/c; \
mkdir -p build.docker/ && cd build.docker/; \
cmake $(CMAKEFLAGS) ../; \
#$(MAKE) clang-format-all
$(MAKE) clang-format-all

$(call announce-end,"Finished formatting C code")

Expand Down
8 changes: 4 additions & 4 deletions c/include/libsbp/acquisition.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@

#ifndef LIBSBP_ACQUISITION_MESSAGES_H
#define LIBSBP_ACQUISITION_MESSAGES_H
#include <libsbp/acquisition/MSG_ACQ_RESULT.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_C.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_B.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_A.h>
#include <libsbp/acquisition/AcqSvProfile.h>
#include <libsbp/acquisition/AcqSvProfileDep.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_A.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_B.h>
#include <libsbp/acquisition/MSG_ACQ_RESULT_DEP_C.h>
#include <libsbp/acquisition/MSG_ACQ_SV_PROFILE.h>
#include <libsbp/acquisition/MSG_ACQ_SV_PROFILE_DEP.h>

Expand Down
121 changes: 65 additions & 56 deletions c/include/libsbp/acquisition/AcqSvProfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@
#ifndef LIBSBP_ACQUISITION_ACQSVPROFILE_H
#define LIBSBP_ACQUISITION_ACQSVPROFILE_H

#include <math.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
#include <math.h>
#include <string.h>

#include <libsbp/common.h>
#include <libsbp/string/sbp_string.h>
#include <libsbp/acquisition_macros.h>
#include <libsbp/common.h>
#include <libsbp/gnss/GnssSignal.h>
#include <libsbp/string/sbp_string.h>

#ifdef __cplusplus
extern "C" {
extern "C" {
#endif

/******************************************************************************
Expand All @@ -41,168 +41,177 @@
*****************************************************************************/
/** Acq perfomance measurement and debug
*
* Profile for a specific SV for debugging purposes. The message describes SV profile during acquisition time. The message is used to debug and measure the performance.
* Profile for a specific SV for debugging purposes. The message describes SV
* profile during acquisition time. The message is used to debug and measure the
* performance.
*/
typedef struct {


/**
* SV search job type (deep, fallback, etc)
* SV search job type (deep, fallback, etc)
*/
u8 job_type;


/**
* Acquisition status 1 is Success, 0 is Failure
* Acquisition status 1 is Success, 0 is Failure
*/
u8 status;


/**
* CN0 value. Only valid if status is '1' [dB-Hz*10]
* CN0 value. Only valid if status is '1' [dB-Hz*10]
*/
u16 cn0;


/**
* Acquisition integration time [ms]
* Acquisition integration time [ms]
*/
u8 int_time;


/**
* GNSS signal for which acquisition was attempted
* GNSS signal for which acquisition was attempted
*/
sbp_v4_gnss_signal_t sid;


/**
* Acq frequency bin width [Hz]
* Acq frequency bin width [Hz]
*/
u16 bin_width;


/**
* Timestamp of the job complete event [ms]
* Timestamp of the job complete event [ms]
*/
u32 timestamp;


/**
* Time spent to search for sid.code [us]
* Time spent to search for sid.code [us]
*/
u32 time_spent;


/**
* Doppler range lowest frequency [Hz]
* Doppler range lowest frequency [Hz]
*/
s32 cf_min;


/**
* Doppler range highest frequency [Hz]
* Doppler range highest frequency [Hz]
*/
s32 cf_max;


/**
* Doppler value of detected peak. Only valid if status is '1' [Hz]
* Doppler value of detected peak. Only valid if status is '1' [Hz]
*/
s32 cf;


/**
* Codephase of detected peak. Only valid if status is '1' [chips*10]
* Codephase of detected peak. Only valid if status is '1' [chips*10]
*/
u32 cp;
} sbp_acq_sv_profile_t;



/**
* Get encoded size of an instance of sbp_acq_sv_profile_t
*
* @param msg sbp_acq_sv_profile_t instance
* @return Length of on-wire representation
*/
static inline size_t sbp_acq_sv_profile_encoded_len(const sbp_acq_sv_profile_t *msg)
{
static inline size_t sbp_acq_sv_profile_encoded_len(
const sbp_acq_sv_profile_t *msg) {
(void)msg;
return SBP_ACQ_SV_PROFILE_ENCODED_LEN;
}

/**
* Encode an instance of sbp_acq_sv_profile_t to wire representation
*
* This function encodes the given instance in to the user provided buffer. The buffer provided to this function must be large enough to store the encoded message otherwise it will return SBP_ENCODE_ERROR without writing anything to the buffer.
* This function encodes the given instance in to the user provided buffer. The
* buffer provided to this function must be large enough to store the encoded
* message otherwise it will return SBP_ENCODE_ERROR without writing anything to
* the buffer.
*
* Specify the length of the destination buffer in the \p len parameter. If non-null the number of bytes written to the buffer will be returned in \p n_written.
* Specify the length of the destination buffer in the \p len parameter. If
* non-null the number of bytes written to the buffer will be returned in \p
* n_written.
*
* @param buf Destination buffer
* @param len Length of \p buf
* @param n_written If not null, on success will be set to the number of bytes written to \p buf
* @param n_written If not null, on success will be set to the number of bytes
* written to \p buf
* @param msg Instance of sbp_acq_sv_profile_t to encode
* @return SBP_OK on success, or other libsbp error code
*/
SBP_EXPORT s8 sbp_acq_sv_profile_encode(uint8_t *buf, uint8_t len, uint8_t *n_written, const sbp_acq_sv_profile_t *msg);
SBP_EXPORT s8 sbp_acq_sv_profile_encode(uint8_t *buf, uint8_t len,
uint8_t *n_written,
const sbp_acq_sv_profile_t *msg);

/**
* Decode an instance of sbp_acq_sv_profile_t from wire representation
*
* This function decodes the wire representation of a sbp_acq_sv_profile_t message to the given instance. The caller must specify the length of the buffer in the \p len parameter. If non-null the number of bytes read from the buffer will be returned in \p n_read.
* This function decodes the wire representation of a sbp_acq_sv_profile_t
* message to the given instance. The caller must specify the length of the
* buffer in the \p len parameter. If non-null the number of bytes read from the
* buffer will be returned in \p n_read.
*
* @param buf Wire representation of the sbp_acq_sv_profile_t instance
* @param len Length of \p buf
* @param n_read If not null, on success will be set to the number of bytes read from \p buf
* @param n_read If not null, on success will be set to the number of bytes read
* from \p buf
* @param msg Destination
* @return SBP_OK on success, or other libsbp error code
*/
SBP_EXPORT s8 sbp_acq_sv_profile_decode(const uint8_t *buf, uint8_t len, uint8_t *n_read, sbp_acq_sv_profile_t *msg);
SBP_EXPORT s8 sbp_acq_sv_profile_decode(const uint8_t *buf, uint8_t len,
uint8_t *n_read,
sbp_acq_sv_profile_t *msg);

/**
* Compare two instances of sbp_acq_sv_profile_t
*
* The two instances will be compared and a value returned consistent with the return codes of comparison functions from the C standard library
* The two instances will be compared and a value returned consistent with the
* return codes of comparison functions from the C standard library
*
* 0 will be returned if \p a and \p b are considered equal
* A value less than 0 will be returned if \p a is considered to be less than \p b
* A value greater than 0 will be returned if \p b is considered to be greater than \p b
* A value less than 0 will be returned if \p a is considered to be less than \p
* b A value greater than 0 will be returned if \p b is considered to be greater
* than \p b
*
* @param a sbp_acq_sv_profile_t instance
* @param b sbp_acq_sv_profile_t instance
* @return 0, <0, >0
*/
SBP_EXPORT int sbp_acq_sv_profile_cmp(const sbp_acq_sv_profile_t *a, const sbp_acq_sv_profile_t *b);
SBP_EXPORT int sbp_acq_sv_profile_cmp(const sbp_acq_sv_profile_t *a,
const sbp_acq_sv_profile_t *b);

#ifdef __cplusplus
}
}

static inline bool operator==(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator==(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) == 0;
}

static inline bool operator!=(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator!=(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) != 0;
}

static inline bool operator<(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator<(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) < 0;
}

static inline bool operator<=(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator<=(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) <= 0;
}

static inline bool operator>(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator>(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) > 0;
}

static inline bool operator>=(const sbp_acq_sv_profile_t &lhs, const sbp_acq_sv_profile_t &rhs) {
static inline bool operator>=(const sbp_acq_sv_profile_t &lhs,
const sbp_acq_sv_profile_t &rhs) {
return sbp_acq_sv_profile_cmp(&lhs, &rhs) >= 0;
}

#endif // ifdef __cplusplus
#endif // ifdef __cplusplus

#endif /* LIBSBP_ACQUISITION_ACQSVPROFILE_H */

Loading

0 comments on commit ee0b25c

Please sign in to comment.