-
Notifications
You must be signed in to change notification settings - Fork 3
/
VizioAPI_Classes.ps1
63 lines (49 loc) · 1.61 KB
/
VizioAPI_Classes.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class VizioTVPower {
hidden [String]$IPAddress
hidden [String]$AuthToken
VizioTVPower([string]$IPAddress, [string]$AuthToken) {
$this.IPAddress = $IPAddress
$this.AuthToken = $AuthToken
}
[void]On() {
Set-Power -action 'on' -IPAddress $this.IPAddress -auth $this.AuthToken
}
[void]Off() {
Set-Power -action 'off' -IPAddress $this.IPAddress -auth $this.AuthToken
}
[String]Status() {
Return Get-PowerStatus -IPAddress $this.IPAddress -auth $this.AuthToken
}
}
class VizioTVInput {
hidden [String]$IPAddress
hidden [String]$AuthToken
VizioTVInput([string]$IPAddress, [string]$AuthToken) {
$this.IPAddress = $IPAddress
$this.AuthToken = $AuthToken
}
[object[]]List() {
Return Get-InputList -IPAddress $this.IPAddress -auth $this.AuthToken
}
[object]Current() {
Return Get-CurrentInput -IPAddress $this.IPAddress -auth $this.AuthToken
}
[void]Set([string]$name) {
Set-Input -name $name -IPAddress $this.IPAddress -auth $this.AuthToken
}
[string]GetInputByName([string]$name) {
Return Get-InputByName -Name $name -IPAddress $this.IPAddress -auth $this.AuthToken
}
}
class VizioTV {
[String]$IPAddress
[String]$AuthToken
[VizioTVPower]$Power
[VizioTVInput]$Input
VizioTV([string]$IPAddress, [string]$AuthToken) {
$this.IPAddress = $IPAddress
$this.AuthToken = $AuthToken
$this.Power = [VizioTVPower]::new($this.IPAddress, $this.AuthToken)
$this.Input = [VizioTVInput]::new($this.IPAddress, $this.AuthToken)
}
}