Documentation
¶
Index ¶
- func Exist(name string) bool
- type Attribute
- type Device
- type DeviceInfo
- type Instance
- type Manager
- func (p *Manager) AddDevice(device Device) error
- func (p *Manager) Devices() (ds []Device, err error)
- func (p *Manager) GetAttributes(identity string) (s []Instance, err error)
- func (p *Manager) HealthCheck(identity string) bool
- func (p *Manager) Init()
- func (p *Manager) Notify(identity string, instanceID int, attr *utils.Attribute) attribute.NotifyFunc
- func (p *Manager) RemoveDevice(identity string) error
- func (p *Manager) SetAttribute(identity string, instanceID int, attr string, val interface{}) (err error)
- func (p *Manager) Subscribe(notify chan Notify)
- func (p *Manager) Unsubscribe(notify chan Notify)
- func (p *Manager) WatchNotify(device Device)
- type Notification
- type Notify
- type OptionFunc
- type Server
- func (p Server) Discover(request *proto.Empty, server proto.Plugin_DiscoverServer) error
- func (p Server) GetAttributes(context context.Context, request *proto.GetAttributesReq) (resp *proto.GetAttributesResp, err error)
- func (p Server) HealthCheck(context context.Context, req *proto.HealthCheckReq) (resp *proto.HealthCheckResp, err error)
- func (p *Server) Init()
- func (p Server) SetAttributes(context context.Context, request *proto.SetAttributesReq) (resp *proto.SetAttributesResp, err error)
- func (p Server) StateChange(request *proto.Empty, server proto.Plugin_StateChangeServer) error
- type SetAttribute
- type SetRequest
- type WatchChan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeviceInfo ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager() *Manager
func (*Manager) GetAttributes ¶
func (*Manager) HealthCheck ¶
func (*Manager) RemoveDevice ¶
RemoveDevice 删除设备
func (*Manager) SetAttribute ¶
func (*Manager) Unsubscribe ¶
func (*Manager) WatchNotify ¶
type Notification ¶
type OptionFunc ¶
type OptionFunc func(s *Server)
func WithConfigFile ¶
func WithConfigFile(configFile string) OptionFunc
func WithStatic ¶
func WithStatic(staticDir string) OptionFunc
type Server ¶
type Server struct {
Manager *Manager
Domain string
Router *gin.Engine
ApiRouter *gin.RouterGroup
// contains filtered or unexported fields
}
func NewPluginServer ¶
func NewPluginServer(domain string, opts ...OptionFunc) *Server
func (Server) GetAttributes ¶
func (p Server) GetAttributes(context context.Context, request *proto.GetAttributesReq) (resp *proto.GetAttributesResp, err error)
func (Server) HealthCheck ¶
func (p Server) HealthCheck(context context.Context, req *proto.HealthCheckReq) (resp *proto.HealthCheckResp, err error)
func (Server) SetAttributes ¶
func (p Server) SetAttributes(context context.Context, request *proto.SetAttributesReq) (resp *proto.SetAttributesResp, err error)
func (Server) StateChange ¶
type SetAttribute ¶
type SetRequest ¶
type SetRequest struct {
Attributes []SetAttribute `json:"attributes"`
}
type WatchChan ¶
type WatchChan chan Notification
Click to show internal directories.
Click to hide internal directories.