AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
A class to manage a client connection to a ISOBUS field computer's task controller or data logger. More...
#include <isobus_task_controller_client.hpp>
Classes | |
struct | ProcessDataCallbackInfo |
Stores data related to requests and commands from the TC. More... | |
struct | RequestValueCommandCallbackInfo |
Stores a TC value command callback along with its parent pointer. More... | |
struct | ValueCommandCallbackInfo |
Stores a TC value command callback along with its parent pointer. More... | |
Public Member Functions | |
TaskControllerClient (std::shared_ptr< PartneredControlFunction > partner, std::shared_ptr< InternalControlFunction > clientSource, std::shared_ptr< PartneredControlFunction > primaryVT) | |
The constructor for a TaskControllerClient. | |
~TaskControllerClient () | |
Destructor for the client. | |
void | initialize (bool spawnThread) |
This function starts the state machine. Call this once you have created your DDOP, set up the client capabilities, and are ready to connect. | |
void | add_request_value_callback (RequestValueCommandCallback callback, void *parentPointer) |
This adds a callback that will be called when the TC requests the value of one of your variables. | |
void | add_value_command_callback (ValueCommandCallback callback, void *parentPointer) |
Adds a callback that will be called when the TC commands a new value for one of your variables. | |
void | remove_request_value_callback (RequestValueCommandCallback callback, void *parentPointer) |
Removes the specified callback from the list of value request callbacks. | |
void | remove_value_command_callback (ValueCommandCallback callback, void *parentPointer) |
Removes the specified callback from the list of value command callbacks. | |
void | configure (std::shared_ptr< DeviceDescriptorObjectPool > DDOP, std::uint8_t maxNumberBoomsSupported, std::uint8_t maxNumberSectionsSupported, std::uint8_t maxNumberChannelsSupportedForPositionBasedControl, bool reportToTCSupportsDocumentation, bool reportToTCSupportsTCGEOWithoutPositionBasedControl, bool reportToTCSupportsTCGEOWithPositionBasedControl, bool reportToTCSupportsPeerControlAssignment, bool reportToTCSupportsImplementSectionControl) |
A convenient way to set all client options at once instead of calling the individual setters. | |
void | configure (std::uint8_t const *binaryDDOP, std::uint32_t DDOPSize, std::uint8_t maxNumberBoomsSupported, std::uint8_t maxNumberSectionsSupported, std::uint8_t maxNumberChannelsSupportedForPositionBasedControl, bool reportToTCSupportsDocumentation, bool reportToTCSupportsTCGEOWithoutPositionBasedControl, bool reportToTCSupportsTCGEOWithPositionBasedControl, bool reportToTCSupportsPeerControlAssignment, bool reportToTCSupportsImplementSectionControl) |
A convenient way to set all client options at once instead of calling the individual setters. | |
void | configure (std::shared_ptr< std::vector< std::uint8_t > > binaryDDOP, std::uint8_t maxNumberBoomsSupported, std::uint8_t maxNumberSectionsSupported, std::uint8_t maxNumberChannelsSupportedForPositionBasedControl, bool reportToTCSupportsDocumentation, bool reportToTCSupportsTCGEOWithoutPositionBasedControl, bool reportToTCSupportsTCGEOWithPositionBasedControl, bool reportToTCSupportsPeerControlAssignment, bool reportToTCSupportsImplementSectionControl) |
A convenient way to set all client options at once instead of calling the individual setters. | |
void | restart () |
Calling this function will reset the task controller client's connection with the TC server, and cause it to reconnect after a short delay. | |
void | terminate () |
Terminates the client and joins the worker thread if applicable. | |
std::shared_ptr< InternalControlFunction > | get_internal_control_function () const |
Returns the internal control function being used by the interface to send messages. | |
std::shared_ptr< PartneredControlFunction > | get_partner_control_function () const |
Returns the control function of the TC server with which this TC client communicates. | |
std::uint8_t | get_number_booms_supported () const |
Returns the previously configured number of booms supported by the client. | |
std::uint8_t | get_number_sections_supported () const |
Returns the previously configured number of section supported by the client. | |
std::uint8_t | get_number_channels_supported_for_position_based_control () const |
Returns the previously configured number of channels supported for position based control. | |
bool | get_supports_documentation () const |
Returns if the client has been configured to report that it supports documentation to the TC. | |
bool | get_supports_tcgeo_without_position_based_control () const |
Returns if the client has been configured to report that it supports TC-GEO without position based control to the TC. | |
bool | get_supports_tcgeo_with_position_based_control () const |
Returns if the client has been configured to report that it supports TC-GEO with position based control to the TC. | |
bool | get_supports_peer_control_assignment () const |
Returns if the client has been configured to report that it supports peer control assignment to the TC. | |
bool | get_supports_implement_section_control () const |
Returns if the client has been configured to report that it supports implement section control to the TC. | |
bool | get_is_initialized () const |
Returns if the client has been initialized. | |
bool | get_is_connected () const |
Check whether the client is connected to the TC server. | |
bool | get_is_task_active () const |
Returns if a task is active as indicated by the TC. | |
StateMachineState | get_state () const |
Returns the current state machine state. | |
std::uint8_t | get_connected_tc_number_booms_supported () const |
Returns the number of booms that the connected TC supports for section control. | |
std::uint8_t | get_connected_tc_number_sections_supported () const |
Returns the number of sections that the connected TC supports for section control. | |
std::uint8_t | get_connected_tc_number_channels_supported () const |
Returns the number of channels that the connected TC supports for position control. | |
std::uint8_t | get_connected_tc_max_boot_time () const |
Returns the maximum boot time in seconds reported by the connected TC. | |
bool | get_connected_tc_option_supported (ServerOptions option) const |
Returns if the connected TC supports a certain option. | |
Version | get_connected_tc_version () const |
Returns the version of the connected task controller. | |
void | on_value_changed_trigger (std::uint16_t elementNumber, std::uint16_t DDI) |
Tells the TC client that a value was changed or the TC client needs to command a value to the TC server. | |
bool | request_task_controller_identification () const |
Sends a broadcast request to TCs to identify themseleves. | |
bool | reupload_device_descriptor_object_pool (std::shared_ptr< std::vector< std::uint8_t > > binaryDDOP) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated. | |
bool | reupload_device_descriptor_object_pool (std::uint8_t const *binaryDDOP, std::uint32_t DDOPSize) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated. | |
bool | reupload_device_descriptor_object_pool (std::shared_ptr< DeviceDescriptorObjectPool > DDOP) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated. | |
void | update () |
The cyclic update function for this interface. | |
Public Attributes | |
LanguageCommandInterface | languageCommandInterface |
Used to determine the language and unit systems in use by the TC server. | |
Protected Member Functions | |
void | clear_queues () |
Clears all queued TC commands and responses. | |
bool | get_was_ddop_supplied () const |
Checks if a DDOP was provided via one of the configure functions. | |
void | process_labels_from_ddop () |
Searches the DDOP for a device object and stores that object's structure and localization labels. | |
void | process_queued_commands () |
Processes queued TC requests and commands. Calls the user's callbacks if needed. | |
void | process_queued_threshold_commands () |
Processes measurement threshold/interval commands. | |
bool | send_delete_object_pool () const |
Sends the delete object pool command to the TC. | |
bool | send_generic_process_data (std::uint8_t multiplexor) const |
Sends a process data message with 1 mux byte and all 0xFFs as payload. | |
bool | send_object_pool_activate () const |
Sends the activate object pool message. | |
bool | send_object_pool_deactivate () const |
Sends the deactivate object pool message. | |
bool | send_pdack (std::uint16_t elementNumber, std::uint16_t ddi) const |
Sends a Process Data ACK. | |
bool | send_request_localization_label () const |
Sends a request to the TC for its localization label. | |
bool | send_request_object_pool_transfer () const |
Sends a request to the TC indicating we wish to transfer an object pool. | |
bool | send_request_structure_label () const |
Sends a request to the TC for its structure label. | |
bool | send_request_version_response () const |
Sends the response to a request for version from the TC. | |
bool | send_status () const |
Sends the status message to the TC. | |
bool | send_value_command (std::uint16_t elementNumber, std::uint16_t ddi, std::int32_t value) const |
Sends the value command message for a specific DDI/Element number combo. | |
bool | send_version_request () const |
Sends the version request message to the TC. | |
bool | send_working_set_master () const |
Sends the working set master message. | |
void | set_common_config_items (std::uint8_t maxNumberBoomsSupported, std::uint8_t maxNumberSectionsSupported, std::uint8_t maxNumberChannelsSupportedForPositionBasedControl, bool reportToTCSupportsDocumentation, bool reportToTCSupportsTCGEOWithoutPositionBasedControl, bool reportToTCSupportsTCGEOWithPositionBasedControl, bool reportToTCSupportsPeerControlAssignment, bool reportToTCSupportsImplementSectionControl) |
Sets the common items found in all versions of configure | |
void | set_state (StateMachineState newState) |
Changes the internal state machine state and updates the associated timestamp. | |
void | set_state (StateMachineState newState, std::uint32_t timestamp) |
Changes the internal state machine state and updates the associated timestamp to the specified one. | |
void | select_language_command_partner () |
Sets the behavior of the language command interface based on the TC's reported version information. | |
void | worker_thread_function () |
The worker thread will execute this function when it runs, if applicable. | |
Static Protected Member Functions | |
static bool | process_internal_object_pool_upload_callback (std::uint32_t callbackIndex, std::uint32_t bytesOffset, std::uint32_t numberOfBytesNeeded, std::uint8_t *chunkBuffer, void *parentPointer) |
The data callback passed to the network manger's send function for the transport layer messages. | |
static void | process_rx_message (const CANMessage &message, void *parentPointer) |
Processes a CAN message destined for any TC client. | |
static void | process_tx_callback (std::uint32_t parameterGroupNumber, std::uint32_t dataLength, std::shared_ptr< InternalControlFunction > sourceControlFunction, std::shared_ptr< ControlFunction > destinationControlFunction, bool successful, void *parentPointer) |
The callback passed to the network manager's send function to know when a Tx is completed. | |
Static Protected Attributes | |
static constexpr std::uint32_t | SIX_SECOND_TIMEOUT_MS = 6000 |
The startup delay time defined in the standard. | |
static constexpr std::uint16_t | TWO_SECOND_TIMEOUT_MS = 2000 |
Used for sending the status message to the TC. | |
Private Types | |
enum class | DDOPUploadType { ProgramaticallyGenerated , UserProvidedBinaryPointer , UserProvidedVector } |
Enumerates the modes that the client may use when dealing with a DDOP. More... | |
Private Attributes | |
std::shared_ptr< PartneredControlFunction > | partnerControlFunction |
The partner control function this client will send to. | |
std::shared_ptr< InternalControlFunction > | myControlFunction |
The internal control function the client uses to send from. | |
std::shared_ptr< PartneredControlFunction > | primaryVirtualTerminal |
A pointer to the primary VT's control function. Used for TCs < version 4 and language command compatibility. | |
std::shared_ptr< DeviceDescriptorObjectPool > | clientDDOP |
Stores the DDOP for upload to the TC (if needed) | |
std::uint8_t const * | userSuppliedBinaryDDOP = nullptr |
Stores a client-provided DDOP if one was provided. | |
std::shared_ptr< std::vector< std::uint8_t > > | userSuppliedVectorDDOP |
Stores a client-provided DDOP if one was provided. | |
std::vector< std::uint8_t > | generatedBinaryDDOP |
Stores the DDOP in binary form after it has been generated. | |
std::vector< RequestValueCommandCallbackInfo > | requestValueCallbacks |
A list of callbacks that will be called when the TC requests a process data value. | |
std::vector< ValueCommandCallbackInfo > | valueCommandsCallbacks |
A list of callbacks that will be called when the TC sets a process data value. | |
std::list< ProcessDataCallbackInfo > | queuedValueRequests |
A list of queued value requests that will be processed on the next update. | |
std::list< ProcessDataCallbackInfo > | queuedValueCommands |
A list of queued value commands that will be processed on the next update. | |
std::list< ProcessDataCallbackInfo > | measurementTimeIntervalCommands |
A list of measurement commands that will be processed on a time interval. | |
std::list< ProcessDataCallbackInfo > | measurementMinimumThresholdCommands |
A list of measurement commands that will be processed when the value drops below a threshold. | |
std::list< ProcessDataCallbackInfo > | measurementMaximumThresholdCommands |
A list of measurement commands that will be processed when the value above a threshold. | |
std::list< ProcessDataCallbackInfo > | measurementOnChangeThresholdCommands |
A list of measurement commands that will be processed when the value changes by the specified amount. | |
Mutex | clientMutex |
A general mutex to protect data in the worker thread against data accessed by the app or the network manager. | |
std::thread * | workerThread = nullptr |
The worker thread that updates this interface. | |
std::string | ddopStructureLabel |
Stores a pre-parsed structure label, helps to avoid processing the whole DDOP during a CAN message callback. | |
std::string | previousStructureLabel |
Stores the last structure label we used, helps to warn the user if they aren't updating the label properly. | |
std::array< std::uint8_t, 7 > | ddopLocalizationLabel = { 0 } |
Stores a pre-parsed localization label, helps to avoid processing the whole DDOP during a CAN message callback. | |
DDOPUploadType | ddopUploadMode = DDOPUploadType::ProgramaticallyGenerated |
Determines if DDOPs get generated or raw uploaded. | |
StateMachineState | currentState = StateMachineState::Disconnected |
Tracks the internal state machine's current state. | |
std::uint32_t | stateMachineTimestamp_ms = 0 |
Timestamp that tracks when the state machine last changed states (in milliseconds) | |
std::uint32_t | statusMessageTimestamp_ms = 0 |
Timestamp corresponding to the last time we sent a status message to the TC. | |
std::uint32_t | serverStatusMessageTimestamp_ms = 0 |
Timestamp corresponding to the last time we received a status message from the TC. | |
std::uint32_t | userSuppliedBinaryDDOPSize_bytes = 0 |
The number of bytes in the user provided binary DDOP (if one was provided) | |
std::uint32_t | languageCommandWaitingTimestamp_ms = 0 |
Timestamp used to determine when to give up on waiting for a language command response. | |
std::uint8_t | numberOfWorkingSetMembers = 1 |
The number of working set members that will be reported in the working set master message. | |
std::uint8_t | tcStatusBitfield = 0 |
The last received TC/DL status from the status message. | |
std::uint8_t | sourceAddressOfCommandBeingExecuted = 0 |
Source address of client for which the current command is being executed. | |
std::uint8_t | commandBeingExecuted = 0 |
The current command the TC is executing as reported in the status message. | |
std::uint8_t | serverVersion = 0 |
The detected version of the TC Server. | |
std::uint8_t | maxServerBootTime_s = 0 |
Maximum number of seconds from a power cycle to transmission of first �Task Controller Status message� or 0xFF. | |
std::uint8_t | serverOptionsByte1 = 0 |
The options specified in ISO 11783-10 that this TC, DL, or client meets (The definition of this byte is introduced in ISO11783-10 version 3) | |
std::uint8_t | serverOptionsByte2 = 0 |
Reserved for ISO assignment, should be zero or 0xFF. | |
std::uint8_t | serverNumberOfBoomsForSectionControl = 0 |
When reported by the TC, this is the maximum number of section control booms that are supported. | |
std::uint8_t | serverNumberOfSectionsForSectionControl = 0 |
When reported by the TC, this is the maximum number of sections that are supported (or 0xFF for version 2 and earlier). | |
std::uint8_t | serverNumberOfChannelsForPositionBasedControl = 0 |
When reported by the TC, this is the maximum number of individual control channels that is supported. | |
std::uint8_t | numberBoomsSupported = 0 |
Stores the number of booms this client supports for section control. | |
std::uint8_t | numberSectionsSupported = 0 |
Stores the number of sections this client supports for section control. | |
std::uint8_t | numberChannelsSupportedForPositionBasedControl = 0 |
Stores the number of channels this client supports for position based control. | |
bool | initialized = false |
Tracks the initialization state of the interface instance. | |
bool | shouldTerminate = false |
This variable tells the worker thread to exit. | |
bool | enableStatusMessage = false |
Enables sending the status message to the TC cyclically. | |
bool | supportsDocumentation = false |
Determines if the client reports documentation support to the TC. | |
bool | supportsTCGEOWithoutPositionBasedControl = false |
Determines if the client reports TC-GEO without position control capability to the TC. | |
bool | supportsTCGEOWithPositionBasedControl = false |
Determines if the client reports TC-GEO with position control capability to the TC. | |
bool | supportsPeerControlAssignment = false |
Determines if the client reports peer control assignment capability to the TC. | |
bool | supportsImplementSectionControl = false |
Determines if the client reports implement section control capability to the TC. | |
bool | shouldReuploadAfterDDOPDeletion = false |
Used to determine how the state machine should progress when updating a DDOP. | |
A class to manage a client connection to a ISOBUS field computer's task controller or data logger.
Definition at line 26 of file isobus_task_controller_client.hpp.
A callback for handling a value request command from the TC.
Definition at line 87 of file isobus_task_controller_client.hpp.
A callback for handling a set value command from the TC.
Definition at line 93 of file isobus_task_controller_client.hpp.
|
strongprivate |
Enumerates the modes that the client may use when dealing with a DDOP.
Enumerator | |
---|---|
ProgramaticallyGenerated | Using the AgIsoStack++ DeviceDescriptorObjectPool class. |
UserProvidedBinaryPointer | Using a raw pointer to a binary DDOP. |
UserProvidedVector | Uses a vector of bytes that comprise a binary DDOP. |
Definition at line 609 of file isobus_task_controller_client.hpp.
|
strongprotected |
Enumerates the subcommands within the device descriptor command message group.
Definition at line 388 of file isobus_task_controller_client.hpp.
|
strongprotected |
Enumerates the different Process Data commands from ISO11783-10 Table B.1.
Definition at line 359 of file isobus_task_controller_client.hpp.
|
strong |
Enumerates the bits stored in our version data that we send to the TC when handshaking.
Definition at line 74 of file isobus_task_controller_client.hpp.
|
strong |
Enumerates the different internal state machine states.
Definition at line 30 of file isobus_task_controller_client.hpp.
|
strongprotected |
Enumerates the subcommands within the technical data message group.
Definition at line 380 of file isobus_task_controller_client.hpp.
|
strong |
Enumerates the different task controller versions.
Definition at line 63 of file isobus_task_controller_client.hpp.
isobus::TaskControllerClient::TaskControllerClient | ( | std::shared_ptr< PartneredControlFunction > | partner, |
std::shared_ptr< InternalControlFunction > | clientSource, | ||
std::shared_ptr< PartneredControlFunction > | primaryVT ) |
The constructor for a TaskControllerClient.
[in] | partner | The TC server control function |
[in] | clientSource | The internal control function to communicate from |
[in] | primaryVT | Pointer to our primary VT. This is optional (can be nullptr), but should be provided if possible to provide the best compatibility to TC < version 4. |
Definition at line 27 of file isobus_task_controller_client.cpp.
isobus::TaskControllerClient::~TaskControllerClient | ( | ) |
Destructor for the client.
Definition at line 35 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::add_request_value_callback | ( | RequestValueCommandCallback | callback, |
void * | parentPointer ) |
This adds a callback that will be called when the TC requests the value of one of your variables.
The task controller will often send a request for the value of a process data variable. When the stack receives those messages, it will call this callback to request the value from your application. You must provide the value at that time for the associated process data variable identified by its element number and DDI.
[in] | callback | The callback to add |
[in] | parentPointer | A generic context variable that will be passed into the associated callback when it gets called |
Definition at line 73 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::add_value_command_callback | ( | ValueCommandCallback | callback, |
void * | parentPointer ) |
Adds a callback that will be called when the TC commands a new value for one of your variables.
The task controller will often send a command to set one of your process data variables to a new value. This callback will get called when that happens, and you will need to set the variable to the commanded value in your application.
[in] | callback | The callback to add |
[in] | parentPointer | A generic context variable that will be passed into the associated callback when it gets called |
Definition at line 81 of file isobus_task_controller_client.cpp.
|
protected |
Clears all queued TC commands and responses.
Definition at line 889 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::configure | ( | std::shared_ptr< DeviceDescriptorObjectPool > | DDOP, |
std::uint8_t | maxNumberBoomsSupported, | ||
std::uint8_t | maxNumberSectionsSupported, | ||
std::uint8_t | maxNumberChannelsSupportedForPositionBasedControl, | ||
bool | reportToTCSupportsDocumentation, | ||
bool | reportToTCSupportsTCGEOWithoutPositionBasedControl, | ||
bool | reportToTCSupportsTCGEOWithPositionBasedControl, | ||
bool | reportToTCSupportsPeerControlAssignment, | ||
bool | reportToTCSupportsImplementSectionControl ) |
A convenient way to set all client options at once instead of calling the individual setters.
This function sets up the parameters that the client will report to the TC server. These parameters should be tailored to your specific application.
[in] | DDOP | The device descriptor object pool to upload to the TC |
[in] | maxNumberBoomsSupported | Configures the max number of booms the client supports |
[in] | maxNumberSectionsSupported | Configures the max number of sections supported by the client for section control |
[in] | maxNumberChannelsSupportedForPositionBasedControl | Configures the max number of channels supported by the client for position based control |
[in] | reportToTCSupportsDocumentation | Denotes if your app supports documentation |
[in] | reportToTCSupportsTCGEOWithoutPositionBasedControl | Denotes if your app supports TC-GEO without position based control |
[in] | reportToTCSupportsTCGEOWithPositionBasedControl | Denotes if your app supports TC-GEO with position based control |
[in] | reportToTCSupportsPeerControlAssignment | Denotes if your app supports peer control assignment |
[in] | reportToTCSupportsImplementSectionControl | Denotes if your app supports implement section control |
Definition at line 115 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::configure | ( | std::shared_ptr< std::vector< std::uint8_t > > | binaryDDOP, |
std::uint8_t | maxNumberBoomsSupported, | ||
std::uint8_t | maxNumberSectionsSupported, | ||
std::uint8_t | maxNumberChannelsSupportedForPositionBasedControl, | ||
bool | reportToTCSupportsDocumentation, | ||
bool | reportToTCSupportsTCGEOWithoutPositionBasedControl, | ||
bool | reportToTCSupportsTCGEOWithPositionBasedControl, | ||
bool | reportToTCSupportsPeerControlAssignment, | ||
bool | reportToTCSupportsImplementSectionControl ) |
A convenient way to set all client options at once instead of calling the individual setters.
This function sets up the parameters that the client will report to the TC server. These parameters should be tailored to your specific application.
[in] | binaryDDOP | The device descriptor object pool to upload to the TC |
[in] | maxNumberBoomsSupported | Configures the max number of booms the client supports |
[in] | maxNumberSectionsSupported | Configures the max number of sections supported by the client for section control |
[in] | maxNumberChannelsSupportedForPositionBasedControl | Configures the max number of channels supported by the client for position based control |
[in] | reportToTCSupportsDocumentation | Denotes if your app supports documentation |
[in] | reportToTCSupportsTCGEOWithoutPositionBasedControl | Denotes if your app supports TC-GEO without position based control |
[in] | reportToTCSupportsTCGEOWithPositionBasedControl | Denotes if your app supports TC-GEO with position based control |
[in] | reportToTCSupportsPeerControlAssignment | Denotes if your app supports peer control assignment |
[in] | reportToTCSupportsImplementSectionControl | Denotes if your app supports implement section control |
Definition at line 190 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::configure | ( | std::uint8_t const * | binaryDDOP, |
std::uint32_t | DDOPSize, | ||
std::uint8_t | maxNumberBoomsSupported, | ||
std::uint8_t | maxNumberSectionsSupported, | ||
std::uint8_t | maxNumberChannelsSupportedForPositionBasedControl, | ||
bool | reportToTCSupportsDocumentation, | ||
bool | reportToTCSupportsTCGEOWithoutPositionBasedControl, | ||
bool | reportToTCSupportsTCGEOWithPositionBasedControl, | ||
bool | reportToTCSupportsPeerControlAssignment, | ||
bool | reportToTCSupportsImplementSectionControl ) |
A convenient way to set all client options at once instead of calling the individual setters.
This function sets up the parameters that the client will report to the TC server. These parameters should be tailored to your specific application.
[in] | binaryDDOP | The device descriptor object pool to upload to the TC |
[in] | DDOPSize | The number of bytes in the binary DDOP that will be uploaded |
[in] | maxNumberBoomsSupported | Configures the max number of booms the client supports |
[in] | maxNumberSectionsSupported | Configures the max number of sections supported by the client for section control |
[in] | maxNumberChannelsSupportedForPositionBasedControl | Configures the max number of channels supported by the client for position based control |
[in] | reportToTCSupportsDocumentation | Denotes if your app supports documentation |
[in] | reportToTCSupportsTCGEOWithoutPositionBasedControl | Denotes if your app supports TC-GEO without position based control |
[in] | reportToTCSupportsTCGEOWithPositionBasedControl | Denotes if your app supports TC-GEO with position based control |
[in] | reportToTCSupportsPeerControlAssignment | Denotes if your app supports peer control assignment |
[in] | reportToTCSupportsImplementSectionControl | Denotes if your app supports implement section control |
Definition at line 152 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_connected_tc_max_boot_time | ( | ) | const |
Returns the maximum boot time in seconds reported by the connected TC.
Definition at line 2130 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_connected_tc_number_booms_supported | ( | ) | const |
Returns the number of booms that the connected TC supports for section control.
Definition at line 2115 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_connected_tc_number_channels_supported | ( | ) | const |
Returns the number of channels that the connected TC supports for position control.
Definition at line 2125 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_connected_tc_number_sections_supported | ( | ) | const |
Returns the number of sections that the connected TC supports for section control.
Definition at line 2120 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_connected_tc_option_supported | ( | ServerOptions | option | ) | const |
Returns if the connected TC supports a certain option.
[in] | option | The option to check against |
true
if the option was reported as "supported" by the TC, otherwise false
Definition at line 2135 of file isobus_task_controller_client.cpp.
TaskControllerClient::Version isobus::TaskControllerClient::get_connected_tc_version | ( | ) | const |
Returns the version of the connected task controller.
Definition at line 2140 of file isobus_task_controller_client.cpp.
std::shared_ptr< InternalControlFunction > isobus::TaskControllerClient::get_internal_control_function | ( | ) | const |
Returns the internal control function being used by the interface to send messages.
Definition at line 259 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_is_connected | ( | ) | const |
Check whether the client is connected to the TC server.
Definition at line 314 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_is_initialized | ( | ) | const |
Returns if the client has been initialized.
Definition at line 309 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_is_task_active | ( | ) | const |
Returns if a task is active as indicated by the TC.
true
if the TC is connected and the TC is reporting it is in a task, otherwise false
Definition at line 319 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_number_booms_supported | ( | ) | const |
Returns the previously configured number of booms supported by the client.
Definition at line 269 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_number_channels_supported_for_position_based_control | ( | ) | const |
Returns the previously configured number of channels supported for position based control.
Definition at line 279 of file isobus_task_controller_client.cpp.
std::uint8_t isobus::TaskControllerClient::get_number_sections_supported | ( | ) | const |
Returns the previously configured number of section supported by the client.
Definition at line 274 of file isobus_task_controller_client.cpp.
std::shared_ptr< PartneredControlFunction > isobus::TaskControllerClient::get_partner_control_function | ( | ) | const |
Returns the control function of the TC server with which this TC client communicates.
Definition at line 264 of file isobus_task_controller_client.cpp.
TaskControllerClient::StateMachineState isobus::TaskControllerClient::get_state | ( | ) | const |
Returns the current state machine state.
Definition at line 2110 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_supports_documentation | ( | ) | const |
Returns if the client has been configured to report that it supports documentation to the TC.
true
if the client has been configured to report that it supports documentation, otherwise false
Definition at line 284 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_supports_implement_section_control | ( | ) | const |
Returns if the client has been configured to report that it supports implement section control to the TC.
true
if the client has been configured to report that it supports implement section control, otherwise false
Definition at line 304 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_supports_peer_control_assignment | ( | ) | const |
Returns if the client has been configured to report that it supports peer control assignment to the TC.
true
if the client has been configured to report that it supports peer control assignment, otherwise false
Definition at line 299 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_supports_tcgeo_with_position_based_control | ( | ) | const |
Returns if the client has been configured to report that it supports TC-GEO with position based control to the TC.
true
if the client has been configured to report that it supports TC-GEO with position based control, otherwise false
Definition at line 294 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::get_supports_tcgeo_without_position_based_control | ( | ) | const |
Returns if the client has been configured to report that it supports TC-GEO without position based control to the TC.
true
if the client has been configured to report that it supports TC-GEO without position based control, otherwise false
Definition at line 289 of file isobus_task_controller_client.cpp.
|
protected |
Checks if a DDOP was provided via one of the configure functions.
Definition at line 899 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::initialize | ( | bool | spawnThread | ) |
This function starts the state machine. Call this once you have created your DDOP, set up the client capabilities, and are ready to connect.
[in] | spawnThread | The client will start a thread to manage itself if this parameter is true. Otherwise you must update it cyclically by calling the update function. |
Definition at line 40 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::on_value_changed_trigger | ( | std::uint16_t | elementNumber, |
std::uint16_t | DDI ) |
Tells the TC client that a value was changed or the TC client needs to command a value to the TC server.
If you provide on-change triggers in your DDOP, this is how you can request the TC client to update the TC server on the current value of your process data variables.
[in] | elementNumber | The element number of the process data variable that changed |
[in] | DDI | The DDI of the process data variable that changed |
Definition at line 2151 of file isobus_task_controller_client.cpp.
|
staticprotected |
The data callback passed to the network manger's send function for the transport layer messages.
We upload the data with callbacks to avoid making yet another complete copy of the pool to accommodate the multiplexor that needs to get passed to the transport layer message's first byte.
[in] | callbackIndex | The number of times the callback has been called |
[in] | bytesOffset | The byte offset at which to get pool data |
[in] | numberOfBytesNeeded | The number of bytes the protocol needs to send another frame (usually 7) |
[out] | chunkBuffer | A pointer through which the data should be returned to the protocol |
[in] | parentPointer | A context variable that is passed back through the callback |
Definition at line 1777 of file isobus_task_controller_client.cpp.
|
protected |
Searches the DDOP for a device object and stores that object's structure and localization labels.
Definition at line 931 of file isobus_task_controller_client.cpp.
|
protected |
Processes queued TC requests and commands. Calls the user's callbacks if needed.
Definition at line 1032 of file isobus_task_controller_client.cpp.
|
protected |
Processes measurement threshold/interval commands.
Definition at line 1073 of file isobus_task_controller_client.cpp.
|
staticprotected |
Processes a CAN message destined for any TC client.
[in] | message | The CAN message being received |
[in] | parentPointer | A context variable to find the relevant TC client class |
Definition at line 1185 of file isobus_task_controller_client.cpp.
|
staticprotected |
The callback passed to the network manager's send function to know when a Tx is completed.
[in] | parameterGroupNumber | The parameter group number of the message that was sent |
[in] | dataLength | The number of bytes sent |
[in] | sourceControlFunction | The control function that sent the message |
[in] | destinationControlFunction | The control function that received the message |
[in] | successful | Whether the message was sent successfully |
[in] | parentPointer | A context variable that is passed back through the callback |
Definition at line 1831 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::remove_request_value_callback | ( | RequestValueCommandCallback | callback, |
void * | parentPointer ) |
Removes the specified callback from the list of value request callbacks.
[in] | callback | The callback to remove |
[in] | parentPointer | parent pointer associated to the callback being removed |
Definition at line 89 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::remove_value_command_callback | ( | ValueCommandCallback | callback, |
void * | parentPointer ) |
Removes the specified callback from the list of value command callbacks.
[in] | callback | The callback to remove |
[in] | parentPointer | parent pointer associated to the callback being removed |
Definition at line 102 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::request_task_controller_identification | ( | ) | const |
Sends a broadcast request to TCs to identify themseleves.
Upon receipt of this message, the TC shall display, for a period of 3 s, the TC Number
true
if the message was sent, otherwise false
Definition at line 2163 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::restart | ( | ) |
Calling this function will reset the task controller client's connection with the TC server, and cause it to reconnect after a short delay.
Definition at line 226 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::reupload_device_descriptor_object_pool | ( | std::shared_ptr< DeviceDescriptorObjectPool > | DDOP | ) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated.
[in] | DDOP | The updated device descriptor object pool to upload to the TC |
Definition at line 374 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::reupload_device_descriptor_object_pool | ( | std::shared_ptr< std::vector< std::uint8_t > > | binaryDDOP | ) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated.
[in] | binaryDDOP | The updated device descriptor object pool to upload to the TC |
Definition at line 324 of file isobus_task_controller_client.cpp.
bool isobus::TaskControllerClient::reupload_device_descriptor_object_pool | ( | std::uint8_t const * | binaryDDOP, |
std::uint32_t | DDOPSize ) |
If the TC client is connected to a TC, calling this function will cause the TC client interface to delete the currently active DDOP, reupload it, then reactivate it using the pool passed into the parameter of this function. This process is faster than restarting the whole interface, and you have to call it if you change certain things in your DDOP at runtime after the DDOP has already been activated.
[in] | binaryDDOP | The updated device descriptor object pool to upload to the TC |
[in] | DDOPSize | The number of bytes in the binary DDOP that will be uploaded |
Definition at line 349 of file isobus_task_controller_client.cpp.
|
protected |
Sets the behavior of the language command interface based on the TC's reported version information.
Definition at line 2078 of file isobus_task_controller_client.cpp.
|
protected |
Sends the delete object pool command to the TC.
This is a message to delete the device descriptor object pool for the client that sends this message. The Object pool Delete message enables a client to delete the entire device descriptor object pool before sending an updated or changed device descriptor object pool with the object pool transfer message.
true
if the message was sent, otherwise false
Definition at line 1859 of file isobus_task_controller_client.cpp.
|
protected |
Sends a process data message with 1 mux byte and all 0xFFs as payload.
This just reduces code duplication by consolidating common message formats
[in] | multiplexor | The multiplexor to use for the message |
true
if the message was sent, otherwise false
Definition at line 1865 of file isobus_task_controller_client.cpp.
|
protected |
Sends the activate object pool message.
This message is sent by a client to complete its connection procedure to a TC
true
if the message was sent, otherwise false
Definition at line 1883 of file isobus_task_controller_client.cpp.
|
protected |
Sends the deactivate object pool message.
This message is sent by a client to disconnect from a TC
true
if the message was sent otherwise false
Definition at line 1889 of file isobus_task_controller_client.cpp.
|
protected |
Sends a Process Data ACK.
[in] | elementNumber | The element number being acked |
[in] | ddi | The DDI being acked |
true
if the message was sent, otherwise false
Definition at line 1908 of file isobus_task_controller_client.cpp.
|
protected |
Sends a request to the TC for its localization label.
The Request Localization Label message allows the client to determine the availability of the requested device descriptor localization at the TC or DL.If the requested localization label is present, a localization label message with the requested localization label shall be transmitted by the TC or DL to the sender of the Request Localization Label message. Otherwise, a localization label message with all localization label bytes set to value = 0xFF shall be transmitted by the TC or DL to the sender of the Request Localization Label message.
true
if the message was sent, otherwise false
Definition at line 1926 of file isobus_task_controller_client.cpp.
|
protected |
Sends a request to the TC indicating we wish to transfer an object pool.
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 or DL.
true
if the message was sent, otherwise false Definition at line 1932 of file isobus_task_controller_client.cpp.
|
protected |
Sends a request to the TC for its structure label.
The Request Structure Label message allows the client to determine the availability of the requested device descriptor structure at the TC. If the requested structure label is present, a structure label message with the requested structure label shall be transmitted by the TC or DL to the sender of the Request Structure Label message. Otherwise, a structure label message with 7 structure label bytes set to value = 0xFF shall be transmitted by the TC or DL to the sender of the Request Structure Label message
true
if the message was sent, otherwise false
Definition at line 1958 of file isobus_task_controller_client.cpp.
|
protected |
Sends the response to a request for version from the TC.
true
if the message was sent, otherwise false
Definition at line 1965 of file isobus_task_controller_client.cpp.
|
protected |
Sends the status message to the TC.
true
if the message was sent, otherwise false Definition at line 1987 of file isobus_task_controller_client.cpp.
|
protected |
Sends the value command message for a specific DDI/Element number combo.
[in] | elementNumber | The element number for the command |
[in] | ddi | The DDI for the command |
[in] | value | The value to send |
true
if the message was sent, otherwise false
Definition at line 2005 of file isobus_task_controller_client.cpp.
|
protected |
Sends the version request message to the TC.
true
if the message was sent, otherwise false
Definition at line 2023 of file isobus_task_controller_client.cpp.
|
protected |
Sends the working set master message.
true
if the message was sent, otherwise false Definition at line 2028 of file isobus_task_controller_client.cpp.
|
protected |
Sets the common items found in all versions of configure
[in] | maxNumberBoomsSupported | Configures the max number of booms the client supports |
[in] | maxNumberSectionsSupported | Configures the max number of sections supported by the client for section control |
[in] | maxNumberChannelsSupportedForPositionBasedControl | Configures the max number of channels supported by the client for position based control |
[in] | reportToTCSupportsDocumentation | Denotes if your app supports documentation |
[in] | reportToTCSupportsTCGEOWithoutPositionBasedControl | Denotes if your app supports TC-GEO without position based control |
[in] | reportToTCSupportsTCGEOWithPositionBasedControl | Denotes if your app supports TC-GEO with position based control |
[in] | reportToTCSupportsPeerControlAssignment | Denotes if your app supports peer control assignment |
[in] | reportToTCSupportsImplementSectionControl | Denotes if your app supports implement section control |
Definition at line 2039 of file isobus_task_controller_client.cpp.
|
protected |
Changes the internal state machine state and updates the associated timestamp.
[in] | newState | The new state for the state machine |
Definition at line 2058 of file isobus_task_controller_client.cpp.
|
protected |
Changes the internal state machine state and updates the associated timestamp to the specified one.
[in] | newState | The new state for the state machine |
[in] | timestamp | The new value for the state machine timestamp (in milliseconds) |
Definition at line 2072 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::terminate | ( | ) |
Terminates the client and joins the worker thread if applicable.
Definition at line 235 of file isobus_task_controller_client.cpp.
void isobus::TaskControllerClient::update | ( | ) |
The cyclic update function for this interface.
true
, otherwise you must call it yourself at some interval. Definition at line 399 of file isobus_task_controller_client.cpp.
|
protected |
The worker thread will execute this function when it runs, if applicable.
Definition at line 2095 of file isobus_task_controller_client.cpp.
|
private |
Stores the DDOP for upload to the TC (if needed)
Definition at line 619 of file isobus_task_controller_client.hpp.
|
private |
A general mutex to protect data in the worker thread against data accessed by the app or the network manager.
Definition at line 631 of file isobus_task_controller_client.hpp.
|
private |
The current command the TC is executing as reported in the status message.
Definition at line 648 of file isobus_task_controller_client.hpp.
|
private |
Tracks the internal state machine's current state.
Definition at line 639 of file isobus_task_controller_client.hpp.
|
private |
Stores a pre-parsed localization label, helps to avoid processing the whole DDOP during a CAN message callback.
Definition at line 637 of file isobus_task_controller_client.hpp.
|
private |
Stores a pre-parsed structure label, helps to avoid processing the whole DDOP during a CAN message callback.
Definition at line 635 of file isobus_task_controller_client.hpp.
|
private |
Determines if DDOPs get generated or raw uploaded.
Definition at line 638 of file isobus_task_controller_client.hpp.
|
private |
Enables sending the status message to the TC cyclically.
Definition at line 661 of file isobus_task_controller_client.hpp.
|
private |
Stores the DDOP in binary form after it has been generated.
Definition at line 622 of file isobus_task_controller_client.hpp.
|
private |
Tracks the initialization state of the interface instance.
Definition at line 659 of file isobus_task_controller_client.hpp.
LanguageCommandInterface isobus::TaskControllerClient::languageCommandInterface |
Used to determine the language and unit systems in use by the TC server.
Definition at line 355 of file isobus_task_controller_client.hpp.
|
private |
Timestamp used to determine when to give up on waiting for a language command response.
Definition at line 644 of file isobus_task_controller_client.hpp.
|
private |
Maximum number of seconds from a power cycle to transmission of first �Task Controller Status message� or 0xFF.
Definition at line 650 of file isobus_task_controller_client.hpp.
|
private |
A list of measurement commands that will be processed when the value above a threshold.
Definition at line 629 of file isobus_task_controller_client.hpp.
|
private |
A list of measurement commands that will be processed when the value drops below a threshold.
Definition at line 628 of file isobus_task_controller_client.hpp.
|
private |
A list of measurement commands that will be processed when the value changes by the specified amount.
Definition at line 630 of file isobus_task_controller_client.hpp.
|
private |
A list of measurement commands that will be processed on a time interval.
Definition at line 627 of file isobus_task_controller_client.hpp.
|
private |
The internal control function the client uses to send from.
Definition at line 617 of file isobus_task_controller_client.hpp.
|
private |
Stores the number of booms this client supports for section control.
Definition at line 656 of file isobus_task_controller_client.hpp.
|
private |
Stores the number of channels this client supports for position based control.
Definition at line 658 of file isobus_task_controller_client.hpp.
|
private |
The number of working set members that will be reported in the working set master message.
Definition at line 645 of file isobus_task_controller_client.hpp.
|
private |
Stores the number of sections this client supports for section control.
Definition at line 657 of file isobus_task_controller_client.hpp.
|
private |
The partner control function this client will send to.
Definition at line 616 of file isobus_task_controller_client.hpp.
|
private |
Stores the last structure label we used, helps to warn the user if they aren't updating the label properly.
Definition at line 636 of file isobus_task_controller_client.hpp.
|
private |
A pointer to the primary VT's control function. Used for TCs < version 4 and language command compatibility.
Definition at line 618 of file isobus_task_controller_client.hpp.
|
private |
A list of queued value commands that will be processed on the next update.
Definition at line 626 of file isobus_task_controller_client.hpp.
|
private |
A list of queued value requests that will be processed on the next update.
Definition at line 625 of file isobus_task_controller_client.hpp.
|
private |
A list of callbacks that will be called when the TC requests a process data value.
Definition at line 623 of file isobus_task_controller_client.hpp.
|
private |
When reported by the TC, this is the maximum number of section control booms that are supported.
Definition at line 653 of file isobus_task_controller_client.hpp.
|
private |
When reported by the TC, this is the maximum number of individual control channels that is supported.
Definition at line 655 of file isobus_task_controller_client.hpp.
|
private |
When reported by the TC, this is the maximum number of sections that are supported (or 0xFF for version 2 and earlier).
Definition at line 654 of file isobus_task_controller_client.hpp.
|
private |
The options specified in ISO 11783-10 that this TC, DL, or client meets (The definition of this byte is introduced in ISO11783-10 version 3)
Definition at line 651 of file isobus_task_controller_client.hpp.
|
private |
Reserved for ISO assignment, should be zero or 0xFF.
Definition at line 652 of file isobus_task_controller_client.hpp.
|
private |
Timestamp corresponding to the last time we received a status message from the TC.
Definition at line 642 of file isobus_task_controller_client.hpp.
|
private |
The detected version of the TC Server.
Definition at line 649 of file isobus_task_controller_client.hpp.
|
private |
Used to determine how the state machine should progress when updating a DDOP.
Definition at line 667 of file isobus_task_controller_client.hpp.
|
private |
This variable tells the worker thread to exit.
Definition at line 660 of file isobus_task_controller_client.hpp.
|
staticconstexprprotected |
The startup delay time defined in the standard.
Definition at line 567 of file isobus_task_controller_client.hpp.
|
private |
Source address of client for which the current command is being executed.
Definition at line 647 of file isobus_task_controller_client.hpp.
|
private |
Timestamp that tracks when the state machine last changed states (in milliseconds)
Definition at line 640 of file isobus_task_controller_client.hpp.
|
private |
Timestamp corresponding to the last time we sent a status message to the TC.
Definition at line 641 of file isobus_task_controller_client.hpp.
|
private |
Determines if the client reports documentation support to the TC.
Definition at line 662 of file isobus_task_controller_client.hpp.
|
private |
Determines if the client reports implement section control capability to the TC.
Definition at line 666 of file isobus_task_controller_client.hpp.
|
private |
Determines if the client reports peer control assignment capability to the TC.
Definition at line 665 of file isobus_task_controller_client.hpp.
|
private |
Determines if the client reports TC-GEO without position control capability to the TC.
Definition at line 663 of file isobus_task_controller_client.hpp.
|
private |
Determines if the client reports TC-GEO with position control capability to the TC.
Definition at line 664 of file isobus_task_controller_client.hpp.
|
private |
The last received TC/DL status from the status message.
Definition at line 646 of file isobus_task_controller_client.hpp.
|
staticconstexprprotected |
Used for sending the status message to the TC.
Definition at line 568 of file isobus_task_controller_client.hpp.
|
private |
Stores a client-provided DDOP if one was provided.
Definition at line 620 of file isobus_task_controller_client.hpp.
|
private |
The number of bytes in the user provided binary DDOP (if one was provided)
Definition at line 643 of file isobus_task_controller_client.hpp.
|
private |
Stores a client-provided DDOP if one was provided.
Definition at line 621 of file isobus_task_controller_client.hpp.
|
private |
A list of callbacks that will be called when the TC sets a process data value.
Definition at line 624 of file isobus_task_controller_client.hpp.
|
private |
The worker thread that updates this interface.
Definition at line 633 of file isobus_task_controller_client.hpp.