Skip to content

Commit

Permalink
Add mock up of some messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Diamond committed Dec 14, 2023
1 parent a05426b commit cb659b1
Showing 1 changed file with 235 additions and 0 deletions.
235 changes: 235 additions & 0 deletions src/point_one/fusion_engine/messages/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -2381,6 +2381,241 @@ struct P1_ALIGNAS(4) InterfaceConfigSubmessage {

/** @} */

enum class CorrectionType : uint8_t {
INVALID = 0,
OSR = 1,
SSR = 2,
EPHEMERIS = 3,
};

enum class CorrectionSource : uint8_t {
INVALID = 0,
TCP = 1,
NTRIP = 2,
LBAND = 3,
POLARIS = 4,
DEVICE_INTERFACE = 5,
};

enum class CorrectionUse : uint8_t {
INVALID = 0,
DISABLED = 1,
ENABLED = 2,
COLLECT_WITHOUT_USING = 3,
};

struct NTRIPParameters {
static constexpr CorrectionSource SOURCE_TYPE = CorrectionSource::NTRIP;
char hostname[64] = {0};
char mountpoint[64] = {0};
char username[16] = {0};
char password[16] = {0};
uint16_t port = 0;
uint8_t reserved1[2] = {0};
};

struct SerialParameters {
static constexpr CorrectionSource SOURCE_TYPE = CorrectionSource::DEVICE_INTERFACE;
char device_path[64] = {0};
uint16_t baud_rate = 0;
};

struct CorrectionEntry {
static constexpr uint8_t INVALID_INDEX = 0xFF;

CorrectionType type = CorrectionType::INVALID;

CorrectionSource source = CorrectionSource::INVALID;

CorrectionUse use = CorrectionUse::INVALID;

// Index to identify the correction for editting or removal. This field is
// ignored in @ref AddCorrectionMessage.
uint8_t correction_index = INVALID_INDEX;

// This value is only used when `CorrectionSource` is @ref
// CorrectionSource::DEVICE_INTERFACE.
InterfaceID interface;
};

/**
* @brief Get a list of the existing correction configurations.
*
* This will only contain the @ref CorrectionEntry data. To get the source
* parameters query a corrections index with @ref GetCorrectionParameters.
*
* # Expected Response
* The device will respond with a @ref ListCorrectionResponse.
*/
struct P1_ALIGNAS(4) ListCorrectionsMessage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::LIST_CORRECTIONS;
static constexpr uint8_t MESSAGE_VERSION = 0;
// Only return entries with fields that match the valid values in the filter.
CorrectionEntry filter;
};

struct P1_ALIGNAS(4) ListCorrectionResponse : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::LIST_CORRECTIONS_RESP;
static constexpr uint8_t MESSAGE_VERSION = 0;

/** The number of interfaces reported by this message. */
uint8_t num_corrections = 0;

uint8_t reserved1[3] = {0};

/** This in then followed by an array of `num_corrections` @ref CorrectionEntry. */
// CorrectionEntry corrections[num_corrections]
};

/**
* Get the configuration for a correction index.
*
* # Expected Response
* The device will respond with a @ref CorrectionParametersResponse.
*/
struct P1_ALIGNAS(4) GetCorrectionParameters : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::GET_CORRECTION_PARAM;
static constexpr uint8_t MESSAGE_VERSION = 0;

uint8_t correction_index = INVALID_INDEX;

uint8_t reserved1[3] = {0};
};

struct P1_ALIGNAS(4) CorrectionParametersResponse : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::CORRECTION_PARAM_RESP;
static constexpr uint8_t MESSAGE_VERSION = 0;

Response response = Response::OK;

uint8_t reserved1[3] = {0};

CorrectionEntry entry.

/**
* Additional data is only sent if `response` is @ref Response::OK.
*
* This in then followed by a an instance of the parameters to configure the
* source specified in `entry.source`.
*
* For example if the the source is @ref CorrectionSource::NTRIP, the
* remaining data in this message would be an instance of @ref
* NTRIPParameters.
*/
};

/**
* @brief Add a new correction source.
*
* # Expected Response
* The device will respond with a @ref CommandResponseMessage indicating whether
* or not the request succeeded.
*/
struct P1_ALIGNAS(4) AddCorrectionMessage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::ADD_CORRECTION;
static constexpr uint8_t MESSAGE_VERSION = 0;

CorrectionEntry entry.

/**
* This in then followed by a an instance of the parameters to configure the
* source specified in `entry.source`.
*
* For example if the the source is @ref CorrectionSource::NTRIP, the
* remaining data in this message would be an instance of @ref
* NTRIPParameters.
*/
};

/**
* @brief Replace the configuration for an existing correction source.
*
* # Expected Response
* The device will respond with a @ref CommandResponseMessage indicating whether
* or not the request succeeded.
*/
struct P1_ALIGNAS(4) ReplaceCorrectionMessage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::REPLACE_CORRECTION;
static constexpr uint8_t MESSAGE_VERSION = 0;

uint8_t correction_index = INVALID_INDEX;

uint8_t reserved1[3] = {0};

CorrectionEntry entry.

/**
* This in then followed by a an instance of the parameters to configure the
* source specified in `entry.source`.
*
* For example if the the source is @ref CorrectionSource::NTRIP, the
* remaining data in this message would be an instance of @ref
* NTRIPParameters.
*/
};

/**
* @brief Delete the configuration for a correction source.
*
* @warning This may cause the index of other configuration sources to change.
*
* # Expected Response
* The device will respond with a @ref CommandResponseMessage indicating whether
* or not the request succeeded.
*/
struct P1_ALIGNAS(4) DeleteCorrectionMessage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::DELETE_CORRECTION;
static constexpr uint8_t MESSAGE_VERSION = 0;

uint8_t correction_index = INVALID_INDEX;

uint8_t reserved1[3] = {0};
};

/**
* @brief Change how a correction source is being used.
*
* # Expected Response
* The device will respond with a @ref CommandResponseMessage indicating whether
* or not the request succeeded.
*/
struct P1_ALIGNAS(4) ChangeCorrectionUsage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::DELETE_CORRECTION;
static constexpr uint8_t MESSAGE_VERSION = 0;

uint8_t correction_index = INVALID_INDEX;

CorrectionUse use = CorrectionUse::INVALID;

uint8_t reserved1[2] = {0};
};

/**
* # Expected Response
* The device will respond with a @ref CommandResponseMessage indicating whether
* or not the request succeeded.
*/
struct P1_ALIGNAS(4) AddSerialCorrectionMessage : public MessagePayload {
static constexpr MessageType MESSAGE_TYPE =
MessageType::ADD_CORRECTION;
static constexpr uint8_t MESSAGE_VERSION = 0;

CorrectionType type = CorrectionType::INVALID;
CorrectionUse use = CorrectionUse::INVALID;

uint8_t reserved1[2] = {0};

SerialParameters parameters;
};

#pragma pack(pop)

} // namespace messages
Expand Down

0 comments on commit cb659b1

Please sign in to comment.