RemoteRF 2.2.0__py3-none-any.whl → 2.2.2__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.
remoterf/core/app.py CHANGED
@@ -536,10 +536,9 @@ def _federated_reservations_for_range(start_day, end_day):
536
536
 
537
537
  def _federated_reserve_slot(device_id, chosen_day, chosen_slot, slot_start_str, slot_end_str):
538
538
  handle = account.reserve_device(device_id, chosen_slot[0], chosen_slot[1])
539
- printf("Reservation successful for ", (Sty.BOLD, Sty.GREEN), f"{chosen_day.strftime('%Y-%m-%d')} {slot_start_str}-{slot_end_str}.", Sty.CYAN)
540
- printf("Your device handle -> ", Sty.BOLD, f"{handle}", (Sty.BOLD, Sty.GREEN))
541
- printf("Use it where a token goes, e.g. adi.Pluto(\"" + handle + "\"); it works while you are logged in to this home.", Sty.DEFAULT)
542
- printf("The first call can take ~20 s while the radio powers on.", Sty.GRAY)
539
+ # Worded as a lab account's reservation; the handle goes where a token goes.
540
+ printf("Reservation successful on device ", (Sty.BOLD, Sty.GREEN), f"{str(device_id).rsplit(':', 1)[-1]}", Sty.MAGENTA, " for ", Sty.DEFAULT, f"{chosen_day.strftime('%Y-%m-%d')} {slot_start_str}-{slot_end_str}.", Sty.CYAN)
541
+ printf("Your Token -> ", Sty.BOLD, f"{handle}", (Sty.BOLD, Sty.GREEN))
543
542
  account.install_reserved_driver(handle, device_id)
544
543
 
545
544
 
@@ -50,11 +50,18 @@ import threading
50
50
  import time
51
51
  from typing import Callable, Optional
52
52
 
53
- from aioice import Candidate, Connection
54
- from aioquic.asyncio.protocol import QuicConnectionProtocol
55
- from aioquic.quic import events
56
- from aioquic.quic.configuration import QuicConfiguration
57
- from aioquic.quic.connection import QuicConnection
53
+ try:
54
+ from aioice import Candidate, Connection
55
+ from aioquic.asyncio.protocol import QuicConnectionProtocol
56
+ from aioquic.quic import events
57
+ from aioquic.quic.configuration import QuicConfiguration
58
+ from aioquic.quic.connection import QuicConnection
59
+
60
+ _BROKEN = None
61
+ except Exception as _exc: # noqa: BLE001 - e.g. conda swapped in a cryptography pip's pyOpenSSL cannot use
62
+ Candidate = Connection = QuicConnectionProtocol = QuicConfiguration = QuicConnection = object
63
+ events = None
64
+ _BROKEN = f"{type(_exc).__name__}: {_exc}"
58
65
 
59
66
  from ..common.grpc import grpc_pb2
60
67
  from ..common.utils import map_arg, unmap_arg
@@ -136,7 +143,7 @@ STUN_SECONDS = 1.5 # a STUN server answers in milliseconds or not at all
136
143
 
137
144
 
138
145
  def enabled() -> bool:
139
- return os.getenv("REMOTERF_DIRECT", "1").strip().lower() not in {"0", "off", "no", "false"}
146
+ return _BROKEN is None and os.getenv("REMOTERF_DIRECT", "1").strip().lower() not in {"0", "off", "no", "false"}
140
147
 
141
148
 
142
149
  def wants(function_name: str) -> bool:
@@ -742,6 +749,8 @@ def current(token: Optional[str] = None) -> Optional[DirectPath]:
742
749
 
743
750
  def describe() -> str:
744
751
  """What device calls use right now, for the shell."""
752
+ if _BROKEN is not None:
753
+ return f"relay (direct path unavailable: {_BROKEN}; fix: pip install --force-reinstall remoterf)"
745
754
  if not enabled():
746
755
  return "relay (direct path disabled: REMOTERF_DIRECT=0)"
747
756
  path = _path
@@ -225,15 +225,16 @@ def _device_token(function_name, args):
225
225
  def rpc_client(*, function_name, args, connection=None):
226
226
  global tcp_calls
227
227
  tcp_calls += 1
228
- ref = _federated_ref(function_name, args) if connection is None else None
229
- if ref is not None:
230
- return _finish(_federated_call(ref, function_name, args))
231
228
  wire = os.getenv("REMOTERF_RX_WIRE", "i16").strip().lower()
232
229
  if wire and function_name.endswith(":rx:CALL0"):
233
230
  # Gate I slice 3: c64 halves the samples on the wire, i16 (the default)
234
231
  # quarters them when they are integer IQ; the driver still sees a complex
235
232
  # array. REMOTERF_RX_WIRE="" or "c128" opts out (servers ignore unknown).
233
+ # Also through a HOME, whose relay caps each response at ~768 KiB.
236
234
  args = {**args, "wire": map_arg(wire)}
235
+ ref = _federated_ref(function_name, args) if connection is None else None
236
+ if ref is not None:
237
+ return _finish(_federated_call(ref, function_name, args))
237
238
  if connection is None and direct_path.wants(function_name):
238
239
  path = direct_path.current(token=_device_token(function_name, args))
239
240
  if path is not None:
remoterf/remoterf_cli.py CHANGED
@@ -312,25 +312,39 @@ def _use_home(name: str, *, register: bool, enrollment_code: str | None = None)
312
312
  )
313
313
 
314
314
 
315
+ def _agree_to_tos() -> bool:
316
+ """Every registration is a fresh agreement, whoever is at the keyboard --
317
+ and starting one forgets the old agreement, so backing out here means
318
+ the next login asks too."""
319
+ from remoterf.config.config import _confirm_tos, forget_tos_agreement, remember_tos_agreement
320
+
321
+ forget_tos_agreement()
322
+ if not _confirm_tos("Do you agree to the RemoteRF Terms of Service? [y/N]: ",
323
+ "Registration cancelled."):
324
+ return False
325
+ remember_tos_agreement()
326
+ return True
327
+
328
+
329
+ def _register_global() -> int:
330
+ """`remoterf -r global`: straight to a Global account, same agreement as -r."""
331
+ print_client_banner(_installed_version(), server="")
332
+ if not _agree_to_tos():
333
+ return 1
334
+ return _use_global(register=True, show_banner=False)
335
+
336
+
315
337
  def _register() -> int:
316
338
  """`remoterf -r`: a deployment enrollment code, or a Global account."""
317
339
  from remoterf_federation_core import ValidationError
318
340
 
319
341
  from remoterf.deployment import homes
320
342
 
321
- from remoterf.config.config import _confirm_tos, forget_tos_agreement, remember_tos_agreement
322
-
323
343
  # The banner opens the session; the target is not known yet, so the shell
324
344
  # below must not print it a second time.
325
345
  print_client_banner(_installed_version(), server="")
326
- # Every registration is a fresh agreement, whoever is at the keyboard --
327
- # and starting one forgets the old agreement, so backing out here means
328
- # the next login asks too.
329
- forget_tos_agreement()
330
- if not _confirm_tos("Do you agree to the RemoteRF Terms of Service? [y/N]: ",
331
- "Registration cancelled."):
346
+ if not _agree_to_tos():
332
347
  return 1
333
- remember_tos_agreement()
334
348
  try:
335
349
  entered = input('Enrollment code (Enter for a RemoteRF Global account): ').strip()
336
350
  except (EOFError, KeyboardInterrupt):
@@ -386,10 +400,8 @@ def _login(target: str | None) -> int:
386
400
  return _register()
387
401
  return _account_shell(register=False)
388
402
  if target == 'global':
389
- if not homes.has_global_account():
390
- printf('No RemoteRF Global account is configured here.', Sty.WARNING)
391
- printf('Run: ', Sty.GRAY, 'remoterf --register', Sty.CYAN)
392
- return 2
403
+ # Global's address is built in, so a fresh install can log in to an
404
+ # existing Global account without registering again.
393
405
  return _use_global(register=False)
394
406
  if target not in homes.homes():
395
407
  printf(f'No saved home named {target!r}.', Sty.WARNING)
@@ -434,8 +446,8 @@ def main() -> int:
434
446
  return 0
435
447
 
436
448
  if argv[0] in ("--register", "-register", "-r"):
437
- if len(argv) == 2 and argv[1] == "global":
438
- return _use_global(register=True)
449
+ if len(argv) == 2 and argv[1].lstrip("-") == "global":
450
+ return _register_global()
439
451
  if len(argv) > 1:
440
452
  print("ERROR: --register takes no arguments (or 'global')")
441
453
  return 2
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 2.2.0
3
+ Version: 2.2.2
4
4
  Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
5
  Author-email: Ethan Ge <ethoGalaxy@gmail.com>
6
6
  License-Expression: GPL-3.0-or-later
@@ -1,6 +1,6 @@
1
1
  remoterf.py,sha256=3fQ4zYeDo4Q8n5stT0H5ol8t2njckfY-FDuTZ2yEx5w,1843
2
2
  remoterf/__init__.py,sha256=-1h_xQjiE66oiWRO-vnLGJ4smpgUNhFuV-ZreW9_tD4,667
3
- remoterf/remoterf_cli.py,sha256=OXkle2f1g_lWHX0t-YoXWSMmoMU8IQ60MPdv7bhybbw,21738
3
+ remoterf/remoterf_cli.py,sha256=yqCypQAefP4C120G9848gZMsZXCM4W1HRyJWb6zX7eY,22034
4
4
  remoterf/version.py,sha256=NWzcPOAdd567IvC8ei1yyPdeS7w0kt99oKwL6oWAQSc,850
5
5
  remoterf/common/__init__.py,sha256=ey1IjkAaXFL1sZBnBwuWVlHhA_n0bu_uxgkDV_KOxYg,708
6
6
  remoterf/common/tos_notice.txt,sha256=fUHXV6U9uhZDvVs8BcRi4kWbU1PeU9mkxML0n5DDQp8,334
@@ -23,12 +23,12 @@ remoterf/config/cert_fetcher.py,sha256=_m4CiYxJPTckDrdynwUjwnehD_gd6yZoly5etfT83
23
23
  remoterf/config/config.py,sha256=xuwYXS7zLgG77nSEn6br4X0vXK7Z2rlmBKedyDVI7Fc,9353
24
24
  remoterf/core/__init__.py,sha256=1E9ARnxVICp4uCpGNQT3Fb-jD9TvUYbJmctuUqPy8hU,1206
25
25
  remoterf/core/acc_login.py,sha256=Qct7vEsc0OIdVwmikOv2mVv9-ehH4CMVw7QWHe2yOsg,1010
26
- remoterf/core/app.py,sha256=Xw9J-zBfGnEHDSIR0VzlIcEaJEYs_lRyUYOiVkI7OEc,73437
26
+ remoterf/core/app.py,sha256=bOdy0nuJC4r3ubB5_cAz48XV24YHDwn_0MjVBXpbOws,73373
27
27
  remoterf/core/banner_note.txt,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- remoterf/core/direct_path.py,sha256=qvitsjj59ci8UJgW3gUyMlPNp24GlTUe5FYZ_gQjQK4,31821
28
+ remoterf/core/direct_path.py,sha256=PeqagybrFESHO9-LKwR8F8t14T0dJTZHIlRxepTQtoo,32291
29
29
  remoterf/core/dynamic_v2_transport.py,sha256=rR0Mfjh3Kcz4QJKJen2gsUNjYtHy22PfsZg2KLDIptI,22052
30
30
  remoterf/core/grpc_acc.py,sha256=nYgCyqecoL27hY2ExwJ8Uv1qhEAl5EkzRo0QwTohgFA,8145
31
- remoterf/core/grpc_client.py,sha256=SAKdDQUm92zAYyzgG1N0gE9Lq53Z9CulRjv_49XILw8,17973
31
+ remoterf/core/grpc_client.py,sha256=d5D4-ORhrh33NxjAwZmWtkcxOeq5D_DwnSeHauZl89Y,18048
32
32
  remoterf/core/secure_channel.py,sha256=_avJBcvtLv0_9MgT6dpM-6bNH8DGph2Gls6DJZMkIXo,2859
33
33
  remoterf/core/v2_errors.py,sha256=Xmuta24cfQEy4FGG7HZk7B9hD5g4pGT5Hz8Eguy42lU,2956
34
34
  remoterf/deployment/__init__.py,sha256=aEl9z32KMUBfRRm6Ho0-fM-VUtiKIRq4bQBU2_u29-c,69
@@ -59,9 +59,9 @@ remoterf/drivers/ti_mmwave/ti_mmwave_remote.py,sha256=hYUJUtPz3yRgGsmXzwo95ZYnvJ
59
59
  remoterf/drivers/usrp/__init__.py,sha256=y79nl50_4dV9-AI3cfDptOAWeR58fAaihHObqJI9HJM,780
60
60
  remoterf/drivers/usrp/usrp_remote.py,sha256=hBh_CmGOAoEkkdQQ8uPFAsBA6LVeZsPSlpPGgo1c7sM,115018
61
61
  remoterf/drivers/usrp/usrp_remote.pyi,sha256=MG7rMJdjyT0hLLoJmnS1emDQjgepWz695GbFED3v-T4,11810
62
- remoterf-2.2.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
63
- remoterf-2.2.0.dist-info/METADATA,sha256=uqKEyi4YXkbWR0nw9q_sJH1gSzwMrEVKnfkQPFcdmG4,12778
64
- remoterf-2.2.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
65
- remoterf-2.2.0.dist-info/entry_points.txt,sha256=83-XNRsKpeQK8A0rzkPfjwb4zF4m3l3cCRhxWm_Er0w,56
66
- remoterf-2.2.0.dist-info/top_level.txt,sha256=BUtCT3KOhL-A4r6WL4RslW53rsZflOhHwq77RODYhlk,9
67
- remoterf-2.2.0.dist-info/RECORD,,
62
+ remoterf-2.2.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
63
+ remoterf-2.2.2.dist-info/METADATA,sha256=ao6P--YcXdeAseHEKKbiuZ9j_0LQxE5Cilb4zZ5LlOQ,12778
64
+ remoterf-2.2.2.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
65
+ remoterf-2.2.2.dist-info/entry_points.txt,sha256=83-XNRsKpeQK8A0rzkPfjwb4zF4m3l3cCRhxWm_Er0w,56
66
+ remoterf-2.2.2.dist-info/top_level.txt,sha256=BUtCT3KOhL-A4r6WL4RslW53rsZflOhHwq77RODYhlk,9
67
+ remoterf-2.2.2.dist-info/RECORD,,