AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
isobus::FastPacketProtocol::FastPacketProtocolSession Class Reference

An object for tracking fast packet session state. More...

#include <nmea2000_fast_packet_protocol.hpp>

Inheritance diagram for isobus::FastPacketProtocol::FastPacketProtocolSession:
[legend]
Collaboration diagram for isobus::FastPacketProtocol::FastPacketProtocolSession:
[legend]

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.
 
TransportProtocolSessionBaseoperator= (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.
 
CANMessageDataget_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< ControlFunctionget_source () const
 Get the control function that is sending the message.
 
std::shared_ptr< ControlFunctionget_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...
 

Detailed Description

An object for tracking fast packet session state.

Definition at line 41 of file nmea2000_fast_packet_protocol.hpp.

Constructor & Destructor Documentation

◆ FastPacketProtocolSession()

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.

Parameters
[in]directionThe direction of the session
[in]dataData buffer (will be moved into the session)
[in]parameterGroupNumberThe PGN of the message
[in]totalMessageSizeThe total size of the message in bytes
[in]sequenceNumberThe sequence number for this PGN
[in]priorityThe priority to encode in the IDs of the component CAN messages
[in]sourceThe source control function
[in]destinationThe destination control function
[in]sessionCompleteCallbackA callback for when the session completes
[in]parentPointerA generic context object for the tx complete and chunk callbacks

Definition at line 26 of file nmea2000_fast_packet_protocol.cpp.

Member Function Documentation

◆ add_number_of_bytes_transferred()

void isobus::FastPacketProtocol::FastPacketProtocolSession::add_number_of_bytes_transferred ( std::uint8_t bytes)
protected

Add number of bytes to the total number of bytes that have been sent or received in this session.

Parameters
[in]bytesThe number of bytes to add to the total

Definition at line 82 of file nmea2000_fast_packet_protocol.cpp.

◆ get_last_packet_number()

std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::get_last_packet_number ( ) const
protected

Get the last packet number that was sent or received in this session.

Returns
The last packet number that was sent or received in this session

Definition at line 58 of file nmea2000_fast_packet_protocol.cpp.

Here is the call graph for this function:

◆ get_message_length()

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.

Note
The maximum number of bytes that can be sent in a single session is 6 + 31 * 7 = 223
Returns
The length of the message in number of bytes

Definition at line 42 of file nmea2000_fast_packet_protocol.cpp.

Here is the call graph for this function:

◆ get_number_of_remaining_packets()

std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::get_number_of_remaining_packets ( ) const
protected

Get the number of packets that remain to be sent or received in this session.

Returns
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.

◆ get_total_bytes_transferred()

std::uint32_t isobus::FastPacketProtocol::FastPacketProtocolSession::get_total_bytes_transferred ( ) const
overridevirtual

Get the number of bytes that have been sent or received in this session.

Returns
The number of bytes that have been sent or received

Implements isobus::TransportProtocolSessionBase.

Definition at line 53 of file nmea2000_fast_packet_protocol.cpp.

◆ get_total_number_of_packets()

std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::get_total_number_of_packets ( ) const
protected

Get the total number of packets that will be sent or received in this session.

Returns
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.

Here is the call graph for this function:

◆ is_broadcast()

bool isobus::FastPacketProtocol::FastPacketProtocolSession::is_broadcast ( ) const

Get whether or not this session is a broadcast session (BAM)

Returns
True if this session is a broadcast session, false if not

Definition at line 48 of file nmea2000_fast_packet_protocol.cpp.

Friends And Related Symbol Documentation

◆ FastPacketProtocol

friend class FastPacketProtocol
friend

Allows the TP manager full access.

Definition at line 81 of file nmea2000_fast_packet_protocol.hpp.

Member Data Documentation

◆ numberOfBytesTransferred

std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::numberOfBytesTransferred = 0
private

The total number of bytes that have been processed in this session.

Definition at line 100 of file nmea2000_fast_packet_protocol.hpp.

◆ priority

CANIdentifier::CANPriority isobus::FastPacketProtocol::FastPacketProtocolSession::priority
private

The priority to encode in the IDs of the component CAN messages.

Definition at line 102 of file nmea2000_fast_packet_protocol.hpp.

◆ sequenceNumber

std::uint8_t isobus::FastPacketProtocol::FastPacketProtocolSession::sequenceNumber
private

The sequence number for this PGN.

Definition at line 101 of file nmea2000_fast_packet_protocol.hpp.


The documentation for this class was generated from the following files: