AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
isobus_task_controller_client.hpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
9#ifndef ISOBUS_TASK_CONTROLLER_CLIENT_HPP
10#define ISOBUS_TASK_CONTROLLER_CLIENT_HPP
11
16#include "isobus/utility/processing_flags.hpp"
17
18#include <list>
19#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
20#include <thread>
21#endif
22
23namespace isobus
24{
27 {
28 public:
61
63 enum class Version : std::uint8_t
64 {
70 Unknown = 0xFF
71 };
72
74 enum class ServerOptions : std::uint8_t
75 {
76 SupportsDocumentation = 0x01,
77 SupportsTCGEOWithoutPositionBasedControl = 0x02,
78 SupportsTCGEOWithPositionBasedControl = 0x04,
79 SupportsPeerControlAssignment = 0x08,
80 SupportsImplementSectionControlFunctionality = 0x10,
81 ReservedOption1 = 0x20,
82 ReservedOption2 = 0x40,
83 ReservedOption3 = 0x80
84 };
85
87 using RequestValueCommandCallback = bool (*)(std::uint16_t elementNumber,
88 std::uint16_t DDI,
89 std::int32_t &processVariableValue,
90 void *parentPointer);
91
93 using ValueCommandCallback = bool (*)(std::uint16_t elementNumber,
94 std::uint16_t DDI,
95 std::int32_t processVariableValue,
96 void *parentPointer);
97
102 TaskControllerClient(std::shared_ptr<PartneredControlFunction> partner, std::shared_ptr<InternalControlFunction> clientSource, std::shared_ptr<PartneredControlFunction> primaryVT);
103
106
107 // Setup Functions
111 void initialize(bool spawnThread);
112
120 void add_request_value_callback(RequestValueCommandCallback callback, void *parentPointer);
121
128 void add_value_command_callback(ValueCommandCallback callback, void *parentPointer);
129
133 void remove_request_value_callback(RequestValueCommandCallback callback, void *parentPointer);
134
138 void remove_value_command_callback(ValueCommandCallback callback, void *parentPointer);
139
154 void configure(std::shared_ptr<DeviceDescriptorObjectPool> DDOP,
155 std::uint8_t maxNumberBoomsSupported,
156 std::uint8_t maxNumberSectionsSupported,
157 std::uint8_t maxNumberChannelsSupportedForPositionBasedControl,
158 bool reportToTCSupportsDocumentation,
159 bool reportToTCSupportsTCGEOWithoutPositionBasedControl,
160 bool reportToTCSupportsTCGEOWithPositionBasedControl,
161 bool reportToTCSupportsPeerControlAssignment,
162 bool reportToTCSupportsImplementSectionControl);
163
179 void configure(std::uint8_t const *binaryDDOP,
180 std::uint32_t DDOPSize,
181 std::uint8_t maxNumberBoomsSupported,
182 std::uint8_t maxNumberSectionsSupported,
183 std::uint8_t maxNumberChannelsSupportedForPositionBasedControl,
184 bool reportToTCSupportsDocumentation,
185 bool reportToTCSupportsTCGEOWithoutPositionBasedControl,
186 bool reportToTCSupportsTCGEOWithPositionBasedControl,
187 bool reportToTCSupportsPeerControlAssignment,
188 bool reportToTCSupportsImplementSectionControl);
189
204 void configure(std::shared_ptr<std::vector<std::uint8_t>> binaryDDOP,
205 std::uint8_t maxNumberBoomsSupported,
206 std::uint8_t maxNumberSectionsSupported,
207 std::uint8_t maxNumberChannelsSupportedForPositionBasedControl,
208 bool reportToTCSupportsDocumentation,
209 bool reportToTCSupportsTCGEOWithoutPositionBasedControl,
210 bool reportToTCSupportsTCGEOWithPositionBasedControl,
211 bool reportToTCSupportsPeerControlAssignment,
212 bool reportToTCSupportsImplementSectionControl);
213
216 void restart();
217
218 // Calling this will stop the worker thread if it exists
220 void terminate();
221
224 std::shared_ptr<InternalControlFunction> get_internal_control_function() const;
225
228 std::shared_ptr<PartneredControlFunction> get_partner_control_function() const;
229
232 std::uint8_t get_number_booms_supported() const;
233
236 std::uint8_t get_number_sections_supported() const;
237
241
244 bool get_supports_documentation() const;
245
249
253
257
261
265 bool get_is_initialized() const;
266
269 bool get_is_connected() const;
270
276 bool get_is_task_active() const;
277
281
284 std::uint8_t get_connected_tc_number_booms_supported() const;
285
289
293
296 std::uint8_t get_connected_tc_max_boot_time() const;
297
302
306
313 void on_value_changed_trigger(std::uint16_t elementNumber, std::uint16_t DDI);
314
319
327 bool reupload_device_descriptor_object_pool(std::shared_ptr<std::vector<std::uint8_t>> binaryDDOP);
328
337 bool reupload_device_descriptor_object_pool(std::uint8_t const *binaryDDOP, std::uint32_t DDOPSize);
338
346 bool reupload_device_descriptor_object_pool(std::shared_ptr<DeviceDescriptorObjectPool> DDOP);
347
352 void update();
353
356
357 protected:
359 enum class ProcessDataCommands : std::uint8_t
360 {
361 TechnicalCapabilities = 0x00,
362 DeviceDescriptor = 0x01,
363 RequestValue = 0x02,
364 Value = 0x03,
370 PeerControlAssignment = 0x09,
372 Reserved1 = 0x0B,
373 Reserved2 = 0x0C,
375 StatusMessage = 0x0E,
376 ClientTask = 0x0F
377 };
378
380 enum class TechnicalDataMessageCommands : std::uint8_t
381 {
383 ParameterVersion = 0x01,
385 };
386
405
415 static bool process_internal_object_pool_upload_callback(std::uint32_t callbackIndex,
416 std::uint32_t bytesOffset,
417 std::uint32_t numberOfBytesNeeded,
418 std::uint8_t *chunkBuffer,
419 void *parentPointer);
420
422 void clear_queues();
423
426 bool get_was_ddop_supplied() const;
427
430
433
436
440 static void process_rx_message(const CANMessage &message, void *parentPointer);
441
449 static void process_tx_callback(std::uint32_t parameterGroupNumber,
450 std::uint32_t dataLength,
451 std::shared_ptr<InternalControlFunction> sourceControlFunction,
452 std::shared_ptr<ControlFunction> destinationControlFunction,
453 bool successful,
454 void *parentPointer);
455
461 bool send_delete_object_pool() const;
462
467 bool send_generic_process_data(std::uint8_t multiplexor) const;
468
472 bool send_object_pool_activate() const;
473
477 bool send_object_pool_deactivate() const;
478
483 bool send_pdack(std::uint16_t elementNumber, std::uint16_t ddi) const;
484
494
500
508 bool send_request_structure_label() const;
509
513
516 bool send_status() const;
517
523 bool send_value_command(std::uint16_t elementNumber, std::uint16_t ddi, std::int32_t value) const;
524
527 bool send_version_request() const;
528
531 bool send_working_set_master() const;
532
542 void set_common_config_items(std::uint8_t maxNumberBoomsSupported,
543 std::uint8_t maxNumberSectionsSupported,
544 std::uint8_t maxNumberChannelsSupportedForPositionBasedControl,
545 bool reportToTCSupportsDocumentation,
546 bool reportToTCSupportsTCGEOWithoutPositionBasedControl,
547 bool reportToTCSupportsTCGEOWithPositionBasedControl,
548 bool reportToTCSupportsPeerControlAssignment,
549 bool reportToTCSupportsImplementSectionControl);
550
553 void set_state(StateMachineState newState);
554
559 void set_state(StateMachineState newState, std::uint32_t timestamp);
560
563
566
567 static constexpr std::uint32_t SIX_SECOND_TIMEOUT_MS = 6000;
568 static constexpr std::uint16_t TWO_SECOND_TIMEOUT_MS = 2000;
569
570 private:
573 {
577 bool operator==(const ProcessDataCallbackInfo &obj) const;
578 std::int32_t processDataValue;
579 std::int32_t lastValue;
580 std::uint16_t elementNumber;
581 std::uint16_t ddi;
584 };
585
596
607
615
616 std::shared_ptr<PartneredControlFunction> partnerControlFunction;
617 std::shared_ptr<InternalControlFunction> myControlFunction;
618 std::shared_ptr<PartneredControlFunction> primaryVirtualTerminal;
619 std::shared_ptr<DeviceDescriptorObjectPool> clientDDOP;
620 std::uint8_t const *userSuppliedBinaryDDOP = nullptr;
621 std::shared_ptr<std::vector<std::uint8_t>> userSuppliedVectorDDOP;
622 std::vector<std::uint8_t> generatedBinaryDDOP;
623 std::vector<RequestValueCommandCallbackInfo> requestValueCallbacks;
624 std::vector<ValueCommandCallbackInfo> valueCommandsCallbacks;
625 std::list<ProcessDataCallbackInfo> queuedValueRequests;
626 std::list<ProcessDataCallbackInfo> queuedValueCommands;
627 std::list<ProcessDataCallbackInfo> measurementTimeIntervalCommands;
628 std::list<ProcessDataCallbackInfo> measurementMinimumThresholdCommands;
629 std::list<ProcessDataCallbackInfo> measurementMaximumThresholdCommands;
630 std::list<ProcessDataCallbackInfo> measurementOnChangeThresholdCommands;
632#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
633 std::thread *workerThread = nullptr;
634#endif
635 std::string ddopStructureLabel;
637 std::array<std::uint8_t, 7> ddopLocalizationLabel = { 0 };
640 std::uint32_t stateMachineTimestamp_ms = 0;
641 std::uint32_t statusMessageTimestamp_ms = 0;
645 std::uint8_t numberOfWorkingSetMembers = 1;
646 std::uint8_t tcStatusBitfield = 0;
648 std::uint8_t commandBeingExecuted = 0;
649 std::uint8_t serverVersion = 0;
650 std::uint8_t maxServerBootTime_s = 0;
651 std::uint8_t serverOptionsByte1 = 0;
652 std::uint8_t serverOptionsByte2 = 0;
656 std::uint8_t numberBoomsSupported = 0;
657 std::uint8_t numberSectionsSupported = 0;
659 bool initialized = false;
660 bool shouldTerminate = false;
661 bool enableStatusMessage = false;
668 };
669} // namespace isobus
670
671#endif // ISOBUS_TASK_CONTROLLER_CLIENT_HPP
A representation of an ISOBUS ECU that we can send from. Use this class when defining your own contro...
A class that describes a control function on the bus that the stack should communicate with....
A class that represents a generic CAN message of arbitrary length.
An interface for requesting and parsing the ISO11783 language command PGN, 0xFE0F.
A class to manage a client connection to a ISOBUS field computer's task controller or data logger.
bool send_working_set_master() const
Sends the working set master message.
std::uint8_t serverNumberOfBoomsForSectionControl
When reported by the TC, this is the maximum number of section control booms that are supported.
bool request_task_controller_identification() const
Sends a broadcast request to TCs to identify themseleves.
std::string ddopStructureLabel
Stores a pre-parsed structure label, helps to avoid processing the whole DDOP during a CAN message ca...
std::shared_ptr< PartneredControlFunction > partnerControlFunction
The partner control function this client will send to.
TaskControllerClient(std::shared_ptr< PartneredControlFunction > partner, std::shared_ptr< InternalControlFunction > clientSource, std::shared_ptr< PartneredControlFunction > primaryVT)
The constructor for a TaskControllerClient.
void select_language_command_partner()
Sets the behavior of the language command interface based on the TC's reported version information.
std::shared_ptr< PartneredControlFunction > primaryVirtualTerminal
A pointer to the primary VT's control function. Used for TCs < version 4 and language command compati...
bool send_pdack(std::uint16_t elementNumber, std::uint16_t ddi) const
Sends a Process Data ACK.
std::uint8_t numberOfWorkingSetMembers
The number of working set members that will be reported in the working set master message.
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 co...
bool send_request_version_response() const
Sends the response to a request for version from the TC.
std::list< ProcessDataCallbackInfo > queuedValueRequests
A list of queued value requests that will be processed on the next update.
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_with_position_based_control() const
Returns if the client has been configured to report that it supports TC-GEO with position based contr...
std::uint8_t serverOptionsByte1
The options specified in ISO 11783-10 that this TC, DL, or client meets (The definition of this byte ...
std::uint8_t maxServerBootTime_s
Maximum number of seconds from a power cycle to transmission of first �Task Controller Status message...
bool send_status() const
Sends the status message to the TC.
std::list< ProcessDataCallbackInfo > queuedValueCommands
A list of queued value commands that will be processed on the next update.
bool get_is_task_active() const
Returns if a task is active as indicated by the TC.
void remove_request_value_callback(RequestValueCommandCallback callback, void *parentPointer)
Removes the specified callback from the list of value request callbacks.
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
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.
std::uint32_t statusMessageTimestamp_ms
Timestamp corresponding to the last time we sent a status message to the TC.
std::uint8_t const * userSuppliedBinaryDDOP
Stores a client-provided DDOP if one was provided.
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.
bool(*)(std::uint16_t elementNumber, std::uint16_t DDI, std::int32_t &processVariableValue, void *parentPointer) RequestValueCommandCallback
A callback for handling a value request command from the TC.
bool send_request_structure_label() const
Sends a request to the TC for its structure label.
void update()
The cyclic update function for this interface.
std::list< ProcessDataCallbackInfo > measurementTimeIntervalCommands
A list of measurement commands that will be processed on a time interval.
Mutex clientMutex
A general mutex to protect data in the worker thread against data accessed by the app or the network ...
bool get_is_initialized() const
Returns if the client has been initialized.
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.
bool enableStatusMessage
Enables sending the status message to the TC cyclically.
std::uint8_t tcStatusBitfield
The last received TC/DL status from the status message.
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.
bool send_object_pool_activate() const
Sends the activate object pool message.
std::uint8_t sourceAddressOfCommandBeingExecuted
Source address of client for which the current command is being executed.
bool send_generic_process_data(std::uint8_t multiplexor) const
Sends a process data message with 1 mux byte and all 0xFFs as payload.
std::shared_ptr< PartneredControlFunction > get_partner_control_function() const
Returns the control function of the TC server with which this TC client communicates.
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 serv...
bool supportsDocumentation
Determines if the client reports documentation support to the TC.
std::uint32_t serverStatusMessageTimestamp_ms
Timestamp corresponding to the last time we received a status message from the TC.
void process_queued_commands()
Processes queued TC requests and commands. Calls the user's callbacks if needed.
std::uint8_t serverOptionsByte2
Reserved for ISO assignment, should be zero or 0xFF.
std::uint8_t get_connected_tc_number_sections_supported() const
Returns the number of sections that the connected TC supports for section control.
bool(*)(std::uint16_t elementNumber, std::uint16_t DDI, std::int32_t processVariableValue, void *parentPointer) ValueCommandCallback
A callback for handling a set value command from the TC.
LanguageCommandInterface languageCommandInterface
Used to determine the language and unit systems in use by the TC server.
std::uint8_t get_connected_tc_number_booms_supported() const
Returns the number of booms that the connected TC supports for section control.
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.
StateMachineState
Enumerates the different internal state machine states.
@ WaitForRequestVersionFromServer
Waiting to see if the TC will request our version (optional)
@ WaitForDeleteObjectPoolResponse
Waiting for a response to our request to delete our object pool off the TC.
@ RequestVersion
Requests the TC version and related data from the TC.
@ WaitForStructureLabelResponse
Client is waiting for the TC to respond to our request for its structure label.
@ SendRequestVersionResponse
Sending our response to the TC's request for out version information.
@ WaitForServerStatusMessage
Client is waiting to identify the TC via reception of a valid status message.
@ SendStatusMessage
Enables sending the status message.
@ RequestLocalizationLabel
Client is requesting the DDOP localization label the TC has for us (if any)
@ WaitForDDOPTransfer
The DDOP transfer in ongoing. Client is waiting for a callback from the transport layer.
@ SendWorkingSetMaster
Client initating communication with TC by sending the working set master message.
@ RequestLanguage
Client is requesting the language command PGN from the TC.
@ SendDeleteObjectPool
Client is sending a request to the TC to delete its current copy of our object pool.
@ DeactivateObjectPool
Client is shutting down and is therefore sending the deactivate object pool message.
@ WaitForObjectPoolActivateResponse
Client is waiting for a response to its request to activate the object pool.
@ SendRequestTransferObjectPool
Client is requesting to transfer the DDOP to the TC.
@ WaitForRequestTransferObjectPoolResponse
Waiting for a response to our request to transfer the DDOP to the TC.
@ SendObjectPoolActivate
Client is sending the activate object pool message.
@ RequestStructureLabel
Client is requesting the DDOP structure label that the TC has (if any)
@ WaitForObjectPoolDeactivateResponse
Client is waiting for a response to the deactivate object pool message.
@ WaitForObjectPoolTransferResponse
DDOP has transferred. Waiting for a response to our object pool transfer.
@ BeginTransferDDOP
Client is initiating the DDOP transfer.
@ WaitForLocalizationLabelResponse
Waiting for a response to our request for the localization label from the TC.
@ WaitForStartUpDelay
Client is waiting for the mandatory 6s startup delay.
@ WaitForLanguageResponse
Waiting for a response to our request for the language command PGN.
@ ProcessDDOP
Client is processing the DDOP into a binary DDOP and validating object IDs in the pool.
@ Disconnected
Not communicating with the TC.
@ WaitForRequestVersionResponse
Waiting for the TC to respond to a request for its version.
std::uint32_t stateMachineTimestamp_ms
Timestamp that tracks when the state machine last changed states (in milliseconds)
void initialize(bool spawnThread)
This function starts the state machine. Call this once you have created your DDOP,...
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.
std::string previousStructureLabel
Stores the last structure label we used, helps to warn the user if they aren't updating the label pro...
std::uint8_t commandBeingExecuted
The current command the TC is executing as reported in the status message.
ProcessDataCommands
Enumerates the different Process Data commands from ISO11783-10 Table B.1.
@ StatusMessage
Message is a Task Controller Status message.
@ MeasurementMaximumWithinThreshold
The client has to send the value of this data element to the TC or DL when the value is lower than th...
@ ProcessDataAcknowledge
Message is a Process Data Acknowledge (PDACK).
@ MeasurementMinimumWithinThreshold
The client has to send the value of this data element to the TC or DL when the value is higher than t...
@ DeviceDescriptor
Subcommand for the transfer and management of device descriptors.
@ Value
This command is used both to answer a request value command and to set the value of a process data en...
@ PeerControlAssignment
This message is used to establish a connection between a setpoint value source and a setpoint value u...
@ TechnicalCapabilities
Used for determining the technical capabilities of a TC, DL, or client.
@ MeasurementChangeThreshold
The client has to send the value of this data element to the TC or DL when the value change is higher...
@ RequestValue
The value of the data entity specified by the data dictionary identifier is requested.
@ MeasurementTimeInterval
The process data value is the time interval for sending the data element specified by the data dictio...
@ MeasurementDistanceInterval
The process data value is the distance interval for sending the data element specified by the data di...
@ SetValueAndAcknowledge
This command is used to set the value of a process data entity and request a reception acknowledgemen...
std::vector< std::uint8_t > generatedBinaryDDOP
Stores the DDOP in binary form after it has been generated.
static void process_rx_message(const CANMessage &message, void *parentPointer)
Processes a CAN message destined for any TC client.
bool get_connected_tc_option_supported(ServerOptions option) const
Returns if the connected TC supports a certain option.
std::list< ProcessDataCallbackInfo > measurementMinimumThresholdCommands
A list of measurement commands that will be processed when the value drops below a threshold.
std::uint8_t get_number_booms_supported() const
Returns the previously configured number of booms supported by the client.
std::uint8_t serverVersion
The detected version of the TC Server.
std::uint8_t get_connected_tc_max_boot_time() const
Returns the maximum boot time in seconds reported by the connected TC.
std::shared_ptr< DeviceDescriptorObjectPool > clientDDOP
Stores the DDOP for upload to the TC (if needed)
void remove_value_command_callback(ValueCommandCallback callback, void *parentPointer)
Removes the specified callback from the list of value command callbacks.
std::list< ProcessDataCallbackInfo > measurementOnChangeThresholdCommands
A list of measurement commands that will be processed when the value changes by the specified amount.
Version
Enumerates the different task controller versions.
@ SecondPublishedEdition
The version of the second edition published as the final draft International Standard(E2....
@ FinalDraftInternationalStandardFirstEdition
The version of the FDIS.1 (final draft International Standard, first edition).
@ DraftInternationalStandard
The version of the DIS (draft International Standard).
@ SecondEditionDraft
The version of the second edition published as a draft International Standard(E2.DIS).
@ FirstPublishedEdition
The version of the FDIS.2 and the first edition published ss an International Standard.
bool send_delete_object_pool() const
Sends the delete object pool command to the TC.
DDOPUploadType ddopUploadMode
Determines if DDOPs get generated or raw uploaded.
std::uint32_t languageCommandWaitingTimestamp_ms
Timestamp used to determine when to give up on waiting for a language command response.
std::uint8_t get_connected_tc_number_channels_supported() const
Returns the number of channels that the connected TC supports for position control.
bool send_object_pool_deactivate() const
Sends the deactivate object pool message.
StateMachineState get_state() const
Returns the current state machine state.
bool supportsTCGEOWithoutPositionBasedControl
Determines if the client reports TC-GEO without position control capability to the TC.
std::uint8_t get_number_sections_supported() const
Returns the previously configured number of section supported by the client.
TechnicalDataMessageCommands
Enumerates the subcommands within the technical data message group.
@ ParameterRequestVersion
The Request Version message allows the TC, DL, and the client to determine the ISO 11783-10 version o...
@ ParameterVersion
The Version message is sent in response to the request version message and contains the ISO 11783-10 ...
@ IdentifyTaskController
Upon receipt of this message, the TC shall display, for a period of 3 s, the TC Number.
bool send_request_object_pool_transfer() const
Sends a request to the TC indicating we wish to transfer an object pool.
std::vector< ValueCommandCallbackInfo > valueCommandsCallbacks
A list of callbacks that will be called when the TC sets a process data value.
std::uint8_t serverNumberOfSectionsForSectionControl
When reported by the TC, this is the maximum number of sections that are supported (or 0xFF for versi...
std::shared_ptr< std::vector< std::uint8_t > > userSuppliedVectorDDOP
Stores a client-provided DDOP if one was provided.
void process_queued_threshold_commands()
Processes measurement threshold/interval commands.
static constexpr std::uint32_t SIX_SECOND_TIMEOUT_MS
The startup delay time defined in the standard.
static constexpr std::uint16_t TWO_SECOND_TIMEOUT_MS
Used for sending the status message to the TC.
bool initialized
Tracks the initialization state of the interface instance.
std::uint8_t numberBoomsSupported
Stores the number of booms this client supports for section control.
bool shouldReuploadAfterDDOPDeletion
Used to determine how the state machine should progress when updating a DDOP.
void terminate()
Terminates the client and joins the worker thread if applicable.
std::vector< RequestValueCommandCallbackInfo > requestValueCallbacks
A list of callbacks that will be called when the TC requests a process data value.
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 shouldTerminate
This variable tells the worker thread to exit.
bool supportsImplementSectionControl
Determines if the client reports implement section control capability to the TC.
void restart()
Calling this function will reset the task controller client's connection with the TC server,...
StateMachineState currentState
Tracks the internal state machine's current state.
std::uint8_t serverNumberOfChannelsForPositionBasedControl
When reported by the TC, this is the maximum number of individual control channels that is supported.
ServerOptions
Enumerates the bits stored in our version data that we send to the TC when handshaking.
std::shared_ptr< InternalControlFunction > get_internal_control_function() const
Returns the internal control function being used by the interface to send messages.
bool get_supports_implement_section_control() const
Returns if the client has been configured to report that it supports implement section control to the...
std::list< ProcessDataCallbackInfo > measurementMaximumThresholdCommands
A list of measurement commands that will be processed when the value above a threshold.
void process_labels_from_ddop()
Searches the DDOP for a device object and stores that object's structure and localization labels.
bool send_request_localization_label() const
Sends a request to the TC for its localization label.
std::uint8_t numberSectionsSupported
Stores the number of sections this client supports for section control.
DeviceDescriptorCommands
Enumerates the subcommands within the device descriptor command message group.
@ ObjectPoolTransferResponse
Response to an object pool transfer.
@ LocalizationLabel
Sent by the TC or DL to inform the client about the availability of the requested localization versio...
@ ObjectPoolTransfer
Enables the client to transfer (part of) the device descriptor object pool to the TC.
@ RequestObjectPoolTransfer
The Request Object-pool Transfer message allows the client to determine whether it is allowed to tran...
@ RequestObjectPoolTransferResponse
Sent in response to Request 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.
@ ObjectPoolDelete
This is a message to delete the device descriptor object pool for the client that sends this message.
@ StructureLabel
The Structure Label message is sent by the TC or DL to inform the client about the availability of th...
@ ChangeDesignator
This message is used to update the designator of an object.
@ ObjectPoolDeleteResponse
TC response to a Object-pool Delete message.
@ ObjectPoolActivateDeactivate
sent by a client to complete its connection procedure to a TC or DL or to disconnect from a TC or DL.
@ ChangeDesignatorResponse
Sent in response to Change Designator message.
std::shared_ptr< InternalControlFunction > myControlFunction
The internal control function the client uses to send from.
Version get_connected_tc_version() const
Returns the version of the connected task controller.
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.
bool get_supports_peer_control_assignment() const
Returns if the client has been configured to report that it supports peer control assignment to the T...
std::uint32_t userSuppliedBinaryDDOPSize_bytes
The number of bytes in the user provided binary DDOP (if one was provided)
std::thread * workerThread
The worker thread that updates this interface.
bool get_is_connected() const
Check whether the client is connected to the TC server.
DDOPUploadType
Enumerates the modes that the client may use when dealing with a DDOP.
@ 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.
std::array< std::uint8_t, 7 > ddopLocalizationLabel
Stores a pre-parsed localization label, helps to avoid processing the whole DDOP during a CAN message...
std::uint8_t numberChannelsSupportedForPositionBasedControl
Stores the number of channels this client supports for position based control.
~TaskControllerClient()
Destructor for the client.
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 de...
bool supportsPeerControlAssignment
Determines if the client reports peer control assignment capability to the TC.
void set_state(StateMachineState newState)
Changes the internal state machine state and updates the associated timestamp.
bool supportsTCGEOWithPositionBasedControl
Determines if the client reports TC-GEO with position control capability to the TC.
bool send_version_request() const
Sends the version request message to the TC.
void worker_thread_function()
The worker thread will execute this function when it runs, if applicable.
Defines an interface for creating a Task Controller DDOP.
Defines a set of values found in the isobus language command message from ISO11783-7 commonly used in...
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
Stores data related to requests and commands from the TC.
std::uint16_t elementNumber
The element number for the command.
bool ackRequested
Stores if the TC used the mux that also requires a PDACK.
bool operator==(const ProcessDataCallbackInfo &obj) const
Allows easy comparison of callback data.
std::int32_t lastValue
Used for measurement commands to store timestamp or previous values.
std::int32_t processDataValue
The value of the value set command.
bool thresholdPassed
Used when the structure is being used to track measurement command thresholds to know if the threshol...
Stores a TC value command callback along with its parent pointer.
bool operator==(const RequestValueCommandCallbackInfo &obj) const
Allows easy comparison of callback data.
Stores a TC value command callback along with its parent pointer.
void * parent
The parent pointer, generic context value.
bool operator==(const ValueCommandCallbackInfo &obj) const
Allows easy comparison of callback data.