Protocols#

constellation::protocol Namespace#

enum class constellation::protocol::Protocol : std::uint8_t#

Protocol Enum (excluding CHIRP)

Values:

enumerator CSCP1#

Constellation Satellite Control Protocol v1

enumerator CMDP1#

Constellation Monitoring Distribution Protocol v1

enumerator CDTP1#

Constellation Data Transmission Protocol v1

enumerator CHP1#

Constellation Heartbeat Protocol v1

std::string_view constellation::protocol::get_protocol_identifier(Protocol protocol)#

Get protocol identifier string for CSCP, CMDP and CDTP protocols

Parameters:

protocol – Protocol

Returns:

Protocol identifier string in message header

Protocol constellation::protocol::get_protocol(std::string_view protocol_identifier)#

Get protocol from a protocol identifier string

Parameters:

protocol_identifier – Protocol identifier string

Returns:

Protocol

inline std::string constellation::protocol::get_readable_protocol(std::string_view protocol_identifier)#

Get human-readable protocol identifier string for CSCP, CMDP and CDTP protocols

Parameters:

protocol_identifier – Protocol identifier string

Returns:

Protocol identifier string with byte version replaced to human-readable version

inline std::string constellation::protocol::get_readable_protocol(Protocol protocol)#

Get human-readable protocol identifier string for CSCP, CMDP and CDTP protocols

Parameters:

protocol – Protocol

Returns:

Protocol identifier string with byte version replaced to human-readable version

constellation::protocol::CSCP Namespace#

enum class constellation::protocol::CSCP::State : std::uint8_t#

Possible Satellite FSM states

The following statements can be made about states:

  • States with lower four bits equal to zero are steady states, e.g. INIT.

  • The other states are transition, and their lower four bits indicate the steady state the enter into, e.g. the lower four bits of state landing are 0x2, so this transitional state enters into steady state 0x20, INIT.

Values:

enumerator NEW#
enumerator initializing#
enumerator INIT#
enumerator launching#
enumerator ORBIT#
enumerator landing#
enumerator reconfiguring#
enumerator starting#
enumerator RUN#
enumerator stopping#
enumerator interrupting#
enumerator SAFE#
enumerator ERROR#
enum class constellation::protocol::CSCP::Transition : std::uint8_t#

Possible FSM transitions

Values:

enumerator initialize#
enumerator initialized#
enumerator launch#
enumerator launched#
enumerator land#
enumerator landed#
enumerator reconfigure#
enumerator reconfigured#
enumerator start#
enumerator started#
enumerator stop#
enumerator stopped#
enumerator interrupt#
enumerator interrupted#
enumerator failure#
enum class constellation::protocol::CSCP::TransitionCommand : std::underlying_type_t<Transition>#

Possible transition commands via CSCP

Values:

enumerator initialize#
enumerator launch#
enumerator land#
enumerator reconfigure#
enumerator start#
enumerator stop#
enumerator _interrupt#
enumerator _failure#
enum class constellation::protocol::CSCP::StandardCommand : std::underlying_type_t<TransitionCommand>#

Possible standard (non-transition) commands via CSCP

Values:

enumerator get_name#
enumerator get_version#
enumerator get_commands#
enumerator get_state#
enumerator get_role#
enumerator get_status#
enumerator get_config#
enumerator get_run_id#
enumerator shutdown#
enumerator _get_commands#
enumerator _get_remotes#
enumerator _get_services#
bool constellation::protocol::CSCP::is_steady(State state)#

Check if a state is steady.

bool constellation::protocol::CSCP::is_shutdown_allowed(State state)#

Check if the CSCP shutdown command is allowed from a given state.

Shutdown is only allowed from NEW, INIT, SAFE and ERROR.

bool constellation::protocol::CSCP::transitions_from(State transition, State steady)#

Check if “transition” is a transitional state from steady state “steady” to a new steady state.

bool constellation::protocol::CSCP::transitions_to(State transition, State steady)#

Check if “transition” is a transitional state from a former state into steady state “steady”.

template<State... states>
bool constellation::protocol::CSCP::is_one_of_states(State state)#

Check if given state is in one of template states list.

Parameters:

state – State to check

Returns:

True if state equals one of the states given in the template parameters

template<State... states>
static bool constellation::protocol::CSCP::is_not_one_of_states(State state)#

Check if given state is not in one of template states list.

Parameters:

state – State to check

Returns:

True if state equals none of the states given in the template parameters

inline bool constellation::protocol::CSCP::is_valid_satellite_name(const std::string &satellite_name)#

Checks if a satellite name is valid.

A satellite name may contain alphanumeric characters and underscores and may not be empty.

inline bool constellation::protocol::CSCP::is_valid_canonical_name(const std::string &canonical_name)#

Checks if a canonical name is valid.

A canonical name consists of two parts, separated by a period. Both parts may contain alphanumeric characters and underscores and may not be empty.

inline bool constellation::protocol::CSCP::is_valid_run_id(const std::string &run_id)#

Checks if a run ID is valid.

A run ID may contain alphanumeric characters, underscores or dashes and may not be empty.

inline bool constellation::protocol::CSCP::is_valid_command_name(const std::string &command_name)#

Checks if a command name is valid.

A command may contain alphanumeric characters or underscores, and may not be empty or start with a digit.

constellation::protocol::CHP Namespace#

enum constellation::protocol::CHP::MessageFlags#

Possible CHP message flags

Values:

enumerator NONE#
enumerator DENY_DEPARTURE#

Indicating that the sender should not be allowed to depart, and an interrupt should be triggered

enumerator TRIGGER_INTERRUPT#

Indicating that ERROR or SAFE states and missing heartbeats should trigger an interrupt

enumerator MARK_DEGRADED#

Indicating that the current run should me marked as degraded if this sender reports failure or disappears

enumerator IS_EXTRASYSTOLE#
enum class constellation::protocol::CHP::Role : std::uint8_t#

Satellite roles, representing a combination of message flags

Values:

enumerator NONE#

No Flags.

enumerator TRANSIENT#

Flags MARK_DEGRADED.

enumerator DYNAMIC#

Flags MARK_DEGRADED, TRIGGER_INTERRUPT.

enumerator ESSENTIAL#

Flags MARK_DEGRADED, TRIGGER_INTERRUPT, DENY_DEPARTURE.

static std::uint8_t constellation::protocol::CHP::Lives = 3#

Default lives for a remote on detection/replenishment

static std::chrono::milliseconds constellation::protocol::CHP::MinimumInterval = std::chrono::milliseconds(500)#

Minimal interval between heartbeat messages

static std::chrono::milliseconds constellation::protocol::CHP::MaximumInterval = std::chrono::milliseconds(300000)#

Default maximum interval between heartbeat messages

static double constellation::protocol::CHP::LoadFactor = 3.#

Load factor to scale CHP subscriber weight in interval scaling

MessageFlags constellation::protocol::CHP::flags_from_role(Role role)#

Get flags for a given role.

Parameters:

role – Role

Role constellation::protocol::CHP::role_from_flags(MessageFlags flags)#

Get role from given message flags.

Parameters:

flags – Message flags

bool constellation::protocol::CHP::role_requires(Role role, MessageFlags flags)#

Check if the given role requires the given message flag.

Parameters:
  • role – Role

  • flags – Message flags

Returns:

True if role mandates the flag, false otherwise

std::chrono::milliseconds constellation::protocol::CHP::calculate_interval(std::size_t subscribers, std::chrono::milliseconds max)#

Method to calculate the heartbeat interval based on the number of subscriber satellites and a maximum interval Using a load factor to scale down number of messages.

Parameters:
  • subscribers – Current number of subscriber satellites

  • max – Maximum allowed interval between heartbeats

Returns:

New heartbeat interval