Documentation
¶
Index ¶
- Constants
- func AccessText(access int) string
- func ValueTypeText(valueType int) string
- type Device
- type DeviceUnit
- type HandlerFunc
- type Model
- type Property
- type PropertyUnit
- type PropertyValue
- type Server
- type ServerConfig
- type Storage
- func (c *Storage) ConvUint16Slice(uint16Slice []uint16, valueType int) (interface{}, error)
- func (s *Storage) DeviceMap() interface{}
- func (s *Storage) GetProperty(id string, property string) (interface{}, error)
- func (s *Storage) Initialize(models []Model, devices []Device) error
- func (s *Storage) Read(address uint16, quantity uint16) ([]uint16, error)
- func (s *Storage) RegisterInfo(address uint16) (id string, property string, err error)
- func (s *Storage) SetProperty(id string, property string, v interface{}) error
- func (c *Storage) Uint16Slice(v interface{}, valueType int) ([]uint16, error)
- func (s *Storage) Write(address uint16, values []uint16) error
Constants ¶
View Source
const ( ValueTypeBool = iota ValueTypeUint8 ValueTypeInt8 ValueTypeUint16 ValueTypeInt16 ValueTypeUint32 ValueTypeInt32 ValueTypeUint64 ValueTypeInt64 ValueTypeUint ValueTypeInt ValueTypeFloat32 ValueTypeFloat64 )
View Source
const ( AccessRead = iota AccessWrite AccessReadWrite )
Variables ¶
This section is empty.
Functions ¶
func AccessText ¶
func ValueTypeText ¶
Types ¶
type DeviceUnit ¶
type DeviceUnit struct {
Id string `json:"id"`
ModelId string `json:"modelId"`
ModelName string `json:"modelName"`
Properties []PropertyUnit `json:"properties"`
}
type HandlerFunc ¶
type HandlerFunc func(id string, propertyValues []PropertyValue)
type PropertyUnit ¶
type PropertyValue ¶
type PropertyValue struct {
Name string
Value interface{}
}
type Server ¶
type Server interface {
Start() error // 启动服务监听
Stop() error // 停止
SetProperty(id string, property string, value interface{}) error // 设置设备属性
SetOnWriteHandler(func(id string, propertyValues []PropertyValue)) // 寄存器写入回调函数
}
func NewServer ¶
func NewServer(conf *ServerConfig) Server
type ServerConfig ¶
type Storage ¶
type Storage struct {
EnableSort bool // 是否启用属性排序(r、rw、w)
// contains filtered or unexported fields
}
func NewStorage ¶
func NewStorage() *Storage
func (*Storage) ConvUint16Slice ¶
func (*Storage) GetProperty ¶
func (*Storage) RegisterInfo ¶
func (*Storage) SetProperty ¶
func (*Storage) Uint16Slice ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.