Documentation
¶
Index ¶
- Variables
- func CreateHTTPClientWithSession() *http.Client
- func Dial(rawURL string) (core.Producer, error)
- func EncryptPassword(password, pbKey string) (string, error)
- func IsEmailAddress(input string) bool
- type Allocate
- type AllocateRequest
- type AllocateResponse
- type AnswerFrame
- type AppInfo
- type AppInfoResponse
- type AudioAttributes
- type AudioSkill
- type CandidateFrame
- type Client
- func (c *Client) AddTrack(media *core.Media, codec *core.Codec, track *core.Receiver) error
- func (c *Client) Close(err error) error
- func (c *Client) GetMedias() []*core.Media
- func (c *Client) GetTrack(media *core.Media, codec *core.Codec) (*core.Receiver, error)
- func (c *Client) MarshalJSON() ([]byte, error)
- func (c *Client) Start() error
- func (c *Client) Stop() error
- type DataChannelMessage
- type Device
- type DisconnectFrame
- type Domain
- type Extras
- type Home
- type HomeListResponse
- type ICEServer
- type LoginResult
- type LoginToken
- type LoginTokenRequest
- type LoginTokenResponse
- type MQTTConfig
- type MQTTConfigResponse
- type MqttFrame
- type MqttFrameHeader
- type MqttLowPowerMessage
- type MqttMessage
- type OfferFrame
- type OpenIoTHubConfig
- type OpenIoTHubConfigRequest
- type OpenIoTHubConfigResponse
- type P2PConfig
- type PasswordLoginRequest
- type PasswordLoginResponse
- type RecvMessage
- type Region
- type ResolutionFrame
- type Room
- type RoomListRequest
- type RoomListResponse
- type SharedHome
- type SharedHomeListResponse
- type Skill
- type SmartApiMQTTConfig
- type SmartApiWebRTCConfig
- type SmartApiWebRTCConfigRequest
- type SmartApiWebRTCConfigResponse
- type SpeakerFrame
- type Token
- type TokenResponse
- type TuyaAPI
- type TuyaClient
- func (c *TuyaClient) Close()
- func (c *TuyaClient) GetAudioCodecs() []*core.Codec
- func (c *TuyaClient) GetICEServers() []pionWebrtc.ICEServer
- func (c *TuyaClient) GetMqtt() *TuyaMqttClient
- func (c *TuyaClient) GetStreamType(streamResolution string) int
- func (c *TuyaClient) GetVideoCodecs() []*core.Codec
- func (c *TuyaClient) IsHEVC(streamType int) bool
- type TuyaCloudApiClient
- type TuyaMqttClient
- func (c *TuyaMqttClient) SendCandidate(candidate string) error
- func (c *TuyaMqttClient) SendDisconnect() error
- func (c *TuyaMqttClient) SendOffer(sdp string, streamResolution string, streamType int, isHEVC bool) error
- func (c *TuyaMqttClient) SendResolution(resolution int) error
- func (c *TuyaMqttClient) SendSpeaker(speaker int) error
- func (c *TuyaMqttClient) Start(hubConfig *MQTTConfig, webrtcConfig *WebRTCConfig, webrtcVersion int) error
- func (c *TuyaMqttClient) Stop()
- func (c *TuyaMqttClient) WakeUp(localKey string) error
- type TuyaSmartApiClient
- func (c *TuyaSmartApiClient) GetAppInfo() (*AppInfoResponse, error)
- func (c *TuyaSmartApiClient) GetHomeList() (*HomeListResponse, error)
- func (c *TuyaSmartApiClient) GetRoomList(homeId string) (*RoomListResponse, error)
- func (c *TuyaSmartApiClient) GetSharedHomeList() (*SharedHomeListResponse, error)
- func (c *TuyaSmartApiClient) GetStreamUrl(streamType string) (streamUrl string, err error)
- func (c *TuyaSmartApiClient) Init() error
- type VideoSkill
- type WebICE
- type WebRTCConfig
- type WebRTCConfigResponse
Constants ¶
This section is empty.
Variables ¶
var AvailableRegions = []Region{
{"eu-central", "protect-eu.ismartlife.me", "Central Europe", "EU"},
{"eu-east", "protect-we.ismartlife.me", "East Europe", "EU"},
{"us-west", "protect-us.ismartlife.me", "West America", "AZ"},
{"us-east", "protect-ue.ismartlife.me", "East America", "AZ"},
{"china", "protect.ismartlife.me", "China", "AY"},
{"india", "protect-in.ismartlife.me", "India", "IN"},
}
Functions ¶
func EncryptPassword ¶
func IsEmailAddress ¶
Types ¶
type AllocateRequest ¶
type AllocateRequest struct {
Type string `json:"type"`
}
type AllocateResponse ¶
type AnswerFrame ¶
type AppInfoResponse ¶
type AudioAttributes ¶
type AudioSkill ¶
type CandidateFrame ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) MarshalJSON ¶
type DataChannelMessage ¶
type DisconnectFrame ¶
type DisconnectFrame struct {
Mode string `json:"mode"`
}
type Domain ¶
type Domain struct {
AispeechHttpsUrl string `json:"aispeechHttpsUrl"`
AispeechQuicUrl string `json:"aispeechQuicUrl"`
DeviceHttpUrl string `json:"deviceHttpUrl"`
DeviceHttpsPskUrl string `json:"deviceHttpsPskUrl"`
DeviceHttpsUrl string `json:"deviceHttpsUrl"`
DeviceMediaMqttUrl string `json:"deviceMediaMqttUrl"`
DeviceMediaMqttsUrl string `json:"deviceMediaMqttsUrl"`
DeviceMqttsPskUrl string `json:"deviceMqttsPskUrl"`
DeviceMqttsUrl string `json:"deviceMqttsUrl"`
GwApiUrl string `json:"gwApiUrl"`
GwMqttUrl string `json:"gwMqttUrl"`
HttpPort int `json:"httpPort"`
HttpsPort int `json:"httpsPort"`
HttpsPskPort int `json:"httpsPskPort"`
MobileApiUrl string `json:"mobileApiUrl"`
MobileMediaMqttUrl string `json:"mobileMediaMqttUrl"`
MobileMqttUrl string `json:"mobileMqttUrl"`
MobileMqttsUrl string `json:"mobileMqttsUrl"`
MobileQuicUrl string `json:"mobileQuicUrl"`
MqttPort int `json:"mqttPort"`
MqttQuicUrl string `json:"mqttQuicUrl"`
MqttsPort int `json:"mqttsPort"`
MqttsPskPort int `json:"mqttsPskPort"`
RegionCode string `json:"regionCode"`
}
type Home ¶
type Home struct {
Admin bool `json:"admin"`
Background string `json:"background"`
DealStatus int `json:"dealStatus"`
DisplayOrder int `json:"displayOrder"`
GeoName string `json:"geoName"`
Gid int `json:"gid"`
GmtCreate int64 `json:"gmtCreate"`
GmtModified int64 `json:"gmtModified"`
GroupId int `json:"groupId"`
GroupUserId int `json:"groupUserId"`
Id int `json:"id"`
Lat float64 `json:"lat"`
Lon float64 `json:"lon"`
ManagementStatus bool `json:"managementStatus"`
Name string `json:"name"`
OwnerId string `json:"ownerId"`
Role int `json:"role"`
Status bool `json:"status"`
Uid string `json:"uid"`
}
type HomeListResponse ¶
type LoginResult ¶
type LoginResult struct {
Attribute int `json:"attribute"`
ClientId string `json:"clientId"`
DataVersion int `json:"dataVersion"`
Domain Domain `json:"domain"`
Ecode string `json:"ecode"`
Email string `json:"email"`
Extras Extras `json:"extras"`
HeadPic string `json:"headPic"`
ImproveCompanyInfo bool `json:"improveCompanyInfo"`
Nickname string `json:"nickname"`
PartnerIdentity string `json:"partnerIdentity"`
PhoneCode string `json:"phoneCode"`
Receiver string `json:"receiver"`
RegFrom int `json:"regFrom"`
Sid string `json:"sid"`
SnsNickname string `json:"snsNickname"`
TempUnit int `json:"tempUnit"`
Timezone string `json:"timezone"`
TimezoneId string `json:"timezoneId"`
Uid string `json:"uid"`
UserType int `json:"userType"`
Username string `json:"username"`
}
type LoginToken ¶
type LoginTokenRequest ¶
type LoginTokenResponse ¶
type LoginTokenResponse struct {
Result LoginToken `json:"result"`
Success bool `json:"success"`
Msg string `json:"errorMsg,omitempty"`
}
type MQTTConfig ¶
type MQTTConfigResponse ¶
type MQTTConfigResponse struct {
Result SmartApiMQTTConfig `json:"result"`
Success bool `json:"success"`
Msg string `json:"errorMsg,omitempty"`
}
type MqttFrame ¶
type MqttFrame struct {
Header MqttFrameHeader `json:"header"`
Message json.RawMessage `json:"msg"`
}
type MqttFrameHeader ¶
type MqttLowPowerMessage ¶
type MqttLowPowerMessage struct {
Protocol int `json:"protocol"`
T int `json:"t"`
S int `json:"s,omitempty"`
Type string `json:"type,omitempty"`
Data struct {
DevID string `json:"devId,omitempty"`
Online bool `json:"online,omitempty"`
LastOnlineChangeTime int64 `json:"lastOnlineChangeTime,omitempty"`
GwID string `json:"gwId,omitempty"`
Cmd string `json:"cmd,omitempty"`
Dps map[string]interface{} `json:"dps,omitempty"`
} `json:"data"`
}
type MqttMessage ¶
type OfferFrame ¶
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 OpenIoTHubConfigResponse ¶
type OpenIoTHubConfigResponse struct {
Timestamp int `json:"t"`
Success bool `json:"success"`
Result OpenIoTHubConfig `json:"result"`
Msg string `json:"msg,omitempty"`
Code int `json:"code,omitempty"`
}
type PasswordLoginRequest ¶
type PasswordLoginResponse ¶
type PasswordLoginResponse struct {
Result LoginResult `json:"result"`
Success bool `json:"success"`
Status string `json:"status"`
ErrorMsg string `json:"errorMsg,omitempty"`
}
type RecvMessage ¶
type RecvMessage struct {
Video struct {
SSRC uint32 `json:"ssrc"`
} `json:"video"`
Audio struct {
SSRC uint32 `json:"ssrc"`
} `json:"audio"`
}
RecvMessage contains SSRC values for video/audio streams
type ResolutionFrame ¶
type RoomListRequest ¶
type RoomListRequest struct {
HomeId string `json:"homeId"`
}
type RoomListResponse ¶
type SharedHome ¶
type SharedHomeListResponse ¶
type SharedHomeListResponse struct {
}
type Skill ¶
type Skill struct {
WebRTC int `json:"webrtc"` // Bit flags: bit 4=speaker, bit 5=clarity, bit 6=record
LowPower int `json:"lowPower,omitempty"` // 1 = battery-powered camera
Audios []AudioSkill `json:"audios"`
Videos []VideoSkill `json:"videos"`
}
type SmartApiMQTTConfig ¶
type SmartApiWebRTCConfig ¶
type SmartApiWebRTCConfig struct {
AudioAttributes AudioAttributes `json:"audioAttributes"`
Auth string `json:"auth"`
GatewayId string `json:"gatewayId"`
Id string `json:"id"`
LocalKey string `json:"localKey"`
MotoId string `json:"motoId"`
NodeId string `json:"nodeId"`
P2PConfig P2PConfig `json:"p2pConfig"`
ProtocolVersion string `json:"protocolVersion"`
Skill string `json:"skill"`
Sub bool `json:"sub"`
SupportWebrtcRecord bool `json:"supportWebrtcRecord"`
SupportsPtz bool `json:"supportsPtz"`
SupportsWebrtc bool `json:"supportsWebrtc"`
VedioClarity int `json:"vedioClarity"`
VedioClaritys []int `json:"vedioClaritys"`
VideoClarity int `json:"videoClarity"`
}
type SmartApiWebRTCConfigResponse ¶
type SmartApiWebRTCConfigResponse struct {
Result SmartApiWebRTCConfig `json:"result"`
Success bool `json:"success"`
Msg string `json:"errorMsg,omitempty"`
}
type SpeakerFrame ¶
type TokenResponse ¶
type TuyaClient ¶
type TuyaClient struct {
TuyaAPI
// contains filtered or unexported fields
}
func (*TuyaClient) Close ¶
func (c *TuyaClient) Close()
func (*TuyaClient) GetAudioCodecs ¶
func (c *TuyaClient) GetAudioCodecs() []*core.Codec
func (*TuyaClient) GetICEServers ¶
func (c *TuyaClient) GetICEServers() []pionWebrtc.ICEServer
func (*TuyaClient) GetMqtt ¶
func (c *TuyaClient) GetMqtt() *TuyaMqttClient
func (*TuyaClient) GetStreamType ¶
func (c *TuyaClient) GetStreamType(streamResolution string) int
GetStreamType returns the Skill StreamType for the requested resolution Returns Skill values (2 or 4), not MQTT values (0 or 1) - "hd" → highest resolution streamType (usually 2 = mainStream) - "sd" → lowest resolution streamType (usually 4 = substream)
These values must be mapped before sending to MQTT: - streamType 2 → MQTT stream_type 0 - streamType 4 → MQTT stream_type 1
func (*TuyaClient) GetVideoCodecs ¶
func (c *TuyaClient) GetVideoCodecs() []*core.Codec
func (*TuyaClient) IsHEVC ¶
func (c *TuyaClient) IsHEVC(streamType int) bool
IsHEVC checks if the given streamType uses H265 (HEVC) codec HEVC cameras use DataChannel, H264 cameras use RTP tracks - codecType 4 = H265 (HEVC) → DataChannel mode - codecType 2 = H264 → Normal RTP mode
type TuyaCloudApiClient ¶
type TuyaCloudApiClient struct {
TuyaClient
// contains filtered or unexported fields
}
func NewTuyaCloudApiClient ¶
func NewTuyaCloudApiClient(baseUrl, uid, deviceId, clientId, clientSecret string) (*TuyaCloudApiClient, error)
func (*TuyaCloudApiClient) GetStreamUrl ¶
func (c *TuyaCloudApiClient) GetStreamUrl(streamType string) (streamUrl string, err error)
type TuyaMqttClient ¶
type TuyaMqttClient struct {
// contains filtered or unexported fields
}
func NewTuyaMqttClient ¶
func NewTuyaMqttClient(deviceId string) *TuyaMqttClient
func (*TuyaMqttClient) SendCandidate ¶
func (c *TuyaMqttClient) SendCandidate(candidate string) error
func (*TuyaMqttClient) SendDisconnect ¶
func (c *TuyaMqttClient) SendDisconnect() error
func (*TuyaMqttClient) SendResolution ¶
func (c *TuyaMqttClient) SendResolution(resolution int) error
func (*TuyaMqttClient) SendSpeaker ¶
func (c *TuyaMqttClient) SendSpeaker(speaker int) error
func (*TuyaMqttClient) Start ¶
func (c *TuyaMqttClient) Start(hubConfig *MQTTConfig, webrtcConfig *WebRTCConfig, webrtcVersion int) error
func (*TuyaMqttClient) Stop ¶
func (c *TuyaMqttClient) Stop()
func (*TuyaMqttClient) WakeUp ¶
func (c *TuyaMqttClient) WakeUp(localKey string) error
WakeUp sends a wake-up signal to battery-powered cameras (LowPower mode). The camera wakes up and starts responding immediately - we don't wait for dps[149]. Note: LowPower cameras sleep after ~3 minutes of inactivity.
type TuyaSmartApiClient ¶
type TuyaSmartApiClient struct {
TuyaClient
// contains filtered or unexported fields
}
func NewTuyaSmartApiClient ¶
func NewTuyaSmartApiClient(httpClient *http.Client, baseUrl, email, password, deviceId string) (*TuyaSmartApiClient, error)
func (*TuyaSmartApiClient) GetAppInfo ¶
func (c *TuyaSmartApiClient) GetAppInfo() (*AppInfoResponse, error)
func (*TuyaSmartApiClient) GetHomeList ¶
func (c *TuyaSmartApiClient) GetHomeList() (*HomeListResponse, error)
func (*TuyaSmartApiClient) GetRoomList ¶
func (c *TuyaSmartApiClient) GetRoomList(homeId string) (*RoomListResponse, error)
func (*TuyaSmartApiClient) GetSharedHomeList ¶
func (c *TuyaSmartApiClient) GetSharedHomeList() (*SharedHomeListResponse, error)
func (*TuyaSmartApiClient) GetStreamUrl ¶
func (c *TuyaSmartApiClient) GetStreamUrl(streamType string) (streamUrl string, err error)
type VideoSkill ¶
type VideoSkill struct {
StreamType int `json:"streamType"` // 2 = main stream (HD), 4 = sub stream (SD)
CodecType int `json:"codecType"` // 2 = H264, 4 = H265 (HEVC)
Width int `json:"width"`
Height int `json:"height"`
SampleRate int `json:"sampleRate"`
ProfileId string `json:"profileId,omitempty"`
}
type WebRTCConfig ¶
type WebRTCConfig struct {
AudioAttributes AudioAttributes `json:"audio_attributes"`
Auth string `json:"auth"`
ID string `json:"id"`
LocalKey string `json:"local_key,omitempty"`
MotoID string `json:"moto_id"`
P2PConfig P2PConfig `json:"p2p_config"`
ProtocolVersion string `json:"protocol_version"`
Skill string `json:"skill"`
SupportsWebRTCRecord bool `json:"supports_webrtc_record"`
SupportsWebRTC bool `json:"supports_webrtc"`
VedioClaritiy int `json:"vedio_clarity"`
VideoClaritiy int `json:"video_clarity"`
VideoClarities []int `json:"video_clarities"`
}
type WebRTCConfigResponse ¶
type WebRTCConfigResponse struct {
Timestamp int64 `json:"t"`
Success bool `json:"success"`
Result WebRTCConfig `json:"result"`
Msg string `json:"msg,omitempty"`
Code int `json:"code,omitempty"`
}