Documentation
¶
Overview ¶
Package plugin @Description:
Index ¶
- Constants
- func NewIpcServer(addr string) chan *wsConnection
- type Adapter
- type Addon
- type AddonsStore
- type ApiHandler
- type Config
- type Extension
- type Manager
- func (m *Manager) AddNewThings(timeout int) error
- func (m *Manager) AddonEnabled(addonId string) bool
- func (m *Manager) CancelAddNewThing()
- func (m *Manager) CancelRemoveThing(deviceId string)
- func (m *Manager) DisableAddon(packageId string) error
- func (m *Manager) EnableAddon(packageId string) error
- func (m *Manager) GetAddonLicense(addonId string) (string, error)
- func (m *Manager) GetDevices() (devices []*device)
- func (m *Manager) GetInstallAddons() any
- func (m *Manager) GetLanguage() string
- func (m *Manager) GetMapOfDevices() map[string]*devices.Device
- func (m *Manager) GetPreferences() *messages.PluginRegisterResponseJsonDataPreferences
- func (m *Manager) GetPropertiesValue(thingId string) (map[string]any, error)
- func (m *Manager) GetPropertyValue(thingId, propName string) (any, error)
- func (m *Manager) GetUserProfile() *messages.PluginRegisterResponseJsonDataUserProfile
- func (m *Manager) InstallAddonFromUrl(id, url, checksum string) error
- func (m *Manager) LoadAddon(packageId string) error
- func (m *Manager) RemoveAction(deviceId, actionId, actionName string) error
- func (m *Manager) RemoveThing(deviceId string) error
- func (m *Manager) RequestAction(ctx context.Context, thingId, actionName string, input map[string]any) error
- func (m *Manager) SetCredentials(ctx context.Context, thingId, username, password string) (*messages.Device, error)
- func (m *Manager) SetPIN(ctx context.Context, thingId string, pin string) (*messages.Device, error)
- func (m *Manager) SetPropertyValue(ctx context.Context, thingId, propName string, newValue any) (any, error)
- func (m *Manager) SetThingsContainer(thingContainer ThingsContainer)
- func (m *Manager) UninstallAddon(packetId string, disable bool) error
- func (m *Manager) UnloadAddon(packageId string) error
- func (m *Manager) UpdatePreferences()
- type ManifestJson
- type Notifier
- type Outlet
- type Plugin
- type PluginsServer
- type Schema
- type ThingsContainer
Constants ¶
View Source
const ( TypeString = "string" TypeBoolean = "boolean" TypeInteger = "integer" TypeNumber = "number" UnitHectopascal = "hectopascal" UnitKelvin = "kelvin" UnitPercentage = "percentage" UnitArcDegrees = "arcdegrees" UnitCelsius = "celsius" UnitLux = "lux" UnitSeconds = "seconds" UnitPPM = "ppm" AlarmProperty = "AlarmProperty" BarometricPressureProperty = "BarometricPressureProperty" ColorModeProperty = "ColorModeProperty" ColorProperty = "ColorProperty" ColorTemperatureProperty = "ColorTemperatureProperty" ConcentrationProperty = "ConcentrationProperty" CurrentProperty = "CurrentProperty" DensityProperty = "DensityProperty" FrequencyProperty = "FrequencyProperty" HeatingCoolingProperty = "HeatingCoolingProperty" HumidityProperty = "HumidityProperty" ImageProperty = "ImageProperty" InstantaneousPowerFactorProperty = "InstantaneousPowerFactorProperty" InstantaneousPowerProperty = "InstantaneousPowerProperty" LeakProperty = "LeakProperty" LevelProperty = "LevelProperty" LockedProperty = "LockedProperty" MotionProperty = "MotionProperty" OpenProperty = "OpenProperty" PushedProperty = "PushedProperty" SmokeProperty = "SmokeProperty" TargetTemperatureProperty = "TargetTemperatureProperty" TemperatureProperty = "TemperatureProperty" ThermostatModeProperty = "ThermostatModeProperty" VideoProperty = "VideoProperty" VoltageProperty = "VoltageProperty" )
View Source
const ( AdapterAddedNotification = 4096 AdapterCancelPairingCommand = 4100 AdapterCancelRemoveDeviceCommand = 4105 AdapterPairingPromptNotification = 4101 AdapterRemoveDeviceRequest = 4103 AdapterRemoveDeviceResponse = 4104 AdapterStartPairingCommand = 4099 AdapterUnloadRequest = 4097 AdapterUnloadResponse = 4098 AdapterUnpairingPromptNotification = 4102 ApiHandlerAddedNotification = 20480 ApiHandlerApiRequest = 20483 ApiHandlerApiResponse = 20484 ApiHandlerUnloadRequest = 20481 ApiHandlerUnloadResponse = 20482 DeviceActionStatusNotification = 8201 DeviceAddedNotification = 8192 DeviceConnectedStateNotification = 8197 DeviceDebugCommand = 8206 DeviceEventNotification = 8200 DevicePropertyChangedNotification = 8199 DeviceRemoveActionRequest = 8202 DeviceRemoveActionResponse = 8203 DeviceRequestActionRequest = 8204 DeviceRequestActionResponse = 8205 DeviceSavedNotification = 8207 DeviceSetCredentialsRequest = 8195 DeviceSetCredentialsResponse = 8196 DeviceSetPinRequest = 8193 DeviceSetPinResponse = 8194 DeviceSetPropertyCommand = 8198 MockAdapterAddDeviceRequest = 61440 MockAdapterAddDeviceResponse = 61441 MockAdapterClearStateRequest = 61446 MockAdapterClearStateResponse = 61447 MockAdapterPairDeviceCommand = 61444 MockAdapterRemoveDeviceRequest = 61442 MockAdapterRemoveDeviceResponse = 61443 MockAdapterUnpairDeviceCommand = 61445 NotifierAddedNotification = 12288 NotifierUnloadRequest = 12289 NotifierUnloadResponse = 12290 OutletAddedNotification = 16384 OutletNotifyRequest = 16386 OutletNotifyResponse = 16387 OutletRemovedNotification = 16385 PluginErrorNotification = 4 PluginRegisterRequest = 0 PluginRegisterResponse = 1 PluginUnloadRequest = 2 PluginUnloadResponse = 3 )
View Source
const ManifestVersion = 1
Variables ¶
This section is empty.
Functions ¶
func NewIpcServer ¶
func NewIpcServer(addr string) chan *wsConnection
Types ¶
type Adapter ¶
func NewAdapter ¶
func (*Adapter) SendPropertyChangedNotification ¶
func (adapter *Adapter) SendPropertyChangedNotification(deviceId string, p properties.PropertyDescription)
type Addon ¶
type Addon struct { ID string `json:"id"` Name string `json:"name"` ShortName string `json:"short_name"` Author string `json:"author"` Description string `json:"description,omitempty"` License string `json:"license,omitempty"` HomepageUrl string `json:"homepage_url"` Version string `json:"version"` Schema Schema `json:"schema,omitempty"` Exec string `json:"exec"` Enabled bool `json:"enabled"` PrimaryType string `json:"primary_type"` ContentScripts any `json:"content_scripts,omitempty"` WSebAccessibleResources any `json:"web_accessible_resources,omitempty"` // contains filtered or unexported fields }
func LoadManifest ¶
func LoadManifest(destPath, packetId string, store AddonsStore) (*Addon, any, error)
LoadManifest
@Description: @param destPath @param packetId @param store @return *Addon @return interface{}:addon default config @return error
func NewAddonSettingFromManifest ¶
func NewAddonSettingFromManifest(manifest *ManifestJson, store AddonsStore) *Addon
func NewAddonSettingFromString ¶
func NewAddonSettingFromString(str string, store AddonsStore) *Addon
func (*Addon) DeleteSettingAndConfig ¶
func (*Addon) SetEnabled ¶
type AddonsStore ¶
type ApiHandler ¶
type ApiHandler struct {
ID string
}
type Manager ¶
func NewAddonsManager ¶
func (*Manager) AddNewThings ¶
func (*Manager) AddonEnabled ¶
func (*Manager) CancelAddNewThing ¶
func (m *Manager) CancelAddNewThing()
func (*Manager) CancelRemoveThing ¶
func (*Manager) DisableAddon ¶
func (*Manager) EnableAddon ¶
func (*Manager) GetDevices ¶
func (m *Manager) GetDevices() (devices []*device)
func (*Manager) GetInstallAddons ¶
GetInstallAddons 获取已安装的add-on
func (*Manager) GetLanguage ¶
func (*Manager) GetPreferences ¶
func (m *Manager) GetPreferences() *messages.PluginRegisterResponseJsonDataPreferences
func (*Manager) GetPropertiesValue ¶
func (*Manager) GetPropertyValue ¶
func (*Manager) GetUserProfile ¶
func (m *Manager) GetUserProfile() *messages.PluginRegisterResponseJsonDataUserProfile
func (*Manager) InstallAddonFromUrl ¶
func (*Manager) RemoveAction ¶
func (*Manager) RemoveThing ¶
func (*Manager) RequestAction ¶
func (*Manager) SetCredentials ¶
func (*Manager) SetPropertyValue ¶
func (m *Manager) SetPropertyValue(ctx context.Context, thingId, propName string, newValue any) (any, error)
SetPropertyValue 返回Fiber.NewError
func (*Manager) SetThingsContainer ¶
func (m *Manager) SetThingsContainer(thingContainer ThingsContainer)
func (*Manager) UninstallAddon ¶
func (*Manager) UnloadAddon ¶
func (*Manager) UpdatePreferences ¶
func (m *Manager) UpdatePreferences()
type ManifestJson ¶
type ManifestJson struct { ID string `json:"id"` Name string `json:"name"` ShortName string `json:"short_name,omitempty"` Author string `json:"author"` Description string `json:"description,omitempty"` License string `json:"license"` HomepageUrl string `json:"homepage_url,omitempty"` ManifestVersion int `json:"manifest_version"` Version string `json:"version"` ContentScripts any `json:"content_Scripts"` WSebAccessibleResources any `json:"web_accessible_resources"` Options struct { Default any `json:"default"` Schema Schema `json:"schema"` } GatewaySpecificSettings struct { WebThings struct { Exec string `json:"exec"` PrimaryType string `json:"primary_type"` StrictMaxVersion string `json:"strict_max_version"` StrictMinVersion string `json:"strict_min_version"` Enable bool `json:"enable,omitempty"` } `json:"webthings"` } `json:"gateway_specific_settings"` Enable bool `json:"setEnabled"` }
type PluginsServer ¶
func NewPluginServer ¶
func NewPluginServer(manager *Manager) *PluginsServer
Click to show internal directories.
Click to hide internal directories.