AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
A storage object to keep track of session information internally. More...
#include <can_transport_protocol.hpp>
Public Member Functions | |
TransportProtocolSession (TransportProtocolSessionBase::Direction direction, std::unique_ptr< CANMessageData > data, std::uint32_t parameterGroupNumber, std::uint16_t totalMessageSize, std::uint8_t clearToSendPacketMax, 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::send_can_message() function to transmit messages. | |
StateMachineState | get_state () const |
Get the state of the session. | |
std::uint16_t | get_message_length () const |
Get the total number of bytes that will be sent or received in this session. | |
bool | is_broadcast () const |
Get whether or not this session is a broadcast session (BAM) | |
std::uint32_t | get_total_bytes_transferred () const override |
Get the number of bytes that have been sent or received in this session. | |
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 | |
void | set_state (StateMachineState value) |
Set the state of the session. | |
std::uint8_t | get_cts_number_of_packets_remaining () const |
Get the number of packets to be sent in response to the current CTS. | |
void | set_cts_number_of_packets (std::uint8_t value) |
Set the number of packets to be sent in response to the curent CTS. | |
std::uint8_t | get_cts_number_of_packets () const |
Get the number of packets that can be sent in response to the current CTS. | |
std::uint8_t | get_rts_number_of_packet_limit () const |
Get the maximum number of packets that can be sent per CTS as indicated by the RTS message. | |
std::uint8_t | get_last_sequence_number () const |
Get the last sequence number that was processed. | |
std::uint8_t | get_last_packet_number () const |
Get the last packet number that was processed. | |
void | set_last_sequency_number (std::uint8_t value) |
Set the last sequence number that will be processed. | |
void | set_acknowledged_packet_number (std::uint8_t value) |
Set the last acknowledged packet number by the receiver. | |
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. | |
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 | |
StateMachineState | state = StateMachineState::None |
The state machine state for this session. | |
std::uint8_t | lastSequenceNumber = 0 |
The last processed sequence number for this set of packets. | |
std::uint8_t | lastAcknowledgedPacketNumber = 0 |
The last acknowledged packet number by the receiver. | |
std::uint8_t | clearToSendPacketCount = 0 |
The number of packets to be sent in response to one CTS. | |
std::uint8_t | clearToSendPacketCountMax = 0xFF |
The max packets that can be sent per CTS as indicated by the RTS message. | |
Friends | |
class | TransportProtocolManager |
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... | |
A storage object to keep track of session information internally.
Definition at line 64 of file can_transport_protocol.hpp.
isobus::TransportProtocolManager::TransportProtocolSession::TransportProtocolSession | ( | TransportProtocolSessionBase::Direction | direction, |
std::unique_ptr< CANMessageData > | data, | ||
std::uint32_t | parameterGroupNumber, | ||
std::uint16_t | totalMessageSize, | ||
std::uint8_t | clearToSendPacketMax, | ||
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::send_can_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] | clearToSendPacketMax | The maximum number of packets that can be sent per CTS as indicated by the RTS message |
[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 can_transport_protocol.cpp.
|
protected |
Get the number of packets that can be sent in response to the current CTS.
Definition at line 76 of file can_transport_protocol.cpp.
|
protected |
Get the number of packets to be sent in response to the current CTS.
Definition at line 64 of file can_transport_protocol.cpp.
|
protected |
Get the last packet number that was processed.
Definition at line 91 of file can_transport_protocol.cpp.
|
protected |
Get the last sequence number that was processed.
Definition at line 86 of file can_transport_protocol.cpp.
std::uint16_t isobus::TransportProtocolManager::TransportProtocolSession::get_message_length | ( | ) | const |
Get the total number of bytes that will be sent or received in this session.
Definition at line 37 of file can_transport_protocol.cpp.
|
protected |
Get the number of packets that remain to be sent or received in this session.
Definition at line 108 of file can_transport_protocol.cpp.
|
protected |
Get the maximum number of packets that can be sent per CTS as indicated by the RTS message.
Definition at line 81 of file can_transport_protocol.cpp.
TransportProtocolManager::StateMachineState isobus::TransportProtocolManager::TransportProtocolSession::get_state | ( | ) | const |
Get the state of the session.
Definition at line 32 of file can_transport_protocol.cpp.
|
overridevirtual |
Get the number of bytes that have been sent or received in this session.
Implements isobus::TransportProtocolSessionBase.
Definition at line 48 of file can_transport_protocol.cpp.
|
protected |
Get the total number of packets that will be sent or received in this session.
Definition at line 113 of file can_transport_protocol.cpp.
bool isobus::TransportProtocolManager::TransportProtocolSession::is_broadcast | ( | ) | const |
Get whether or not this session is a broadcast session (BAM)
Definition at line 43 of file can_transport_protocol.cpp.
|
protected |
Set the last acknowledged packet number by the receiver.
[in] | value | The last acknowledged packet number by the receiver |
Definition at line 102 of file can_transport_protocol.cpp.
|
protected |
Set the number of packets to be sent in response to the curent CTS.
[in] | value | The number of packets to be sent in response to the curent CTS |
Definition at line 70 of file can_transport_protocol.cpp.
|
protected |
Set the last sequence number that will be processed.
[in] | value | The last sequence number that will be processed |
Definition at line 96 of file can_transport_protocol.cpp.
|
protected |
Set the state of the session.
[in] | value | The state to set the session to |
Definition at line 58 of file can_transport_protocol.cpp.
|
friend |
Allows the TP manager full access.
Definition at line 105 of file can_transport_protocol.hpp.
|
private |
The number of packets to be sent in response to one CTS.
Definition at line 156 of file can_transport_protocol.hpp.
|
private |
The max packets that can be sent per CTS as indicated by the RTS message.
Definition at line 157 of file can_transport_protocol.hpp.
|
private |
The last acknowledged packet number by the receiver.
Definition at line 155 of file can_transport_protocol.hpp.
|
private |
The last processed sequence number for this set of packets.
Definition at line 154 of file can_transport_protocol.hpp.
|
private |
The state machine state for this session.
Definition at line 152 of file can_transport_protocol.hpp.