Skip to content

Commit 8a4e8c6

Browse files
committed
ucloud: Add Television type.
1 parent c32228e commit 8a4e8c6

File tree

1 file changed

+87
-12
lines changed

1 file changed

+87
-12
lines changed

src/arduino_iot_cloud/__init__.py

Lines changed: 87 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

@@ -35,6 +35,19 @@
3535
b"8d6444ffe82217304ff2b89aafca8ecf"
3636
)
3737

38+
class Task(ArduinoCloudObject):
39+
def __init__(self, name, **kwargs):
40+
kwargs.update({("runnable", True)}) # Force task creation.
41+
self.on_run = kwargs.pop("on_run", None)
42+
if not callable(self.on_run):
43+
raise TypeError("Expected a callable object")
44+
super().__init__(name, **kwargs)
45+
46+
async def run(self, aiot):
47+
while True:
48+
self.on_run(aiot)
49+
await asyncio.sleep(self.interval)
50+
3851

3952
class Location(ArduinoCloudObject):
4053
def __init__(self, name, **kwargs):
@@ -78,15 +91,77 @@ async def run(self, aiot):
7891
await asyncio.sleep(self.interval)
7992

8093

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

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

0 commit comments

Comments
 (0)