blinker

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 12 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 (
	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获取

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 BlinkerDevice

type BlinkerDevice struct {
	DetailInfo BlinkerDetailInfo
	// contains filtered or unexported fields
}

func CreateBlinkerDevice

func CreateBlinkerDevice(ak string) *BlinkerDevice

func (*BlinkerDevice) AddVoiceAssistant

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

func (*BlinkerDevice) Init

func (d *BlinkerDevice) Init() error

func (*BlinkerDevice) Login

func (d *BlinkerDevice) Login() error

func (*BlinkerDevice) ReceiveMessageHandler

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

func (*BlinkerDevice) RunHeartBearTimer

func (d *BlinkerDevice) RunHeartBearTimer()

func (*BlinkerDevice) RunSenderMessageService

func (d *BlinkerDevice) RunSenderMessageService()

func (*BlinkerDevice) SendMessage

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

func (*BlinkerDevice) SyncAssistants

func (d *BlinkerDevice) SyncAssistants() error

type BlinkerInfoRes

type BlinkerInfoRes struct {
	Message int               `json:"message"`
	Detail  BlinkerDetailInfo `json:"detail"`
}

type VoiceAssistant

type VoiceAssistant struct {
	DeviceType string //语言助手类型 (设备类型).
	VAType     string //语言助手类型  MIOT AliGenie DuerOS
	Device     *BlinkerDevice
	// 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, st 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