Documentation ¶
Index ¶
- func LoadConfig(path string, packageName string) (string, error)
- func LoadThings(path string) map[string]things.Thing
- func SaveConfig(path string, packageName string, value string) error
- type Adapter
- func (a *Adapter) CancelPairing()
- func (a *Adapter) CancelRemoveThing(id string)
- func (a *Adapter) Close()
- func (a *Adapter) GetName() string
- func (a *Adapter) GetPackageName() string
- func (a *Adapter) HandleDeviceAdded(devices ...DeviceProxy)
- func (a *Adapter) HandleDeviceRemoved(device DeviceProxy)
- func (a *Adapter) HandleDeviceSaved(msg messages.DeviceSavedNotificationJsonData)
- func (a *Adapter) Send(mt messages.MessageType, data any)
- func (a *Adapter) SendError(message string)
- func (a *Adapter) SendPairingPrompt(prompt, url string, did string)
- func (a *Adapter) SendPropertyChangedNotification(deviceId string, property properties.PropertyDescription)
- func (a *Adapter) SendUnpairingPrompt(prompt, url string, did string)
- func (a *Adapter) StartPairing(timeout <-chan time.Time)
- type AdapterProxy
- type Client
- type DeviceProxy
- type Manager
- type ManagerProxy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Adapter ¶
func NewAdapter ¶
func (*Adapter) CancelPairing ¶
func (a *Adapter) CancelPairing()
func (*Adapter) CancelRemoveThing ¶
func (*Adapter) GetPackageName ¶
func (*Adapter) HandleDeviceAdded ¶
func (a *Adapter) HandleDeviceAdded(devices ...DeviceProxy)
func (*Adapter) HandleDeviceRemoved ¶
func (a *Adapter) HandleDeviceRemoved(device DeviceProxy)
func (*Adapter) HandleDeviceSaved ¶
func (a *Adapter) HandleDeviceSaved(msg messages.DeviceSavedNotificationJsonData)
func (*Adapter) SendPairingPrompt ¶
SendPairingPrompt 向前端UI发送提示
func (*Adapter) SendPropertyChangedNotification ¶
func (a *Adapter) SendPropertyChangedNotification(deviceId string, property properties.PropertyDescription)
func (*Adapter) SendUnpairingPrompt ¶
func (*Adapter) StartPairing ¶
type AdapterProxy ¶
type AdapterProxy interface { adapter.Entity devices.AdapterHandler GetName() string GetPackageName() string // CancelPairing ## 取消配对 子类可改写业务逻辑 CancelPairing() // StartPairing ## 开始配对 子类可改写业务逻辑 StartPairing(timeout <-chan time.Time) // HandleDeviceSaved 当网关把一个设备进行了保存 HandleDeviceSaved(data messages.DeviceSavedNotificationJsonData) // HandleDeviceRemoved 当一个设备被网关移除 HandleDeviceRemoved(DeviceProxy) // CancelRemoveThing 当一个设备重新添加 CancelRemoveThing(id string) // contains filtered or unexported methods }
AdapterProxy Adapter 的抽象接口,
type DeviceProxy ¶
type DeviceProxy interface { // Entity Device的公共接口 devices.Entity // DeviceHandler 处理Device下Property业务的抽象接口, properties.DeviceHandler // SetCredentials 设备设置用户名t 密码时 //子类需重写这个方法,来完成设备的用户名密码设置的逻辑 SetCredentials(username, password string) error // SetPin 设备需要Pin码时时调用 //子类需重写这个方法,来完成设备的用户名密码设置的逻辑 SetPin(pin string) error }
DeviceProxy 所有Addon所有Device的抽象接口,
addons/devices下所有Device均实现了此接口
type Manager ¶
type Manager struct { *manager.Manager Done chan struct{} // contains filtered or unexported fields }
func (*Manager) AddAdapters ¶
func (m *Manager) AddAdapters(adapters ...AdapterProxy)
func (*Manager) GetAdapter ¶
func (m *Manager) GetAdapter(adapterId string) AdapterProxy
func (*Manager) HandleAdapterRemoved ¶
type ManagerProxy ¶
type ManagerProxy interface { // AddAdapters 插件调用的方法,向Manager参加AdapterProxy AddAdapters(adapters ...AdapterProxy) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.