tuya

package
v1.9.9-cui.13 Latest Latest
Warning

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

Go to latest
Published: May 10, 2025 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultCnURL        = "openapi.tuyacn.com"
	DefaultWestUsURL    = "openapi.tuyaus.com"
	DefaultEastUsURL    = "openapi-ueaz.tuyaus.com"
	DefaultCentralEuURL = "openapi.tuyaeu.com"
	DefaultWestEuURL    = "openapi-weaz.tuyaeu.com"
	DefaultInURL        = "openapi.tuyain.com"
)

Variables

This section is empty.

Functions

func Dial

func Dial(rawURL string) (core.Producer, error)

Types

type AnswerFrame

type AnswerFrame struct {
	Mode string `json:"mode"`
	Sdp  string `json:"sdp"`
}

type AudioAttributes

type AudioAttributes struct {
	CallMode           []int `json:"call_mode"`           // 1 = one way, 2 = two way
	HardwareCapability []int `json:"hardware_capability"` // 1 = mic, 2 = speaker
}

type CandidateFrame

type CandidateFrame struct {
	Mode      string `json:"mode"`
	Candidate string `json:"candidate"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func (*Client) AddTrack

func (c *Client) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error

func (*Client) GetMedias

func (c *Client) GetMedias() []*core.Media

func (*Client) GetTrack

func (c *Client) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)

func (*Client) MarshalJSON

func (c *Client) MarshalJSON() ([]byte, error)

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop() error

type DisconnectFrame

type DisconnectFrame struct {
	Mode string `json:"mode"`
}

type MqttFrame

type MqttFrame struct {
	Header  MqttFrameHeader `json:"header"`
	Message json.RawMessage `json:"msg"`
}

type MqttFrameHeader

type MqttFrameHeader struct {
	Type          string `json:"type"`
	From          string `json:"from"`
	To            string `json:"to"`
	SubDevID      string `json:"sub_dev_id"`
	SessionID     string `json:"sessionid"`
	MotoID        string `json:"moto_id"`
	TransactionID string `json:"tid"`
}

type MqttMessage

type MqttMessage struct {
	Protocol int       `json:"protocol"`
	Pv       string    `json:"pv"`
	T        int64     `json:"t"`
	Data     MqttFrame `json:"data"`
}

type OfferFrame

type OfferFrame struct {
	Mode       string `json:"mode"`
	Sdp        string `json:"sdp"`
	StreamType uint32 `json:"stream_type"`
	Auth       string `json:"auth"`
}

type OpenApiICE

type OpenApiICE struct {
	Urls       string `json:"urls"`
	Username   string `json:"username"`
	Credential string `json:"credential"`
	TTL        int    `json:"ttl"`
}

type OpenIoTHubConfig

type OpenIoTHubConfig struct {
	Url      string `json:"url"`
	ClientID string `json:"client_id"`
	Username string `json:"username"`
	Password string `json:"password"`

	SinkTopic struct {
		IPC string `json:"ipc"`
	} `json:"sink_topic"`

	SourceSink struct {
		IPC string `json:"ipc"`
	} `json:"source_topic"`

	ExpireTime int `json:"expire_time"`
}

type OpenIoTHubConfigRequest

type OpenIoTHubConfigRequest struct {
	UID      string `json:"uid"`
	UniqueID string `json:"unique_id"`
	LinkType string `json:"link_type"`
	Topics   string `json:"topics"`
}

type OpenIoTHubConfigResponse

type OpenIoTHubConfigResponse struct {
	Success bool             `json:"success"`
	Result  OpenIoTHubConfig `json:"result"`
}

type P2PConfig

type P2PConfig struct {
	Ices []OpenApiICE `json:"ices"`
}

type RTSPRequest

type RTSPRequest struct {
	Type string `json:"type"`
}

type RTSPResponse

type RTSPResponse struct {
	Success bool `json:"success"`
	Result  struct {
		URL string `json:"url"`
	} `json:"result"`
}

type ResolutionFrame

type ResolutionFrame struct {
	Mode  string `json:"mode"`
	Value int    `json:"value"`
}

type Skill

type Skill struct {
	WebRTC int `json:"webrtc"`
	Audios []struct {
		Channels   int `json:"channels"`
		DataBit    int `json:"dataBit"`
		CodecType  int `json:"codecType"`
		SampleRate int `json:"sampleRate"`
	} `json:"audios"`
	Videos []struct {
		StreamType int    `json:"streamType"` // streamType = 2 => H265 and streamType = 4 => H264
		ProfileId  string `json:"profileId"`
		Width      int    `json:"width"`
		CodecType  int    `json:"codecType"`
		SampleRate int    `json:"sampleRate"`
		Height     int    `json:"height"`
	} `json:"videos"`
}

type Token

type Token struct {
	UID          string `json:"uid"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpireTime   int64  `json:"expire_time"`
}

type TokenResponse

type TokenResponse struct {
	Result Token `json:"result"`
}

type TuyaClient

type TuyaClient struct {
	// contains filtered or unexported fields
}

func NewTuyaClient

func NewTuyaClient(openAPIURL string, deviceID string, uid string, clientID string, secret string, useRTSP bool) (*TuyaClient, error)

func (*TuyaClient) Close

func (c *TuyaClient) Close()

func (*TuyaClient) GetRTSP

func (c *TuyaClient) GetRTSP() (err error)

func (*TuyaClient) InitDevice

func (c *TuyaClient) InitDevice() (err error)

func (*TuyaClient) InitToken

func (c *TuyaClient) InitToken() (err error)

func (*TuyaClient) LoadHubConfig

func (c *TuyaClient) LoadHubConfig() (config *OpenIoTHubConfig, err error)

func (*TuyaClient) Request

func (c *TuyaClient) Request(method string, url string, body any) ([]byte, error)

func (*TuyaClient) StartMQTT

func (c *TuyaClient) StartMQTT() error

func (*TuyaClient) StopMQTT

func (c *TuyaClient) StopMQTT()

type TuyaMQTT

type TuyaMQTT struct {
	// contains filtered or unexported fields
}

type WebICE

type WebICE struct {
	Urls       string `json:"urls"`
	Username   string `json:"username,omitempty"`
	Credential string `json:"credential,omitempty"`
}

type WebRTCConfigResponse

type WebRTCConfigResponse struct {
	Result WebRTConfig `json:"result"`
}

type WebRTConfig

type WebRTConfig struct {
	AudioAttributes AudioAttributes `json:"audio_attributes"`
	Auth            string          `json:"auth"`
	ID              string          `json:"id"`
	MotoID          string          `json:"moto_id"`
	P2PConfig       P2PConfig       `json:"p2p_config"`
	Skill           string          `json:"skill"`
	SupportsWebRTC  bool            `json:"supports_webrtc"`
	VideoClaritiy   int             `json:"video_clarity"`
}

Jump to

Keyboard shortcuts

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