Skip to content

Commit a4f695d

Browse files
committed
src: Rename AIOTClient and AIOTObject classes.
1 parent 5830b63 commit a4f695d

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/arduino_iot_cloud/__init__.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
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 AIOTClient # noqa
8-
from .ucloud import AIOTObject
7+
from .ucloud import ArduinoCloud # noqa
8+
from .ucloud import ArduinoCloudObject
99
from .ucloud import timestamp
1010

1111
try:
@@ -36,27 +36,27 @@
3636
)
3737

3838

39-
class Location(AIOTObject):
39+
class Location(ArduinoCloudObject):
4040
def __init__(self, name, **kwargs):
4141
super().__init__(name, keys={"lat", "lon"}, **kwargs)
4242

4343

44-
class Color(AIOTObject):
44+
class Color(ArduinoCloudObject):
4545
def __init__(self, name, **kwargs):
4646
super().__init__(name, keys={"hue", "sat", "bri"}, **kwargs)
4747

4848

49-
class ColoredLight(AIOTObject):
49+
class ColoredLight(ArduinoCloudObject):
5050
def __init__(self, name, **kwargs):
5151
super().__init__(name, keys={"swi", "hue", "sat", "bri"}, **kwargs)
5252

5353

54-
class DimmedLight(AIOTObject):
54+
class DimmedLight(ArduinoCloudObject):
5555
def __init__(self, name, **kwargs):
5656
super().__init__(name, keys={"swi", "bri"}, **kwargs)
5757

5858

59-
class Schedule(AIOTObject):
59+
class Schedule(ArduinoCloudObject):
6060
def __init__(self, name, **kwargs):
6161
kwargs.update({("runnable", True)}) # Force task creation.
6262
self.on_active = kwargs.pop("on_active", None)
@@ -78,7 +78,7 @@ async def run(self, aiot):
7878
await asyncio.sleep(self.interval)
7979

8080

81-
class Task(AIOTObject):
81+
class Task(ArduinoCloudObject):
8282
def __init__(self, name, **kwargs):
8383
kwargs.update({("runnable", True)}) # Force task creation.
8484
self.on_run = kwargs.pop("on_run", None)

src/arduino_iot_cloud/ucloud.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def timestamp():
3737
return int(time.time())
3838

3939

40-
class AIOTObject(SenmlRecord):
40+
class ArduinoCloudObject(SenmlRecord):
4141
def __init__(self, name, **kwargs):
4242
self.on_read = kwargs.pop("on_read", None)
4343
self.on_write = kwargs.pop("on_write", None)
@@ -46,7 +46,7 @@ def __init__(self, name, **kwargs):
4646
value = kwargs.pop("value", None)
4747
if keys := kwargs.pop("keys", {}):
4848
value = { # Create a complex object (with sub-records).
49-
k: AIOTObject(f"{name}:{k}", value=v, callback=self.senml_callback)
49+
k: ArduinoCloudObject(f"{name}:{k}", value=v, callback=self.senml_callback)
5050
for (k, v) in {k: kwargs.pop(k, None) for k in keys}.items()
5151
}
5252
self._updated = False
@@ -157,7 +157,7 @@ async def run(self, client):
157157
await asyncio.sleep(self.interval)
158158

159159

160-
class AIOTClient:
160+
class ArduinoCloud:
161161
def __init__(
162162
self,
163163
device_id,
@@ -256,9 +256,9 @@ def register(self, aiotobj, coro=None, **kwargs):
256256
if isinstance(aiotobj, str):
257257
if kwargs.get("value", None) is None and kwargs.get("on_read", None) is not None:
258258
kwargs["value"] = kwargs.get("on_read")(self)
259-
aiotobj = AIOTObject(aiotobj, **kwargs)
259+
aiotobj = ArduinoCloudObject(aiotobj, **kwargs)
260260

261-
# Register the AIOTObject
261+
# Register the ArduinoCloudObject
262262
self.records[aiotobj.name] = aiotobj
263263

264264
# Create a task for this object if it has any callbacks.

0 commit comments

Comments
 (0)