AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
An object for tracking fast packet session state. More...
#include <nmea2000_fast_packet_protocol.hpp>
Public Member Functions | |
FastPacketProtocolSession (TransportProtocolSessionBase::Direction direction, std::unique_ptr< CANMessageData > data, std::uint32_t parameterGroupNumber, std::uint16_t totalMessageSize, std::uint8_t sequenceNumber, CANIdentifier::CANPriority priority, std::shared_ptr< ControlFunction > source, std::shared_ptr< ControlFunction > destination, TransmitCompleteCallback sessionCompleteCallback, void *parentPointer) | |
The constructor for a session, for advanced use only. In most cases, you should use the CANNetworkManager::get_fast_packet_protocol().send_message() function to transmit messages. | |
std::uint8_t | get_message_length () const |
Get the total number of bytes that will be sent or received in this session. | |
std::uint32_t | get_total_bytes_transferred () const override |
Get the number of bytes that have been sent or received in this session. | |
bool | is_broadcast () const |
Get whether or not this session is a broadcast session (BAM) | |
Public Member Functions inherited from isobus::TransportProtocolSessionBase | |
TransportProtocolSessionBase (TransportProtocolSessionBase::Direction direction, std::unique_ptr< CANMessageData > data, std::uint32_t parameterGroupNumber, std::uint32_t totalMessageSize, std::shared_ptr< ControlFunction > source, std::shared_ptr< ControlFunction > destination, TransmitCompleteCallback sessionCompleteCallback, void *parentPointer) | |
The constructor for a session. | |
TransportProtocolSessionBase (TransportProtocolSessionBase &&other)=default | |
The move constructor. | |
TransportProtocolSessionBase & | operator= (TransportProtocolSessionBase &&other)=default |
The move assignment operator. | |
virtual | ~TransportProtocolSessionBase ()=default |
The destructor for a session. | |
Direction | get_direction () const |
Get the direction of the session. | |
bool | operator== (const TransportProtocolSessionBase &obj) const |
A useful way to compare session objects to each other for equality,. | |
bool | matches (std::shared_ptr< ControlFunction > other_source, std::shared_ptr< ControlFunction > other_destination) const |
Checks if the source and destination control functions match the given control functions. | |
CANMessageData & | get_data () const |
Get the data buffer for the session. | |
std::uint32_t | get_message_length () const |
Get the total number of bytes that will be sent or received in this session. | |
float | get_percentage_bytes_transferred () const |
Get the percentage of bytes that have been sent or received in this session. | |
std::shared_ptr< ControlFunction > | get_source () const |
Get the control function that is sending the message. | |
std::shared_ptr< ControlFunction > | get_destination () const |
Get the control function that is receiving the message. | |
std::uint32_t | get_parameter_group_number () const |
Get the parameter group number of the message. | |
Protected Member Functions | |
std::uint8_t | get_last_packet_number () const |
Get the last packet number that was sent or received in this session. | |
std::uint8_t | get_number_of_remaining_packets () const |
Get the number of packets that remain to be sent or received in this session. | |
std::uint8_t | get_total_number_of_packets () const |
Get the total number of packets that will be sent or received in this session. | |
void | add_number_of_bytes_transferred (std::uint8_t bytes) |
Add number of bytes to the total number of bytes that have been sent or received in this session. | |
Protected Member Functions inherited from isobus::TransportProtocolSessionBase | |
void | update_timestamp () |
Update the timestamp of the session. | |
std::uint32_t | get_time_since_last_update () const |
Get the time that has passed since the last update of the timestamp. | |
void | complete (bool success) const |
Complete the session. | |
Private Attributes | |
std::uint8_t | numberOfBytesTransferred = 0 |
The total number of bytes that have been processed in this session. | |
std::uint8_t | sequenceNumber |
The sequence number for this PGN. | |
CANIdentifier::CANPriority | priority |
The priority to encode in the IDs of the component CAN messages. | |
Friends | |
class | FastPacketProtocol |
Allows the TP manager full access. | |
Additional Inherited Members | |
Public Types inherited from isobus::TransportProtocolSessionBase | |
enum class | Direction { Transmit , Receive } |
Enumerates the possible session directions. More... | |
An object for tracking fast packet session state.
Definition at line 41 of file nmea2000_fast_packet_protocol.hpp.
isobus::FastPacketProtocol::FastPacketProtocolSession::FastPacketProtocolSession | ( | TransportProtocolSessionBase::Direction | direction, |
std::unique_ptr< CANMessageData > | data, | ||
std::uint32_t | parameterGroupNumber, | ||
std::uint16_t | totalMessageSize, | ||
std::uint8_t | sequenceNumber, | ||
CANIdentifier::CANPriority | priority, | ||
std::shared_ptr< ControlFunction > | source, | ||
std::shared_ptr< ControlFunction > | destination, | ||
TransmitCompleteCallback | sessionCompleteCallback, | ||
void * | parentPointer ) |
The constructor for a session, for advanced use only. In most cases, you should use the CANNetworkManager::get_fast_packet_protocol().send_message() function to transmit messages.
[in] | direction | The direction of the session |
[in] | data | Data buffer (will be moved into the session) |
[in] | parameterGroupNumber | The PGN of the message |
[in] | totalMessageSize | The total size of the message in bytes |
[in] | sequenceNumber | The sequence number for this PGN |
[in] | priority | The priority to encode in the IDs of the component CAN messages |
[in] | source | The source control function |
[in] | destination | The destination control function |
[in] | sessionCompleteCallback | A callback for when the session completes |
[in] | parentPointer | A generic context object for the tx complete and chunk callbacks |
Definition at line 26 of file nmea2000_fast_packet_protocol.cpp.
|
protected |
Add number of bytes to the total number of bytes that have been sent or received in this session.
[in] | bytes | The number of bytes to add to the total |
Definition at line 82 of file nmea2000_fast_packet_protocol.cpp.
|
protected |
Get the last packet number that was sent or received in this session.
Definition at line 58 of file nmea2000_fast_packet_protocol.cpp.
std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::get_message_length | ( | ) | const |
Get the total number of bytes that will be sent or received in this session.
Definition at line 42 of file nmea2000_fast_packet_protocol.cpp.
|
protected |
Get the number of packets that remain to be sent or received in this session.
Definition at line 72 of file nmea2000_fast_packet_protocol.cpp.
|
overridevirtual |
Get the number of bytes that have been sent or received in this session.
Implements isobus::TransportProtocolSessionBase.
Definition at line 53 of file nmea2000_fast_packet_protocol.cpp.
|
protected |
Get the total number of packets that will be sent or received in this session.
Definition at line 77 of file nmea2000_fast_packet_protocol.cpp.
bool isobus::FastPacketProtocol::FastPacketProtocolSession::is_broadcast | ( | ) | const |
Get whether or not this session is a broadcast session (BAM)
Definition at line 48 of file nmea2000_fast_packet_protocol.cpp.
|
friend |
Allows the TP manager full access.
Definition at line 81 of file nmea2000_fast_packet_protocol.hpp.
|
private |
The total number of bytes that have been processed in this session.
Definition at line 100 of file nmea2000_fast_packet_protocol.hpp.
|
private |
The priority to encode in the IDs of the component CAN messages.
Definition at line 102 of file nmea2000_fast_packet_protocol.hpp.
|
private |
The sequence number for this PGN.
Definition at line 101 of file nmea2000_fast_packet_protocol.hpp.