zcan

package
v0.0.0-...-917be1f Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UNIT_WATT    = "W"
	UNIT_KWH     = "kWh"
	UNIT_CELCIUS = "°C"
	UNIT_PERCENT = "%"
	UNIT_RPM     = "rpm"
	UNIT_M3H     = "m³/h"
	UNIT_SECONDS = "seconds"
	UNIT_UNKNOWN = "unknown"
	UNIT_DAYS    = "Days"
)

Variables

This section is empty.

Functions

func ZehnderVersionDecode

func ZehnderVersionDecode(val uint32) []int

Types

type MsgType

type MsgType uint8
const (
	PDOData MsgType = iota
	HeartBeat
	RMI
)

type PDOSensor

type PDOSensor struct {
	Name string

	Units         string
	DataType      ZehnderType
	DecimalPlaces int
	// contains filtered or unexported fields
}

type PDOValue

type PDOValue struct {
	Sensor PDOSensor
	Value  []byte
}

func (PDOValue) Float

func (pv PDOValue) Float() float64

func (PDOValue) GetData

func (pv PDOValue) GetData() interface{}

func (PDOValue) IsBool

func (pv PDOValue) IsBool() bool

func (PDOValue) IsFloat

func (pv PDOValue) IsFloat() bool

func (PDOValue) IsSigned

func (pv PDOValue) IsSigned() bool

func (PDOValue) IsString

func (pv PDOValue) IsString() bool

func (PDOValue) Number

func (pv PDOValue) Number() uint

func (PDOValue) SignedNumber

func (pv PDOValue) SignedNumber() int

func (PDOValue) String

func (pv PDOValue) String() string

type ZehnderCanMessage

type ZehnderCanMessage struct {
	CanId  uint32
	NodeId uint32
	Data   [8]byte
	Length uint8
	Remote bool
	// contains filtered or unexported fields
}

func MessageFromFrame

func MessageFromFrame(frame can.Frame) ZehnderCanMessage

func (ZehnderCanMessage) String

func (msg ZehnderCanMessage) String() string

type ZehnderDestination

type ZehnderDestination struct {
	DestNodeId byte
	Unit       byte
	SubUnit    byte
}

func NewZehnderDestination

func NewZehnderDestination(node byte, unit byte, subunit byte) ZehnderDestination

func (ZehnderDestination) GetMultiple

func (zr ZehnderDestination) GetMultiple(dev *ZehnderDevice, props []byte, flags ZehnderTypeFlag, cbFn func(*ZehnderRMI))

func (ZehnderDestination) GetOne

func (zr ZehnderDestination) GetOne(dev *ZehnderDevice, prop byte, flags ZehnderTypeFlag, cbFn func(*ZehnderRMI))

func (ZehnderDestination) SetOne

func (zr ZehnderDestination) SetOne(dev *ZehnderDevice, prop byte, value []byte)

type ZehnderDevice

type ZehnderDevice struct {
	Name      string
	NodeID    byte
	Connected bool

	Model           string
	SerialNumber    string
	SoftwareVersion string
	// contains filtered or unexported fields
}

func NewZehnderDevice

func NewZehnderDevice(id byte) *ZehnderDevice

func (*ZehnderDevice) CaptureAll

func (dev *ZehnderDevice) CaptureAll(fn string) error

func (*ZehnderDevice) Connect

func (dev *ZehnderDevice) Connect(interfaceName string) error

func (*ZehnderDevice) DumpPDO

func (dev *ZehnderDevice) DumpPDO()

func (*ZehnderDevice) ProcessDumpFile

func (dev *ZehnderDevice) ProcessDumpFile(filename string) (err error)

func (*ZehnderDevice) RequestPDO

func (dev *ZehnderDevice) RequestPDO(prod byte, pdo uint16, interval byte)

func (*ZehnderDevice) RequestPDOBySlug

func (dev *ZehnderDevice) RequestPDOBySlug(prod byte, pdoSlug string, interval byte) error

func (*ZehnderDevice) SetDefaultRMICallback

func (dev *ZehnderDevice) SetDefaultRMICallback(fn func(*ZehnderRMI))

func (*ZehnderDevice) Start

func (dev *ZehnderDevice) Start() error

func (*ZehnderDevice) StartHttpServer

func (dev *ZehnderDevice) StartHttpServer(host string, port int)

func (*ZehnderDevice) Stop

func (dev *ZehnderDevice) Stop()

func (*ZehnderDevice) Wait

func (dev *ZehnderDevice) Wait()

type ZehnderRMI

type ZehnderRMI struct {
	SourceId   byte
	DestId     byte
	Sequence   byte
	Counter    byte
	IsMulti    bool
	IsRequest  bool
	IsError    bool
	Data       []byte
	DataLength int
	// contains filtered or unexported fields
}

func (*ZehnderRMI) GetData

func (zrmi *ZehnderRMI) GetData(typ ZehnderType) (rv any, err error)

func (ZehnderRMI) MakeCANId

func (zrmi ZehnderRMI) MakeCANId() uint32

type ZehnderType

type ZehnderType int
const (
	CN_BOOL   ZehnderType = iota // 00 (false), 01 (true)
	CN_UINT8                     // 00 (0) until ff (255)
	CN_UINT16                    // 3412 = 1234
	CN_UINT32                    // 7856 3412 = 12345678
	CN_INT8
	CN_INT16 //3412 = 1234
	CN_INT64
	CN_STRING
	CN_TIME
	CN_VERSION
)

type ZehnderTypeFlag

type ZehnderTypeFlag byte
const (
	ZehnderRMITypeNoValue     ZehnderTypeFlag = 0x00
	ZehnderRMITypeActualValue ZehnderTypeFlag = 0x10
	ZehnderRMITypeRange       ZehnderTypeFlag = 0x20
	ZehnderRMITypeStepSize    ZehnderTypeFlag = 0x40
)

Jump to

Keyboard shortcuts

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