connection

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrRegisterTimeout is returned if a registered response is not recieved from the TV
	// before a timeout
	ErrRegisterTimeout = errors.New("Timeout waiting for registered response")
	// ErrFailResponse is returned when the TV returns a fail response to a request
	ErrFailResponse = errors.New("TV returned fail response to request")
	// ErrRequestTimeout is returned when no response is recieved to a request before a timeout.
	// Note that it can also be returned if we do get a response, but an error occurs processing it
	// on our end.
	ErrRequestTimeout = errors.New("Timeout waiting for response to request")
	// ErrConnectionTimeout is returned when we fail to open the websocket connection before the timeout
	ErrConnectionTimeout = errors.New("Failed to connect to TV's websocket connection before timeout")
)

Functions

This section is empty.

Types

type AccessibilityInfo

type AccessibilityInfo struct {
	SupportsAudioGuidance bool `json:"supportsAudioGuidance"`
}

AccessibilityInfo represents accessibility options supported by an App

type App

type App struct {
	DefaultWindowType          string            `json:"defaultWindowType"`
	InstalledTime              int               `json:"installedTime"`
	BgImages                   []string          `json:"bgImages"`
	UIRevision                 json.RawMessage   `json:"uiRevision"` // Some apps report this as a string, some as a number
	CPApp                      bool              `json:"CPApp"`
	Version                    string            `json:"version"`
	SystemApp                  bool              `json:"systemApp"`
	AppSize                    int               `json:"appsize"`
	Vendor                     string            `json:"vendor"`
	MiniIcon                   string            `json:"miniicon"`
	HasPromotion               bool              `json:"hasPromotion"`
	TileSize                   string            `json:"tileSize"`
	Icons                      []string          `json:"icons"`
	RequestedWindowOrientation string            `json:"requestedWindowOrientation"`
	LargeIcon                  string            `json:"largeIcon"`
	Lockable                   bool              `json:"lockable"`
	Transparent                bool              `json:"transparent"`
	Icon                       string            `json:"icon"`
	CheckUpdateOnLaunch        bool              `json:"checkUpdateOnLaunch"`
	Category                   string            `json:"category"`
	LaunchInNewGroup           bool              `json:"launchinnewgroup"`
	SpinnerOnLaunch            bool              `json:"spinnerOnLaunch"`
	HandlesRelaunch            bool              `json:"handlesRelaunch"`
	UnMovable                  bool              `json:"unmovable"`
	ID                         string            `json:"id"`
	Inspectable                bool              `json:"inspectable"`
	InAppSetting               bool              `json:"inAppSetting"`
	PriviledgedJail            bool              `json:"privilegedJail"`
	SupportQuickStart          bool              `json:"supportQuickStart"`
	Title                      string            `json:"title"`
	SplashBackground           string            `json:"splashBackground"`
	TrustLevel                 string            `json:"trustLevel"`
	BootLaunchParams           BootLaunchParams  `json:"bootLaunchParams"`
	HardwareFeaturesNeeded     []string          `json:"hardwareFeaturesNeeded"`
	Visible                    bool              `json:"visible"`
	NoWindow                   bool              `json:"noWindow"`
	Age                        int               `json:"age"`
	WindowGroup                WindowGroup       `json:"windowGroup"`
	Accessibility              AccessibilityInfo `json:"accessibility"`
	FolderPath                 string            `json:"folderPath"`
	DeepLinkingParams          string            `json:"deeplinkingParams"`
	Main                       string            `json:"main"`
	Removable                  bool              `json:"removable"`
	Type                       string            `json:"type"`
	BgImage                    string            `json:"bgImage"`
	IconColor                  string            `json:"iconColor"`
	DisableBackHistoryAPI      bool              `json:"disableBackHistoryAPI"`
	NoSplashOnLaunch           bool              `json:"noSplashOnLaunch"`
}

App represents an App on the TV

type BootLaunchParams

type BootLaunchParams struct {
	Boot bool `json:"boot"`
}

BootLaunchParams represents the parameters relating to launching the app on TV boot

type CASystemIDList

type CASystemIDList struct {
}

CASystemIDList represents... something

type Channel

type Channel struct {
	ChannelID           string         `json:"channelId"`
	ProgramID           string         `json:"programId"`
	SignalChannelID     string         `json:"signalChannelId"`
	ChanCode            string         `json:"chanCode"`
	ChannelMode         string         `json:"channelMode"`
	ChannelModeID       int            `json:"channelModeId"`
	ChannelType         string         `json:"channelType"`
	ChannelTypeID       int            `json:"channelTypeId"`
	ChannelNumber       string         `json:"channelNumber"`
	MajorNumber         int            `json:"majorNumber"`
	MinorNumber         int            `json:"minorNumber"`
	ChannelName         string         `json:"channelName"`
	Skipped             bool           `json:"skipped"`
	Locked              bool           `json:"locked"`
	Descrambled         bool           `json:"descrambled"`
	Scrambled           bool           `json:"scrambled"`
	ServiceType         int            `json:"serviceType"`
	FavoriteGroup       []string       `json:"favoriteGroup"`
	ImgURL              string         `json:"imgUrl"`
	Display             int            `json:"display"`
	SatelliteName       string         `json:"satelliteName"`
	FineTuned           bool           `json:"fineTuned"`
	Frequency           int            `json:"Frequency"`
	ShortCut            int            `json:"shortCut"`
	Bandwidth           int            `json:"Bandwidth"`
	HDTV                bool           `json:"HDTV"`
	Invisible           bool           `json:"Invisible"`
	TV                  bool           `json:"TV"`
	DTV                 bool           `json:"DTV"`
	ATV                 bool           `json:"ATV"`
	Data                bool           `json:"Data"`
	Radio               bool           `json:"Radio"`
	Numeric             bool           `json:"Numeric"`
	PrimaryCh           bool           `json:"PrimaryCh"`
	SpecialService      bool           `json:"specialService"`
	CASystemIDList      CASystemIDList `json:"CASystemIDList"`
	CASystemIDListCount int            `json:"CASystemIDListCount"`
	GroupIDList         []int          `json:"groupIdList"`
	ChannelGenreCode    string         `json:"channelGenreCode"`
	FavoriteIdxA        int            `json:"favoriteIdxA"`
	FavoriteIdxB        int            `json:"favoriteIdxB"`
	FavoriteIDxC        int            `json:"favoriteIdxC"`
	FavoriteIDxD        int            `json:"favoriteIdxD"`
	FavoriteIDxE        int            `json:"favoriteIdxE"`
	FavoriteIDxF        int            `json:"favoriteIdxF"`
	FavoriteIDxG        int            `json:"favoriteIdxG"`
	FavoriteIDxH        int            `json:"favoriteIdxH"`
	ImgURL2             string         `json:"imgUrl2"`
	ChannelLogoSize     string         `json:"channelLogoSize"`
	IPChanServerURL     string         `json:"ipChanServerUrl"`
	PayChan             bool           `json:"payChan"`
	IPChannelCode       string         `json:"IPChannelCode"`
	IPCallNumber        string         `json:"ipCallNumber"`
	UTOFlag             bool           `json:"otuFlag"`
	SatelliteLcn        bool           `json:"satelliteLcn"`
	WaterMarkURL        string         `json:"waterMarkUrl"`
	ChannelNameSortKey  string         `json:"channelNameSortKey"`
	IPChanType          string         `json:"ipChanType"`
	AdultFlag           int            `json:"adultFlag"`
	IPChanCategory      string         `json:"ipChanCategory"`
	IPChanInteractive   bool           `json:"ipChanInteractive"`
	CallSign            string         `json:"callSign"`
	AdFlag              int            `json:"adFlag"`
	Configured          bool           `json:"configured"`
	LastUpdated         string         `json:"lastUpdated"`
	IPChanCpID          string         `json:"ipChanCpId"`
	IsFreeviewPlay      int            `json:"isFreeviewPlay"`
	PlayerService       string         `json:"playerService"`
}

Channel represents all the details of a TV channel

type Connection

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

Connection represents a web socket connection to the TV

func NewConnection

func NewConnection(ip net.IP, timeout int) (*Connection, error)

NewConnection creates a new web socket connection to the TV at the given IP address. The timeout is in milliseconds.

func (*Connection) Close

func (c *Connection) Close() error

Close closes the connection to the TV

func (*Connection) Register

func (c *Connection) Register(clientKey string) (string, error)

Register registers with the TV using the provided client key. If no client key is provided, the TV will generate a new one

func (*Connection) Request

func (c *Connection) Request(uri string, reqPayload interface{}, respPayload interface{}) error

Request makes a request to the TV to perform an action

type Device

type Device struct {
	ID           string   `json:"id"`
	Label        string   `json:"label"`
	Port         int      `json:"port"`
	AppID        string   `json:"appId"`
	Icon         string   `json:"icon"`
	Modified     bool     `json:"modified"`
	LastUniqueID int      `json:"lastUniqueId"`
	SubList      []string `json:"subList"`
	SubCount     int      `json:"subCount"`
	Connected    bool     `json:"connected"`
	Favorite     bool     `json:"favorite"`
}

Device represents an external device inputs connected to the TV

type DualChannel

type DualChannel struct {
	DualChannelID       string `json:"dualChannelId"`
	DualChannelTypeName string `json:"dualChannelTypeName"`
	DualChannelTypeID   string `json:"dualChannelTypeId"`
	DualChannelNumber   string `json:"dualChannelNumber"`
}

DualChannel represents dual channel details for dual channel TV channels

type GetChannelListResponsePayload

type GetChannelListResponsePayload struct {
	ReturnValue          bool                `json:"returnValue"`
	ValueList            string              `json:"valueList"`
	DataSource           int                 `json:"dataSource"`
	DataType             int                 `json:"dataType"`
	CableAnalogSkipped   bool                `json:"cableAnalogSkipped"`
	ScannedChannelCount  ScannedChannelCount `json:"scannedChannelCount"`
	DeviceSourceIndex    int                 `json:"deviceSourceIndex"`
	ChannelListCount     int                 `json:"channelListCount"`
	ChannelLogoServerURL string              `json:"channelLogoServerUrl"`
	IPChanInteractiveURL string              `json:"ipChanInteractiveUrl"`
	ChannelList          []Channel           `json:"channelList"`
}

GetChannelListResponsePayload is the payload returned to "GetChannelList" requests

type GetChannelProgramInfoResponsePayload

type GetChannelProgramInfoResponsePayload struct {
	ReturnValue bool      `json:"returnValue"`
	Channel     Channel   `json:"channel"`
	ProgramList []Program `json:"programList"`
}

GetChannelProgramInfoResponsePayload is the payload returned to "GetChannelProgramInfo" requests

type GetCurrentChannelResponsePayload

type GetCurrentChannelResponsePayload struct {
	ReturnValue      bool        `json:"returnValue"`
	ChannelID        string      `json:"channelId"`
	PhysicalNumber   int         `json:"physicalNumber"`
	IsScrambled      bool        `json:"isScrambled"`
	ChannelTypeName  string      `json:"channelTypeName"`
	IsLocked         bool        `json:"isLocked"`
	DualChannel      DualChannel `json:"dualChannel"`
	IsChannelChanged bool        `json:"isChannelChanged"`
	ChannelModeName  string      `json:"channelModeName"`
	ChannelNumber    string      `json:"channelNumber"`
	IsFineTuned      bool        `json:"isFineTuned"`
	ChannelTypeID    int         `json:"channelTypeId"`
	IsDescrambled    bool        `json:"isDescrambled"`
	IsSkipped        bool        `json:"isSkipped"`
	IsHevcChannel    bool        `json:"isHEVCChannel"`
	HybridTvType     string      `json:"hybridtvType"`
	IsInvisible      bool        `json:"isInvisible"`
	FavoriteGroup    string      `json:"favoriteGroup"`
	ChannelName      string      `json:"channelName"`
	ChannelModeID    int         `json:"channelModeId"`
	SignalChannelID  string      `json:"signalChannelId"`
}

GetCurrentChannelResponsePayload is the payload returned to "GetCurrentChannel" requests

type GetExternalInputListResponsePayload

type GetExternalInputListResponsePayload struct {
	ReturnValue bool     `json:"returnValue"`
	Devices     []Device `json:"devices"`
}

GetExternalInputListResponsePayload is the payload returned to "ListExternalInputs" requests

type GetInstalledAppsResponsePayload

type GetInstalledAppsResponsePayload struct {
	ReturnValue bool  `json:"returnValue"`
	Apps        []App `json:"apps"`
}

GetInstalledAppsResponsePayload is the payload returned to "ListInstalledApps" requests

type GetMuteResponsePayload

type GetMuteResponsePayload struct {
	ReturnValue bool `json:"returnValue"`
	Mute        bool `json:"mute"`
}

GetMuteResponsePayload is the payload returned to "GetMute" requests

type GetVolumeResponsePayload

type GetVolumeResponsePayload struct {
	ReturnValue bool   `json:"returnValue"`
	Scenario    string `json:"scenario"`
	Volume      int    `json:"volume"`
	Muted       bool   `json:"muted"`
	VolumeMax   int    `json:"volumeMax"`
}

GetVolumeResponsePayload is the payload returned to "GetVolume" requests

type LaunchAppPayload

type LaunchAppPayload struct {
	ID         string      `json:"id"`
	ContentID  string      `json:"contentId"`
	Parameters interface{} `json:"params"`
}

LaunchAppPayload is the payload send with a "LaunchApp" request

type LaunchAppResponsePayload

type LaunchAppResponsePayload struct {
	ReturnValue bool   `json:"returnValue"`
	ID          string `json:"id"`
	SessionID   string `json:"sessionId"`
}

LaunchAppResponsePayload is the payload returned to "LaunchApp" requests

type Program

type Program struct {
	ChannelList     string   `json:"channelId"`
	Duration        int      `json:"duration"`
	EndTime         string   `json:"endTime"`
	LocalEndTime    string   `json:"localEndTime"`
	LocalStartTime  string   `json:"localStartTime"`
	Genre           string   `json:"genre"`
	ProgramID       string   `json:"programId"`
	ProgramName     string   `json:"programName"`
	Rating          []Rating `json:"rating"`
	SignalChannelID string   `json:"signalChannelId"`
	StartTime       string   `json:"startTime"`
	TableID         int      `json:"tableId"`
}

Program represents a program on TV

type Rating

type Rating struct {
	RatingString string `json:"ratingString"`
	RatingValue  int    `json:"ratingValue"`
	Region       int    `json:"region"`
	ID           string `json:"_id"`
}

Rating represents the rating of a TV program

type ScannedChannelCount

type ScannedChannelCount struct {
	TerrestrialAnalogCount  int `json:"terrestrialAnalogCount"`
	TerrestrialDigitalCount int `json:"terrestrialDigitalCount"`
	CableAnalogCount        int `json:"cableAnalogCount"`
	CableDigitalCount       int `json:"cableDigitalCount"`
	SatelliteDigitalCount   int `json:"satelliteDigitalCount"`
}

ScannedChannelCount represents count details of the returned channels

type SetChannelPayload

type SetChannelPayload struct {
	ChannelNumber string `json:"channelNumber"`
}

SetChannelPayload is the payload sent with an OpenChannel request

type SetMutePayload

type SetMutePayload struct {
	Mute bool `json:"mute"`
}

SetMutePayload is the payload sent with a SetMute request

type SetVolumePayload

type SetVolumePayload struct {
	Volume int `json:"volume"`
}

SetVolumePayload is the payload sent with a SetVolume request

type SwitchInputPayload

type SwitchInputPayload struct {
	InputID string `json:"inputId"`
}

SwitchInputPayload is the payload sent with a SwitchInput request

type WindowGroup

type WindowGroup struct {
	Owner     bool            `json:"owner"`
	OwnerInfo WindowOwnerInfo `json:"ownerInfo"`
	Name      string          `json:"name"`
}

WindowGroup represents something to do with windows

type WindowOwnerInfo

type WindowOwnerInfo struct {
	AllowAnonymous bool                   `json:"allowAnonymous"`
	Layers         []WindowOwnerInfoLayer `json:"layers"`
}

WindowOwnerInfo represents something to do with owners of windows

type WindowOwnerInfoLayer

type WindowOwnerInfoLayer struct {
	Z    int    `json:"z"`
	Name string `json:"name"`
}

WindowOwnerInfoLayer represents something to do with layers in the window owner... or something

Jump to

Keyboard shortcuts

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