Documentation ¶
Overview ¶
Package ets provides functions to extract information from ETS .knxproj and .knxprod exports.
Opening the archive ¶
You can open exported projects and product databases.
archive, err := ets.OpenExportArchive("my-project.knxproj") if err != nil { fmt.Println(err) return } // Make sure to close the archive eventually. defer archive.Close()
OpenExportArchive will scan for project and manufacturer files inside the given export archive. Project and manufacturer files will be stored in ProjectFiles and ManufacturerFiles respectively.
for _, manuFile := range archive.ManufacturerFiles { fmt.Println(manuFile.ContentID) } for _, projFile := range archive.ProjectFiles { fmt.Println(projFile.ProjectID) }
Decoding files ¶
Not all files within the export might be relevant to you. Therefore, no files are decoded automatically.
for _, projFile := range archive.ProjectFiles { projInfo, err := projFile.Decode() if err != nil { log.Println(err) continue } // Variable projInfo contains the project info described in the projFile. fmt.Println("Project", projInfo.Name) }
This decodes only the basic project information. The actual project is contained in the installation files. Each installation file can contain multiple project installations. Yes, this is weird.
for _, instFile := range projFile.InstallationFiles { proj, err := instFile.Decode() if err != nil { log.Println(err) continue } for _, inst := range proj.Installations { fmt.Println("Installation", inst.Name) } }
Index ¶
- type ApplicationProgram
- type ApplicationProgramID
- type Area
- type AreaID
- type ComObject
- type ComObjectID
- type ComObjectInstanceRef
- type ComObjectRef
- type ComObjectRefID
- type Connector
- type DeviceInstance
- type DeviceInstanceID
- type ExportArchive
- type GroupAddress
- type GroupAddressID
- type GroupRange
- type GroupRangeID
- type Installation
- type InstallationFile
- type Line
- type LineID
- type ManufacturerData
- type ManufacturerFile
- type ManufacturerID
- type Project
- type ProjectFile
- type ProjectID
- type ProjectInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationProgram ¶
type ApplicationProgram struct { ID ApplicationProgramID Name string Version uint Objects []ComObject ObjectRefs []ComObjectRef }
ApplicationProgram is an application program.
type ApplicationProgramID ¶
type ApplicationProgramID string
ApplicationProgramID is the ID of an application program.
type ComObject ¶
type ComObject struct { ID ComObjectID Name string Text string Description string FunctionText string ObjectSize string DatapointType string Priority string ReadFlag bool WriteFlag bool CommunicationFlag bool TransmitFlag bool UpdateFlag bool ReadOnInitFlag bool }
ComObject is a communication object.
type ComObjectInstanceRef ¶
type ComObjectInstanceRef struct { RefID ComObjectRefID DatapointType string Connectors []Connector }
ComObjectInstanceRef connects a communication object reference with zero or more group addresses.
type ComObjectRef ¶
type ComObjectRef struct { ID ComObjectRefID RefID ComObjectID Name *string Text *string Description *string FunctionText *string ObjectSize *string DatapointType *string Priority *string ReadFlag *bool WriteFlag *bool CommunicationFlag *bool TransmitFlag *bool UpdateFlag *bool ReadOnInitFlag *bool }
ComObjectRef is an instance/reference to a communication object.
type ComObjectRefID ¶
type ComObjectRefID string
ComObjectRefID is the ID of a communication object reference.
type Connector ¶
type Connector struct { Receive bool RefID GroupAddressID }
Connector is a connection to a group address.
type DeviceInstance ¶
type DeviceInstance struct { ID DeviceInstanceID Name string Address uint ComObjects []ComObjectInstanceRef }
DeviceInstance is a device instance.
type DeviceInstanceID ¶
type DeviceInstanceID string
DeviceInstanceID is the ID of a device instance.
type ExportArchive ¶
type ExportArchive struct { ProjectFiles []ProjectFile ManufacturerFiles []ManufacturerFile // contains filtered or unexported fields }
ExportArchive is a handle to an exported archive (.knxproj or .knxprod).
func OpenExportArchive ¶
func OpenExportArchive(path string) (*ExportArchive, error)
OpenExportArchive opens the exported archive located at given path.
type GroupAddress ¶
type GroupAddress struct { ID GroupAddressID Name string Address uint }
GroupAddress is a group address.
type GroupRange ¶
type GroupRange struct { ID GroupRangeID Name string RangeStart uint RangeEnd uint Addresses []GroupAddress SubRanges []GroupRange }
GroupRange is a range of group addresses.
type Installation ¶
type Installation struct { Name string Topology []Area GroupAddresses []GroupRange }
Installation is an installation within a project.
type InstallationFile ¶
InstallationFile is a file that contains zero or more project installations.
func (*InstallationFile) Decode ¶
func (i *InstallationFile) Decode() (p *Project, err error)
Decode the file in order to retrieve the project inside it.
type Line ¶
type Line struct { ID LineID Name string Address uint Devices []DeviceInstance }
Line is a line.
type ManufacturerData ¶
type ManufacturerData struct { Manufacturer ManufacturerID Programs []ApplicationProgram }
ManufacturerData contains manufacturer-specific data.
func DecodeManufacturerData ¶
func DecodeManufacturerData(r io.Reader) (*ManufacturerData, error)
DecodeManufacturerData parses the contents of a manufacturer file.
func (*ManufacturerData) UnmarshalXML ¶
func (md *ManufacturerData) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.
type ManufacturerFile ¶
ManufacturerFile is a manufacturer file.
func (*ManufacturerFile) Decode ¶
func (mf *ManufacturerFile) Decode() (md *ManufacturerData, err error)
Decode the file in order to retrieve the manufacturer data inside it.
type Project ¶
type Project struct { ID ProjectID Installations []Installation }
Project contains an entire project. These information are usually stored within a file located at P-XXXX/N.xml (0 <= N <= 16).
func DecodeProject ¶
DecodeProject parses the contents of a project file.
func (*Project) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler.
type ProjectFile ¶
type ProjectFile struct { *zip.File ProjectID string InstallationFiles []InstallationFile }
ProjectFile is a file that contains project information.
func (*ProjectFile) Decode ¶
func (pf *ProjectFile) Decode() (pi *ProjectInfo, err error)
Decode the file in order to retrieve the project info inside it.
type ProjectInfo ¶
ProjectInfo contains project information. These information are usually stored in the P-XXXX/Project.xml file.
func DecodeProjectInfo ¶
func DecodeProjectInfo(r io.Reader) (*ProjectInfo, error)
DecodeProjectInfo parses the contents of project info file.
func (*ProjectInfo) UnmarshalXML ¶
func (pi *ProjectInfo) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML implements xml.Unmarshaler.