blinker

package
v1.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 29, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

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 GetAndParseJSONResponseFromHttpResponse

func GetAndParseJSONResponseFromHttpResponse(resp *http.Response, result interface{}) error

func GetBytesFromHttpResponse

func GetBytesFromHttpResponse(resp *http.Response) ([]byte, error)

GetStringFromHttpResponse 从response获取

func UnRegisterPowerChangeCallback added in v1.7.2

func UnRegisterPowerChangeCallback(d *Device, key string)

Types

type BlinkerDetailInfo

type BlinkerDetailInfo struct {
	Broker     string `json:"broker"`
	DeviceName string `json:"deviceName"`
	Host       string `json:"host"`
	IotID      string `json:"iotId"`
	IotToken   string `json:"iotToken"`
	Port       string `json:"port"`
	ProductKey string `json:"productKey"`
	UUID       string `json:"uuid"`
}

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 CreateDevice(ak string, httpClientSecureVerify bool, httpClientTimeout int) *Device

func GetBlinkerDevice added in v1.7.2

func GetBlinkerDevice(authKey string, httpClientSecureVerify bool, httpClientTimeout int) (*Device, error)

func (*Device) AddVoiceAssistant added in v1.7.2

func (d *Device) AddVoiceAssistant(v *VoiceAssistant)

func (*Device) GetExtData added in v1.7.2

func (d *Device) GetExtData(key any) (val any, ok bool)

func (*Device) GetState added in v1.7.2

func (d *Device) GetState() bool

func (*Device) Init added in v1.7.2

func (d *Device) Init() error

func (*Device) IsDisconnected added in v1.7.2

func (d *Device) IsDisconnected() bool

func (*Device) Login added in v1.7.2

func (d *Device) Login() error

func (*Device) OnLine added in v1.7.2

func (d *Device) OnLine() bool

func (*Device) ReceiveMessageHandler added in v1.7.2

func (d *Device) ReceiveMessageHandler(c MQTT.Client, m MQTT.Message)

func (*Device) RegisterPowerChangeCallbackFunc added in v1.7.2

func (d *Device) RegisterPowerChangeCallbackFunc(key string, cb func(string))

func (*Device) RunHeartBearTimer added in v1.7.2

func (d *Device) RunHeartBearTimer()

func (*Device) SendMessage added in v1.7.2

func (d *Device) SendMessage(targetType, todevice, msgid string, msg any)

func (*Device) SetQueryStateFunc added in v1.7.2

func (d *Device) SetQueryStateFunc(f func() bool)

func (*Device) Stop added in v1.7.2

func (d *Device) Stop()

func (*Device) StoreExtData added in v1.7.2

func (d *Device) StoreExtData(key any, val any)

func (*Device) SyncAssistants added in v1.7.2

func (d *Device) SyncAssistants() error

func (*Device) UnRegisterPowerChangeCallbackFunc added in v1.7.2

func (d *Device) UnRegisterPowerChangeCallbackFunc(key string)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL