AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
isobus::TaskControllerServer Class Referenceabstract

An ISO11783-10 task controller (or data logger) server. A task controller collects task data from connected implements, and optionally controls them. This interface supports the CAN layer of TC-SC, TC-GEO, and TC-BAS. More...

#include <isobus_task_controller_server.hpp>

Collaboration diagram for isobus::TaskControllerServer:
[legend]

Classes

class  ActiveClient
 Stores information about a client that is currently being communicated with. More...
 

Public Types

enum class  ObjectPoolActivationError : std::uint8_t {
  NoErrors = 0x00 , ThereAreErrorsInTheDDOP = 0x01 , TaskControllerRanOutOfMemoryDuringActivation = 0x02 , AnyOtherError = 0x04 ,
  DifferentDDOPExistsWithSameStructureLabel = 0x08
}
 Enumerates the different error codes that can be returned when activating a device descriptor object pool. More...
 
enum class  ObjectPoolDeletionErrors : std::uint8_t { ObjectPoolIsReferencedByTaskData = 0 , ServerCannotCheckForObjectPoolReferences = 1 , ErrorDetailsNotAvailable = 0xFF }
 Enumerates the different error codes that can be returned when deleting a device descriptor object pool. More...
 
enum class  ObjectPoolErrorCodes : std::uint8_t {
  NoErrors = 0x00 , MethodOrAttributeNotSupported = 0x01 , UnknownObjectReference = 0x02 , AnyOtherError = 0x04 ,
  DDOPWasDeletedFromVolatileMemory = 0x08
}
 Enumerates the different error codes that can be returned when processing a DDOP. More...
 
enum class  ProcessDataCommands : std::uint8_t {
  TechnicalCapabilities = 0x00 , DeviceDescriptor = 0x01 , RequestValue = 0x02 , Value = 0x03 ,
  MeasurementTimeInterval = 0x04 , MeasurementDistanceInterval = 0x05 , MeasurementMinimumWithinThreshold = 0x06 , MeasurementMaximumWithinThreshold = 0x07 ,
  MeasurementChangeThreshold = 0x08 , PeerControlAssignment = 0x09 , SetValueAndAcknowledge = 0x0A , Reserved = 0x0B ,
  Reserved2 = 0x0C , Acknowledge = 0x0D , Status = 0x0E , ClientTask = 0x0F
}
 Enumerates the different process data commands that can be sent to the client. More...
 
enum class  ServerOptions : std::uint8_t {
  SupportsDocumentation = 0x01 , SupportsTCGEOWithoutPositionBasedControl = 0x02 , SupportsTCGEOWithPositionBasedControl = 0x04 , SupportsPeerControlAssignment = 0x08 ,
  SupportsImplementSectionControl = 0x10 , ReservedOption1 = 0x20 , ReservedOption2 = 0x40 , ReservedOption3 = 0x80
}
 Enumerates the different options that can be reported by the server. Each option is a bit in a bitfield, with 1 meaning the option is supported and 0 meaning it is not. For example, if the server supports documentation and peer control assignment, but not the other options, the bitfield would be 0b00001001. More...
 
enum class  ProcessDataAcknowledgeErrorCodes : std::uint8_t {
  ProcessDataCommandNotSupported = 0x01 , InvalidElementNumber = 0x02 , DDINotSupportedByElement = 0x04 , TriggerMethodNotSupported = 0x08 ,
  ProcessDataNotSettable = 0x10 , InvalidOrUnsupportedIntervalOrThreshold = 0x20 , ProcessDataValueDoesNotConformToDDIDefinition = 0x40 , ProcessDataValueIsOutOfOperationalRangeOfThisDevice = 0x80
}
 Enumerates all PDACK error codes that can be sent to or from the client. More...
 
enum class  TaskControllerVersion : std::uint8_t {
  DraftInternationalStandard = 0 , FinalDraftInternationalStandardFirstEdition = 1 , FirstPublishedEdition = 2 , SecondEditionDraft = 3 ,
  SecondPublishedEdition = 4 , Unknown = 0xFF
}
 Enumerates the different versions of the task controller standard. More...
 

Public Member Functions

 TaskControllerServer (std::shared_ptr< InternalControlFunction > internalControlFunction, std::uint8_t numberBoomsSupported, std::uint8_t numberSectionsSupported, std::uint8_t numberChannelsSupportedForPositionBasedControl, const TaskControllerOptions &options, TaskControllerVersion versionToReport=TaskControllerVersion::SecondPublishedEdition)
 Constructor for a TC server.
 
virtual ~TaskControllerServer ()
 Destructor for a TC server.
 
 TaskControllerServer (TaskControllerServer &)=delete
 Deleted copy constructor.
 
TaskControllerServeroperator= (const TaskControllerServer &)=delete
 Deleted assignment operator.
 
virtual bool activate_object_pool (std::shared_ptr< ControlFunction > clientControlFunction, ObjectPoolActivationError &activationError, ObjectPoolErrorCodes &objectPoolError, std::uint16_t &parentObjectIDOfFaultyObject, std::uint16_t &faultyObjectID)=0
 This function will be called by the server when the client wants to activate its DDOP. You should implement this function to activate the DDOP and return whether or not it was successful. Generally this means that you will want to parse the pool, and make sure its schema is valid at this time. You can use our DeviceDescriptorObjectPool class to help you with this.
 
virtual bool change_designator (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t objectIDToAlter, const std::vector< std::uint8_t > &designator)=0
 This function will be called by the server when the client wants to change the designator of an object. This could be called because the client wants to change the name of an implement, or the name of a section, or change the active language being used in the DDOP's designators. You should implement this function to change the designator of the object and return whether or not it was successful.
 
virtual bool deactivate_object_pool (std::shared_ptr< ControlFunction > clientControlFunction)=0
 This function will be called by the server when the client wants to deactivate its DDOP. You should implement this function to deactivate the DDOP and return whether or not it was successful.
 
virtual bool delete_device_descriptor_object_pool (std::shared_ptr< ControlFunction > clientControlFunction, ObjectPoolDeletionErrors &returnedErrorCode)=0
 This function will be called by the server when the client wants to delete its DDOP. Each client is allowed to have one DDOP, so deletion is not required, but a client might be kind and delete its DDOP when it is no longer needed. You should implement this function to delete the DDOP and return whether or not it was successful.
 
virtual bool get_is_stored_device_descriptor_object_pool_by_structure_label (std::shared_ptr< ControlFunction > clientControlFunction, const std::vector< std::uint8_t > &structureLabel, const std::vector< std::uint8_t > &extendedStructureLabel)=0
 This function will be called by the server when the server needs to know if it has previously saved to non volatile memory (NVM) a DDOP which is identified by the provided structure label, and optionally also the provided extended structure label. You should implement this function to return whether or not the DDOP is stored in NVM.
 
virtual bool get_is_stored_device_descriptor_object_pool_by_localization_label (std::shared_ptr< ControlFunction > clientControlFunction, const std::array< std::uint8_t, 7 > &localizationLabel)=0
 This function will be called by the server when the server needs to know if it has previously saved to non volatile memory (NVM) a DDOP which is identified by the provided localization label. You should implement this function to return whether or not the DDOP is stored in NVM.
 
virtual bool get_is_enough_memory_available (std::uint32_t numberBytesRequired)=0
 This function will be called by the server when the client wants to transfer its DDOP to the server and needs to know if the server has enough memory available to store the DDOP. You should implement this function to return whether or not the server has enough memory available to store the DDOP.
 
virtual void identify_task_controller (std::uint8_t taskControllerNumber)=0
 This function will be called if someone requests that the TC identify itself. If this gets called, you should display the TC number for 3 seconds if your TC has a visual interface.
 
virtual void on_client_timeout (std::shared_ptr< ControlFunction > clientControlFunction)=0
 This function will be called by the server when a connected client times out. You should implement this function to do whatever you want to do when a client times out. Generally this means you will want to also deactivate the DDOP for that client.
 
virtual void on_process_data_acknowledge (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint8_t errorCodesFromClient, ProcessDataCommands processDataCommand)=0
 This function will be called by the server when a client sends an acknowledgement for a process data command that was sent to it. This can be useful to know if the client received the command or not when using the set_value_and_acknowledge command.
 
virtual bool on_value_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::int32_t processDataValue, std::uint8_t &errorCodes)=0
 This function will be called by the server when a client sends a value command to the TC. You should implement this function to do whatever you want to do when a client sends a value command. This could be anything from setting a value in your program, to sending a command to a connected implement. The client could be telling you that a section's state changed, or that a boom's position changed, etc. Therefore this is probably the most important function to implement to get your TC "working". Use the ISOBUS data dictionary to determine what the dataDescriptionIndex and elementNumber mean.
 
virtual bool store_device_descriptor_object_pool (std::shared_ptr< ControlFunction > clientControlFunction, const std::vector< std::uint8_t > &objectPoolData, bool appendToPool)=0
 This function is called when the server wants you to save a DDOP to non volatile memory (NVM). You should implement this function to save the DDOP to NVM. If appendToPool is true, you should append the DDOP to the existing DDOP in NVM.
 
bool send_request_value (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber) const
 Sends a request to a client for an element's value of a particular DDI.
 
bool send_time_interval_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t timeInterval) const
 Sends a time interval measurement command. The process data value for this command is the time interval for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL cyclic with this time interval.
 
bool send_distance_interval_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t distanceInterval) const
 Sends a distance interval measurement command. The process data value for this command is the distance interval for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL cyclic with this distance interval.
 
bool send_minimum_threshold_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t minimum) const
 Sends a minimum threshold measurement command. The process data value for this command is the minimum threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value is higher than the threshold value.
 
bool send_maximum_threshold_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t maximum) const
 Sends a maximum threshold measurement command. The process data value for this command is the maximum threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value is lower than the threshold value.
 
bool send_change_threshold_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t threshold) const
 Sends a change threshold measurement command. The process data value for this command is the change threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value change is higher than or equal to the change threshold since last transmission.
 
bool send_set_value_and_acknowledge (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t processDataValue) const
 Sends a set value and acknowledge command. This command is used to set the value of a process data entity and request a reception acknowledgement from the recipient. The set value command process data value is the value of the data entity specified by the data dictionary identifier.
 
bool send_set_value (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t processDataValue) const
 Sends a set value command without requesting an acknowledgement. This command is used to set the value of a process data entity. The set value command process data value is the value of the data entity specified by the data dictionary identifier.
 
void set_task_totals_active (bool isTaskActive)
 Use this to set the reported task state in the status message. Basically, this should be set to true when the user starts a job, and false when the user stops a job.
 
bool get_task_totals_active () const
 Returns whether a task is currently active or not.
 
LanguageCommandInterfaceget_language_command_interface ()
 Returns the language command interface used to communicate with the client which language/units are in use. The language command is very important for the TC to function correctly, so it is recommended that you call this function and configure the language command interface before calling initialize().
 
std::condition_variable & get_condition_variable ()
 Returns a condition variable which you can optionally use to wake up your server's thread when messages are received from the client.
 
void initialize ()
 Initializes the task controller server.
 
bool get_initialized () const
 Returns whether or not the task controller server has been initialized.
 
void terminate ()
 Shuts down the TC server, unregisters PGN callbacks.
 
void update ()
 This must be called periodically for the interface to operate correctly.
 

Protected Types

enum class  ServerStatusBit : std::uint8_t {
  TaskTotalsActive = 0x01 , BusySavingDataToNVM = 0x02 , BusyReadingDataFromNVM = 0x04 , BusyExecutingACommand = 0x08 ,
  OutOfMemory = 0x80
}
 Enumerates the different status bits that can be sent in the status message. More...
 
enum class  TechnicalDataCommandParameters : std::uint8_t { RequestVersion = 0x00 , ParameterVersion = 0x01 , IdentifyTaskController = 0x02 }
 Enumerates the subcommands for determining the technical capabilities of a TC, DL, or client. More...
 
enum class  DeviceDescriptorCommandParameters : std::uint8_t {
  RequestStructureLabel = 0x00 , StructureLabel = 0x01 , RequestLocalizationLabel = 0x02 , LocalizationLabel = 0x03 ,
  RequestObjectPoolTransfer = 0x04 , RequestObjectPoolTransferResponse = 0x05 , ObjectPoolTransfer = 0x06 , ObjectPoolTransferResponse = 0x07 ,
  ObjectPoolActivateDeactivate = 0x08 , ObjectPoolActivateDeactivateResponse = 0x09 , DeleteObjectPool = 0x0A , DeleteObjectPoolResponse = 0x0B ,
  ChangeDesignator = 0x0C , ChangeDesignatorResponse = 0x0D
}
 Enumerates subcommands for the transfer and management of device descriptors. These device descriptor messages are defined in ISO11783-10 B.6. More...
 

Protected Member Functions

void process_rx_messages ()
 Processes messages received from task controller clients.
 
bool send_generic_process_data_default_payload (std::uint8_t multiplexer, std::shared_ptr< ControlFunction > destination) const
 This sends a process data message with all FFs in the payload except for the command byte. Useful for avoiding a lot of boilerplate code when sending process data messages.
 
bool send_measurement_command (std::shared_ptr< ControlFunction > clientControlFunction, std::uint8_t commandValue, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint32_t processDataValue) const
 Sends a measurement command to the client.
 
bool send_status_message () const
 Sends a status message broadcast.
 
bool send_version (std::shared_ptr< ControlFunction > clientControlFunction) const
 Sends the version message to a client.
 
std::shared_ptr< ActiveClientget_active_client (std::shared_ptr< ControlFunction > clientControlFunction) const
 Checks to see if we are communicating with a control function that is already in our list of active clients. If we are, it returns a pointer to our active client object for that control function.
 
bool nack_process_data_command (std::shared_ptr< ControlFunction > clientControlFunction) const
 Sends a negative acknowledge for a the process data PGN which indicates to clients that we aren't listening to them because they aren't following the protocol.
 
bool send_structure_label (std::shared_ptr< ControlFunction > clientControlFunction, std::vector< std::uint8_t > &structureLabel, const std::vector< std::uint8_t > &extendedStructureLabel) const
 Sends a response to a request structure label command.
 
bool send_localization_label (std::shared_ptr< ControlFunction > clientControlFunction, const std::array< std::uint8_t, 7 > &localizationLabel) const
 Sends a response to a request localization label command.
 
bool send_request_object_pool_transfer_response (std::shared_ptr< ControlFunction > clientControlFunction, bool isEnoughMemory) const
 Sends a response to a request object pool transfer command.
 
bool send_object_pool_transfer_response (std::shared_ptr< ControlFunction > clientControlFunction, std::uint8_t errorBitfield, std::uint32_t sizeBytes) const
 Sends a response to an object pool transfer.
 
bool send_object_pool_activate_deactivate_response (std::shared_ptr< ControlFunction > clientControlFunction, std::uint8_t activationErrorBitfield, std::uint8_t objectPoolErrorBitfield, std::uint16_t parentOfFaultingObject, std::uint16_t faultingObject) const
 Sends a response to an object pool activate/deactivate command.
 
bool send_delete_object_pool_response (std::shared_ptr< ControlFunction > clientControlFunction, bool deletionResult, std::uint8_t errorCode) const
 Sends a response to a delete object pool command.
 
bool send_change_designator_response (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t objectID, std::uint8_t errorCode) const
 Sends a response to a change designator command.
 
bool send_process_data_acknowledge (std::shared_ptr< ControlFunction > clientControlFunction, std::uint16_t dataDescriptionIndex, std::uint16_t elementNumber, std::uint8_t errorBitfield, ProcessDataCommands processDataCommand) const
 Sends a process data acknowledge message to the client.
 
bool send_process_data_to_client (std::shared_ptr< ControlFunction > clientControlFunction, const std::uint8_t *dataBuffer, std::uint32_t dataLength, CANIdentifier::CANPriority priority=CANIdentifier::CANPriority::Priority5) const
 Sends a process data message to a client with a slightly shorter signature than calling send_can_message.
 

Static Protected Member Functions

static void store_rx_message (const CANMessage &message, void *parentPointer)
 Stores messages received from task controller clients for processing later.
 

Protected Attributes

LanguageCommandInterface languageCommandInterface
 The language command interface used to communicate with the client which language/units are in use.
 
std::shared_ptr< InternalControlFunctionserverControlFunction
 The control function used to communicate with the clients.
 
std::deque< CANMessagerxMessageQueue
 A queue of messages received from the clients which will be processed when update is called.
 
std::deque< std::shared_ptr< ActiveClient > > activeClients
 A list of clients that are currently being communicated with.
 
std::condition_variable updateWakeupCondition
 A condition variable you can optionally use to update the interface when messages are received.
 
std::mutex messagesMutex
 A mutex used to protect the rxMessageQueue.
 
std::uint32_t lastStatusMessageTimestamp_ms = 0
 The timestamp of the last status message sent on the bus.
 
const TaskControllerVersion reportedVersion
 The version of the TC that will be reported to the clients.
 
const std::uint8_t numberBoomsSupportedToReport
 The number of booms that will be reported as supported by the TC.
 
const std::uint8_t numberSectionsSupportedToReport
 The number of sections that will be reported as supported by the TC.
 
const std::uint8_t numberChannelsSupportedForPositionBasedControlToReport
 The number of channels that will be reported as supported by the TC.
 
const std::uint8_t optionsBitfieldToReport
 The options bitfield that will be reported as supported by the TC.
 
std::uint8_t currentStatusByte = 0
 The current status byte to send in the status message.
 
std::uint8_t currentCommandByte = 0
 The current command byte to send in the status message.
 
std::uint8_t currentCommandSourceAddress = NULL_CAN_ADDRESS
 The current command source address to send in the status message.
 
bool initialized = false
 Whether or not the task controller server has been initialized.
 

Static Protected Attributes

static constexpr std::uint32_t STATUS_MESSAGE_RATE_MS = 2000
 The rate at which status messages are sent to the clients in milliseconds.
 

Detailed Description

An ISO11783-10 task controller (or data logger) server. A task controller collects task data from connected implements, and optionally controls them. This interface supports the CAN layer of TC-SC, TC-GEO, and TC-BAS.

Definition at line 26 of file isobus_task_controller_server.hpp.

Member Enumeration Documentation

◆ DeviceDescriptorCommandParameters

enum class isobus::TaskControllerServer::DeviceDescriptorCommandParameters : std::uint8_t
strongprotected

Enumerates subcommands for the transfer and management of device descriptors. These device descriptor messages are defined in ISO11783-10 B.6.

Enumerator
StructureLabel 

Allows the client to determine the availability of the requested device descriptor structure.

RequestLocalizationLabel 

The Structure Label message is sent by the TC or DL to inform the client about the availability of the requested version of the device descriptor structure.

LocalizationLabel 

Allows the client to determine the availability of the requested device descriptor localization.

RequestObjectPoolTransfer 

/// Sent by the TC or DL to inform the client about the availability of the requested localization version of the device descriptor

RequestObjectPoolTransferResponse 

/// The Request Object-pool Transfer message allows the client to determine whether it is allowed to transfer(part of) the device descriptor object pool to the TC

ObjectPoolTransfer 

Sent in response to Request Object-pool Transfer message.

ObjectPoolTransferResponse 

Enables the client to transfer (part of) the device descriptor object pool to the TC.

ObjectPoolActivateDeactivate 

Response to an object pool transfer message.

ObjectPoolActivateDeactivateResponse 

Sent by a client to complete its connection procedure to a TC or DL or to disconnect from a TC or DL.

DeleteObjectPool 

Sent by a client to complete its connection procedure to a TC or DL or to disconnect from a TC or DL.

DeleteObjectPoolResponse 

This is a message to delete the device descriptor object pool for the client that sends this message.

ChangeDesignator 

TC response to a Object-pool Delete message.

ChangeDesignatorResponse 

This message is used to update the designator of an object.

Definition at line 401 of file isobus_task_controller_server.hpp.

◆ ObjectPoolActivationError

Enumerates the different error codes that can be returned when activating a device descriptor object pool.

Definition at line 31 of file isobus_task_controller_server.hpp.

◆ ObjectPoolDeletionErrors

Enumerates the different error codes that can be returned when deleting a device descriptor object pool.

Definition at line 42 of file isobus_task_controller_server.hpp.

◆ ObjectPoolErrorCodes

enum class isobus::TaskControllerServer::ObjectPoolErrorCodes : std::uint8_t
strong

Enumerates the different error codes that can be returned when processing a DDOP.

Definition at line 50 of file isobus_task_controller_server.hpp.

◆ ProcessDataAcknowledgeErrorCodes

Enumerates all PDACK error codes that can be sent to or from the client.

Definition at line 97 of file isobus_task_controller_server.hpp.

◆ ProcessDataCommands

enum class isobus::TaskControllerServer::ProcessDataCommands : std::uint8_t
strong

Enumerates the different process data commands that can be sent to the client.

Enumerator
TechnicalCapabilities 

Used for determining the technical capabilities of a TC, DL, or client.

DeviceDescriptor 

Transfer and management of device descriptors.

RequestValue 

Used when the value of the data entity specified by the data dictionary identifier is requested.

Value 

This command is used both to answer a request value command and to set the value of a process data entity.

MeasurementTimeInterval 

The process data value is the time interval for sending the data element specified by the data dictionary identifier.

MeasurementDistanceInterval 

The process data value is the distance interval for sending the data element specified by the data dictionary identifier.

MeasurementMinimumWithinThreshold 

The client has to send the value of this data element to the TC or DL when the value is higher than the threshold value.

MeasurementMaximumWithinThreshold 

The client has to send the value of this data element to the TC or DL when the value is lower than the threshold value.

MeasurementChangeThreshold 

The client has to send the value of this data element to the TC or DL when the value change is higher than or equal to the change threshold since last transmission.

PeerControlAssignment 

This message is used to establish a connection between a setpoint value source and a setpoint value user.

SetValueAndAcknowledge 

This command is used to set the value of a process data entity and request a reception acknowledgement from the recipient.

Reserved 

Reserved.

Reserved2 

Reserved.

Acknowledge 

Message is a Process Data Acknowledge (PDACK).

Status 

Message is a Task Controller Status message.

ClientTask 

Sent by the client as a status message every 2s.

Definition at line 60 of file isobus_task_controller_server.hpp.

◆ ServerOptions

enum class isobus::TaskControllerServer::ServerOptions : std::uint8_t
strong

Enumerates the different options that can be reported by the server. Each option is a bit in a bitfield, with 1 meaning the option is supported and 0 meaning it is not. For example, if the server supports documentation and peer control assignment, but not the other options, the bitfield would be 0b00001001.

Definition at line 84 of file isobus_task_controller_server.hpp.

◆ ServerStatusBit

enum class isobus::TaskControllerServer::ServerStatusBit : std::uint8_t
strongprotected

Enumerates the different status bits that can be sent in the status message.

Definition at line 382 of file isobus_task_controller_server.hpp.

◆ TaskControllerVersion

enum class isobus::TaskControllerServer::TaskControllerVersion : std::uint8_t
strong

Enumerates the different versions of the task controller standard.

Enumerator
DraftInternationalStandard 

The version of the DIS (draft International Standard).

FinalDraftInternationalStandardFirstEdition 

The version of the FDIS.1 (final draft International Standard, first edition).

FirstPublishedEdition 

The version of the FDIS.2 and the first edition published ss an International Standard.

SecondEditionDraft 

The version of the second edition published as a draft International Standard(E2.DIS).

SecondPublishedEdition 

The version of the second edition published as the final draft International Standard(E2.FDIS) and as the International Standard(E2.IS)

Definition at line 110 of file isobus_task_controller_server.hpp.

◆ TechnicalDataCommandParameters

enum class isobus::TaskControllerServer::TechnicalDataCommandParameters : std::uint8_t
strongprotected

Enumerates the subcommands for determining the technical capabilities of a TC, DL, or client.

Enumerator
ParameterVersion 

The Request Version message allows the TC, DL, and the client to determine the ISO 11783-10 version of the implementation.

IdentifyTaskController 

The Version message is sent in response to the request version message and contains the ISO 11783-10 version information of the TC, DL, or client implementation.

Definition at line 392 of file isobus_task_controller_server.hpp.

Constructor & Destructor Documentation

◆ TaskControllerServer()

isobus::TaskControllerServer::TaskControllerServer ( std::shared_ptr< InternalControlFunction > internalControlFunction,
std::uint8_t numberBoomsSupported,
std::uint8_t numberSectionsSupported,
std::uint8_t numberChannelsSupportedForPositionBasedControl,
const TaskControllerOptions & options,
TaskControllerVersion versionToReport = TaskControllerVersion::SecondPublishedEdition )

Constructor for a TC server.

Parameters
[in]internalControlFunctionThe control function to use to communicate with the clients.
[in]numberBoomsSupportedThe number of booms to report as supported by the TC.
[in]numberSectionsSupportedThe number of sections to report as supported by the TC.
[in]numberChannelsSupportedForPositionBasedControlThe number of channels to report as supported by the TC.
[in]optionsThe options to report as supported by the TC. See the TaskControllerOptions object for more info.
[in]versionToReportThe version of the task controller standard to report as supported by the TC. Generally you should leave this as 4 (SecondPublishedEdition).

Definition at line 22 of file isobus_task_controller_server.cpp.

◆ ~TaskControllerServer()

isobus::TaskControllerServer::~TaskControllerServer ( )
virtual

Destructor for a TC server.

Definition at line 38 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ activate_object_pool()

virtual bool isobus::TaskControllerServer::activate_object_pool ( std::shared_ptr< ControlFunction > clientControlFunction,
ObjectPoolActivationError & activationError,
ObjectPoolErrorCodes & objectPoolError,
std::uint16_t & parentObjectIDOfFaultyObject,
std::uint16_t & faultyObjectID )
pure virtual

This function will be called by the server when the client wants to activate its DDOP. You should implement this function to activate the DDOP and return whether or not it was successful. Generally this means that you will want to parse the pool, and make sure its schema is valid at this time. You can use our DeviceDescriptorObjectPool class to help you with this.

Parameters
[in]clientControlFunctionThe control function which is requesting the activation.
[out]activationErrorThe error code to return if the activation fails.
[out]objectPoolErrorThis error code tells the client if there was an error in the DDOP.
[out]parentObjectIDOfFaultyObjectIf there was an error in the DDOP, this is the parent object ID of the object that caused the error. Otherwise you should return 0xFFFF
[out]faultyObjectIDIf there was an error in the DDOP, this is the object ID of the object that caused the error. Otherwise you should return 0xFFFF
Returns
Whether or not the activation was successful.
Here is the caller graph for this function:

◆ change_designator()

virtual bool isobus::TaskControllerServer::change_designator ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t objectIDToAlter,
const std::vector< std::uint8_t > & designator )
pure virtual

This function will be called by the server when the client wants to change the designator of an object. This could be called because the client wants to change the name of an implement, or the name of a section, or change the active language being used in the DDOP's designators. You should implement this function to change the designator of the object and return whether or not it was successful.

Parameters
[in]clientControlFunctionThe control function which is requesting the designator change.
[in]objectIDToAlterThe object ID of the object to change the designator of.
[in]designatorThe new designator to set for the object.
Returns
Whether or not the designator change was successful.
Here is the caller graph for this function:

◆ deactivate_object_pool()

virtual bool isobus::TaskControllerServer::deactivate_object_pool ( std::shared_ptr< ControlFunction > clientControlFunction)
pure virtual

This function will be called by the server when the client wants to deactivate its DDOP. You should implement this function to deactivate the DDOP and return whether or not it was successful.

Parameters
[in]clientControlFunctionThe control function which is requesting the deactivation.
Returns
Whether or not the deactivation was successful.
Here is the caller graph for this function:

◆ delete_device_descriptor_object_pool()

virtual bool isobus::TaskControllerServer::delete_device_descriptor_object_pool ( std::shared_ptr< ControlFunction > clientControlFunction,
ObjectPoolDeletionErrors & returnedErrorCode )
pure virtual

This function will be called by the server when the client wants to delete its DDOP. Each client is allowed to have one DDOP, so deletion is not required, but a client might be kind and delete its DDOP when it is no longer needed. You should implement this function to delete the DDOP and return whether or not it was successful.

Parameters
[in]clientControlFunctionThe control function which is requesting the deletion.
[out]returnedErrorCodeThe error code to return if the deletion fails.
Returns
Whether or not the deletion was successful.
Here is the caller graph for this function:

◆ get_active_client()

std::shared_ptr< TaskControllerServer::ActiveClient > isobus::TaskControllerServer::get_active_client ( std::shared_ptr< ControlFunction > clientControlFunction) const
protected

Checks to see if we are communicating with a control function that is already in our list of active clients. If we are, it returns a pointer to our active client object for that control function.

Parameters
[in]clientControlFunctionThe control function to check for.
Returns
A pointer to our active client object for that control function, or nullptr if we are not communicating with that control function.

Definition at line 805 of file isobus_task_controller_server.cpp.

Here is the caller graph for this function:

◆ get_condition_variable()

std::condition_variable & isobus::TaskControllerServer::get_condition_variable ( )

Returns a condition variable which you can optionally use to wake up your server's thread when messages are received from the client.

Returns
A condition variable which you can optionally use to wake up your server's thread

Definition at line 144 of file isobus_task_controller_server.cpp.

◆ get_initialized()

bool isobus::TaskControllerServer::get_initialized ( ) const

Returns whether or not the task controller server has been initialized.

Returns
Whether or not the task controller server has been initialized.

Definition at line 123 of file isobus_task_controller_server.cpp.

◆ get_is_enough_memory_available()

virtual bool isobus::TaskControllerServer::get_is_enough_memory_available ( std::uint32_t numberBytesRequired)
pure virtual

This function will be called by the server when the client wants to transfer its DDOP to the server and needs to know if the server has enough memory available to store the DDOP. You should implement this function to return whether or not the server has enough memory available to store the DDOP.

Parameters
[in]numberBytesRequiredThe number of bytes required to store the DDOP.
Returns
Whether or not the server has enough memory available to store the DDOP. A value of true indicates: "There may be enough memory available. However, because there is overhead associated with object storage,it is impossible to predict whether there is enough memory available." and false indicates: "There is not enough memory available. Do not transmit device descriptor object pool."
Here is the caller graph for this function:

◆ get_is_stored_device_descriptor_object_pool_by_localization_label()

virtual bool isobus::TaskControllerServer::get_is_stored_device_descriptor_object_pool_by_localization_label ( std::shared_ptr< ControlFunction > clientControlFunction,
const std::array< std::uint8_t, 7 > & localizationLabel )
pure virtual

This function will be called by the server when the server needs to know if it has previously saved to non volatile memory (NVM) a DDOP which is identified by the provided localization label. You should implement this function to return whether or not the DDOP is stored in NVM.

Parameters
[in]clientControlFunctionThe control function which is requesting the information.
[in]localizationLabelThe localization label of the DDOP to check for.
Returns
Whether or not the DDOP is stored in NVM.
Here is the caller graph for this function:

◆ get_is_stored_device_descriptor_object_pool_by_structure_label()

virtual bool isobus::TaskControllerServer::get_is_stored_device_descriptor_object_pool_by_structure_label ( std::shared_ptr< ControlFunction > clientControlFunction,
const std::vector< std::uint8_t > & structureLabel,
const std::vector< std::uint8_t > & extendedStructureLabel )
pure virtual

This function will be called by the server when the server needs to know if it has previously saved to non volatile memory (NVM) a DDOP which is identified by the provided structure label, and optionally also the provided extended structure label. You should implement this function to return whether or not the DDOP is stored in NVM.

Parameters
[in]clientControlFunctionThe control function which is requesting the information.
[in]structureLabelThe structure label of the DDOP to check for. (always 7 bytes)
[in]extendedStructureLabelThe extended structure label of the DDOP to check for. (up to 32 bytes)
Returns
Whether or not the DDOP is stored in NVM.
Here is the caller graph for this function:

◆ get_language_command_interface()

LanguageCommandInterface & isobus::TaskControllerServer::get_language_command_interface ( )

Returns the language command interface used to communicate with the client which language/units are in use. The language command is very important for the TC to function correctly, so it is recommended that you call this function and configure the language command interface before calling initialize().

Returns
The language command interface used to communicate with the client which language/units are in use.

Definition at line 138 of file isobus_task_controller_server.cpp.

◆ get_task_totals_active()

bool isobus::TaskControllerServer::get_task_totals_active ( ) const

Returns whether a task is currently active or not.

Returns
Whether a task is currently active or not.

Definition at line 106 of file isobus_task_controller_server.cpp.

Here is the caller graph for this function:

◆ identify_task_controller()

virtual void isobus::TaskControllerServer::identify_task_controller ( std::uint8_t taskControllerNumber)
pure virtual

This function will be called if someone requests that the TC identify itself. If this gets called, you should display the TC number for 3 seconds if your TC has a visual interface.

Parameters
[in]taskControllerNumberThe task controller number to display.
Here is the caller graph for this function:

◆ initialize()

void isobus::TaskControllerServer::initialize ( )

Initializes the task controller server.

Definition at line 111 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ nack_process_data_command()

bool isobus::TaskControllerServer::nack_process_data_command ( std::shared_ptr< ControlFunction > clientControlFunction) const
protected

Sends a negative acknowledge for a the process data PGN which indicates to clients that we aren't listening to them because they aren't following the protocol.

Parameters
[in]clientControlFunctionThe control function to send the message to
Returns
true if the message was sent, otherwise false

Definition at line 821 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_client_timeout()

virtual void isobus::TaskControllerServer::on_client_timeout ( std::shared_ptr< ControlFunction > clientControlFunction)
pure virtual

This function will be called by the server when a connected client times out. You should implement this function to do whatever you want to do when a client times out. Generally this means you will want to also deactivate the DDOP for that client.

Parameters
[in]clientControlFunctionThe control function which timed out.

◆ on_process_data_acknowledge()

virtual void isobus::TaskControllerServer::on_process_data_acknowledge ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint8_t errorCodesFromClient,
ProcessDataCommands processDataCommand )
pure virtual

This function will be called by the server when a client sends an acknowledgement for a process data command that was sent to it. This can be useful to know if the client received the command or not when using the set_value_and_acknowledge command.

Parameters
[in]clientControlFunctionThe control function which sent the acknowledgement.
[in]dataDescriptionIndexThe data description index of the data element that was acknowledged.
[in]elementNumberThe element number of the data element that was acknowledged.
[in]errorCodesFromClientThe error codes that the client sent in the acknowledgement. This will be a bitfield defined by the ProcessDataAcknowledgeErrorCodes enum.
[in]processDataCommandThe process data command that was acknowledged.
Here is the caller graph for this function:

◆ on_value_command()

virtual bool isobus::TaskControllerServer::on_value_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::int32_t processDataValue,
std::uint8_t & errorCodes )
pure virtual

This function will be called by the server when a client sends a value command to the TC. You should implement this function to do whatever you want to do when a client sends a value command. This could be anything from setting a value in your program, to sending a command to a connected implement. The client could be telling you that a section's state changed, or that a boom's position changed, etc. Therefore this is probably the most important function to implement to get your TC "working". Use the ISOBUS data dictionary to determine what the dataDescriptionIndex and elementNumber mean.

Parameters
[in]clientControlFunctionThe control function which sent the value command.
[in]dataDescriptionIndexThe data description index of the data element that was sent.
[in]elementNumberThe element number of the data element that was sent.
[in]processDataValueThe process data value that was sent.
[out]errorCodesYou should return any errors that occurred while processing the value command in this variable as defined by the ProcessDataAcknowledgeErrorCodes enum. This will be sent back to the client if an acknowledgement is requested.
Returns
Whether or not the value command was processed successfully.
Here is the caller graph for this function:

◆ process_rx_messages()

void isobus::TaskControllerServer::process_rx_messages ( )
protected

Processes messages received from task controller clients.

This is called by update() and processes messages that were received from clients. Because update is called by your application, this means that messages are processed on your application's thread, rather than on the CAN stack's thread, which avoids a bunch of mutexing in your app. You can get a condition variable from get_condition_variable() which you can use to wake up your application's thread to process messages if you want to avoid polling the interface at a high rate.

Definition at line 195 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_change_designator_response()

bool isobus::TaskControllerServer::send_change_designator_response ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t objectID,
std::uint8_t errorCode ) const
protected

Sends a response to a change designator command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]objectIDThe object ID that was changed
[in]errorCodeThe error code to send
Returns
true if the message was sent, otherwise false

Definition at line 999 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_change_threshold_measurement_command()

bool isobus::TaskControllerServer::send_change_threshold_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t threshold ) const

Sends a change threshold measurement command. The process data value for this command is the change threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value change is higher than or equal to the change threshold since last transmission.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]thresholdThe change threshold for sending the data element specified by the data dictionary identifier.
Returns
true if the message was sent, otherwise false

Definition at line 81 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_delete_object_pool_response()

bool isobus::TaskControllerServer::send_delete_object_pool_response ( std::shared_ptr< ControlFunction > clientControlFunction,
bool deletionResult,
std::uint8_t errorCode ) const
protected

Sends a response to a delete object pool command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]deletionResultWhether or not the object pool was deleted
[in]errorCodeThe error code to send
Returns
true if the message was sent, otherwise false

Definition at line 976 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_distance_interval_measurement_command()

bool isobus::TaskControllerServer::send_distance_interval_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t distanceInterval ) const

Sends a distance interval measurement command. The process data value for this command is the distance interval for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL cyclic with this distance interval.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]distanceIntervalThe distance interval for sending the data element specified by the data dictionary identifier.
Returns
true if the message was sent, otherwise false

Definition at line 66 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_generic_process_data_default_payload()

bool isobus::TaskControllerServer::send_generic_process_data_default_payload ( std::uint8_t multiplexer,
std::shared_ptr< ControlFunction > destination ) const
protected

This sends a process data message with all FFs in the payload except for the command byte. Useful for avoiding a lot of boilerplate code when sending process data messages.

Parameters
[in]multiplexerThe multiplexer value to send in the message.
[in]destinationThe control function to send the message to.
Returns
true if the message was sent, otherwise false

Definition at line 713 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_localization_label()

bool isobus::TaskControllerServer::send_localization_label ( std::shared_ptr< ControlFunction > clientControlFunction,
const std::array< std::uint8_t, 7 > & localizationLabel ) const
protected

Sends a response to a request localization label command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]localizationLabelThe localization label to send
Returns
true if the message was sent, otherwise false

Definition at line 877 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_maximum_threshold_measurement_command()

bool isobus::TaskControllerServer::send_maximum_threshold_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t maximum ) const

Sends a maximum threshold measurement command. The process data value for this command is the maximum threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value is lower than the threshold value.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]maximumThe maximum threshold for sending the data element specified by the data dictionary identifier.
Returns
true if the message was sent, otherwise false

Definition at line 76 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_measurement_command()

bool isobus::TaskControllerServer::send_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint8_t commandValue,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t processDataValue ) const
protected

Sends a measurement command to the client.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]commandValueThe command value to send
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]processDataValueThe process data value to send
Returns
true if the message was sent, otherwise false

Definition at line 744 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_minimum_threshold_measurement_command()

bool isobus::TaskControllerServer::send_minimum_threshold_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t minimum ) const

Sends a minimum threshold measurement command. The process data value for this command is the minimum threshold for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL when the value is higher than the threshold value.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]minimumThe minimum threshold for sending the data element specified by the data dictionary identifier.
Returns
true if the message was sent, otherwise false

Definition at line 71 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_object_pool_activate_deactivate_response()

bool isobus::TaskControllerServer::send_object_pool_activate_deactivate_response ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint8_t activationErrorBitfield,
std::uint8_t objectPoolErrorBitfield,
std::uint16_t parentOfFaultingObject,
std::uint16_t faultingObject ) const
protected

Sends a response to an object pool activate/deactivate command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]activationErrorBitfieldThe error bitfield to send for the activation
[in]objectPoolErrorBitfieldThe error bitfield to send for the object pool
[in]parentOfFaultingObjectThe parent of the object that caused the error (or 0xFFFF if there is no error or it's unknown)
[in]faultingObjectThe object that caused the error (or 0xFFFF if there is no error or it's unknown)
Returns
true if the message was sent, otherwise false

Definition at line 949 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_object_pool_transfer_response()

bool isobus::TaskControllerServer::send_object_pool_transfer_response ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint8_t errorBitfield,
std::uint32_t sizeBytes ) const
protected

Sends a response to an object pool transfer.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]errorBitfieldThe error bitfield to send
[in]sizeBytesThe size of the object pool in bytes
Returns
true if the message was sent, otherwise false

Definition at line 925 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_process_data_acknowledge()

bool isobus::TaskControllerServer::send_process_data_acknowledge ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint8_t errorBitfield,
ProcessDataCommands processDataCommand ) const
protected

Sends a process data acknowledge message to the client.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element that was acknowledged.
[in]elementNumberThe element number of the data element that was acknowledged.
[in]errorBitfieldThe error bitfield to send (see ProcessDataAcknowledgeErrorCodes enum)
[in]processDataCommandThe process data command that was acknowledged. (or 0x0F if N/A)
Returns
true if the message was sent, otherwise false

Definition at line 1022 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_process_data_to_client()

bool isobus::TaskControllerServer::send_process_data_to_client ( std::shared_ptr< ControlFunction > clientControlFunction,
const std::uint8_t * dataBuffer,
std::uint32_t dataLength,
CANIdentifier::CANPriority priority = CANIdentifier::CANPriority::Priority5 ) const
protected

Sends a process data message to a client with a slightly shorter signature than calling send_can_message.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataBufferThe data to send
[in]dataLengthThe data buffer length
[in]priorityThe priority of the message, normally 5
Returns
true if the message was sent, otherwise false

Definition at line 1046 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_request_object_pool_transfer_response()

bool isobus::TaskControllerServer::send_request_object_pool_transfer_response ( std::shared_ptr< ControlFunction > clientControlFunction,
bool isEnoughMemory ) const
protected

Sends a response to a request object pool transfer command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]isEnoughMemoryWhether or not there is enough memory available to transfer the object pool.
Returns
true if the message was sent, otherwise false

Definition at line 901 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_request_value()

bool isobus::TaskControllerServer::send_request_value ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber ) const

Sends a request to a client for an element's value of a particular DDI.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe Data Description Index being requested
[in]elementNumberThe element number being requested
Returns
true if the message was sent, otherwise false

Definition at line 43 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_set_value()

bool isobus::TaskControllerServer::send_set_value ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t processDataValue ) const

Sends a set value command without requesting an acknowledgement. This command is used to set the value of a process data entity. The set value command process data value is the value of the data entity specified by the data dictionary identifier.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]processDataValueThe process data value to send
Returns
true if the message was sent, otherwise false

Definition at line 91 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_set_value_and_acknowledge()

bool isobus::TaskControllerServer::send_set_value_and_acknowledge ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t processDataValue ) const

Sends a set value and acknowledge command. This command is used to set the value of a process data entity and request a reception acknowledgement from the recipient. The set value command process data value is the value of the data entity specified by the data dictionary identifier.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]processDataValueThe process data value to send
Returns
true if the message was sent, otherwise false

Definition at line 86 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_status_message()

bool isobus::TaskControllerServer::send_status_message ( ) const
protected

Sends a status message broadcast.

Returns
true if the message was sent, otherwise false

Definition at line 769 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_structure_label()

bool isobus::TaskControllerServer::send_structure_label ( std::shared_ptr< ControlFunction > clientControlFunction,
std::vector< std::uint8_t > & structureLabel,
const std::vector< std::uint8_t > & extendedStructureLabel ) const
protected

Sends a response to a request structure label command.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]structureLabelThe structure label to send
[in]extendedStructureLabelThe extended structure label to send
Returns
true if the message was sent, otherwise false

Definition at line 848 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_time_interval_measurement_command()

bool isobus::TaskControllerServer::send_time_interval_measurement_command ( std::shared_ptr< ControlFunction > clientControlFunction,
std::uint16_t dataDescriptionIndex,
std::uint16_t elementNumber,
std::uint32_t timeInterval ) const

Sends a time interval measurement command. The process data value for this command is the time interval for sending the data element specified by the data dictionary identifier.The client has to send the value of this data element to the TC or DL cyclic with this time interval.

Parameters
[in]clientControlFunctionThe control function to send the message to
[in]dataDescriptionIndexThe data description index of the data element to send the command for
[in]elementNumberThe element number of the data element to send the command for
[in]timeIntervalThe time interval for sending the data element specified by the data dictionary identifier.
Returns
true if the message was sent, otherwise false

Definition at line 61 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ send_version()

bool isobus::TaskControllerServer::send_version ( std::shared_ptr< ControlFunction > clientControlFunction) const
protected

Sends the version message to a client.

Parameters
[in]clientControlFunctionThe control function to send the message to
Returns
true if the message was sent, otherwise false

Definition at line 788 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_task_totals_active()

void isobus::TaskControllerServer::set_task_totals_active ( bool isTaskActive)

Use this to set the reported task state in the status message. Basically, this should be set to true when the user starts a job, and false when the user stops a job.

Note
Don't be like some terminals which set this to true all the time, that's very annoying for the client.
Parameters
[in]isTaskActiveWhether a task is currently active or not.

Definition at line 96 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

◆ store_device_descriptor_object_pool()

virtual bool isobus::TaskControllerServer::store_device_descriptor_object_pool ( std::shared_ptr< ControlFunction > clientControlFunction,
const std::vector< std::uint8_t > & objectPoolData,
bool appendToPool )
pure virtual

This function is called when the server wants you to save a DDOP to non volatile memory (NVM). You should implement this function to save the DDOP to NVM. If appendToPool is true, you should append the DDOP to the existing DDOP in NVM.

Parameters
[in]clientControlFunctionThe control function which is requesting the save.
[in]objectPoolDataThe DDOP itself as a binary blob.
[in]appendToPoolWhether or not to append the DDOP to the existing DDOP in NVM, or overwrite it.
Returns
Whether or not the save was successful.
Here is the caller graph for this function:

◆ store_rx_message()

void isobus::TaskControllerServer::store_rx_message ( const CANMessage & message,
void * parentPointer )
staticprotected

Stores messages received from task controller clients for processing later.

This is used to avoid processing messages on the CAN stack's thread. Messages are actually processed in process_rx_messages which is called by update(). Because update is called by your application, this means that messages are processed on your application's thread, which avoids a bunch of mutexing in your app.

Parameters
[in]messageThe message received from the client.
[in]parentPointerA context variable that can be used to find this class's instance.

Definition at line 180 of file isobus_task_controller_server.cpp.

Here is the caller graph for this function:

◆ terminate()

void isobus::TaskControllerServer::terminate ( )

Shuts down the TC server, unregisters PGN callbacks.

Definition at line 128 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update()

void isobus::TaskControllerServer::update ( )

This must be called periodically for the interface to operate correctly.

This function must be called periodically. You have some choices on how to do this: First, you could poll it at a high rate in your main thread, at least 2-3x as fast as your fastest triggered message. Second, you could call it at a slower rate (something like 250-500 ms), and update it when the condition variable is notified. You can get the condition variable by calling get_condition_variable() if threading is enabled in the CAN stack. Third, you could run this in a separate thread, but again, you should call it at least 2-3x as fast as your fastest triggered message. Calling this often ensures timed out clients are pruned, and messages are processed in a timely fashion, which is important for the TC to function correctly and for agronomic/implement performance.

Definition at line 150 of file isobus_task_controller_server.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ activeClients

std::deque<std::shared_ptr<ActiveClient> > isobus::TaskControllerServer::activeClients
protected

A list of clients that are currently being communicated with.

Definition at line 566 of file isobus_task_controller_server.hpp.

◆ currentCommandByte

std::uint8_t isobus::TaskControllerServer::currentCommandByte = 0
protected

The current command byte to send in the status message.

Definition at line 578 of file isobus_task_controller_server.hpp.

◆ currentCommandSourceAddress

std::uint8_t isobus::TaskControllerServer::currentCommandSourceAddress = NULL_CAN_ADDRESS
protected

The current command source address to send in the status message.

Definition at line 579 of file isobus_task_controller_server.hpp.

◆ currentStatusByte

std::uint8_t isobus::TaskControllerServer::currentStatusByte = 0
protected

The current status byte to send in the status message.

Definition at line 577 of file isobus_task_controller_server.hpp.

◆ initialized

bool isobus::TaskControllerServer::initialized = false
protected

Whether or not the task controller server has been initialized.

Definition at line 580 of file isobus_task_controller_server.hpp.

◆ languageCommandInterface

LanguageCommandInterface isobus::TaskControllerServer::languageCommandInterface
protected

The language command interface used to communicate with the client which language/units are in use.

Definition at line 563 of file isobus_task_controller_server.hpp.

◆ lastStatusMessageTimestamp_ms

std::uint32_t isobus::TaskControllerServer::lastStatusMessageTimestamp_ms = 0
protected

The timestamp of the last status message sent on the bus.

Definition at line 571 of file isobus_task_controller_server.hpp.

◆ messagesMutex

std::mutex isobus::TaskControllerServer::messagesMutex
protected

A mutex used to protect the rxMessageQueue.

Definition at line 569 of file isobus_task_controller_server.hpp.

◆ numberBoomsSupportedToReport

const std::uint8_t isobus::TaskControllerServer::numberBoomsSupportedToReport
protected

The number of booms that will be reported as supported by the TC.

Definition at line 573 of file isobus_task_controller_server.hpp.

◆ numberChannelsSupportedForPositionBasedControlToReport

const std::uint8_t isobus::TaskControllerServer::numberChannelsSupportedForPositionBasedControlToReport
protected

The number of channels that will be reported as supported by the TC.

Definition at line 575 of file isobus_task_controller_server.hpp.

◆ numberSectionsSupportedToReport

const std::uint8_t isobus::TaskControllerServer::numberSectionsSupportedToReport
protected

The number of sections that will be reported as supported by the TC.

Definition at line 574 of file isobus_task_controller_server.hpp.

◆ optionsBitfieldToReport

const std::uint8_t isobus::TaskControllerServer::optionsBitfieldToReport
protected

The options bitfield that will be reported as supported by the TC.

Definition at line 576 of file isobus_task_controller_server.hpp.

◆ reportedVersion

const TaskControllerVersion isobus::TaskControllerServer::reportedVersion
protected

The version of the TC that will be reported to the clients.

Definition at line 572 of file isobus_task_controller_server.hpp.

◆ rxMessageQueue

std::deque<CANMessage> isobus::TaskControllerServer::rxMessageQueue
protected

A queue of messages received from the clients which will be processed when update is called.

Definition at line 565 of file isobus_task_controller_server.hpp.

◆ serverControlFunction

std::shared_ptr<InternalControlFunction> isobus::TaskControllerServer::serverControlFunction
protected

The control function used to communicate with the clients.

Definition at line 564 of file isobus_task_controller_server.hpp.

◆ STATUS_MESSAGE_RATE_MS

constexpr std::uint32_t isobus::TaskControllerServer::STATUS_MESSAGE_RATE_MS = 2000
staticconstexprprotected

The rate at which status messages are sent to the clients in milliseconds.

Definition at line 561 of file isobus_task_controller_server.hpp.

◆ updateWakeupCondition

std::condition_variable isobus::TaskControllerServer::updateWakeupCondition
protected

A condition variable you can optionally use to update the interface when messages are received.

Definition at line 568 of file isobus_task_controller_server.hpp.


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