RemoteRF 2.0.12__tar.gz → 2.0.14__tar.gz

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.
Files changed (66) hide show
  1. {remoterf-2.0.12/src/remoterf.egg-info → remoterf-2.0.14}/PKG-INFO +1 -1
  2. {remoterf-2.0.12 → remoterf-2.0.14}/setup.py +1 -1
  3. remoterf-2.0.14/src/remoteRF/common/grpc/grpc.proto +237 -0
  4. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/dynamic_device.py +5 -1
  5. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/hackrf/hackrf_remote.py +58 -10
  6. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/remoterf_cli.py +15 -1
  7. {remoterf-2.0.12 → remoterf-2.0.14/src/remoterf.egg-info}/PKG-INFO +1 -1
  8. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoterf.egg-info/SOURCES.txt +1 -37
  9. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_dynamic_device_codegen.py +11 -0
  10. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_remoterf_cli.py +26 -0
  11. {remoterf-2.0.12 → remoterf-2.0.14}/LICENSE +0 -0
  12. {remoterf-2.0.12 → remoterf-2.0.14}/MANIFEST.in +0 -0
  13. {remoterf-2.0.12 → remoterf-2.0.14}/README.md +0 -0
  14. {remoterf-2.0.12 → remoterf-2.0.14}/setup.cfg +0 -0
  15. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/__init__.py +0 -0
  16. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/__init__.py +0 -0
  17. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/grpc/__init__.py +0 -0
  18. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/grpc/grpc_pb2.py +0 -0
  19. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/grpc/grpc_pb2_grpc.py +0 -0
  20. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/grpc/v2_codec.py +0 -0
  21. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/tos_notice.txt +0 -0
  22. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/__init__.py +0 -0
  23. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/ansi_codes.py +0 -0
  24. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/api_token.py +0 -0
  25. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/banner.py +0 -0
  26. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/list_string.py +0 -0
  27. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/common/utils/process_arg.py +0 -0
  28. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/config/__init__.py +0 -0
  29. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/config/cert_fetcher.py +0 -0
  30. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/config/config.py +0 -0
  31. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/__init__.py +0 -0
  32. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/acc_login.py +0 -0
  33. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/app.py +0 -0
  34. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/banner_note.txt +0 -0
  35. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/dynamic_v2_transport.py +0 -0
  36. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/grpc_acc.py +0 -0
  37. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/grpc_client.py +0 -0
  38. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/core/v2_errors.py +0 -0
  39. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/__init__.py +0 -0
  40. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/_virtual.py +0 -0
  41. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/adalm_pluto/__init__.py +0 -0
  42. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/adalm_pluto/pluto_remote.py +0 -0
  43. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/dynamic_v2.py +0 -0
  44. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/hackrf/__init__.py +0 -0
  45. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/rtl_sdr/__init__.py +0 -0
  46. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/rtl_sdr/rtl_sdr_remote.py +0 -0
  47. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/support/__init__.py +0 -0
  48. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/support/ti_mmwave.py +0 -0
  49. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/support/uhd.py +0 -0
  50. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/support/uhd_dsp.py +0 -0
  51. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/support/uhd_v2.py +0 -0
  52. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/ti_mmwave/__init__.py +0 -0
  53. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/ti_mmwave/ti_mmwave_remote.py +0 -0
  54. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/usrp/__init__.py +0 -0
  55. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/usrp/usrp_remote.py +0 -0
  56. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/drivers/usrp/usrp_remote.pyi +0 -0
  57. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoteRF/version.py +0 -0
  58. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoterf.egg-info/dependency_links.txt +0 -0
  59. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoterf.egg-info/entry_points.txt +0 -0
  60. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoterf.egg-info/requires.txt +0 -0
  61. {remoterf-2.0.12 → remoterf-2.0.14}/src/remoterf.egg-info/top_level.txt +0 -0
  62. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_banner.py +0 -0
  63. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_dynamic_v2.py +0 -0
  64. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_pluto_virtual.py +0 -0
  65. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_process_arg.py +0 -0
  66. {remoterf-2.0.12 → remoterf-2.0.14}/tests/test_ti_mmwave.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 2.0.12
3
+ Version: 2.0.14
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: Ethan Ge
6
6
  Author-email: ethoGalaxy@gmail.com
@@ -21,7 +21,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
21
21
 
22
22
  setup(
23
23
  name="remoterf",
24
- version="2.0.12",
24
+ version="2.0.14",
25
25
  author="Ethan Ge",
26
26
  author_email="ethoGalaxy@gmail.com",
27
27
  description="A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.",
@@ -0,0 +1,237 @@
1
+ // Copyright (C) 2026 RemoteRF
2
+ //
3
+ // This program is free software: you can redistribute it and/or modify
4
+ // it under the terms of the GNU General Public License as published by
5
+ // the Free Software Foundation, either version 3 of the License, or
6
+ // (at your option) any later version.
7
+ //
8
+ // This program is distributed in the hope that it will be useful,
9
+ // but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ // GNU General Public License for more details.
12
+ //
13
+ // You should have received a copy of the GNU General Public License
14
+ // along with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+ syntax = "proto3";
17
+
18
+ option java_package = "com.example.demo";
19
+ option java_outer_classname = "DemoProtos";
20
+
21
+ package remote_rf;
22
+
23
+ service GenericRPC {
24
+ rpc Call (GenericRPCRequest) returns (GenericRPCResponse);
25
+ }
26
+
27
+ // Dynamic protocol v2 is deliberately additive. GenericRPC remains the v1
28
+ // compatibility surface for existing generated clients and device schemas.
29
+ service DynamicControlV2 {
30
+ rpc Negotiate (NegotiateRequest) returns (NegotiateResponse);
31
+ rpc GetSchema (GetSchemaRequest) returns (GetSchemaResponse);
32
+ rpc OpenSession (OpenSessionRequest) returns (OpenSessionResponse);
33
+ rpc Invoke (InvokeRequest) returns (InvokeResponse);
34
+ rpc CloseHandle (CloseHandleRequest) returns (CloseResponse);
35
+ rpc CloseSession (CloseSessionRequest) returns (CloseResponse);
36
+ }
37
+
38
+ service SampleDataV1 {
39
+ rpc SampleStream (stream SampleFrame) returns (stream SampleFrame);
40
+ }
41
+
42
+ message GenericRPCRequest {
43
+ string function_name = 1;
44
+ map<string, Argument> args = 2;
45
+ }
46
+
47
+ message GenericRPCResponse {
48
+ map<string, Argument> results = 1;
49
+ }
50
+
51
+ message ArrayShape {
52
+ repeated int32 dim = 1;
53
+ }
54
+
55
+ message ComplexNumber {
56
+ float real = 1;
57
+ float imag = 2;
58
+ }
59
+
60
+ message ComplexNumpyArray {
61
+ ArrayShape shape = 1;
62
+ repeated ComplexNumber data = 2;
63
+ }
64
+
65
+ message RealNumpyArray {
66
+ ArrayShape shape = 1;
67
+ repeated float data = 2;
68
+ }
69
+
70
+ message Argument {
71
+ oneof value {
72
+ string string_value = 1;
73
+ int64 int64_value = 2;
74
+ float float_value = 3;
75
+ bool bool_value = 4;
76
+ ComplexNumpyArray complex_array = 5;
77
+ RealNumpyArray real_array = 6;
78
+ string json_value = 7;
79
+ bytes bytes_value = 8;
80
+ // Contiguous C-order numeric data; fields 5 and 6 remain decode-compatible.
81
+ NDArrayValue ndarray_value = 9;
82
+ }
83
+ }
84
+
85
+ message NDArrayValue {
86
+ string dtype = 1;
87
+ repeated int64 shape = 2;
88
+ bytes data = 3;
89
+ }
90
+
91
+ message DynamicValue {
92
+ oneof value {
93
+ bool null_value = 1;
94
+ bool bool_value = 2;
95
+ sint64 int64_value = 3;
96
+ double double_value = 4;
97
+ string string_value = 5;
98
+ bytes bytes_value = 6;
99
+ string json_value = 7;
100
+ NDArrayValue ndarray_value = 8;
101
+ }
102
+ }
103
+
104
+ message NamedValue {
105
+ string name = 1;
106
+ DynamicValue value = 2;
107
+ }
108
+
109
+ message Mutation {
110
+ string target = 1;
111
+ DynamicValue value = 2;
112
+ }
113
+
114
+ message ErrorEnvelope {
115
+ string code = 1;
116
+ string message = 2;
117
+ string details_json = 3;
118
+ string method = 4;
119
+ string native_exception = 5;
120
+ string uhd_version = 6;
121
+ bool retryable = 7;
122
+ bool fatal_to_session = 8;
123
+ }
124
+
125
+ message NegotiateRequest {
126
+ repeated string schema_versions = 1;
127
+ repeated string control_protocol_versions = 2;
128
+ repeated string streaming_protocol_versions = 3;
129
+ }
130
+
131
+ message NegotiateResponse {
132
+ string schema_version = 1;
133
+ string control_protocol_version = 2;
134
+ string streaming_protocol_version = 3;
135
+ ErrorEnvelope error = 4;
136
+ }
137
+
138
+ message GetSchemaRequest {
139
+ string token = 1;
140
+ repeated string schema_versions = 2;
141
+ }
142
+
143
+ message GetSchemaResponse {
144
+ string schema_version = 1;
145
+ string schema_json = 2;
146
+ string schema_hash = 3;
147
+ ErrorEnvelope error = 4;
148
+ }
149
+
150
+ message OpenSessionRequest {
151
+ string token = 1;
152
+ string requested_schema_hash = 2;
153
+ string control_protocol_version = 3;
154
+ string streaming_protocol_version = 4;
155
+ }
156
+
157
+ message OpenSessionResponse {
158
+ string session_id = 1;
159
+ string device_handle = 2;
160
+ string schema_json = 3;
161
+ string schema_hash = 4;
162
+ string capabilities_json = 5;
163
+ string uhd_version = 6;
164
+ string uhd_abi = 7;
165
+ string hardware_profile = 8;
166
+ ErrorEnvelope error = 9;
167
+ }
168
+
169
+ message InvokeRequest {
170
+ string session_id = 1;
171
+ string handle = 2;
172
+ string method = 3;
173
+ string overload_id = 4;
174
+ repeated NamedValue args = 5;
175
+ }
176
+
177
+ message InvokeResponse {
178
+ DynamicValue result = 1;
179
+ repeated Mutation mutations = 2;
180
+ ErrorEnvelope error = 3;
181
+ }
182
+
183
+ message CloseHandleRequest {
184
+ string session_id = 1;
185
+ string handle = 2;
186
+ }
187
+
188
+ message CloseSessionRequest {
189
+ string session_id = 1;
190
+ }
191
+
192
+ message CloseResponse {
193
+ bool closed = 1;
194
+ ErrorEnvelope error = 2;
195
+ }
196
+
197
+ enum SampleDirection {
198
+ SAMPLE_DIRECTION_UNSPECIFIED = 0;
199
+ SAMPLE_DIRECTION_RX = 1;
200
+ SAMPLE_DIRECTION_TX = 2;
201
+ }
202
+
203
+ enum SampleFrameKind {
204
+ SAMPLE_FRAME_UNSPECIFIED = 0;
205
+ SAMPLE_FRAME_OPEN = 1;
206
+ SAMPLE_FRAME_REQUEST = 2;
207
+ SAMPLE_FRAME_DATA = 3;
208
+ SAMPLE_FRAME_RESULT = 4;
209
+ SAMPLE_FRAME_CREDIT = 5;
210
+ SAMPLE_FRAME_CANCEL = 6;
211
+ SAMPLE_FRAME_CLOSE = 7;
212
+ SAMPLE_FRAME_ERROR = 8;
213
+ }
214
+
215
+ message SampleFrame {
216
+ string session_id = 1;
217
+ string handle = 2;
218
+ uint64 generation = 3;
219
+ string operation_id = 4;
220
+ uint64 sequence = 5;
221
+ SampleDirection direction = 6;
222
+ SampleFrameKind kind = 7;
223
+ string dtype = 8;
224
+ repeated int64 shape = 9;
225
+ repeated uint32 channels = 10;
226
+ uint64 sample_count = 11;
227
+ bytes payload = 12;
228
+ string metadata_json = 13;
229
+ double device_time_secs = 14;
230
+ uint32 credits = 15;
231
+ double timeout_sec = 16;
232
+ bool one_packet = 17;
233
+ bool end_of_stream = 18;
234
+ bool cancelled = 19;
235
+ ErrorEnvelope error = 20;
236
+ uint64 flags = 21;
237
+ }
@@ -1070,6 +1070,8 @@ def _emit_client_object_bindings(client_objects: dict, *, class_name: str) -> li
1070
1070
  # Regular string (not f-string) — {_PREFIX}/{prop}/{e} are literal text
1071
1071
  # that become f-strings inside the *generated* file.
1072
1072
  _HELPERS = '''\
1073
+ import os
1074
+
1073
1075
  from importlib import import_module as _import_module
1074
1076
 
1075
1077
  from ...common.utils import map_arg, unmap_arg
@@ -1230,7 +1232,9 @@ def _codegen(schema: dict) -> str:
1230
1232
  f' self.token = make_virtual_token(token, device_type="{device_type}")',
1231
1233
  " return",
1232
1234
  ' if token is None:',
1233
- ' raise ValueError("A reservation token is required unless virtual=True")',
1235
+ ' token = os.getenv("REMOTERF_TOKEN")',
1236
+ ' if not token:',
1237
+ ' raise ValueError("A reservation token is required; pass token= or set REMOTERF_TOKEN")',
1234
1238
  " self.token = token",
1235
1239
  " from ..dynamic_device import install_driver_if_stale",
1236
1240
  " install_driver_if_stale(token=token, current_hash=_SCHEMA_HASH)",
@@ -14,21 +14,35 @@
14
14
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
 
16
16
  # Auto-generated from IDL schema — do not edit by hand.
17
- # device_type: hackrf driver_version: 0.1.1 schema_hash: sha256:1d6e935e2e33959e753b89d943a1a5696d814ec28aac52a7c39142b3fce89693
17
+ # device_type: hackrf driver_version: 0.1.1 schema_hash: sha256:6fb625ce99aaf7e190de013ad3e66276265020a5464d9d55d4c0e076dae28f3c
18
18
 
19
19
  _PREFIX = "Hackrf"
20
- _SCHEMA_HASH = "sha256:1d6e935e2e33959e753b89d943a1a5696d814ec28aac52a7c39142b3fce89693"
20
+ _SCHEMA_HASH = "sha256:6fb625ce99aaf7e190de013ad3e66276265020a5464d9d55d4c0e076dae28f3c"
21
21
  _CLIENT_MODULES = {}
22
22
  _CLIENT_OBJECTS = {}
23
23
 
24
+ import os
25
+
24
26
  from importlib import import_module as _import_module
25
27
 
26
- from ...core.grpc_client import rpc_client
27
28
  from ...common.utils import map_arg, unmap_arg
29
+ from .._virtual import (
30
+ is_virtual_token,
31
+ make_virtual_token,
32
+ virtual_call,
33
+ virtual_get,
34
+ virtual_set,
35
+ )
28
36
 
29
37
  _NO_ARG = object()
30
38
 
31
39
 
40
+ def _rpc_client(*, function_name, args):
41
+ from ...core.grpc_client import rpc_client
42
+
43
+ return rpc_client(function_name=function_name, args=args)
44
+
45
+
32
46
  for _alias, _module_path in _CLIENT_MODULES.items():
33
47
  globals()[_alias] = _import_module(_module_path)
34
48
 
@@ -71,27 +85,34 @@ def _wrap_client_return(spec, self_obj, result):
71
85
 
72
86
 
73
87
  def _try_get(prop, token):
74
- return unmap_arg(rpc_client(
88
+ if is_virtual_token(token):
89
+ return virtual_get(token, prop)
90
+ return unmap_arg(_rpc_client(
75
91
  function_name=f"{_PREFIX}:{prop}:GET",
76
92
  args={'a': map_arg(token)},
77
93
  ).results[prop])
78
94
 
79
95
 
80
96
  def _try_set(prop, value, token):
81
- rpc_client(
97
+ if is_virtual_token(token):
98
+ virtual_set(token, prop, value)
99
+ return None
100
+ _rpc_client(
82
101
  function_name=f"{_PREFIX}:{prop}:SET",
83
102
  args={prop: map_arg(value), 'a': map_arg(token)},
84
103
  )
85
104
 
86
105
 
87
106
  def _try_call(prop, token, arg=_NO_ARG):
107
+ if is_virtual_token(token):
108
+ return virtual_call(token, prop, arg, has_arg=arg is not _NO_ARG)
88
109
  if arg is _NO_ARG:
89
- resp = rpc_client(
110
+ resp = _rpc_client(
90
111
  function_name=f"{_PREFIX}:{prop}:CALL0",
91
112
  args={'a': map_arg(token)},
92
113
  )
93
114
  else:
94
- resp = rpc_client(
115
+ resp = _rpc_client(
95
116
  function_name=f"{_PREFIX}:{prop}:CALL1",
96
117
  args={'a': map_arg(token), 'arg1': map_arg(arg)},
97
118
  )
@@ -100,12 +121,15 @@ def _try_call(prop, token, arg=_NO_ARG):
100
121
 
101
122
 
102
123
  def _try_calln(prop, token, kwargs):
124
+ if is_virtual_token(token):
125
+ filtered = {key: value for key, value in dict(kwargs).items() if value is not _NO_ARG}
126
+ return virtual_call(token, prop, filtered, has_arg=True)
103
127
  payload = {'a': map_arg(token)}
104
128
  for key, value in dict(kwargs).items():
105
129
  if value is _NO_ARG:
106
130
  continue
107
131
  payload[str(key)] = map_arg(value)
108
- resp = rpc_client(
132
+ resp = _rpc_client(
109
133
  function_name=f"{_PREFIX}:{prop}:CALLN",
110
134
  args=payload,
111
135
  )
@@ -114,7 +138,15 @@ def _try_calln(prop, token, kwargs):
114
138
 
115
139
  class HackRF:
116
140
 
117
- def __init__(self, token: str):
141
+ def __init__(self, token: str = None, *, virtual: bool = False):
142
+ self.virtual = bool(virtual)
143
+ if self.virtual:
144
+ self.token = make_virtual_token(token, device_type="hackrf")
145
+ return
146
+ if token is None:
147
+ token = os.getenv("REMOTERF_TOKEN")
148
+ if not token:
149
+ raise ValueError("A reservation token is required; pass token= or set REMOTERF_TOKEN")
118
150
  self.token = token
119
151
  from ..dynamic_device import install_driver_if_stale
120
152
  install_driver_if_stale(token=token, current_hash=_SCHEMA_HASH)
@@ -204,6 +236,10 @@ class HackRF:
204
236
  'Clear any captured or queued IQ bytes while the radio is idle.'
205
237
  return _try_call("clear_buffer", self.token)
206
238
 
239
+ def close(self):
240
+ 'Safely end this remote TX use without closing the server-owned radio.'
241
+ return _try_call("close", self.token)
242
+
207
243
  def enumerate(self):
208
244
  'Return attached serials as a JSON array for broad client compatibility.'
209
245
  return _try_call("enumerate", self.token)
@@ -213,7 +249,7 @@ class HackRF:
213
249
  return _try_call("get_serial_no", self.token)
214
250
 
215
251
  def load_tx_iq(self, samples):
216
- 'Convert normalized IQ samples and load the native transmit buffer.'
252
+ 'Load normalized complex or native interleaved signed-int8 TX IQ.'
217
253
  return _try_call("load_tx_iq", self.token, samples)
218
254
 
219
255
  def read_samples(self, num_samples=_NO_ARG):
@@ -222,6 +258,18 @@ class HackRF:
222
258
  "num_samples": num_samples,
223
259
  })
224
260
 
261
+ def set_freq(self, value):
262
+ 'Compatibility alias for setting the center frequency in Hz.'
263
+ return _try_call("set_freq", self.token, value)
264
+
265
+ def set_sample_rate(self, value):
266
+ 'Compatibility alias for setting the complex sample rate in Hz.'
267
+ return _try_call("set_sample_rate", self.token, value)
268
+
269
+ def setup(self):
270
+ 'Confirm the already-managed remote HackRF is ready for use.'
271
+ return _try_call("setup", self.token)
272
+
225
273
  def start_tx(self):
226
274
  'Start transmitting the IQ bytes previously loaded with load_tx_iq().'
227
275
  return _try_call("start_tx", self.token)
@@ -134,6 +134,7 @@ def print_help() -> None:
134
134
  printf("Config:", (Sty.BOLD, Sty.MAGENTA))
135
135
  printf(" remoterf -c | --config [options]", Sty.CYAN)
136
136
  printf(" -a, --addr, -addr <host:port>", Sty.CYAN, " Set target server", Sty.DEFAULT)
137
+ printf(" --cert-port <port>", Sty.CYAN, " Cert server port (default: grpc port + 1)", Sty.DEFAULT)
137
138
  printf(" -w, --wipe, -wipe", Sty.CYAN, " Delete all local config", Sty.DEFAULT)
138
139
  printf(" -y, --yes, -yes", Sty.CYAN, " Skip wipe confirmation", Sty.DEFAULT)
139
140
  print()
@@ -182,6 +183,7 @@ def main() -> int:
182
183
  addr = None
183
184
  wipe = False
184
185
  yes = False
186
+ cert_port_arg = None
185
187
 
186
188
  i = 1
187
189
  while i < len(argv):
@@ -195,6 +197,18 @@ def main() -> int:
195
197
  i += 2
196
198
  continue
197
199
 
200
+ if tok in ("--cert-port", "-cert-port"):
201
+ if i + 1 >= len(argv):
202
+ print("ERROR: missing required argument after --cert-port")
203
+ return 2
204
+ try:
205
+ cert_port_arg = int(argv[i + 1].strip())
206
+ except Exception:
207
+ print("ERROR: --cert-port must be an integer")
208
+ return 2
209
+ i += 2
210
+ continue
211
+
198
212
  if tok in ("--wipe", "-w", "-wipe"):
199
213
  wipe = True
200
214
  i += 1
@@ -235,7 +249,7 @@ def main() -> int:
235
249
  return 2
236
250
 
237
251
  # configure returns the proper exit code
238
- cert_port = port + 1
252
+ cert_port = cert_port_arg if cert_port_arg is not None else port + 1
239
253
  configure(host, port, cert_port)
240
254
  return 0
241
255
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: remoterf
3
- Version: 2.0.12
3
+ Version: 2.0.14
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: Ethan Ge
6
6
  Author-email: ethoGalaxy@gmail.com
@@ -8,6 +8,7 @@ src/remoteRF/version.py
8
8
  src/remoteRF/common/__init__.py
9
9
  src/remoteRF/common/tos_notice.txt
10
10
  src/remoteRF/common/grpc/__init__.py
11
+ src/remoteRF/common/grpc/grpc.proto
11
12
  src/remoteRF/common/grpc/grpc_pb2.py
12
13
  src/remoteRF/common/grpc/grpc_pb2_grpc.py
13
14
  src/remoteRF/common/grpc/v2_codec.py
@@ -48,49 +49,12 @@ src/remoteRF/drivers/ti_mmwave/ti_mmwave_remote.py
48
49
  src/remoteRF/drivers/usrp/__init__.py
49
50
  src/remoteRF/drivers/usrp/usrp_remote.py
50
51
  src/remoteRF/drivers/usrp/usrp_remote.pyi
51
- src/remoterf/__init__.py
52
- src/remoterf/remoterf_cli.py
53
- src/remoterf/version.py
54
52
  src/remoterf.egg-info/PKG-INFO
55
53
  src/remoterf.egg-info/SOURCES.txt
56
54
  src/remoterf.egg-info/dependency_links.txt
57
55
  src/remoterf.egg-info/entry_points.txt
58
56
  src/remoterf.egg-info/requires.txt
59
57
  src/remoterf.egg-info/top_level.txt
60
- src/remoterf/common/__init__.py
61
- src/remoterf/common/tos_notice.txt
62
- src/remoterf/common/grpc/__init__.py
63
- src/remoterf/common/grpc/grpc_pb2.py
64
- src/remoterf/common/grpc/grpc_pb2_grpc.py
65
- src/remoterf/common/grpc/v2_codec.py
66
- src/remoterf/common/utils/__init__.py
67
- src/remoterf/common/utils/ansi_codes.py
68
- src/remoterf/common/utils/api_token.py
69
- src/remoterf/common/utils/list_string.py
70
- src/remoterf/common/utils/process_arg.py
71
- src/remoterf/config/__init__.py
72
- src/remoterf/config/cert_fetcher.py
73
- src/remoterf/config/config.py
74
- src/remoterf/core/__init__.py
75
- src/remoterf/core/acc_login.py
76
- src/remoterf/core/app.py
77
- src/remoterf/core/banner_note.txt
78
- src/remoterf/core/dynamic_v2_transport.py
79
- src/remoterf/core/grpc_acc.py
80
- src/remoterf/core/grpc_client.py
81
- src/remoterf/core/v2_errors.py
82
- src/remoterf/drivers/__init__.py
83
- src/remoterf/drivers/dynamic_device.py
84
- src/remoterf/drivers/dynamic_v2.py
85
- src/remoterf/drivers/adalm_pluto/__init__.py
86
- src/remoterf/drivers/adalm_pluto/pluto_remote.py
87
- src/remoterf/drivers/support/__init__.py
88
- src/remoterf/drivers/support/uhd.py
89
- src/remoterf/drivers/support/uhd_dsp.py
90
- src/remoterf/drivers/support/uhd_v2.py
91
- src/remoterf/drivers/usrp/__init__.py
92
- src/remoterf/drivers/usrp/usrp_remote.py
93
- src/remoterf/drivers/usrp/usrp_remote.pyi
94
58
  tests/test_banner.py
95
59
  tests/test_dynamic_device_codegen.py
96
60
  tests/test_dynamic_v2.py
@@ -13,6 +13,7 @@
13
13
  # You should have received a copy of the GNU General Public License
14
14
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
15
 
16
+ import os
16
17
  import unittest
17
18
  import sys
18
19
  import tempfile
@@ -413,6 +414,15 @@ class DynamicDeviceCodegenTests(unittest.TestCase):
413
414
  exec(code, module.__dict__)
414
415
 
415
416
  device = module.FakeDevice("token")
417
+ old_token = os.environ.get("REMOTERF_TOKEN")
418
+ os.environ["REMOTERF_TOKEN"] = "token-from-env"
419
+ try:
420
+ self.assertEqual(module.FakeDevice().token, "token-from-env")
421
+ finally:
422
+ if old_token is None:
423
+ os.environ.pop("REMOTERF_TOKEN", None)
424
+ else:
425
+ os.environ["REMOTERF_TOKEN"] = old_token
416
426
  self.assertEqual(device.status, {"raw": True})
417
427
  self.assertEqual(device.echo({"payload": 3}), {"payload": 3})
418
428
  self.assertEqual(device.configure(1.0), {"configured": True})
@@ -423,6 +433,7 @@ class DynamicDeviceCodegenTests(unittest.TestCase):
423
433
  self.assertEqual(
424
434
  [item[0] for item in seen],
425
435
  [
436
+ "Fake_device:ip:CALL0",
426
437
  "Fake_device:ip:CALL0",
427
438
  "Fake_device:status:GET",
428
439
  "Fake_device:echo:CALL1",
@@ -48,6 +48,32 @@ class RemoteRFCliTests(unittest.TestCase):
48
48
  connected_server.assert_called_once_with()
49
49
  print_unavailable.assert_called_once_with()
50
50
 
51
+ @mock.patch("remoteRF.config.config.configure")
52
+ @mock.patch.object(
53
+ remoterf_cli.sys, "argv", ["remoterf", "--config", "--addr", "10.0.0.1:12321"]
54
+ )
55
+ def test_config_without_cert_port_defaults_to_grpc_port_plus_one(self, configure):
56
+ self.assertEqual(remoterf_cli.main(), 0)
57
+ configure.assert_called_once_with("10.0.0.1", 12321, 12322)
58
+
59
+ @mock.patch("remoteRF.config.config.configure")
60
+ @mock.patch.object(
61
+ remoterf_cli.sys,
62
+ "argv",
63
+ ["remoterf", "--config", "--addr", "10.0.0.1:12321", "--cert-port", "9999"],
64
+ )
65
+ def test_config_with_explicit_cert_port_overrides_default(self, configure):
66
+ self.assertEqual(remoterf_cli.main(), 0)
67
+ configure.assert_called_once_with("10.0.0.1", 12321, 9999)
68
+
69
+ @mock.patch("remoteRF.config.config.configure")
70
+ @mock.patch.object(
71
+ remoterf_cli.sys, "argv", ["remoterf", "-c", "-a", "10.0.0.1:12321"]
72
+ )
73
+ def test_existing_short_flag_usage_remains_compatible(self, configure):
74
+ self.assertEqual(remoterf_cli.main(), 0)
75
+ configure.assert_called_once_with("10.0.0.1", 12321, 12322)
76
+
51
77
 
52
78
  if __name__ == "__main__":
53
79
  unittest.main()
File without changes
File without changes
File without changes
File without changes