ecpClient

package
v0.0.0-...-13528ae Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const RequestTimeoutMilliseconds = 30000

Variables

View Source
var AppResponseMock = `` /* 138-byte string literal not displayed */
View Source
var AppsResponseMock = `` /* 203-byte string literal not displayed */
View Source
var SuccessResponseMock = `{}`
View Source
var UiResponseMock = `` /* 219-byte string literal not displayed */

Functions

func NewTestClient

func NewTestClient(fn RoundTripFunc) *http.Client

NewTestClient returns *http.Client with Transport replaced to avoid making real calls

func TestingHTTPClient

func TestingHTTPClient(resp *string) *http.Client

Types

type ActiveAppResponse

type ActiveAppResponse struct {
	ActiveApp App `xml:"app"`
}

type App

type App struct {
	Title   string `xml:",chardata"`
	ID      string `xml:"id,attr"`
	Type    string `xml:"type,attr"`
	Version string `xml:"version,attr"`
	Subtype string `xml:"subtype,attr"`
}

type AppsResponse

type AppsResponse struct {
	Apps []App `xml:"app"`
}

type BaseClient

type BaseClient struct {
	BaseURL    *url.URL
	HttpClient *Client
}

type Client

type Client struct {
	HttpClient *http.Client
}

func NewClient

func NewClient(options ...Option) *Client

type DeviceInfo

type DeviceInfo struct {
	Udn                      string `xml:"udn"`
	SerialNumber             string `xml:"serial-number"`
	DeviceID                 string `xml:"device-id"`
	AdvertisingID            string `xml:"advertising-id"`
	VendorName               string `xml:"vendor-name"`
	ModelName                string `xml:"model-name"`
	ModelNumber              string `xml:"model-number"`
	ModelRegion              string `xml:"model-region"`
	IsTv                     string `xml:"is-tv"`
	IsStick                  string `xml:"is-stick"`
	SupportsEthernet         string `xml:"supports-ethernet"`
	WifiMac                  string `xml:"wifi-mac"`
	WifiDriver               string `xml:"wifi-driver"`
	EthernetMac              string `xml:"ethernet-mac"`
	NetworkType              string `xml:"network-type"`
	NetworkName              string `xml:"network-name"`
	FriendlyDeviceName       string `xml:"friendly-device-name"`
	FriendlyModelName        string `xml:"friendly-model-name"`
	DefaultDeviceName        string `xml:"default-device-name"`
	UserDeviceName           string `xml:"user-device-name"`
	UserDeviceLocation       string `xml:"user-device-location"`
	BuildNumber              string `xml:"build-number"`
	SoftwareVersion          string `xml:"software-version"`
	SoftwareBuild            string `xml:"software-build"`
	SecureDevice             string `xml:"secure-device"`
	Language                 string `xml:"language"`
	Country                  string `xml:"country"`
	Locale                   string `xml:"locale"`
	TimeZoneAuto             string `xml:"time-zone-auto"`
	TimeZone                 string `xml:"time-zone"`
	TimeZoneName             string `xml:"time-zone-name"`
	TimeZoneTz               string `xml:"time-zone-tz"`
	TimeZoneOffset           string `xml:"time-zone-offset"`
	ClockFormat              string `xml:"clock-format"`
	Uptime                   string `xml:"uptime"`
	PowerMode                string `xml:"power-mode"`
	SupportsSuspend          string `xml:"supports-suspend"`
	SupportsFindRemote       string `xml:"supports-find-remote"`
	FindRemoteIsPossible     string `xml:"find-remote-is-possible"`
	SupportsAudioGuide       string `xml:"supports-audio-guide"`
	SupportsRva              string `xml:"supports-rva"`
	DeveloperEnabled         string `xml:"developer-enabled"`
	KeyedDeveloperID         string `xml:"keyed-developer-id"`
	SearchEnabled            string `xml:"search-enabled"`
	SearchChannelsEnabled    string `xml:"search-channels-enabled"`
	NotificationsEnabled     string `xml:"notifications-enabled"`
	NotificationsFirstUse    string `xml:"notifications-first-use"`
	SupportsPrivateListening string `xml:"supports-private-listening"`
	HeadphonesConnected      string `xml:"headphones-connected"`
	SupportsEcsTextedit      string `xml:"supports-ecs-textedit"`
	SupportsEcsMicrophone    string `xml:"supports-ecs-microphone"`
	SupportsWakeOnWlan       string `xml:"supports-wake-on-wlan"`
	HasPlayOnRoku            string `xml:"has-play-on-roku"`
	HasMobileScreensaver     string `xml:"has-mobile-screensaver"`
	SupportURL               string `xml:"support-url"`
	GrandcentralVersion      string `xml:"grandcentral-version"`
	TrcVersion               string `xml:"trc-version"`
	TrcChannelVersion        string `xml:"trc-channel-version"`
	DavinciVersion           string `xml:"davinci-version"`
}

type EcpClient

type EcpClient struct {
	*BaseClient
}

func GetEcpClient

func GetEcpClient(ip string) (*EcpClient, error)

func GetMockedClient

func GetMockedClient(resp *string) *EcpClient

func (*EcpClient) GetActiveApp

func (ec *EcpClient) GetActiveApp() (*App, error)

func (*EcpClient) GetAppUi

func (ec *EcpClient) GetAppUi() (*Node, error)

func (*EcpClient) GetApps

func (ec *EcpClient) GetApps() (*[]App, error)

func (*EcpClient) GetDeviceInfo

func (ec *EcpClient) GetDeviceInfo() (*DeviceInfo, error)

func (*EcpClient) GetIcon

func (ec *EcpClient) GetIcon(channelId string) (image.Image, error)

func (*EcpClient) GetPlayer

func (ec *EcpClient) GetPlayer() (*Player, error)

func (*EcpClient) GetSource

func (ec *EcpClient) GetSource() ([]byte, error)

func (*EcpClient) GetTimeout

func (ec *EcpClient) GetTimeout() int

func (*EcpClient) InputChannel

func (ec *EcpClient) InputChannel(channelId string, contentId string, mediaType string) (bool, error)

func (*EcpClient) InstallChannel

func (ec *EcpClient) InstallChannel(channelId string) (bool, error)

func (*EcpClient) KeyDown

func (ec *EcpClient) KeyDown(button string) (bool, error)

func (*EcpClient) KeyPress

func (ec *EcpClient) KeyPress(button string) (bool, error)

func (*EcpClient) KeyUp

func (ec *EcpClient) KeyUp(button string) (bool, error)

func (*EcpClient) LaunchChannel

func (ec *EcpClient) LaunchChannel(channelId string, contentId string, mediaType string) (bool, error)

func (*EcpClient) SetTimeout

func (ec *EcpClient) SetTimeout(timeout time.Duration)

type Node

type Node struct {
	XMLName xml.Name
	Attrs   []xml.Attr `xml:",any,attr"`
	Nodes   []Node     `xml:",any"`
}

type Option

type Option func(*Client)

func SetHTTPClient

func SetHTTPClient(httpClient *http.Client) Option

func SetRequestTimeout

func SetRequestTimeout(timeout time.Duration) Option

type Player

type Player struct {
	Error  string `xml:"error,attr"`
	State  string `xml:"state,attr"`
	Format struct {
		Audio     string `xml:"audio,attr"`
		Captions  string `xml:"captions,attr"`
		Container string `xml:"container,attr"`
		Drm       string `xml:"drm,attr"`
		Video     string `xml:"video,attr"`
		VideoRes  string `xml:"video_res,attr"`
	} `xml:"format"`
	Buffering struct {
		Current string `xml:"current,attr"`
		Max     string `xml:"max,attr"`
		Target  string `xml:"target,attr"`
	} `xml:"buffering"`
	NewStream struct {
		Speed string `xml:"speed,attr"`
	} `xml:"new_stream"`
	Position      string `xml:"position"`
	Duration      string `xml:"duration"`
	IsLive        string `xml:"is_live"`
	Runtime       string `xml:"runtime"`
	StreamSegment struct {
		Bitrate       string `xml:"bitrate,attr"`
		MediaSequence string `xml:"media_sequence,attr"`
		SegmentType   string `xml:"segment_type,attr"`
		Time          string `xml:"time,attr"`
	} `xml:"stream_segment"`
}

type PluginClient

type PluginClient struct {
	*BaseClient
}

func GetPluginClient

func GetPluginClient(ip string) (*PluginClient, error)

func (*PluginClient) Load

func (ec *PluginClient) Load(file io.Reader, user string, pass string) (bool, error)

type RequestData

type RequestData struct {
	Endpoint    *url.URL
	ParamsMap   map[string]string
	HeadersMap  map[string]string
	Method      string
	RequestBody io.Reader
}

type RoundTripFunc

type RoundTripFunc func(req *http.Request) (*http.Response, error)

RoundTripFunc .

func (RoundTripFunc) RoundTrip

func (f RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip .

Jump to

Keyboard shortcuts

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