10#ifndef ISOBUS_LANGUAGE_COMMAND_INTERFACE_HPP
11#define ISOBUS_LANGUAGE_COMMAND_INTERFACE_HPP
21 class InternalControlFunction;
22 class PartneredControlFunction;
23 class ControlFunction;
144 LanguageCommandInterface(std::shared_ptr<InternalControlFunction> sourceControlFunction,
bool shouldRespondToRequests =
false);
151 LanguageCommandInterface(std::shared_ptr<InternalControlFunction> sourceControlFunction, std::shared_ptr<PartneredControlFunction> filteredControlFunction);
167 void set_partner(std::shared_ptr<PartneredControlFunction> filteredControlFunction);
171 std::shared_ptr<PartneredControlFunction>
get_partner()
const;
329 std::shared_ptr<ControlFunction> requestingControlFunction,
332 void *parentPointer);
An object to represent common callbacks used within this CAN stack.
An abstraction of a CAN message, could be > 8 data bytes.
A class that represents a generic CAN message of arbitrary length.
An interface for requesting and parsing the ISO11783 language command PGN, 0xFE0F.
static bool on_language_request(std::uint32_t parameterGroupNumber, std::shared_ptr< ControlFunction > requestingControlFunction, bool &acknowledge, AcknowledgementType &acknowledgeType, void *parentPointer)
This is a callback to handle clients requesting the content of our language data for things like VT/T...
~LanguageCommandInterface()
Destructor for the LanguageCommandInterface.
ForceUnits forceUnitSystem
The force units that were commanded by the last language command message.
DecimalSymbols get_commanded_decimal_symbol() const
Returns the commanded decimal symbol parsed from the last language command.
PressureUnits get_commanded_pressure_units() const
Returns the commanded pressure units parsed from the last received language command.
ForceUnits get_commanded_force_units() const
Returns the commanded force units parsed from the last received language command.
UnitSystem genericUnitSystem
The "unit system" that was commanded by the last language command message.
void set_commanded_generic_units(UnitSystem units)
Sets the commanded generic unit system.
MassUnits
Command specifying a mass unit. (SPN 2417)
@ Metric
Tonnes, Kilograms.
void set_commanded_date_format(DateFormats format)
Sets the commanded date format.
std::string get_language_code() const
Returns the commanded language code parsed from the last language command.
bool respondToRequests
Stores if the class should respond to PGN requests for the language command.
TemperatureUnits get_commanded_temperature_units() const
Returns the commanded temperature units parsed from the last received language command.
void set_commanded_force_units(ForceUnits units)
Sets the commanded force units.
bool initialized
Tracks if initialize has been called yet for this interface.
std::shared_ptr< InternalControlFunction > myControlFunction
The control function to send messages as.
bool send_request_language_command() const
Sends a PGN request for the language command PGN to the interface's partner, or the global address de...
VolumeUnits
Command specifying a volume unit. (SPN 2416)
@ Imperial
Imperial Gallon.
void set_country_code(std::string country)
Sets the country code specifying the operator's desired language dialect.
DistanceUnits get_commanded_distance_units() const
Returns the commanded distance units parsed from the last language command.
void set_commanded_decimal_symbol(DecimalSymbols decimals)
Sets the decimal symbol to be used.
TemperatureUnits temperatureUnitSystem
The temperature units that were commanded by the last language command message.
LanguageCommandInterface(std::shared_ptr< InternalControlFunction > sourceControlFunction, bool shouldRespondToRequests=false)
Constructor for a LanguageCommandInterface.
TimeFormats
Command sent to all CFs specifying the displayed format of the time. (SPN 2413)
@ TwelveHourAmPm
12 h (am/pm)
AreaUnits
Command specifying an area unit. (SPN 2415)
std::string get_country_code() const
Returns the commanded country code parsed from the last language command specifying the operator's de...
MassUnits get_commanded_mass_units() const
Returns the commanded mass units parsed from the last received language command.
ForceUnits
Command specifying a force unit (SPN 5196)
MassUnits massUnitSystem
The mass units that were commanded by the last language command message.
DateFormats dateFormat
The date format that was commanded by the last language command message.
std::shared_ptr< PartneredControlFunction > get_partner() const
Returns the current partner being used by the interface.
DateFormats
Command sent to all CFs specifying the displayed format of the date. (SPN 2412)
@ ReservedStart
Reserved range begins here.
@ ReservedEnd
Reserved range ends here.
void set_commanded_mass_units(MassUnits units)
Sets the commanded mass units.
void set_partner(std::shared_ptr< PartneredControlFunction > filteredControlFunction)
Changes the partner being used by the interface to a new partner.
void set_commanded_pressure_units(PressureUnits units)
Sets the commanded pressure units.
LanguageCommandInterface(LanguageCommandInterface &)=delete
Deleted copy constructor for LanguageCommandInterface.
bool get_initialized() const
Returns if initialize has been called yet.
UnitSystem get_commanded_generic_units() const
Returns the commanded "unit system" generic value that was parsed from the last received language com...
std::uint32_t get_language_command_timestamp() const
Returns a timestamp (in ms) corresponding to when the interface last received a language command.
AreaUnits get_commanded_area_units() const
Returns the commanded area units parsed from the last received language command.
const std::array< std::uint8_t, 7 > get_localization_raw_data() const
Returns The raw bytes that comprise the current localization data as defined in ISO11783-7.
void initialize()
Initializes the interface.
bool send_language_command()
Sends a language command based on the current content of this class as a broadcast.
UnitSystem
May be used for the display of any unit, or a unit other than those explicitly specified (SPN 5197)
DistanceUnits distanceUnitSystem
The distance units that were commanded by the last language command message.
void set_language_code(std::string language)
Sets the language.
AreaUnits areaUnitSystem
The area units that were commanded by the last language command message.
void set_commanded_volume_units(VolumeUnits units)
Sets the commanded volume units.
DistanceUnits
Command specifying a distance unit. (SPN 2414)
@ Metric
Kilometers, meters.
DecimalSymbols decimalSymbol
The decimal symbol that was commanded by the last language command message.
VolumeUnits volumeUnitSystem
The volume units that were commanded by the last language command message.
PressureUnits
Command specifying a pressure unit (SPN 5195)
@ Metric
Kilopascals, pascals.
TimeFormats timeFormat
The time format that was commanded by the last language command message.
TemperatureUnits
Command specifying a temperature unit. (SPN 5194)
@ Metric
Degrees Celsius, Degrees Kelvin.
void set_commanded_temperature_units(TemperatureUnits units)
Sets the commanded temperature units.
static void process_rx_message(const CANMessage &message, void *parentPointer)
Parses incoming CAN messages into usable unit and language settings.
void set_commanded_area_units(AreaUnits units)
Sets the commanded area units.
std::shared_ptr< PartneredControlFunction > myPartner
The partner to talk to, or nullptr to listen to all CFs.
TimeFormats get_commanded_time_format() const
Returns the commanded time format parsed from the last language command.
DecimalSymbols
Command sent to all CFs that determines whether a point or a comma will be displayed as the decimal s...
@ NoAction
Take No Action.
@ Point
A decimal point '.' is used.
@ Comma
A comma ',' is used.
std::string languageCode
The last received language code, such as "en", "es", "de", etc.
DateFormats get_commanded_date_format() const
Returns the commanded date format parsed from the last language command.
std::uint32_t languageCommandTimestamp_ms
A millisecond timestamp correlated to the last received language command message.
std::string countryCode
The last received alpha-2 country code as specified by ISO 3166-1, such as "NL, FR,...
void set_commanded_distance_units(DistanceUnits units)
Sets the commanded distance units.
VolumeUnits get_commanded_volume_units() const
Returns the commanded volume units parsed from the last received language command.
void set_commanded_time_format(TimeFormats format)
Sets the commanded time format.
PressureUnits pressureUnitSystem
The pressure units that were commanded by the last language command message.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
AcknowledgementType
The types of acknowledgement that can be sent in the Ack PGN.