isoxml

package
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultName = "---"

Variables

View Source
var (
	ErrFilePathEmpty = errors.New("file path cannot be empty")
	ErrReadingFile   = errors.New("failed to read file")
	ErrParsingXML    = errors.New("failed to parse XML")
)
View Source
var ErrNoTimezone = errors.New("isoxml: xs:dateTime has no timezone and no fallback Location was supplied")

ErrNoTimezone is returned by parseISOXMLDateTime (and the StartTime / StopTime accessors that call it) when the raw xs:dateTime attribute carries no timezone information AND the caller did not supply a fallback Location.

Per ISO 11783-10 §D.2 / §D.48, a timezone-less xs:dateTime is "local time of the producing system". That zone is not recorded anywhere in the file, so the reader cannot recover the true UTC instant without the caller committing to a Location. Returning this sentinel makes the ambiguity a hard failure rather than a silent ±14h mistranslation.

Use errors.Is(err, isoxml.ErrNoTimezone) to detect it.

Functions

func ARGBToVTColour

func ARGBToVTColour(argb uint32) uint8

ARGBToVTColour returns the VT palette index whose RGB is closest (squared Euclidean distance) to the low 24 bits of argb. The alpha byte is ignored.

func GetCustomerName

func GetCustomerName(task *Task, taskData *ISO11783TaskData) string

func GetFarmName

func GetFarmName(task *Task, taskData *ISO11783TaskData) string

func MarshalTaskData

func MarshalTaskData(taskdata *ISO11783TaskData) ([]byte, error)

MarshalTaskData produces the XML encoding of an ISO11783TaskData, including the XML declaration header.

func VTColourARGB

func VTColourARGB(i uint8) uint32

VTColourARGB converts an ISO 11783-6 VT palette index to 0xAARRGGBB with alpha fixed to 0xFF (the VT palette defines no alpha).

Types

type AllocationStamp

type AllocationStamp struct {
	Start    string              `xml:"A,attr"`
	Stop     string              `xml:"B,attr,omitempty"`
	Duration uint64              `xml:"C,attr,omitempty"`
	Type     AllocationStampType `xml:"D,attr"`
	Position *Position           `xml:"PTN,omitempty"`
}

AllocationStamp records an allocation event with a start time, an optional stop or duration, an allocation type (planned or effective), and optionally up to two Position elements marking the start and stop.

func (*AllocationStamp) Elapsed

func (s *AllocationStamp) Elapsed() time.Duration

Elapsed converts the raw Duration (seconds) into a time.Duration. Returns zero when Duration is zero.

func (*AllocationStamp) StartTime

func (s *AllocationStamp) StartTime(loc *time.Location) (time.Time, error)

StartTime parses the Start xs:dateTime attribute into a time.Time.

If the raw string carries a timezone (Z or explicit offset), loc is ignored. If the raw string has no timezone, the value is resolved in loc; passing loc == nil in that case returns ErrNoTimezone so the ambiguity is surfaced to the caller rather than silently defaulted to UTC.

An empty Start is treated as an error; check the field before calling.

func (*AllocationStamp) StopTime

func (s *AllocationStamp) StopTime(loc *time.Location) (time.Time, error)

StopTime parses the Stop xs:dateTime attribute. Same Location rules as StartTime.

type AllocationStampType

type AllocationStampType string

AllocationStampType classifies an AllocationStamp. ISO 11783-10:2015 §D.2. Note the spec defines only values 1 and 4 — there is no value 2 or 3 here.

const (
	AllocationStampTypePlanned   AllocationStampType = "1" // supplied by FMIS (office-side scheduling)
	AllocationStampTypeEffective AllocationStampType = "4" // recorded by MICS (the actual allocation that happened in the field)
)

type CodedComment

type CodedComment struct {
	CodedCommentId         string                   `xml:"A,attr"`
	CodedCommentDesignator string                   `xml:"B,attr"`
	CodedCommentScope      CodedCommentScope        `xml:"C,attr"`
	CodedCommentGroupIdRef string                   `xml:"D,attr,omitempty"`
	CodedCommentListValue  []*CodedCommentListValue `xml:"CCL,omitempty"`
}

CodedComment is a predefined comment that can be attached to a task, optionally grouped via CodedCommentGroupIdRef and optionally refined by a list of CodedCommentListValue qualifiers (e.g. low, medium, high).

type CodedCommentGroup

type CodedCommentGroup struct {
	CodedCommentGroupId         string `xml:"A,attr"`
	CodedCommentGroupDesignator string `xml:"B,attr"`
}

CodedCommentGroup groups predefined CodedComments under a common label (for example "weeds") so mobile systems can navigate and select them more easily.

type CodedCommentListValue

type CodedCommentListValue struct {
	CodedCommentListValueId         string `xml:"A,attr"`
	CodedCommentListValueDesignator string `xml:"B,attr"`
}

CodedCommentListValue provides a value to qualify a coded comment (e.g. "low", "medium", "high"); each one belongs to a single CodedComment and may be referenced from a CommentAllocation.

type CodedCommentScope

type CodedCommentScope string

CodedCommentScope selects how a CodedComment applies. ISO 11783-10:2015 §D.5.

const (
	CodedCommentScopePoint      CodedCommentScope = "1" // attached to a single position
	CodedCommentScopeGlobal     CodedCommentScope = "2" // applies to the whole task
	CodedCommentScopeContinuous CodedCommentScope = "3" // active over a time/position range; activating one forces 1 Hz time+position logging
)

type ColourLegend

type ColourLegend struct {
	ColourLegendId string         `xml:"A,attr"`
	DefaultColour  uint8          `xml:"B,attr,omitempty"`
	ColourRange    []*ColourRange `xml:"CRG"`
}

ColourLegend describes a colour legend for presenting grid-map values in different colours; it contains one or more ColourRange entries and an optional DefaultColour used when a value falls outside every range.

type ColourRange

type ColourRange struct {
	MinimumValue int64 `xml:"A,attr"`
	MaximumValue int64 `xml:"B,attr"`
	Colour       uint8 `xml:"C,attr"`
}

ColourRange specifies the colour to use for values falling within a given inclusive numeric range on a grid map; a ColourLegend contains one or more of these to present different value ranges in different colours.

type CommentAllocation

type CommentAllocation struct {
	CodedCommentIdRef          string           `xml:"A,attr,omitempty"`
	CodedCommentListValueIdRef string           `xml:"B,attr,omitempty"`
	FreeCommentText            string           `xml:"C,attr,omitempty"`
	ASP                        *AllocationStamp `xml:"ASP,omitempty"`
}

CommentAllocation allocates either a referenced CodedComment (optionally refined by a CodedCommentListValue) or a free-form operator comment to a task, pinned to a time and position by an embedded AllocationStamp.

type Connection

type Connection struct {
	DeviceIdRef0        string `xml:"A,attr"`
	DeviceElementIdRef0 string `xml:"B,attr"`
	DeviceIdRef1        string `xml:"C,attr"`
	DeviceElementIdRef1 string `xml:"D,attr"`
}

Connection specifies how two devices are linked within a task by referencing the two "connector" DeviceElements (one per device) whose relative positions let the TC compute device geometry.

type CropType

type CropType struct {
	CropTypeId         string         `xml:"A,attr"`
	CropTypeDesignator string         `xml:"B,attr"`
	CropVariety        []*CropVariety `xml:"CVT,omitempty"`
}

CropType describes a crop that can be cultivated on a partfield; it carries an id and a designator and may include a list of CropVariety entries.

type CropVariety

type CropVariety struct {
	CropVarietyId         string `xml:"A,attr"`
	CropVarietyDesignator string `xml:"B,attr"`
}

CropVariety describes a variety of a crop specified by CropType that can be cultivated on a partfield; each CropVariety belongs to a single CropType.

type CulturalPractice

type CulturalPractice struct {
	CulturalPracticeId          string                         `xml:"A,attr"`
	CulturalPracticeDesignator  string                         `xml:"B,attr"`
	OperationTechniqueReference []*OperationTechniqueReference `xml:"OTR,omitempty"`
}

CulturalPractice describes one or a series of activities to realize an objective in crop production (e.g. "primary soil tillage", "seeding", "fertilization"); it carries an id and a designator and may reference a list of OperationTechniques that realize the practice.

type Customer

type Customer struct {
	CustomerId         string `xml:"A,attr"`
	CustomerDesignator string `xml:"B,attr"`
	CustomerFirstName  string `xml:"C,attr,omitempty"`
	CustomerStreet     string `xml:"D,attr,omitempty"`
	CustomerPOBox      string `xml:"E,attr,omitempty"`
	CustomerPostalCode string `xml:"F,attr,omitempty"`
	CustomerCity       string `xml:"G,attr,omitempty"`
	CustomerState      string `xml:"H,attr,omitempty"`
	CustomerCountry    string `xml:"I,attr,omitempty"`
	CustomerPhone      string `xml:"J,attr,omitempty"`
	CustomerMobile     string `xml:"K,attr,omitempty"`
	CustomerFax        string `xml:"L,attr,omitempty"`
	CustomerEMail      string `xml:"M,attr,omitempty"`
}

type DDIUnit

type DDIUnit string

DDIUnit represents a unit symbol as defined in the ISOBUS 11783-11 data dictionary. Values correspond to the UnitSymbol column of isobus_ddentity.csv.

const (
	DDIUnitCount       DDIUnit = "#"
	DDIUnitPercent     DDIUnit = "%"
	DDIUnitPerM2       DDIUnit = "/m²"
	DDIUnitPerS        DDIUnit = "/s"
	DDIUnitAmpere      DDIUnit = "A"
	DDIUnitHz          DDIUnit = "Hz"
	DDIUnitLiter       DDIUnit = "L"
	DDIUnitNewton      DDIUnit = "N"
	DDIUnitNewtonMeter DDIUnit = "N*m"
	DDIUnitOhm         DDIUnit = "Ohm"
	DDIUnitPascal      DDIUnit = "Pa"
	DDIUnitVolt        DDIUnit = "V"
	DDIUnitWatt        DDIUnit = "W"
	DDIUnitGram        DDIUnit = "g"
	DDIUnitHour        DDIUnit = "h"
	DDIUnitKWh         DDIUnit = "kWh"
	DDIUnitKWhPerM2    DDIUnit = "kWh/m²"
	DDIUnitKg          DDIUnit = "kg"
	DDIUnitKgPerH      DDIUnit = "kg/h"
	DDIUnitMeter       DDIUnit = "m"
	DDIUnitMillikelvin DDIUnit = "mK"
	DDIUnitMSPerM      DDIUnit = "mS/m"
	DDIUnitMgPer1000   DDIUnit = "mg/1000"
	DDIUnitMgPerKg     DDIUnit = "mg/kg"
	DDIUnitMgPerL      DDIUnit = "mg/l"
	DDIUnitMgPerM2     DDIUnit = "mg/m²"
	DDIUnitMgPerS      DDIUnit = "mg/s"
	DDIUnitMl          DDIUnit = "ml"
	DDIUnitMlPer1000   DDIUnit = "ml/1000"
	DDIUnitMlPerM      DDIUnit = "ml/m"
	DDIUnitMlPerM2     DDIUnit = "ml/m²"
	DDIUnitMlPerS      DDIUnit = "ml/s"
	DDIUnitMm          DDIUnit = "mm"
	DDIUnitMmPerS      DDIUnit = "mm/s"
	DDIUnitMm2PerS     DDIUnit = "mm²/s"
	DDIUnitMm3PerKg    DDIUnit = "mm³/kg"
	DDIUnitMm3PerM2    DDIUnit = "mm³/m²"
	DDIUnitMm3PerM3    DDIUnit = "mm³/m³"
	DDIUnitMm3PerS     DDIUnit = "mm³/s"
	DDIUnitMs          DDIUnit = "ms"
	DDIUnitM2          DDIUnit = "m²"
	DDIUnitNA          DDIUnit = "n.a."
	DDIUnitNotDefined  DDIUnit = "not defined"
	DDIUnitPpm         DDIUnit = "ppm"
	DDIUnitRpm         DDIUnit = "r/min"
	DDIUnitSecond      DDIUnit = "s"
	DDIUnitDegree      DDIUnit = "°"
)

type DataLogMethod

type DataLogMethod uint8

DataLogMethod is a bit-flag (1–31) selecting how the TC should sample the requested DDI. ISO 11783-10:2015 §D.17. Time/distance/on-change methods combine freely; the threshold-limits bit gates them. The "total" bit is independent. The same five bit values are surfaced by DeviceProcessData.DeviceProcessDataTriggerMethods (§D.23) — a method chosen here must be in the device's supported set.

const (
	DataLogMethodTimeInterval     DataLogMethod = 1  // sample every N milliseconds (DataLogTimeInterval)
	DataLogMethodDistanceInterval DataLogMethod = 2  // sample every N millimetres travelled (DataLogDistanceInterval)
	DataLogMethodThresholdLimits  DataLogMethod = 4  // sample only while value is within DataLogThresholdMinimum..Maximum
	DataLogMethodOnChange         DataLogMethod = 8  // sample when value changes by ≥ DataLogThresholdChange
	DataLogMethodTotal            DataLogMethod = 16 // running total — emitted once per Time element, independent of the other bits
)

type DataLogTrigger

type DataLogTrigger struct {
	DataLogDDI              string        `xml:"A,attr"`
	DataLogMethod           DataLogMethod `xml:"B,attr"`
	DataLogDistanceInterval int64         `xml:"C,attr,omitempty"`
	DataLogTimeInterval     int64         `xml:"D,attr,omitempty"`
	DataLogThresholdMinimum int64         `xml:"E,attr,omitempty"`
	DataLogThresholdMaximum int64         `xml:"F,attr,omitempty"`
	DataLogThresholdChange  int64         `xml:"G,attr,omitempty"`
	DeviceElementIdRef      string        `xml:"H,attr,omitempty"`
	ValuePresentationIdRef  string        `xml:"I,attr,omitempty"`
	DataLogPGN              uint64        `xml:"J,attr,omitempty"`
	DataLogPGNStartBit      uint8         `xml:"K,attr,omitempty"`
	DataLogPGNStopBit       uint8         `xml:"L,attr,omitempty"`
}

DataLogTrigger specifies which ProcessDataVariable (identified by DDI) shall be logged as DataLogValues during task processing, together with the bit-flagged log method (time/distance interval, threshold limits, on change, total), optional interval and threshold parameters, an optional DeviceElement/ValuePresentation reference, and optional PGN bit-range selection for logging values from a parameter group.

type DataLogValue

type DataLogValue struct {
	ProcessDataDDI     string `xml:"A,attr"`
	ProcessDataValue   int64  `xml:"B,attr"`
	DeviceElementIdRef string `xml:"C,attr"`
	DataLogPGN         uint64 `xml:"D,attr,omitempty"`
	DataLogPGNStartBit uint8  `xml:"E,attr,omitempty"`
	DataLogPGNStopBit  uint8  `xml:"F,attr,omitempty"`
}

DataLogValue specifies a single value of a single ProcessDataVariable (identified by its DDI) supplied by a single DeviceElement; its position and time come from the enclosing Time element. When the value is logged from a parameter group, ProcessDataDDI is DFFE and DataLogPGN with its start/stop bits select the bit range.

type DataTransferOrigin

type DataTransferOrigin string

DataTransferOrigin identifies which system most recently generated this data transfer file set. ISO 11783-10:2015 §D.32.

const (
	DataTransferOriginFMIS DataTransferOrigin = "1" // Farm Management Information System (the office-side software)
	DataTransferOriginMICS DataTransferOrigin = "2" // Mobile Implement Control System (the in-cab task controller)
)

type Device

type Device struct {
	DeviceId                string                     `xml:"A,attr"`
	DeviceDesignator        string                     `xml:"B,attr,omitempty"`
	DeviceSoftwareVersion   string                     `xml:"C,attr,omitempty"`
	ClientNAME              string                     `xml:"D,attr"`
	DeviceSerialNumber      string                     `xml:"E,attr,omitempty"`
	DeviceStructureLabel    string                     `xml:"F,attr"`
	DeviceLocalizationLabel string                     `xml:"G,attr"`
	DeviceElement           []*DeviceElement           `xml:"DET"`
	DeviceProperty          []*DeviceProperty          `xml:"DPT,omitempty"`
	DeviceProcessData       []*DeviceProcessData       `xml:"DPD,omitempty"`
	DeviceValuePresentation []*DeviceValuePresentation `xml:"DVP,omitempty"`
}

Device describes a complete device — a machine or sensor system — identified by its ISO 11783-5 client NAME and labelled with the hex-binary structure and localization labels that identify its device descriptor object pool; each Device shall contain at least one DeviceElement and may carry a flat namespace of DeviceProcessData, DeviceProperty and DeviceValuePresentation objects referenced by object id from its DeviceElements.

type DeviceAllocation

type DeviceAllocation struct {
	ClientNAMEValue string           `xml:"A,attr"`
	ClientNAMEMask  string           `xml:"B,attr,omitempty"`
	DeviceIdRef     string           `xml:"C,attr,omitempty"`
	ASP             *AllocationStamp `xml:"ASP,omitempty"`
}

DeviceAllocation records which device(s) a task was planned for or actually processed with: a required 8-byte ClientNAME value, an optional ClientNAME bit-mask allowing a range of NAME values, an optional reference to a specific Device, and an optional AllocationStamp pinning the allocation in time.

type DeviceElement

type DeviceElement struct {
	DeviceElementId         string                   `xml:"A,attr"`
	DeviceElementObjectId   uint16                   `xml:"B,attr"`
	DeviceElementType       DeviceElementType        `xml:"C,attr"`
	DeviceElementDesignator string                   `xml:"D,attr,omitempty"`
	DeviceElementNumber     uint16                   `xml:"E,attr"`
	ParentObjectId          uint16                   `xml:"F,attr"`
	DeviceObjectReference   []*DeviceObjectReference `xml:"DOR,omitempty"`
}

DeviceElement describes a functional or physical element of a Device (one of seven types: device, function, bin, section, unit, connector, navigation); DeviceElements form a hierarchy via ParentObjectId (pointing either at the parent DeviceElement's ObjectId or at 0 for the Device itself) and carry an optional list of DeviceObjectReferences into the Device's flat DPD/DPT/DVP object-pool namespace.

type DeviceElementType

type DeviceElementType string

DeviceElementType selects the role a DeviceElement plays inside its Device's hierarchy. ISO 11783-10:2015 §D.21 (definitions in Annex A.3).

const (
	DeviceElementTypeDevice     DeviceElementType = "1" // root element of the descriptor (the machine itself); ParentObjectId=0
	DeviceElementTypeFunction   DeviceElementType = "2" // a complete operation/function group (e.g. seeding, spreading)
	DeviceElementTypeBin        DeviceElementType = "3" // product container (tank, hopper)
	DeviceElementTypeSection    DeviceElementType = "4" // individually controllable boom/row section
	DeviceElementTypeUnit       DeviceElementType = "5" // smaller controllable unit beneath a Section (e.g. single nozzle / row unit)
	DeviceElementTypeConnector  DeviceElementType = "6" // physical attach point used by the Connection element to relate two devices
	DeviceElementTypeNavigation DeviceElementType = "7" // navigation reference point of the device (used to position other elements)
)

type DeviceObjectReference

type DeviceObjectReference struct {
	DeviceObjectId uint16 `xml:"A,attr"`
}

DeviceObjectReference links a DeviceElement to a DeviceProcessData or DeviceProperty object in the Device's flat object-pool namespace, via a single ObjectId that is unique inside the device descriptor.

type DeviceProcessData

type DeviceProcessData struct {
	DeviceProcessDataObjectId       uint16                          `xml:"A,attr"`
	DeviceProcessDataDDI            string                          `xml:"B,attr"`
	DeviceProcessDataProperty       DeviceProcessDataProperty       `xml:"C,attr"`
	DeviceProcessDataTriggerMethods DeviceProcessDataTriggerMethods `xml:"D,attr"`
	DeviceProcessDataDesignator     string                          `xml:"E,attr,omitempty"`
	DeviceValuePresentationObjectId uint16                          `xml:"F,attr,omitempty"`
}

DeviceProcessData describes a ProcessDataVariable DDI supported by the DeviceElements that reference this entry from the enclosing Device's flat object-pool namespace, carrying a property bitfield (default-set / settable / control-source, mutually exclusive), a supported-trigger-methods bitfield (time / distance / threshold / on-change / total), and optional designator and DeviceValuePresentation reference.

type DeviceProcessDataProperty

type DeviceProcessDataProperty uint8

DeviceProcessDataProperty is a bit-flag (0–7) describing a ProcessDataVariable's behaviour. ISO 11783-10:2015 §D.23. Settable and ControlSource are mutually exclusive.

const (
	DeviceProcessDataPropertyDefaultSet    DeviceProcessDataProperty = 1 // include this DDI in the default working set the TC should subscribe to
	DeviceProcessDataPropertySettable      DeviceProcessDataProperty = 2 // the TC may write a setpoint to this DDI (e.g. prescription rate)
	DeviceProcessDataPropertyControlSource DeviceProcessDataProperty = 4 // v4+ — this element acts as a peer-control source supplying setpoints to another CF
)

type DeviceProcessDataTriggerMethods

type DeviceProcessDataTriggerMethods uint8

DeviceProcessDataTriggerMethods is a bit-flag (0–31) listing which TC log trigger methods this DDI supports. ISO 11783-10:2015 §D.23. The same bit values are reused by DataLogTrigger.DataLogMethod (§D.17) — picking a method there must intersect this set.

const (
	DeviceProcessDataTriggerTimeInterval     DeviceProcessDataTriggerMethods = 1  // sample every N milliseconds
	DeviceProcessDataTriggerDistanceInterval DeviceProcessDataTriggerMethods = 2  // sample every N millimetres travelled
	DeviceProcessDataTriggerThresholdLimits  DeviceProcessDataTriggerMethods = 4  // gate logging on min/max value range
	DeviceProcessDataTriggerOnChange         DeviceProcessDataTriggerMethods = 8  // log only when value changes by ≥ threshold
	DeviceProcessDataTriggerTotal            DeviceProcessDataTriggerMethods = 16 // running total — value reported once per Time element
)

type DeviceProperty

type DeviceProperty struct {
	DevicePropertyObjectId          uint16 `xml:"A,attr"`
	DevicePropertyDDI               string `xml:"B,attr"`
	DevicePropertyValue             int64  `xml:"C,attr"`
	DevicePropertyDesignator        string `xml:"D,attr,omitempty"`
	DeviceValuePresentationObjectId uint16 `xml:"E,attr,omitempty"`
}

DeviceProperty describes a property of a DeviceElement by means of a DDI reference and an integer value; DeviceProperty entries live in the enclosing Device's flat object-pool namespace alongside DeviceProcessData and DeviceValuePresentation, are referenced by DeviceElements via DeviceObjectReference, and may optionally point at a DeviceValuePresentation for display.

type DeviceValuePresentation

type DeviceValuePresentation struct {
	DeviceValuePresentationObjectId uint16  `xml:"A,attr"`
	Offset                          int64   `xml:"B,attr"`
	Scale                           float64 `xml:"C,attr"`
	NumberOfDecimals                uint8   `xml:"D,attr"`
	UnitDesignator                  string  `xml:"E,attr,omitempty"`
}

DeviceValuePresentation specifies how an integer value produced by a ProcessDataVariable within a single Device is presented: the raw integer is offset, scaled, rounded to a fixed number of decimals, and optionally labelled with a unit designator (presented value = (integer + Offset) * Scale, rounded to NumberOfDecimals). DeviceValuePresentation entries live in the enclosing Device's flat object-pool namespace alongside DeviceProcessData and DeviceProperty, and are referenced from those by DeviceValuePresentationObjectId.

type ExternalFileReference

type ExternalFileReference struct {
	Filename string           `xml:"A,attr"`
	Filetype ExternalFileType `xml:"B,attr"`
}

ExternalFileReference refers to an XML file external to the main TASKDATA.XML. An external file can only include top-level XML elements (those that can appear under ISO11783_TaskData), and inside a single external file only one type of top-level element may be specified. Recursive use of XFR or XFC elements is not permitted.

type ExternalFileType

type ExternalFileType string

ExternalFileType selects the format of an externally referenced file. ISO 11783-10:2015 §D.55. Only one value is currently defined.

const (
	ExternalFileTypeXML ExternalFileType = "1"
)

type Farm

type Farm struct {
	FarmId         string `xml:"A,attr"`
	FarmDesignator string `xml:"B,attr"`
	FarmStreet     string `xml:"C,attr,omitempty"`
	FarmPOBox      string `xml:"D,attr,omitempty"`
	FarmPostalCode string `xml:"E,attr,omitempty"`
	FarmCity       string `xml:"F,attr,omitempty"`
	FarmState      string `xml:"G,attr,omitempty"`
	FarmCountry    string `xml:"H,attr,omitempty"`
	CustomerIdRef  string `xml:"I,attr,omitempty"`
}

func GetFarm

func GetFarm(farmId string, taskData *ISO11783TaskData) *Farm

type File

type File struct {
	TaskData ISO11783TaskData
	Binaries map[string][]byte
}

type Grid

type Grid struct {
	GridMinimumNorthPosition float64  `xml:"A,attr"`
	GridMinimumEastPosition  float64  `xml:"B,attr"`
	GridCellNorthSize        float64  `xml:"C,attr"`
	GridCellEastSize         float64  `xml:"D,attr"`
	GridMaximumColumn        uint64   `xml:"E,attr"`
	GridMaximumRow           uint64   `xml:"F,attr"`
	Filename                 string   `xml:"G,attr"`
	Filelength               uint64   `xml:"H,attr,omitempty"`
	GridType                 GridType `xml:"I,attr"`
	TreatmentZoneCode        uint8    `xml:"J,attr,omitempty"`
}

type GridType

type GridType string

GridType selects the binary encoding of the gridcell file backing a site-specific (prescription) Task. ISO 11783-10:2015 §D.27 (file format detail in §8.6.2).

const (
	GridTypeType1 GridType = "1" // each cell carries a TreatmentZoneCode (1 byte) referencing a TZN inside the Task
	GridTypeType2 GridType = "2" // each cell carries the raw process-data values directly, sharing one TZN template (Grid.TreatmentZoneCode)
)

type GuidanceGroup

type GuidanceGroup struct {
	GuidanceGroupId         string             `xml:"A,attr"`
	GuidanceGroupDesignator string             `xml:"B,attr,omitempty"`
	GuidancePattern         []*GuidancePattern `xml:"GPN"`
	BoundaryPolygon         []*Polygon         `xml:"PLN,omitempty"`
}

GuidanceGroup (GGP) bundles GuidancePatterns intended to be used together on the same partfield (e.g. one mainfield pattern plus two headland patterns). ISO 11783-10:2015 §D.29. Added in version 4.

type GuidancePattern

type GuidancePattern struct {
	GuidancePatternId                   string                              `xml:"A,attr"`
	GuidancePatternDesignator           string                              `xml:"B,attr,omitempty"`
	GuidancePatternType                 GuidancePatternType                 `xml:"C,attr"`
	GuidancePatternOptions              GuidancePatternOptions              `xml:"D,attr,omitempty"`
	GuidancePatternPropagationDirection GuidancePatternPropagationDirection `xml:"E,attr,omitempty"`
	GuidancePatternExtension            GuidancePatternExtension            `xml:"F,attr,omitempty"`
	GuidancePatternHeading              float64                             `xml:"G,attr,omitempty"`
	GuidancePatternRadius               uint64                              `xml:"H,attr,omitempty"`
	GuidancePatternGNSSMethod           GuidancePatternGNSSMethod           `xml:"I,attr,omitempty"`
	GuidancePatternHorizontalAccuracy   float64                             `xml:"J,attr,omitempty"`
	GuidancePatternVerticalAccuracy     float64                             `xml:"K,attr,omitempty"`
	BaseStationIdRef                    string                              `xml:"L,attr,omitempty"`
	OriginalSRID                        string                              `xml:"M,attr,omitempty"`
	NumberOfSwathsLeft                  uint64                              `xml:"N,attr,omitempty"`
	NumberOfSwathsRight                 uint64                              `xml:"O,attr,omitempty"`
	LineString                          *LineString                         `xml:"LSG"`
	BoundaryPolygon                     []*Polygon                          `xml:"PLN,omitempty"`
}

GuidancePattern (GPN) describes a guidance line geometry plus the metadata needed to propagate it across the field. ISO 11783-10:2015 §D.30. Added in version 4.

type GuidancePatternExtension

type GuidancePatternExtension string

GuidancePatternExtension controls whether guidance continues past A or B. §D.30 attribute F.

const (
	GuidanceExtensionBoth      GuidancePatternExtension = "1"
	GuidanceExtensionFirstOnly GuidancePatternExtension = "2" // from A only
	GuidanceExtensionLastOnly  GuidancePatternExtension = "3" // from B only
	GuidanceExtensionNone      GuidancePatternExtension = "4"
)

type GuidancePatternGNSSMethod

type GuidancePatternGNSSMethod string

GuidancePatternGNSSMethod mirrors the NMEA 2000 GNSS Method parameter (values 1–8) plus two non-NMEA tokens for desktop/other origins. §D.30 attribute I. Note value 0 ("no GPS fix") is allowed by the V4 XSD but not listed in the 2015 standard's table.

const (
	GuidanceGNSSNoFix     GuidancePatternGNSSMethod = "0"
	GuidanceGNSSFix       GuidancePatternGNSSMethod = "1"
	GuidanceGNSSDGNSS     GuidancePatternGNSSMethod = "2"
	GuidanceGNSSPrecise   GuidancePatternGNSSMethod = "3"
	GuidanceGNSSRTKFixed  GuidancePatternGNSSMethod = "4"
	GuidanceGNSSRTKFloat  GuidancePatternGNSSMethod = "5"
	GuidanceGNSSEstimated GuidancePatternGNSSMethod = "6"
	GuidanceGNSSManual    GuidancePatternGNSSMethod = "7"
	GuidanceGNSSSimulated GuidancePatternGNSSMethod = "8"
	GuidanceGNSSDesktop   GuidancePatternGNSSMethod = "16"
	GuidanceGNSSOther     GuidancePatternGNSSMethod = "17"
)

type GuidancePatternOptions

type GuidancePatternOptions string

GuidancePatternOptions is reserved for pivot patterns (§D.30 attribute D).

const (
	GuidancePatternOptionClockwise        GuidancePatternOptions = "1"
	GuidancePatternOptionCounterClockwise GuidancePatternOptions = "2"
	GuidancePatternOptionFullCircle       GuidancePatternOptions = "3"
)

type GuidancePatternPropagationDirection

type GuidancePatternPropagationDirection string

GuidancePatternPropagationDirection indicates how parallel offset lines grow from the original. Direction is taken while standing on point A and looking toward the next point. §D.30 attribute E.

const (
	GuidancePropagateBoth      GuidancePatternPropagationDirection = "1"
	GuidancePropagateLeftOnly  GuidancePatternPropagationDirection = "2"
	GuidancePropagateRightOnly GuidancePatternPropagationDirection = "3"
	GuidancePropagateNone      GuidancePatternPropagationDirection = "4"
)

type GuidancePatternType

type GuidancePatternType string

GuidancePatternType selects the geometric class of a GuidancePattern. ISO 11783-10:2015 §D.30 (attribute C). The LineString point classification (PointType A / B / Center / Point) follows from this choice.

const (
	GuidancePatternTypeAB     GuidancePatternType = "1" // A-B line — two points (PointType 6 and 7)
	GuidancePatternTypeAPlus  GuidancePatternType = "2" // A+ heading — one point (PointType 6) + GuidancePatternHeading
	GuidancePatternTypeCurve  GuidancePatternType = "3" // adaptive curve — A, intermediate Guidance Points, B
	GuidancePatternTypePivot  GuidancePatternType = "4" // pivot — Center point (PointType 8), optionally A and B for partial circle
	GuidancePatternTypeSpiral GuidancePatternType = "5" // spiral — A, intermediate Guidance Points, B
)

type ISO11783TaskData

type ISO11783TaskData struct {
	XMLName                            xml.Name                 `xml:"ISO11783_TaskData"`
	VersionMajorAttr                   VersionMajor             `xml:"VersionMajor,attr"`
	VersionMinorAttr                   string                   `xml:"VersionMinor,attr"`
	ManagementSoftwareManufacturerAttr string                   `xml:"ManagementSoftwareManufacturer,attr"`
	ManagementSoftwareVersionAttr      string                   `xml:"ManagementSoftwareVersion,attr"`
	TaskControllerManufacturerAttr     string                   `xml:"TaskControllerManufacturer,attr,omitempty"`
	TaskControllerVersionAttr          string                   `xml:"TaskControllerVersion,attr,omitempty"`
	DataTransferOriginAttr             DataTransferOrigin       `xml:"DataTransferOrigin,attr"`
	CCT                                []*CodedComment          `xml:"CCT,omitempty"`
	CCG                                []*CodedCommentGroup     `xml:"CCG,omitempty"`
	CLD                                []*ColourLegend          `xml:"CLD,omitempty"`
	CTP                                []*CropType              `xml:"CTP,omitempty"`
	CPC                                []*CulturalPractice      `xml:"CPC,omitempty"`
	Customer                           []*Customer              `xml:"CTR,omitempty"`
	Farm                               []*Farm                  `xml:"FRM,omitempty"`
	DVC                                []*Device                `xml:"DVC,omitempty"`
	OTQ                                []*OperationTechnique    `xml:"OTQ,omitempty"`
	Partfield                          []*Partfield             `xml:"PFD,omitempty"`
	Product                            []*Product               `xml:"PDT,omitempty"`
	ProductGroup                       []*ProductGroup          `xml:"PGP,omitempty"`
	Task                               []*Task                  `xml:"TSK,omitempty"`
	ValuePresentation                  []*ValuePresentation     `xml:"VPN,omitempty"`
	WKR                                []*Worker                `xml:"WKR,omitempty"`
	XFR                                []*ExternalFileReference `xml:"XFR,omitempty"`
}

func ParseTaskData

func ParseTaskData(filePath string) (*ISO11783TaskData, error)

ParseTaskData reads and unmarshals a TASKDATA.XML file from disk.

func ReadTaskData

func ReadTaskData(r io.Reader) (*ISO11783TaskData, error)

ReadTaskData unmarshals TASKDATA.XML from an io.Reader.

func UnmarshalTaskData

func UnmarshalTaskData(data []byte) (*ISO11783TaskData, error)

UnmarshalTaskData unmarshals TASKDATA.XML bytes into an ISO11783TaskData.

type LineString

type LineString struct {
	LinestringType       LineStringType `xml:"A,attr"`
	LinestringDesignator string         `xml:"B,attr,omitempty"`
	LinestringWidth      uint64         `xml:"C,attr,omitempty"`
	LinestringLength     uint64         `xml:"D,attr,omitempty"`
	LinestringColour     uint8          `xml:"E,attr,omitempty"`
	Points               []*Point       `xml:"PNT"`
}

type LineStringType

type LineStringType string

LineStringType classifies a LineString's role. ISO 11783-10:2015 §D.33.

const (
	LineStringTypePolygonExterior LineStringType = "1" // outer ring of a Polygon
	LineStringTypePolygonInterior LineStringType = "2" // inner ring (hole) of a Polygon
	LineStringTypeTramLine        LineStringType = "3" // controlled-traffic / skip-row tramline path
	LineStringTypeSamplingRoute   LineStringType = "4" // soil/crop sampling route
	LineStringTypeGuidancePattern LineStringType = "5" // guidance line geometry; LineStringWidth carries the swathe width
	LineStringTypeDrainage        LineStringType = "6" // tile/surface drainage line
	LineStringTypeFence           LineStringType = "7"
	LineStringTypeFlag            LineStringType = "8" // flag annotation; LinestringDesignator surfaces as an operator message along the line
	LineStringTypeObstacle        LineStringType = "9" // v4+ — generic obstacle to warn the operator
)

type OperTechPractice

type OperTechPractice struct {
	CulturalPracticeIdRef   string `xml:"A,attr"`
	OperationTechniqueIdRef string `xml:"B,attr,omitempty"`
}

OperTechPractice (OTP) provides a task-related assignment of the combination of a specific operation technique with a single cultural practice. It appears as a child of Task and references a CulturalPractice (required) and optionally an OperationTechnique.

type OperationTechnique

type OperationTechnique struct {
	OperationTechniqueId         string `xml:"A,attr"`
	OperationTechniqueDesignator string `xml:"B,attr"`
}

OperationTechnique describes an operation technique such as "drilling", "spreading" or "gaseous"; it carries an id and a designator and is referenced from CulturalPractice via OperationTechniqueReference.

type OperationTechniqueReference

type OperationTechniqueReference struct {
	OperationTechniqueIdRef string `xml:"A,attr"`
}

OperationTechniqueReference contains a reference to a single OperationTechnique. It appears inside CulturalPractice to list the operation techniques that realize the practice.

type Partfield

type Partfield struct {
	PartfieldId         string           `xml:"A,attr"`
	PartfieldCode       string           `xml:"B,attr,omitempty"`
	PartfieldDesignator string           `xml:"C,attr"`
	PartfieldArea       uint64           `xml:"D,attr"`
	CustomerIdRef       string           `xml:"E,attr,omitempty"`
	FarmIdRef           string           `xml:"F,attr,omitempty"`
	CropTypeIdRef       string           `xml:"G,attr,omitempty"`
	CropVarietyIdRef    string           `xml:"H,attr,omitempty"`
	FieldIdRef          string           `xml:"I,attr,omitempty"`
	Polygon             []*Polygon       `xml:"PLN,omitempty"`
	LineString          []*LineString    `xml:"LSG,omitempty"`
	Point               []*Point         `xml:"PNT,omitempty"`
	GuidanceGroup       []*GuidanceGroup `xml:"GGP,omitempty"`
}

func GetPartfield

func GetPartfield(task *Task, taskData *ISO11783TaskData) *Partfield

type Point

type Point struct {
	PointType       PointType `xml:"A,attr"`
	PointDesignator string    `xml:"B,attr,omitempty"`
	PointNorth      float64   `xml:"C,attr"`
	PointEast       float64   `xml:"D,attr"`
	PointUp         int64     `xml:"E,attr,omitempty"`
	PointColour     uint8     `xml:"F,attr,omitempty"`
}

type PointType

type PointType string

PointType classifies the meaning of a Point. ISO 11783-10:2015 §D.38.

const (
	PointTypeFlag                    PointType = "1"  // operator-visible annotation; PointDesignator surfaces as a message
	PointTypeOther                   PointType = "2"  // unclassified
	PointTypeFieldAccess             PointType = "3"  // v4+ — gate / entry where machinery enters the field
	PointTypeStorage                 PointType = "4"  // v4+ — on-field stockpile (e.g. seed pallet, fuel)
	PointTypeObstacle                PointType = "5"  // v4+ — point obstacle to warn against (pole, rock, …)
	PointTypeGuidanceReferenceA      PointType = "6"  // v4+ — A point of an A-B guidance line
	PointTypeGuidanceReferenceB      PointType = "7"  // v4+ — B point of an A-B guidance line
	PointTypeGuidanceReferenceCenter PointType = "8"  // v4+ — centre of a pivot guidance pattern
	PointTypeGuidancePoint           PointType = "9"  // v4+ — intermediate guidance point (Curve/Spiral); not A, B, or Center
	PointTypePartfieldReferencePoint PointType = "10" // v4+ — administrative reference location for the field (e.g. centroid)
	PointTypeHomebase                PointType = "11" // v4+ — farm yard / depot
)

type Polygon

type Polygon struct {
	PolygonType       PolygonType   `xml:"A,attr"`
	PolygonDesignator string        `xml:"B,attr,omitempty"`
	PolygonArea       uint64        `xml:"C,attr,omitempty"`
	PolygonColour     uint8         `xml:"D,attr,omitempty"`
	LineString        []*LineString `xml:"LSG"`
}

type PolygonType

type PolygonType string

PolygonType classifies a Polygon. ISO 11783-10:2015 §D.39.

const (
	PolygonTypePartfieldBoundary PolygonType = "1"  // outer boundary of the field
	PolygonTypeTreatmentZone     PolygonType = "2"  // a TreatmentZone's geometry (rate / setpoint area)
	PolygonTypeWaterSurface      PolygonType = "3"  // pond, ditch, etc.
	PolygonTypeBuilding          PolygonType = "4"  // structure inside the field
	PolygonTypeRoad              PolygonType = "5"  // road crossing or bordering the field
	PolygonTypeObstacle          PolygonType = "6"  // areal obstacle to avoid
	PolygonTypeFlag              PolygonType = "7"  // operator-visible annotation; PolygonDesignator surfaces as a message
	PolygonTypeOther             PolygonType = "8"  // unclassified
	PolygonTypeMainfield         PolygonType = "9"  // v4+ — productive area = boundary minus obstacles, water, headland
	PolygonTypeHeadland          PolygonType = "10" // v4+ — turning area, often planted in another direction
	PolygonTypeBufferZone        PolygonType = "11" // v4+ — area treated differently due to environmental regulation (e.g. PPP buffer)
	PolygonTypeWindbreak         PolygonType = "12" // v4+ — surrounding belt that reduces wind on the field
)

type Position

type Position struct {
	PositionNorth      float64        `xml:"A,attr"`
	PositionEast       float64        `xml:"B,attr"`
	PositionUp         int64          `xml:"C,attr,omitempty"`
	PositionStatus     PositionStatus `xml:"D,attr"`
	PDOP               float64        `xml:"E,attr,omitempty"`
	HDOP               float64        `xml:"F,attr,omitempty"`
	NumberOfSatellites uint8          `xml:"G,attr,omitempty"`
	GpsUtcTime         uint64         `xml:"H,attr,omitempty"`
	GpsUtcDate         uint16         `xml:"I,attr,omitempty"`
}

Position describes a measured GPS position. It is included by AllocationStamp and by Time — in the latter case it logs the position at which DataLogValues were recorded. PositionNorth/PositionEast are WGS84 decimal degrees, PositionUp is altitude in millimetres, PositionStatus is the NMEA 2000 MethodGNSS code (see PositionStatus), PDOP/HDOP are quality metrics, NumberOfSatellites is the used-satellite count, and GpsUtcTime / GpsUtcDate together locate the fix in UTC (milliseconds since midnight / days since 1980-01-01).

type PositionStatus

type PositionStatus string

PositionStatus is the NMEA 2000 MethodGNSS code (0–15) reported with a fix. ISO 11783-10:2015 §D.40. Values 9–13 are reserved by NMEA 2000 and have no constants here.

const (
	PositionStatusNoGPSFix     PositionStatus = "0"  // no fix
	PositionStatusGNSSFix      PositionStatus = "1"  // standard GNSS (single-frequency, no corrections)
	PositionStatusDGNSSFix     PositionStatus = "2"  // Differential GNSS (e.g. SBAS / WAAS / EGNOS corrections)
	PositionStatusPreciseGNSS  PositionStatus = "3"  // precise GNSS — no SA, P-code, dual-frequency atmospheric correction
	PositionStatusRTKFixedInt  PositionStatus = "4"  // Real-Time Kinematic with fixed-integer ambiguity — centimetre-level
	PositionStatusRTKFloat     PositionStatus = "5"  // Real-Time Kinematic float (integer ambiguity not resolved) — decimetre-level
	PositionStatusEstimatedDR  PositionStatus = "6"  // dead-reckoning estimate (no live fix)
	PositionStatusManualInput  PositionStatus = "7"  // operator-entered position
	PositionStatusSimulateMode PositionStatus = "8"  // simulator output, not a real fix
	PositionStatusError        PositionStatus = "14" // GNSS receiver reports an error
	PositionStatusNotAvailable PositionStatus = "15" // status is unknown / not reported
)

type ProcessDataVariable

type ProcessDataVariable struct {
	ProcessDataDDI              string                 `xml:"A,attr"`
	ProcessDataValue            int64                  `xml:"B,attr"`
	ProductIdRef                string                 `xml:"C,attr,omitempty"`
	DeviceElementIdRef          string                 `xml:"D,attr,omitempty"`
	ValuePresentationIdRef      string                 `xml:"E,attr,omitempty"`
	ActualCulturalPracticeValue int64                  `xml:"F,attr,omitempty"`
	ElementTypeInstanceValue    string                 `xml:"G,attr,omitempty"`
	ProcessDataVariable         []*ProcessDataVariable `xml:"PDV,omitempty"`
}

type Product

type Product struct {
	ProductId              string      `xml:"A,attr"`
	ProductIdDesignator    string      `xml:"B,attr"`
	ProductGroupIdRef      string      `xml:"C,attr,omitempty"`
	ValuePresentationIdRef string      `xml:"D,attr,omitempty"`
	QuantityDDI            string      `xml:"E,attr,omitempty"`
	ProductType            ProductType `xml:"F,attr,omitempty"`
	MixtureRecipeQuantity  string      `xml:"G,attr,omitempty"`
	DensityMassPerVolume   string      `xml:"H,attr,omitempty"`
	DensityMassPerCount    string      `xml:"I,attr,omitempty"`
	DensityVolumePerCount  string      `xml:"J,attr,omitempty"`
}

type ProductAllocation

type ProductAllocation struct {
	ProductIdRef           string           `xml:"A,attr"`
	QuantityDDI            string           `xml:"B,attr,omitempty"`
	QuantityValue          int64            `xml:"C,attr,omitempty"`
	TransferMode           TransferMode     `xml:"D,attr,omitempty"`
	DeviceElementIdRef     string           `xml:"E,attr,omitempty"`
	ValuePresentationIdRef string           `xml:"F,attr,omitempty"`
	ASP                    *AllocationStamp `xml:"ASP,omitempty"`
}

ProductAllocation allocates a single Product to a task, optionally scoped to a DeviceElement and pinned to a time/position by an embedded AllocationStamp. The transferred or remaining quantity is given by the QuantityDDI (hex, per ISO 11783-11) / QuantityValue pair, with TransferMode distinguishing filling, emptying, and remainder allocations (see TransferMode).

type ProductGroup

type ProductGroup struct {
	ProductGroupId         string           `xml:"A,attr"`
	ProductGroupDesignator string           `xml:"B,attr"`
	ProductGroupType       ProductGroupType `xml:"C,attr"`
}

type ProductGroupType

type ProductGroupType string

ProductGroupType distinguishes a group of substance Products from a group of crop varieties (cross-referenced from CropType/CropVariety). ISO 11783- 10:2015 §D.44 (introduced in v4). When the attribute is absent, the ProductGroup semantics apply.

const (
	ProductGroupTypeProductGroup ProductGroupType = "1" // default — contains substance Products (e.g. "Herbicides")
	ProductGroupTypeCropType     ProductGroupType = "2" // contains crop varieties; cross-referenced by CropType.ProductGroupIdRef
)

type ProductType

type ProductType string

ProductType selects whether a Product is a single substance or a recipe. ISO 11783-10:2015 §D.42 (introduced in v4). When the attribute is absent, the Single semantics apply.

const (
	ProductTypeSingle           ProductType = "1" // default — a single product (no ProductRelation children)
	ProductTypeMixture          ProductType = "2" // reusable mixture recipe; ingredients listed via ProductRelation; selectable from FMIS/MICS product lists
	ProductTypeTemporaryMixture ProductType = "3" // ad-hoc field-mixed recipe; documented but not added to selectable product lists
)

type Task

type Task struct {
	TaskId                        string               `xml:"A,attr"`
	TaskDesignator                string               `xml:"B,attr,omitempty"`
	CustomerIdRef                 string               `xml:"C,attr,omitempty"`
	FarmIdRef                     string               `xml:"D,attr,omitempty"`
	PartfieldIdRef                string               `xml:"E,attr,omitempty"`
	ResponsibleWorkerIdRef        string               `xml:"F,attr,omitempty"`
	TaskStatus                    TaskStatus           `xml:"G,attr"`
	DefaultTreatmentZoneCode      uint8                `xml:"H,attr,omitempty"`
	PositionLostTreatmentZoneCode uint8                `xml:"I,attr,omitempty"`
	OutOfFieldTreatmentZoneCode   uint8                `xml:"J,attr,omitempty"`
	TreatmentZone                 []*TreatmentZone     `xml:"TZN,omitempty"`
	Time                          []*Time              `xml:"TIM,omitempty"`
	OTP                           []*OperTechPractice  `xml:"OTP,omitempty"`
	WAN                           []*WorkerAllocation  `xml:"WAN,omitempty"`
	DAN                           []*DeviceAllocation  `xml:"DAN,omitempty"`
	CNN                           []*Connection        `xml:"CNN,omitempty"`
	PAN                           []*ProductAllocation `xml:"PAN,omitempty"`
	DataLogTrigger                []*DataLogTrigger    `xml:"DLT,omitempty"`
	CAN                           []*CommentAllocation `xml:"CAN,omitempty"`
	TimeLog                       []*TimeLog           `xml:"TLG,omitempty"`
	Grid                          []*Grid              `xml:"GRD,omitempty"`
}

type TaskStatus

type TaskStatus string

TaskStatus is the lifecycle state of a Task. ISO 11783-10:2015 §D.46.

const (
	TaskStatusPlanned   TaskStatus = "1" // scheduled but not yet started
	TaskStatusRunning   TaskStatus = "2" // currently being executed by the TC
	TaskStatusPaused    TaskStatus = "3" // temporarily halted; can be resumed (status returns to Running)
	TaskStatusCompleted TaskStatus = "4" // finished — terminal
	TaskStatusTemplate  TaskStatus = "5" // v4+ — on start, the TC creates a copy and runs the copy; the template is not executed itself
	TaskStatusCanceled  TaskStatus = "6" // v4+ — abandoned without completing — terminal
)

type Time

type Time struct {
	Start        string          `xml:"A,attr"`
	Stop         string          `xml:"B,attr,omitempty"`
	Duration     uint64          `xml:"C,attr,omitempty"`
	Type         TimeType        `xml:"D,attr"`
	Position     []*Position     `xml:"PTN,omitempty"`
	DataLogValue []*DataLogValue `xml:"DLV,omitempty"`
}

Time records a time event on a Task or inside a TimeLog template: a Start (xs:dateTime), an optional Stop or Duration (seconds) making the interval finite, a Type (see TimeType), up to two Positions marking start/stop locations, and a list of DataLogValue samples.

func (*Time) Elapsed

func (t *Time) Elapsed() time.Duration

Elapsed converts the raw Duration (seconds) into a time.Duration. Returns zero when Duration is zero.

func (*Time) IsFinite

func (t *Time) IsFinite() bool

IsFinite reports whether this Time entry defines a bounded interval. Per ISO 11783-10 §D.48, an entry with only Start set is open-ended; setting either Stop or a non-zero Duration closes the interval.

func (*Time) StartTime

func (t *Time) StartTime(loc *time.Location) (time.Time, error)

StartTime parses the Start xs:dateTime attribute into a time.Time.

If the raw string carries a timezone (Z or explicit offset), loc is ignored. If the raw string has no timezone, the value is resolved in loc; passing loc == nil in that case returns ErrNoTimezone so the ambiguity is surfaced to the caller rather than silently defaulted to UTC.

An empty Start is treated as an error; check the field before calling.

func (*Time) StopTime

func (t *Time) StopTime(loc *time.Location) (time.Time, error)

StopTime parses the Stop xs:dateTime attribute. Same Location rules as StartTime.

type TimeLog

type TimeLog struct {
	Filename    string      `xml:"A,attr"`
	Filelength  uint64      `xml:"B,attr,omitempty"`
	TimeLogType TimeLogType `xml:"C,attr"`
}

TimeLog declares a binary-coded data-log file collected for a Task: a unique Filename stem (format "TLG[0-9][0-9][0-9][0-9][0-9]") shared by a companion pair of files (<Filename>.XML records the fixed-value Time template with DataLogValue columns, <Filename>.BIN holds the records), an optional Filelength in bytes, and a TimeLogType code (see TimeLogType).

type TimeLogType

type TimeLogType string

TimeLogType selects the binary timelog file format. ISO 11783-10:2015 §D.49. The enum is reserved for future data-logging methods; today only one value is defined.

const (
	TimeLogTypeBinary1 TimeLogType = "1" // binary timelog file type 1 (per §6.8.2 / §6.8.4)
)

type TimeType

type TimeType string

TimeType classifies a Time entry. ISO 11783-10:2015 §D.48.

const (
	TimeTypePlanned     TimeType = "1" // FMIS-supplied schedule (planned start/stop or duration); max one per Task
	TimeTypePreliminary TimeType = "2" // recorded preliminary work time (e.g. setup, manoeuvring) — see Annex G
	TimeTypePreparation TimeType = "3" // DEPRECATED in v4 — added no detail beyond Preliminary; still emitted by older producers, so kept here for round-trip parsing
	TimeTypeEffective   TimeType = "4" // recorded productive task time; the catch-all when the MICS does not break time down further
	TimeTypeIneffective TimeType = "5" // recorded non-productive time within the task (e.g. waiting)
	TimeTypeRepair      TimeType = "6" // recorded repair / maintenance time
	TimeTypeClearing    TimeType = "7" // recorded clearing time (e.g. unblocking, cleaning)
	TimeTypePoweredDown TimeType = "8" // v4+ — machine of which the TC is a part was powered down
)

type TransferMode

type TransferMode string

TransferMode distinguishes the three kinds of bin-quantity allocation. ISO 11783-10:2015 §D.43. Filling and Emptying carry transferred quantities (going in / out of the bin); Remainder carries the absolute quantity left in the bin at that timestamp. With no Remainder PAN at task start, the FMIS assumes the bin started empty; same at task end.

const (
	TransferModeFilling   TransferMode = "1" // QuantityValue = amount loaded into the bin
	TransferModeEmptying  TransferMode = "2" // QuantityValue = amount removed from the bin
	TransferModeRemainder TransferMode = "3" // v4+ — QuantityValue = absolute amount currently in the bin
)

type TreatmentZone

type TreatmentZone struct {
	TreatmentZoneCode       uint8                  `xml:"A,attr"`
	TreatmentZoneDesignator string                 `xml:"B,attr,omitempty"`
	TreatmentZoneColour     uint8                  `xml:"C,attr,omitempty"`
	Polygon                 []*Polygon             `xml:"PLN,omitempty"`
	ProcessDataVariable     []*ProcessDataVariable `xml:"PDV,omitempty"`
}

type ValuePresentation

type ValuePresentation struct {
	ValuePresentationId string  `xml:"A,attr"`
	Offset              int64   `xml:"B,attr"`
	Scale               float64 `xml:"C,attr"`
	NumberOfDecimals    uint8   `xml:"D,attr"`
	UnitDesignator      string  `xml:"E,attr,omitempty"`
	ColourLegendIdRef   string  `xml:"F,attr,omitempty"`
}

type VersionMajor

type VersionMajor string

VersionMajor is the major release number of ISO 11783-10 that the file claims to meet. ISO 11783-10:2015 §D.32. The same set of tokens is reused by TaskControllerCapabilities.VersionNumber (§D.47) and the LinkList root (§E.2 — LinkList currently allows only "4"). Tokens label stages of the standard's publication lifecycle, not feature levels.

const (
	VersionMajorDIS    VersionMajor = "0" // DIS — Draft International Standard
	VersionMajorFDIS1  VersionMajor = "1" // FDIS.1 — Final Draft International Standard, first edition
	VersionMajorFDIS2  VersionMajor = "2" // FDIS.2 — first edition published as an International Standard
	VersionMajorE2DIS  VersionMajor = "3" // E2.DIS — second edition Draft International Standard
	VersionMajorE2FDIS VersionMajor = "4" // E2.FDIS — second edition Final Draft International Standard (the version most modern files use)
)

type Worker

type Worker struct {
	WorkerId            string `xml:"A,attr"`
	WorkerLastName      string `xml:"B,attr"`
	WorkerFirstName     string `xml:"C,attr,omitempty"`
	WorkerStreet        string `xml:"D,attr,omitempty"`
	WorkerPOBox         string `xml:"E,attr,omitempty"`
	WorkerPostalCode    string `xml:"F,attr,omitempty"`
	WorkerCity          string `xml:"G,attr,omitempty"`
	WorkerState         string `xml:"H,attr,omitempty"`
	WorkerCountry       string `xml:"I,attr,omitempty"`
	WorkerPhone         string `xml:"J,attr,omitempty"`
	WorkerMobile        string `xml:"K,attr,omitempty"`
	WorkerLicenseNumber string `xml:"L,attr,omitempty"`
	WorkerEmail         string `xml:"M,attr,omitempty"`
}

type WorkerAllocation

type WorkerAllocation struct {
	WorkerIdRef string           `xml:"A,attr"`
	ASP         *AllocationStamp `xml:"ASP,omitempty"`
}

WorkerAllocation records the allocation of a Worker to a task, with the start/stop time and the changes of the worker allocation inside the task pinned by an embedded AllocationStamp.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL