Documentation
¶
Overview ¶
Package mitv talks to the LAN remote API of Xiaomi HyperOS displays and TVs: the HTTP server on port 6095 that switches inputs and changes volume.
Index ¶
- Constants
- Variables
- func Discover() ([]string, error)
- type Link
- func (l *Link) DeviceName() (string, error)
- func (l *Link) IsMonitor() bool
- func (l *Link) Press(key string) error
- func (l *Link) Select(sourceID int) error
- func (l *Link) SetCompetitive(on bool) error
- func (l *Link) Sources() ([]Source, error)
- func (l *Link) Volume() (int, error)
- func (l *Link) Wake(d time.Duration) bool
- type Source
Constants ¶
const ( SourceDP = 29 SourceUSBC = 30 )
The ids of the monitor-only inputs.
const Port = 6095
Port is where the remote API listens.
Variables ¶
var ErrNotFound = errors.New("mitv: no monitor found")
ErrNotFound means no HyperOS monitor answered on the local network.
var ErrRejected = errors.New("mitv: request rejected")
ErrRejected means the device answered but refused the request.
Functions ¶
Types ¶
type Link ¶
type Link struct {
Host string
// contains filtered or unexported fields
}
Link is a client for one device.
func (*Link) DeviceName ¶
DeviceName answers whether the device is reachable, with its name.
func (*Link) IsMonitor ¶ added in v1.4.1
IsMonitor tells a monitor from the other devices with the same remote API, such as TVs: MonitorBar must never switch a TV in another room. A monitor's name says so, unless its owner renamed it (#5); then its DP or USB-C input does, which TVs don't have.
func (*Link) Select ¶
Select switches input. changesource2 takes the numeric id, so it also reaches DP and USB-C, which the name-based changesource rejects.
func (*Link) SetCompetitive ¶ added in v1.5.0
SetCompetitive turns the 320Hz competitive mode of dual-mode monitors such as the G Pro 27U on or off: it trades 4K 160Hz for 1080p 320Hz by changing the EDID the monitor offers (#8). No API sets it, so this walks the game bar the menu key opens, where the mode is the sixth item.