Documentation ¶
Index ¶
- Constants
- func MessageTypeToString(mt int) string
- type Action
- type Adapter
- func (a *Adapter) CancelPairing()
- func (a *Adapter) GetID() string
- func (a *Adapter) GetName() string
- func (a *Adapter) HandleDeviceAdded(device IDevice)
- func (a *Adapter) HandleDeviceRemoved(device IDevice)
- func (a *Adapter) HandleDeviceSaved(device IDevice)
- func (a *Adapter) Running() bool
- func (a *Adapter) Send(mt int, data map[string]interface{})
- func (a *Adapter) SendError(message string)
- func (a *Adapter) SendPairingPrompt(prompt, url string, did string)
- func (a *Adapter) SendUnpairingPrompt(prompt, url string, did string)
- func (a *Adapter) SetCredentials(deviceId, username, password string)
- func (a *Adapter) SetPin(deviceId string, pin interface{})
- func (a *Adapter) StartPairing(timeout float64)
- func (a *Adapter) Unload()
- type AddonManager
- type Event
- type IAction
- type IAdapter
- type IDevice
- type IEvent
- type IProperty
- type IpcClient
- type Map
- type OnCancelPairingFunc
- type OnDeviceSavedFunc
- type OnMessage
- type OnSetCredentialsFunc
- type Preferences
- type RpcClint
- type Units
- type UserProfile
Constants ¶
View Source
const ( Aid = "adapterId" Pid = "pluginId" Did = "deviceId" )
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" Alarm = "Alarm" AirQualitySensor = "AirQualitySensor" BarometricPressureSensor = "BarometricPressureSensor" BinarySensor = "BinarySensor" Camera = "Camera" ColorControl = "ColorControl" ColorSensor = "ColorSensor" DoorSensor = "DoorSensor" EnergyMonitor = "EnergyMonitor" HumiditySensor = "HumiditySensor" LeakSensor = "LeakSensor" Light = "Light" Lock = "Lock" MotionSensor = "MotionSensor" MultiLevelSensor = "MultiLevelSensor" MultiLevelSwitch = "MultiLevelSwitch" OnOffSwitch = "OnOffSwitch" SmartPlug = "SmartPlug" SmokeSensor = "SmokeSensor" TemperatureSensor = "TemperatureSensor" Thermostat = "Thermostat" VideoCamera = "VideoCamera" Context = "https://webthings.io/schemas" 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 ( Disconnect = "Disconnect" Connected = "Connected" Registered = "Registered" )
View Source
const IpcDefaultPort = "9500"
Variables ¶
This section is empty.
Functions ¶
func MessageTypeToString ¶
Types ¶
type Adapter ¶
type Adapter struct { Devices map[string]IDevice Id string IsPairing bool // contains filtered or unexported fields }
func NewAdapter ¶
func (*Adapter) CancelPairing ¶
func (a *Adapter) CancelPairing()
func (*Adapter) HandleDeviceAdded ¶
func (*Adapter) HandleDeviceRemoved ¶
func (*Adapter) HandleDeviceSaved ¶
func (*Adapter) SendPairingPrompt ¶
向前端UI发送提示
func (*Adapter) SendUnpairingPrompt ¶
func (*Adapter) SetCredentials ¶
func (*Adapter) StartPairing ¶
type AddonManager ¶
type AddonManager struct {
// contains filtered or unexported fields
}
func InitAddonManager ¶
func InitAddonManager(packageName string) *AddonManager
func (*AddonManager) AddAdapters ¶
func (m *AddonManager) AddAdapters(adapters ...IAdapter)
type Event ¶
type Event struct { Name string `json:"name"` //Subscription *data_schema.DataSchema `json:"subscription,omitempty"` //Data *data_schema.DataSchema `json:"data,omitempty"` //Cancellation *data_schema.DataSchema `json:"cancellation,omitempty"` DeviceId string `json:"deviceId"` }
func (*Event) MarshalJson ¶
type IAdapter ¶
type IAdapter interface { //SendPairingPrompt(promt, url string, device *Device) StartPairing(timeout float64) CancelPairing() GetID() string GetName() string Unload() HandleDeviceSaved(device IDevice) HandleDeviceRemoved(device IDevice) Send(mt int, data map[string]interface{}) // contains filtered or unexported methods }
type IpcClient ¶
type IpcClient struct {
// contains filtered or unexported fields
}
type OnCancelPairingFunc ¶
type OnCancelPairingFunc func()
type OnDeviceSavedFunc ¶
type OnSetCredentialsFunc ¶
type OnSetCredentialsFunc func(deivceId, username, password string)
type Preferences ¶
type RpcClint ¶
type RpcClint struct {
// contains filtered or unexported fields
}
func NewRpcClint ¶
type UserProfile ¶
type UserProfile struct { BaseDir string `validate:"required" json:"base_dir"` DataDir string `validate:"required" json:"data_dir"` AddonsDir string `validate:"required" json:"addons_dir"` ConfigDir string `validate:"required" json:"config_dir"` UploadDir string `validate:"required" json:"upload_dir"` MediaDir string `validate:"required" json:"media_dir"` LogDir string `validate:"required" json:"log_dir"` GatewayVersion string }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.