Skip to content

Commit 34ed08a

Browse files
committed
ucloud: Add Television type.
1 parent c32228e commit 34ed08a

File tree

1 file changed

+88
-12
lines changed

1 file changed

+88
-12
lines changed

src/arduino_iot_cloud/__init__.py

Lines changed: 88 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# License, v. 2.0. If a copy of the MPL was not distributed with this
55
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
66

7-
from .ucloud import ArduinoCloudClient # noqa
7+
from .ucloud import ArduinoCloudClient # noqa
88
from .ucloud import ArduinoCloudObject
99
from .ucloud import timestamp
1010

@@ -36,6 +36,20 @@
3636
)
3737

3838

39+
class Task(ArduinoCloudObject):
40+
def __init__(self, name, **kwargs):
41+
kwargs.update({("runnable", True)}) # Force task creation.
42+
self.on_run = kwargs.pop("on_run", None)
43+
if not callable(self.on_run):
44+
raise TypeError("Expected a callable object")
45+
super().__init__(name, **kwargs)
46+
47+
async def run(self, aiot):
48+
while True:
49+
self.on_run(aiot)
50+
await asyncio.sleep(self.interval)
51+
52+
3953
class Location(ArduinoCloudObject):
4054
def __init__(self, name, **kwargs):
4155
super().__init__(name, keys={"lat", "lon"}, **kwargs)
@@ -78,15 +92,77 @@ async def run(self, aiot):
7892
await asyncio.sleep(self.interval)
7993

8094

81-
class Task(ArduinoCloudObject):
82-
def __init__(self, name, **kwargs):
83-
kwargs.update({("runnable", True)}) # Force task creation.
84-
self.on_run = kwargs.pop("on_run", None)
85-
if not callable(self.on_run):
86-
raise TypeError("Expected a callable object")
87-
super().__init__(name, **kwargs)
95+
class Television(ArduinoCloudObject):
96+
PLAYBACK_FASTFORWARD = 0
97+
PLAYBACK_NEXT = 1
98+
PLAYBACK_PAUSE = 2
99+
PLAYBACK_PLAY = 3
100+
PLAYBACK_PREVIOUS = 4
101+
PLAYBACK_REWIND = 5
102+
PLAYBACK_STARTOVER = 6
103+
PLAYBACK_STOP = 7
104+
PLAYBACK_NONE = 255
105+
INPUT_AUX1 = 0
106+
INPUT_AUX2 = 1
107+
INPUT_AUX3 = 2
108+
INPUT_AUX4 = 3
109+
INPUT_AUX5 = 4
110+
INPUT_AUX6 = 5
111+
INPUT_AUX7 = 6
112+
INPUT_BLUERAY = 7
113+
INPUT_CABLE = 8
114+
INPUT_CD = 9
115+
INPUT_COAX1 = 10
116+
INPUT_COAX2 = 11
117+
INPUT_COMPOSITE1 = 12
118+
INPUT_DVD = 13
119+
INPUT_GAME = 14
120+
INPUT_HDRADIO = 15
121+
INPUT_HDMI1 = 16
122+
INPUT_HDMI2 = 17
123+
INPUT_HDMI3 = 18
124+
INPUT_HDMI4 = 19
125+
INPUT_HDMI5 = 20
126+
INPUT_HDMI6 = 21
127+
INPUT_HDMI7 = 22
128+
INPUT_HDMI8 = 23
129+
INPUT_HDMI9 = 24
130+
INPUT_HDMI10 = 25
131+
INPUT_HDMIARC = 26
132+
INPUT_INPUT1 = 27
133+
INPUT_INPUT2 = 28
134+
INPUT_INPUT3 = 29
135+
INPUT_INPUT4 = 30
136+
INPUT_INPUT5 = 31
137+
INPUT_INPUT6 = 32
138+
INPUT_INPUT7 = 33
139+
INPUT_INPUT8 = 34
140+
INPUT_INPUT9 = 35
141+
INPUT_INPUT10 = 36
142+
INPUT_IPOD = 37
143+
INPUT_LINE1 = 38
144+
INPUT_LINE2 = 39
145+
INPUT_LINE3 = 40
146+
INPUT_LINE4 = 41
147+
INPUT_LINE5 = 42
148+
INPUT_LINE6 = 43
149+
INPUT_LINE7 = 44
150+
INPUT_MEDIAPLAYER = 45
151+
INPUT_OPTICAL1 = 46
152+
INPUT_OPTICAL2 = 47
153+
INPUT_PHONO = 48
154+
INPUT_PLAYSTATION = 49
155+
INPUT_PLAYSTATION3 = 50
156+
INPUT_PLAYSTATION4 = 51
157+
INPUT_SATELLITE = 52
158+
INPUT_SMARTCAST = 53
159+
INPUT_TUNER = 54
160+
INPUT_TV = 55
161+
INPUT_USBDAC = 56
162+
INPUT_VIDEO1 = 57
163+
INPUT_VIDEO2 = 58
164+
INPUT_VIDEO3 = 59
165+
INPUT_XBOX = 60
88166

89-
async def run(self, aiot):
90-
while True:
91-
self.on_run(aiot)
92-
await asyncio.sleep(self.interval)
167+
def __init__(self, name, **kwargs):
168+
super().__init__(name, keys={"swi", "vol", "mut", "pbc", "inp", "cha"}, **kwargs)

0 commit comments

Comments
 (0)