ironflock 1.0.5__py3-none-any.whl → 1.0.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ironflock/__init__.py +1 -1
- ironflock/ironflock.py +28 -5
- {ironflock-1.0.5.dist-info → ironflock-1.0.7.dist-info}/METADATA +1 -1
- ironflock-1.0.7.dist-info/RECORD +8 -0
- ironflock-1.0.5.dist-info/RECORD +0 -8
- {ironflock-1.0.5.dist-info → ironflock-1.0.7.dist-info}/WHEEL +0 -0
- {ironflock-1.0.5.dist-info → ironflock-1.0.7.dist-info}/licenses/LICENSE +0 -0
- {ironflock-1.0.5.dist-info → ironflock-1.0.7.dist-info}/top_level.txt +0 -0
ironflock/__init__.py
CHANGED
ironflock/ironflock.py
CHANGED
|
@@ -44,10 +44,8 @@ class IronFlock:
|
|
|
44
44
|
async def onJoin(session, details):
|
|
45
45
|
print("component joined")
|
|
46
46
|
self._session = session
|
|
47
|
-
self._main_task = asyncio.create_task(mainFunc())
|
|
48
|
-
|
|
49
47
|
if self.mainFunc:
|
|
50
|
-
|
|
48
|
+
self._main_task = asyncio.create_task(mainFunc())
|
|
51
49
|
|
|
52
50
|
@self._component.on_disconnect
|
|
53
51
|
@self._component.on_leave
|
|
@@ -138,13 +136,38 @@ class IronFlock:
|
|
|
138
136
|
app_key = os.environ.get("APP_KEY")
|
|
139
137
|
env_value = os.environ.get("ENV")
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
full_topic = f"{swarm_key}.{self._device_key}.{app_key}.{env_value}.{topic}"
|
|
142
140
|
|
|
143
141
|
if self._session is not None:
|
|
144
|
-
await self._session.register(
|
|
142
|
+
await self._session.register(func, full_topic, options=RegisterOptions(force_reregister=True))
|
|
145
143
|
else:
|
|
146
144
|
print("cannot register function, not connected")
|
|
147
145
|
|
|
146
|
+
async def call(self, device_key, topic, args, kwargs):
|
|
147
|
+
"""Calls a remote procedure on the IronFlock platform.
|
|
148
|
+
|
|
149
|
+
Args:
|
|
150
|
+
device_key (str): The key of the device to call the procedure on.
|
|
151
|
+
topic (str): The URI of the topic to call, e.g. "com.myprocedure".
|
|
152
|
+
args (list): The arguments to pass to the procedure.
|
|
153
|
+
kwargs (dict): The keyword arguments to pass to the procedure.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
The result of the remote procedure call.
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
swarm_key = os.environ.get("SWARM_KEY")
|
|
160
|
+
app_key = os.environ.get("APP_KEY")
|
|
161
|
+
env_value = os.environ.get("ENV")
|
|
162
|
+
|
|
163
|
+
full_topic = f"{swarm_key}.{device_key}.{app_key}.{env_value}.{topic}"
|
|
164
|
+
|
|
165
|
+
if self._session is not None:
|
|
166
|
+
return await self._session.call(full_topic, *args, **kwargs)
|
|
167
|
+
else:
|
|
168
|
+
print("cannot call, not connected")
|
|
169
|
+
return None
|
|
170
|
+
|
|
148
171
|
async def publish_to_table(
|
|
149
172
|
self, tablename: str, *args, **kwargs
|
|
150
173
|
) -> Optional[Publication]:
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
ironflock/AutobahnConnection.py,sha256=clwEsptqQFjDFn4dUGN4bQyb1cOnPmmNjetfTrRqckY,3687
|
|
2
|
+
ironflock/__init__.py,sha256=z-s5x1G27QSftSknNGAuwKSxF4xvxoktd9VVOFx6HW0,264
|
|
3
|
+
ironflock/ironflock.py,sha256=9zGmYVssBmMp4l_iceQc581aLu5-HieZIdRmBL2YkCE,7836
|
|
4
|
+
ironflock-1.0.7.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
|
|
5
|
+
ironflock-1.0.7.dist-info/METADATA,sha256=alvJX4W3cvxwoY4fNtzNJQZrN22TmIRcN88ONIsEoyQ,2764
|
|
6
|
+
ironflock-1.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
+
ironflock-1.0.7.dist-info/top_level.txt,sha256=hmMdMPJuvnOTlFKYl1XQOn81vg1DE2LT7xrEXgyxcRA,10
|
|
8
|
+
ironflock-1.0.7.dist-info/RECORD,,
|
ironflock-1.0.5.dist-info/RECORD
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
ironflock/AutobahnConnection.py,sha256=clwEsptqQFjDFn4dUGN4bQyb1cOnPmmNjetfTrRqckY,3687
|
|
2
|
-
ironflock/__init__.py,sha256=J5w21EeWOBHuxr98nMVMXAASa0tYnKppMluxtKL_x4U,264
|
|
3
|
-
ironflock/ironflock.py,sha256=7ugUzrt1yCG_hJAlUKiyMqALZzhrvokHBOgsPDpLxgU,6906
|
|
4
|
-
ironflock-1.0.5.dist-info/licenses/LICENSE,sha256=GpUKjPB381nmkbBIdX74vxXhsNZaNpngTOciss39Pjk,1073
|
|
5
|
-
ironflock-1.0.5.dist-info/METADATA,sha256=9htX7guGxMP0xAqdOg-uWuyy8riEEs37LrPvV1gygQY,2764
|
|
6
|
-
ironflock-1.0.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
7
|
-
ironflock-1.0.5.dist-info/top_level.txt,sha256=hmMdMPJuvnOTlFKYl1XQOn81vg1DE2LT7xrEXgyxcRA,10
|
|
8
|
-
ironflock-1.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|