GenericInertialCommand
GenericInertialCommandResponse
public
InertialCmdResponse
GenericInertialCommandResponse

Represents the response to a GenericInertialCommand.

See Also

InertialCmdResponse

Functions
GenericInertialCommandResponse
GenericInertialCommandResponse()

Creates a GenericInertialCommandResponse with default values.

GenericInertialCommandResponse
GenericInertialCommandResponse(
ResponsePattern::State state,
bool success,
InertialPacket::MipAckNack errorCode,
std::string cmdName,
ByteStream data
)

Creates a GenericInertialCommandResponse with the given parameters.

Parameters
state
ResponsePattern::State

The state of the response.

success
bool

Whether or not the command was a success.

errorCode
InertialPacket::MipAckNack

The MIP Ack/Nack error code received.

cmdName
std::string

The name of the command.

data

The <ByteStream that holds the result data from the response (if any).

ResponseSuccess
static GenericInertialCommandResponse ResponseSuccess(
std::string cmdName,
ByteStream data ByteStream()
)

Creates a GenericInertialCommandResponse with a successful response.

Parameters
cmdName
std::string

The name of the command.

data

The <ByteStream that holds the data from the response (if any).

Returns

A GenericInertialCommandResponse representing a success response from the command.

ResponseFail
static GenericInertialCommandResponse ResponseFail(
ResponsePattern::State errorState,
InertialPacket::MipAckNack errorCode,
std::string cmdName
)

Creates a GenericInertialCommandResponse with a fail response.

Parameters
errorState
ResponsePattern::State

The state that caused the ResponseFail.

errorCode
InertialPacket::MipAckNack

The MIP Ack/Nack error code to set with the ResponseFail.

cmdName
std::string

The name of the command.

Returns

A GenericInertialCommandResponse representing a failed response from the command.

Variables
m_data
ByteStream m_data

The <ByteStream that holds the data received from the response, if any.

Functions
data
ByteStream data() const

Gets the data that was received from the response, if any.

Returns

A ByteStream that contains the data received from the response, if any.

GenericInertialCommand
GenericInertialCommand

Represents a base class for Inertial commands

Functions
buildCommand
static ByteStream buildCommand(
uint8 descSetByte,
uint8 cmdByte,
Bytes fieldData Bytes()
)

Builds the command for an Inertial command, and returns a ByteStream containing the bytes to send

Parameters
descSetByte
uint8

The descriptor set byte for the command

cmdByte
uint8

The command (field) byte for the command

fieldData

A vector of bytes that make up the field data to be sent in the command (defaults to empty)

Returns

A ByteStream containing the Inertial command packet built from the given bytes

buildCommand
static ByteStream buildCommand(
InertialTypes::Command commandId,
Bytes fieldData Bytes()
)

Builds the command for an Inertial command, and returns a ByteStream containing the bytes to send

Parameters
commandId

The InertialTypes::Command for the command

fieldData

A vector of bytes that make up the field data to be sent in the command (defaults to empty)

Returns

A ByteStream containing the Inertial command packet built from the given bytes

Response
public
ResponsePattern
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
GenericInertialCommand.​Response
Response

Handles the response to the Inertial command

Variables
m_ackNackResponse
bool m_ackNackResponse

Whether or not an ack/nack response field is expected

m_dataResponse
bool m_dataResponse

Whether or not a data response field is expected

m_commandName
std::string m_commandName

The name of the command

m_result
GenericInertialCommandResponse m_result

The GenericInertialCommandResponse that holds the result of the GenericInertialCommand

Functions
commandId
virtual InertialTypes::Command commandId() const = 0

Gets the InertialTypes::Command for the Inertial command

fieldDataByte
virtual uint8 fieldDataByte() const

Gets the data field byte that should be received with the data field (if any)

descSetByte
uint8 descSetByte() const

Gets the descriptor set byte for the Inertial command

cmdByte
uint8 cmdByte() const

Gets the command byte for the Inertial command

fieldAckNackByte
uint8 fieldAckNackByte() const

Gets the ack/nack byte that should be received with the ack/nack field

Response
Response(
std::weak_ptr<ResponseCollectorcollector,
bool ackNackResponse,
bool dataResponse,
std::string cmdName
)

Creates a Ping Response object

Parameters
collector
std::weak_ptr<ResponseCollector>

The ResponseCollector used to register and unregister the response

ackNackResponse
bool

Whether or not an ack/nack response field is expected

dataResponse
bool

Whether or not a data response field is expected

cmdName
std::string

The name of the command (to be used in exceptions that may be thrown)

match
virtual bool match(
const InertialDataField &field
) override

Checks if the InertialDataField passed in matches the expected response pattern's bytes

Parameters
field

The InertialDataField in which to try to find the pattern

Returns

true if the packet matches a response pattern, false otherwise

match_ackNack
bool match_ackNack(
const InertialDataField &field
)

Checks if the InertialDataField matches the ACK/NACK field for this command (if one is even expected)

Parameters
field

The InertialDataField in which to try to find the pattern

Returns

true if the packet matches the expected response pattern, false otherwise

match_data
virtual bool match_data(
const InertialDataField &field
)

Checks if the InertialDataField matches the data field for this command (if one is even expected)

Parameters
field

The InertialDataField in which to try to find the pattern

Returns

true if the packet matches the expected response pattern, false otherwise

wait
bool wait(
uint64 timeout
)

Waits for a certain amount of time for the response pattern to be matched

Parameters
timeout
uint64

The maximum time (in milliseconds) to wait until the command times out and returns, if not found first

Returns

true if the response pattern was matched, false otherwise

result
GenericInertialCommandResponse result()

Gets the GenericInertialCommandResponse that holds the result of the response

Returns

A GenericInertialCommandResponse that holds the result of the response