zcl

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidData = errors.New("invalid data")
View Source
var ErrNotEnoughData = errors.New("not enough data")
View Source
var ErrNotImplemented = errors.New("not implemented")
View Source
var SizeDynamic = -2
View Source
var SizeInvalid = -1

Functions

func ParseValue

func ParseValue(typ DataType, data []byte) (interface{}, []byte, error)

func SerializeFrame

func SerializeFrame(frame Frame) []byte

func SerializeReadReportingConfigurationCommand

func SerializeReadReportingConfigurationCommand(command ReadReportingConfigurationCommand) []byte

Types

type AttributeID

type AttributeID uint16

func (AttributeID) String

func (id AttributeID) String() string

type AttributeRecord

type AttributeRecord struct {
	Direction   byte
	AttributeID AttributeID
}

type AttributeReport

type AttributeReport struct {
	AttributeID AttributeID
	DataType    DataType
	Value       interface{}
}

func ParseAttributeReport

func ParseAttributeReport(data []byte) (AttributeReport, []byte, error)

type AttributeReportingConfigurationRecord

type AttributeReportingConfigurationRecord struct {
	Status                   Status
	Direction                byte
	AttributeID              AttributeID
	DataType                 DataType
	MinimumReportingInterval uint16
	MaximumReportingInterval uint16
	ReportableChange         interface{}
	TimeoutPeriod            uint16
}

func ParseAttributeReportingConfigurationRecord

func ParseAttributeReportingConfigurationRecord(data []byte) (AttributeReportingConfigurationRecord, []byte, error)

type ClusterID

type ClusterID uint16
const (
	ClusterGeneralBasic               ClusterID = 0x0000
	ClusterGeneralPowerConfig         ClusterID = 0x0001
	ClusterGeneralDeviceTempConfig    ClusterID = 0x0002
	ClusterGeneralIdentify            ClusterID = 0x0003
	ClusterGeneralGroups              ClusterID = 0x0004
	ClusterGeneralScenes              ClusterID = 0x0005
	ClusterGeneralOnOff               ClusterID = 0x0006
	ClusterGeneralOnOffSwitchConfig   ClusterID = 0x0007
	ClusterGeneralLevelControl        ClusterID = 0x0008
	ClusterGeneralAlarms              ClusterID = 0x0009
	ClusterGeneralTime                ClusterID = 0x000a
	ClusterGeneralLocation            ClusterID = 0x000b
	ClusterGeneralDiagnostics         ClusterID = 0x0b05
	ClusterGeneralPollControl         ClusterID = 0x0020
	ClusterGeneralPowerProfile        ClusterID = 0x001a
	ClusterGeneralMeterIdentification ClusterID = 0x0b01

	ClusterGeneralAnalogInputBasic      ClusterID = 0x000c
	ClusterGeneralAnalogOutputBasic     ClusterID = 0x000d
	ClusterGeneralAnalogValueBasic      ClusterID = 0x000e
	ClusterGeneralBinaryInputBasic      ClusterID = 0x000f
	ClusterGeneralBinaryOutputBasic     ClusterID = 0x0010
	ClusterGeneralBinaryValueBasic      ClusterID = 0x0011
	ClusterGeneralMultistateInputBasic  ClusterID = 0x0012
	ClusterGeneralMultistateOutputBasic ClusterID = 0x0013
	ClusterGeneralMultistateValueBasic  ClusterID = 0x0014

	ClusterMSIlluminanceMeasurement        ClusterID = 0x0400
	ClusterMSIlluminanceLevelSensingConfig ClusterID = 0x0401
	ClusterMSTemperatureMeasurement        ClusterID = 0x0402
	ClusterMSPressureMeasurement           ClusterID = 0x0403
	ClusterMSFlowMeasurement               ClusterID = 0x0404
	ClusterMSRelativeHumidity              ClusterID = 0x0405
	ClusterMSOccupancySensing              ClusterID = 0x0406
	ClusterMSElectricalMeasurement         ClusterID = 0x0b04
)

func (ClusterID) String

func (id ClusterID) String() string

type CommandID

type CommandID byte
const (
	CommandReadAttributes                     CommandID = 0x00
	CommandReadAttributesResponse             CommandID = 0x01
	CommandWriteAttributes                    CommandID = 0x02
	CommandWriteAttributesUndivided           CommandID = 0x03
	CommandWriteAttributesResponse            CommandID = 0x04
	CommandWriteAttributesNoResponse          CommandID = 0x05
	CommandConfigureReporting                 CommandID = 0x06
	CommandConfigureReportingResponse         CommandID = 0x07
	CommandReadReportingConfiguration         CommandID = 0x08
	CommandReadReportingConfigurationResponse CommandID = 0x09
	CommandReportAttributes                   CommandID = 0x0a
	CommandDefaultResponse                    CommandID = 0x0b
	CommandDiscoverAttributes                 CommandID = 0x0c
	CommandDiscoverAttributesResponse         CommandID = 0x0d
	CommandReadAttributesStructured           CommandID = 0x0e
	CommandWriteAttributesStructured          CommandID = 0x0f
	CommandWriteAttributesStructuredResponse  CommandID = 0x10
	CommandDiscoverCommandsReceived           CommandID = 0x11
	CommandDiscoverCommandsReceivedResponse   CommandID = 0x12
	CommandDiscoverCommandsGenerated          CommandID = 0x13
	CommandDiscoverCommandsGeneratedResponse  CommandID = 0x14
	CommandDiscoverAttributesExtended         CommandID = 0x15
	CommandDiscoverAttributesExtendedResponse CommandID = 0x16
)

func (CommandID) String

func (id CommandID) String() string

type DataType

type DataType byte
const (
	DataTypeNoData DataType = 0x00

	DataTypeData8  DataType = 0x08
	DataTypeData16 DataType = 0x09
	DataTypeData24 DataType = 0x0a
	DataTypeData32 DataType = 0x0b
	DataTypeData40 DataType = 0x0c
	DataTypeData48 DataType = 0x0d
	DataTypeData56 DataType = 0x0e
	DataTypeData64 DataType = 0x0f

	DataTypeBool DataType = 0x10

	DataTypeBitmap8  DataType = 0x18
	DataTypeBitmap16 DataType = 0x19
	DataTypeBitmap24 DataType = 0x1a
	DataTypeBitmap32 DataType = 0x1b
	DataTypeBitmap40 DataType = 0x1c
	DataTypeBitmap48 DataType = 0x1d
	DataTypeBitmap56 DataType = 0x1e
	DataTypeBitmap64 DataType = 0x1f

	DataTypeUint8  DataType = 0x20
	DataTypeUint16 DataType = 0x21
	DataTypeUint24 DataType = 0x22
	DataTypeUint32 DataType = 0x23
	DataTypeUint40 DataType = 0x24
	DataTypeUint48 DataType = 0x25
	DataTypeUint56 DataType = 0x26
	DataTypeUint64 DataType = 0x27

	DataTypeInt8  DataType = 0x28
	DataTypeInt16 DataType = 0x29
	DataTypeInt24 DataType = 0x2a
	DataTypeInt32 DataType = 0x2b
	DataTypeInt40 DataType = 0x2c
	DataTypeInt48 DataType = 0x2d
	DataTypeInt56 DataType = 0x2e
	DataTypeInt64 DataType = 0x2f

	DataTypeEnum8  DataType = 0x30
	DataTypeEnum16 DataType = 0x31

	DataTypeFloat16 DataType = 0x38
	DataTypeFloat32 DataType = 0x39
	DataTypeFloat64 DataType = 0x3a

	DataTypeOctetString         DataType = 0x41
	DataTypeCharacterString     DataType = 0x42
	DataTypeLongOctetString     DataType = 0x43
	DataTypeLongCharacterString DataType = 0x44

	DataTypeArray     DataType = 0x48
	DataTypeStructure DataType = 0x4c

	DataTypeSet DataType = 0x50
	DataTypeBag DataType = 0x51

	DataTypeTimeOfDay DataType = 0xe0
	DataTypeDate      DataType = 0xe1
	DataTypeUTCTime   DataType = 0xe2

	DataTypeClusterID   DataType = 0xe8
	DataTypeAttributeID DataType = 0xe9
	DataTypeBACnetOID   DataType = 0xea

	DataTypeIEEEAddress    DataType = 0xf0
	DataTypeSecurityKey128 DataType = 0xf1

	DataTypeUnknown DataType = 0xff
)

func (DataType) SizeInBytes

func (typ DataType) SizeInBytes() int

func (DataType) String

func (typ DataType) String() string

type Frame

type Frame struct {
	FrameHeader
	Data []byte
}

func ParseFrame

func ParseFrame(data []byte) (Frame, error)

type FrameHeader

type FrameHeader struct {
	Type                    FrameType
	ManufacturerSpecific    bool
	DirectionServerToClient bool
	DisableDefaultResponse  bool

	ManufacturerCode uint16
	TransSeqNumber   uint8
	CommandID        CommandID
}

type FrameType

type FrameType byte
const (
	FrameTypeGlobal FrameType = 0b00
	FrameTypeLocal  FrameType = 0b01
)

func (FrameType) String

func (t FrameType) String() string

type ReadAttributeStatusRecord

type ReadAttributeStatusRecord struct {
	AttributeID AttributeID
	Status      Status
	DataType    DataType
	Value       interface{}
}

func ParseReadAttributeStatusRecord

func ParseReadAttributeStatusRecord(data []byte) (ReadAttributeStatusRecord, []byte, error)

type ReadAttributesCommand

type ReadAttributesCommand struct {
	Attributes []AttributeID
}

func ParseReadAttributesCommand

func ParseReadAttributesCommand(data []byte) (ReadAttributesCommand, error)

type ReadAttributesResponseCommand

type ReadAttributesResponseCommand struct {
	Records []ReadAttributeStatusRecord
}

func ParseReadAttributesResponseCommand

func ParseReadAttributesResponseCommand(data []byte) (ReadAttributesResponseCommand, error)

type ReadReportingConfigurationCommand

type ReadReportingConfigurationCommand struct {
	Records []AttributeRecord
}

type ReadReportingConfigurationResponseCommand

type ReadReportingConfigurationResponseCommand struct {
	Records []AttributeReportingConfigurationRecord
}

func ParseReadReportingConfigurationResponseCommand

func ParseReadReportingConfigurationResponseCommand(data []byte) (ReadReportingConfigurationResponseCommand, error)

type ReportAttributesCommand

type ReportAttributesCommand struct {
	Reports []AttributeReport
}

func ParseReportAttributesCommand

func ParseReportAttributesCommand(data []byte) (ReportAttributesCommand, error)

type Status

type Status byte
const (
	StatusSuccess                               Status = 0x00
	StatusFailure                               Status = 0x01
	StatusNotAuthorized                         Status = 0x7e
	StatusReservedFieldNotZero                  Status = 0x7f
	StatusMalformedCommand                      Status = 0x80
	StatusUnsupportedClusterCommand             Status = 0x81
	StatusUnsupportedGeneralCommand             Status = 0x82
	StatusUnsupportedManufacturerClusterCommand Status = 0x83
	StatusUnsupportedManufacturerGeneralCommand Status = 0x84
	StatusInvalidField                          Status = 0x85
	StatusUnsupportedAttribute                  Status = 0x86
	StatusInvalidValue                          Status = 0x87
	StatusReadOnly                              Status = 0x88
	StatusInsufficientSpace                     Status = 0x89
	StatusDuplicateExists                       Status = 0x8a
	StatusNotFound                              Status = 0x8b
	StatusUnreportableAttribute                 Status = 0x8c
	StatusInvalidDataType                       Status = 0x8d
	StatusInvalidSelector                       Status = 0x8e
	StatusWriteOnly                             Status = 0x8f
	StatusInconsistentStartupState              Status = 0x90
	StatusDefinedOutOfBand                      Status = 0x91
	StatusInconsistent                          Status = 0x92
	StatusActionDenied                          Status = 0x93
	StatusTimeout                               Status = 0x94
	StatusAbort                                 Status = 0x95
	StatusInvalidImage                          Status = 0x96
	StatusWaitForData                           Status = 0x97
	StatusNoImageAvailable                      Status = 0x98
	StatusRequireMoreImage                      Status = 0x99
	StatusNotificationPending                   Status = 0x9a
	StatusHardwareFailure                       Status = 0xc0
	StatusSoftwareFailure                       Status = 0xc1
	StatusCalibrationError                      Status = 0xc2
	StatusUnsupportedCluster                    Status = 0xc3
)

func (Status) String

func (status Status) String() string

Jump to

Keyboard shortcuts

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