ep6v2

package
v0.0.0-...-ae4999c Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHBlockSize         = 256
	AIValueStartAddress = 96
	AIAlarmStartAddress = 48
)
View Source
const (
	None = iota
	Control
	Alarm
)
View Source
const (
	AOCHStartAddress    = 28672
	AOValueStartAddress = 0
)
View Source
const (
	DOCHStartAddress = 20480
	ON               = 0xFF00
	OFF              = 0x0000
)
View Source
const (
	DICHStartAddress = 12288
)

Variables

This section is empty.

Functions

func AlarmDesc

func AlarmDesc(alarm AlarmValue) string

Types

type AI

type AI struct {
	Index int
	// contains filtered or unexported fields
}

func (*AI) CheckAlarm

func (ai *AI) CheckAlarm(val float32) (AlarmValue, float32)

func (*AI) GetAlarmState

func (ai *AI) GetAlarmState() (AlarmValue, error)

func (*AI) GetConfig

func (ai *AI) GetConfig() *AIConfig

func (*AI) GetValue

func (ai *AI) GetValue() (float32, error)

type AIAlarmConfig

type AIAlarmConfig struct {
	Enabled        bool
	PrimalMaxValue float32
	PrimalMinValue float32
	MaxValue       float32
	MinValue       float32
	LowCut         int
	DeadBand       float32
	HiHi           AlarmItem
	HI             AlarmItem
	LO             AlarmItem
	LoLo           AlarmItem
	HF             AlarmItem
	LF             AlarmItem

	Delay int
}

type AIConfig

type AIConfig struct {
	Enabled      bool //是否启用
	AlarmEnabled bool

	TagName string //频道名称
	Title   string //中文名称
	Point   int    //小位数
	Uint    string //单位名称
	Gain    float32
	Offset  float32

	Alarm *AIAlarmConfig //警报设置
}

type AO

type AO struct {
	Index int
	// contains filtered or unexported fields
}

func (*AO) GetConfig

func (ao *AO) GetConfig() *AOConfig

func (*AO) GetValue

func (ao *AO) GetValue() (float32, error)

type AOConfig

type AOConfig struct {
	Enabled bool //是否启用

	CTLMode        int
	CTLSource      int
	CTLMin         float32
	CTLMax         float32
	CTLTarget      float32
	CTLKp          float32
	CTLKi          float32
	CTLKd          float32
	CTLManualValue float32

	TagName string //频道名称
	Title   string //中文名称
	Point   int    //小位数
	Uint    string //单位名称
}

type Addr

type Addr struct {
	Ip      IPAddr
	Mask    IPAddr
	Gateway IPAddr
	Mac     MAC
}

type AlarmItem

type AlarmItem struct {
	Style int
	Value float32
}

type AlarmValue

type AlarmValue int
const (
	AlarmInvalid AlarmValue = 0xFF
	AlarmError   AlarmValue = 0xFE
	AlarmNormal  AlarmValue = 0x0
	AlarmHF      AlarmValue = 0x10
	AlarmHH      AlarmValue = 0x0c
	AlarmHI      AlarmValue = 0x04
	AlarmLO      AlarmValue = 0x01
	AlarmLL      AlarmValue = 0x03
	AlarmLF      AlarmValue = 0x20
)

type Connector

type Connector interface {
	Try(ctx context.Context, addr string) (net.Conn, error)
}

func NewTCPConnector

func NewTCPConnector() Connector

type DI

type DI struct {
	Index int
	// contains filtered or unexported fields
}

func (*DI) GetConfig

func (di *DI) GetConfig() *DIConfig

func (*DI) GetValue

func (di *DI) GetValue() (bool, error)

type DIConfig

type DIConfig struct {
	Enabled      bool //是否启用
	Inverse      bool
	AlarmEnabled bool

	TagName string //频道名称
	Title   string //中文名称

	AlarmConfig int
	AlarmDelay  int //警报延迟(秒)
}

type DO

type DO struct {
	Index int
	// contains filtered or unexported fields
}

func (*DO) GetConfig

func (do *DO) GetConfig() *DOConfig

func (*DO) GetValue

func (do *DO) GetValue() (bool, error)

func (*DO) SetValue

func (do *DO) SetValue(v bool) (bool, error)

type DOConfig

type DOConfig struct {
	Enabled      bool //是否启用
	AlarmEnabled bool

	TagName string //频道名称
	Title   string //中文名称

	AutoControl bool //自动控制是否开启
	LogEnabled  bool //记录启用时间
	Reverse     bool //反向输出
	IsManual    bool //手动控制是否开启

	EnableSwitch bool
	OnTime       int
	OffTime      int
}

type Device

type Device struct {
	// contains filtered or unexported fields
}

func New

func New() *Device

func (*Device) Close

func (device *Device) Close()

func (*Device) Connect

func (device *Device) Connect(ctx context.Context, address string) error

func (*Device) GetAI

func (device *Device) GetAI(index int) (*AI, error)

func (*Device) GetAO

func (device *Device) GetAO(index int) (*AO, error)

func (*Device) GetAddr

func (device *Device) GetAddr() (*Addr, error)

func (*Device) GetCHNum

func (device *Device) GetCHNum(flush bool) (*CHNum.Data, error)

func (*Device) GetCHValue

func (device *Device) GetCHValue(tag string) (value map[string]interface{}, err error)

func (*Device) GetDI

func (device *Device) GetDI(index int) (*DI, error)

func (*Device) GetDO

func (device *Device) GetDO(index int) (*DO, error)

func (*Device) GetDOFromTag

func (device *Device) GetDOFromTag(tag string) (*DO, error)

func (*Device) GetModel

func (device *Device) GetModel() (*Model, error)

func (*Device) GetRealTimeData

func (device *Device) GetRealTimeData() (*realtime.Data, error)

func (*Device) GetStatus

func (device *Device) GetStatus() lang.StrIndex

func (*Device) GetStatusTitle

func (device *Device) GetStatusTitle() string

func (*Device) IsConnected

func (device *Device) IsConnected() bool

func (*Device) Reset

func (device *Device) Reset(otherFN ...func())

func (*Device) SetCHValue

func (device *Device) SetCHValue(tag string, value interface{}) error

func (*Device) SetConnector

func (device *Device) SetConnector(connector Connector)

type IPAddr

type IPAddr [4]uint8

func (*IPAddr) String

func (ip *IPAddr) String() string

type MAC

type MAC [6]uint8

func (*MAC) String

func (mac *MAC) String() string

type Model

type Model struct {
	ID      string
	Version string
	Title   string
}

type TCPConnector

type TCPConnector struct {
	// contains filtered or unexported fields
}

func (*TCPConnector) Try

func (c *TCPConnector) Try(ctx context.Context, addr string) (net.Conn, error)

Jump to

Keyboard shortcuts

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