Documentation
¶
Index ¶
- Constants
- func GetAndParseJSONResponseFromHttpResponse(resp *http.Response, result interface{}) error
- func GetBytesFromHttpResponse(resp *http.Response) ([]byte, error)
- func UnRegisterPowerChangeCallback(d *Device, key string)
- type BlinkerDetailInfo
- type BlinkerInfoRes
- type Device
- func (d *Device) AddVoiceAssistant(v *VoiceAssistant)
- func (d *Device) GetExtData(key any) (val any, ok bool)
- func (d *Device) GetState() bool
- func (d *Device) Init() error
- func (d *Device) IsDisconnected() bool
- func (d *Device) Login() error
- func (d *Device) OnLine() bool
- func (d *Device) ReceiveMessageHandler(c MQTT.Client, m MQTT.Message)
- func (d *Device) RegisterPowerChangeCallbackFunc(key string, cb func(string))
- func (d *Device) RunHeartBearTimer()
- func (d *Device) SendMessage(targetType, todevice, msgid string, msg any)
- func (d *Device) SetQueryStateFunc(f func() bool)
- func (d *Device) Stop()
- func (d *Device) StoreExtData(key any, val any)
- func (d *Device) SyncAssistants() error
- func (d *Device) UnRegisterPowerChangeCallbackFunc(key string)
- type VoiceAssistant
Constants ¶
View Source
const ( VA_TYPE_LIGHT = "light" VA_TYPE_OUTLET = "outlet" VA_TYPE_MULTI_OUTLET = "multi_outlet" VA_TYPE_SENSOR = "sensor" VA_TYPE_FAN = "fan" VA_TYPE_AIRCONDITION = "aircondition" )
View Source
const ( Disconnected uint32 = iota Connecting Reconnecting Connected )
View Source
const ( HOST = "https://iot.diandeng.tech" API_AUTH = HOST + "/api/v1/user/device/diy/auth" API_HEARTBEAT = HOST + "/api/v1/user/device/heartbeat" API_VOICE_ASSISTANT = HOST + "/api/v1/user/device/voice_assistant" )
Variables ¶
This section is empty.
Functions ¶
func GetBytesFromHttpResponse ¶
GetStringFromHttpResponse 从response获取
func UnRegisterPowerChangeCallback ¶ added in v1.7.2
Types ¶
type BlinkerDetailInfo ¶
type BlinkerInfoRes ¶
type BlinkerInfoRes struct { Message int `json:"message"` Detail BlinkerDetailInfo `json:"detail"` }
type Device ¶ added in v1.7.2
type Device struct { DetailInfo BlinkerDetailInfo // contains filtered or unexported fields }
func CreateDevice ¶ added in v1.7.2
func GetBlinkerDevice ¶ added in v1.7.2
func (*Device) AddVoiceAssistant ¶ added in v1.7.2
func (d *Device) AddVoiceAssistant(v *VoiceAssistant)
func (*Device) IsDisconnected ¶ added in v1.7.2
func (*Device) ReceiveMessageHandler ¶ added in v1.7.2
func (*Device) RegisterPowerChangeCallbackFunc ¶ added in v1.7.2
func (*Device) RunHeartBearTimer ¶ added in v1.7.2
func (d *Device) RunHeartBearTimer()
func (*Device) SendMessage ¶ added in v1.7.2
func (*Device) SetQueryStateFunc ¶ added in v1.7.2
func (*Device) StoreExtData ¶ added in v1.7.2
func (*Device) SyncAssistants ¶ added in v1.7.2
func (*Device) UnRegisterPowerChangeCallbackFunc ¶ added in v1.7.2
type VoiceAssistant ¶
type VoiceAssistant struct { DeviceType string //语言助手类型 (设备类型). VAType string //语言助手类型 MIOT AliGenie DuerOS Device *Device // contains filtered or unexported fields }
func CreateVoiceAssistant ¶
func CreateVoiceAssistant(deviceType, vaType string) *VoiceAssistant
func (*VoiceAssistant) GetSKey ¶
func (v *VoiceAssistant) GetSKey() string
func (*VoiceAssistant) GetToDevice ¶
func (v *VoiceAssistant) GetToDevice() string
func (*VoiceAssistant) PowerChangeReply ¶
func (v *VoiceAssistant) PowerChangeReply(msgid, state string)
func (*VoiceAssistant) QueryDeviceState ¶
func (v *VoiceAssistant) QueryDeviceState(msgid string)
Click to show internal directories.
Click to hide internal directories.