11#ifndef CAN_PARAMETER_GROUP_NUMBER_REQUEST_PROTOCOL_HPP
12#define CAN_PARAMETER_GROUP_NUMBER_REQUEST_PROTOCOL_HPP
51 static bool request_parameter_group_number(std::uint32_t pgn, std::shared_ptr<InternalControlFunction> source, std::shared_ptr<ControlFunction> destination);
60 static bool request_repetition_rate(std::uint32_t pgn, std::uint16_t repetitionRate_ms, std::shared_ptr<InternalControlFunction> source, std::shared_ptr<ControlFunction> destination);
A way to only allow certain object types to access certain functions that is enforced at compile time...
Defines a base class to represent a generic ISOBUS control function.
The main class that manages the ISOBUS stack including: callbacks, Name to Address management,...
This is a way to protect functions on public interfaces from being accessed by objects that shouldn't...
A class that represents a generic CAN message of arbitrary length.
A storage class for holding PGN callbacks and their associated PGN.
PGNRequestCallbackInfo(PGNRequestCallback callback, std::uint32_t parameterGroupNumber, void *parentPointer)
Constructor for PGNRequestCallbackInfo.
std::uint32_t pgn
The PGN associated with the callback.
PGNRequestCallback callbackFunction
The actual callback.
bool operator==(const PGNRequestCallbackInfo &obj) const
A utility function for determining if the data in the object is equal to another object.
void * parent
Pointer to the class that registered the callback, or nullptr
A storage class for holding PGN callbacks and their associated PGN.
std::uint32_t pgn
The PGN associated with the callback.
PGNRequestForRepetitionRateCallback callbackFunction
The actual callback.
bool operator==(const PGNRequestForRepetitionRateCallbackInfo &obj) const
A utility function for determining if the data in the object is equal to another object.
void * parent
Pointer to the class that registered the callback, or nullptr
PGNRequestForRepetitionRateCallbackInfo(PGNRequestForRepetitionRateCallback callback, std::uint32_t parameterGroupNumber, void *parentPointer)
Constructor for PGNRequestCallbackInfo.
A protocol that handles PGN requests.
ParameterGroupNumberRequestProtocol & operator=(const ParameterGroupNumberRequestProtocol &)=delete
Remove the copy assignment operator.
std::shared_ptr< InternalControlFunction > myControlFunction
The internal control function that this protocol will send from.
Mutex pgnRequestMutex
A mutex to protect the callback lists.
std::vector< PGNRequestCallbackInfo > pgnRequestCallbacks
A list of all registered PGN callbacks and the PGN associated with each callback.
bool remove_pgn_request_callback(std::uint32_t pgn, PGNRequestCallback callback, void *parentPointer)
Removes a previously registered PGN request callback.
void process_message(const CANMessage &message)
A generic way for a protocol to process a received message.
ParameterGroupNumberRequestProtocol(const ParameterGroupNumberRequestProtocol &)=delete
Remove the copy constructor.
static constexpr std::uint8_t PGN_REQUEST_LENGTH
The CAN data length of a PGN request.
bool register_pgn_request_callback(std::uint32_t pgn, PGNRequestCallback callback, void *parentPointer)
Registers for a callback on receipt of a PGN request.
bool remove_request_for_repetition_rate_callback(std::uint32_t pgn, PGNRequestForRepetitionRateCallback callback, void *parentPointer)
Removes a callback for repetition rate requests.
bool register_request_for_repetition_rate_callback(std::uint32_t pgn, PGNRequestForRepetitionRateCallback callback, void *parentPointer)
Registers for a callback on receipt of a request for repetition rate.
ParameterGroupNumberRequestProtocol(std::shared_ptr< InternalControlFunction > internalControlFunction, CANLibBadge< InternalControlFunction >)
The constructor for this protocol.
std::vector< PGNRequestForRepetitionRateCallbackInfo > repetitionRateCallbacks
A list of all registered request for repetition rate callbacks and the PGN associated with the callba...
~ParameterGroupNumberRequestProtocol()
The destructor for this protocol.
std::size_t get_number_registered_pgn_request_callbacks() const
Returns the number of PGN request callbacks that have been registered with this protocol instance.
static bool request_repetition_rate(std::uint32_t pgn, std::uint16_t repetitionRate_ms, std::shared_ptr< InternalControlFunction > source, std::shared_ptr< ControlFunction > destination)
Sends a PGN request for repetition rate.
std::size_t get_number_registered_request_for_repetition_rate_callbacks() const
Returns the number of PGN request for repetition rate callbacks that have been registered with this p...
static bool request_parameter_group_number(std::uint32_t pgn, std::shared_ptr< InternalControlFunction > source, std::shared_ptr< ControlFunction > destination)
Sends a PGN request to the specified control function.
bool send_acknowledgement(AcknowledgementType type, std::uint32_t parameterGroupNumber, std::shared_ptr< ControlFunction > destination) const
Sends a message using the acknowledgement PGN.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
bool(*)(std::uint32_t parameterGroupNumber, std::shared_ptr< ControlFunction > requestingControlFunction, std::shared_ptr< ControlFunction > targetControlFunction, std::uint32_t repetitionRate, void *parentPointer) PGNRequestForRepetitionRateCallback
A callback for handling a request for repetition rate for a specific PGN.
bool(*)(std::uint32_t parameterGroupNumber, std::shared_ptr< ControlFunction > requestingControlFunction, bool &acknowledge, AcknowledgementType &acknowledgeType, void *parentPointer) PGNRequestCallback
A callback for handling a PGN request.
AcknowledgementType
The types of acknowledgement that can be sent in the Ack PGN.