remoterf 0.0.7.41__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.

Potentially problematic release.


This version of remoterf might be problematic. Click here for more details.

@@ -0,0 +1,249 @@
1
+ from ...core.grpc_client import rpc_client
2
+ from ...common.utils import *
3
+ from ...common.grpc import grpc_pb2
4
+ from ...core.grpc_client import get_tcp_calls
5
+
6
+ def try_get(function_name, token):
7
+ try:
8
+ return unmap_arg(rpc_client(function_name=f"Pluto:{function_name}:GET", args={'a':map_arg(token)}).results[function_name])
9
+ except Exception as e:
10
+ input(f"Error: {e}\nHit enter to continue...")
11
+ return None
12
+
13
+ def try_set(function_name, value, token):
14
+ try:
15
+ rpc_client(function_name=f"Pluto:{function_name}:SET", args={function_name: map_arg(value), 'a':map_arg(token)})
16
+ except Exception as e:
17
+ input(f"Error: {e}\nHit enter to continue...")
18
+
19
+ def try_call_0_arg(function_name, token): # 0 argument call
20
+ try:
21
+ response = rpc_client(
22
+ function_name=f"Pluto:{function_name}:CALL0",
23
+ args={
24
+ 'a': map_arg(token)
25
+ }
26
+ )
27
+ return unmap_arg(response.results[function_name])
28
+ except Exception as e:
29
+ input(f"RPC_0_call Error: {e}\nHit enter to continue...")
30
+ return None
31
+
32
+ def try_call_1_arg(function_name, arg, token): # 1 argument call
33
+ try:
34
+ response = rpc_client(
35
+ function_name=f"Pluto:{function_name}:CALL1",
36
+ args={
37
+ 'a': map_arg(token),
38
+ 'arg1': map_arg(arg)
39
+ }
40
+ )
41
+ # The server should return something like {function_name: <something>}
42
+ return unmap_arg(response.results[function_name])
43
+ except Exception as e:
44
+ input(f"RPC_1_call Error: {e}\nHit enter to continue...")
45
+ return None
46
+
47
+ class rx_def:
48
+ pass
49
+
50
+ class tx_def:
51
+ pass
52
+
53
+ class rx_tx_def(rx_def, tx_def):
54
+ pass
55
+
56
+ class ad9364(rx_tx_def):
57
+ pass
58
+
59
+ class Pluto: # client
60
+
61
+ def __init__(self, token:str, debug=False):
62
+ self.token = token
63
+ response = try_call_0_arg(function_name="ip", token=token)
64
+
65
+
66
+ def api_token(self, token:str) -> None:
67
+ self.token = token
68
+ try_call_0_arg(function_name="ip", token=token)
69
+
70
+ # PlutoSDR
71
+
72
+ _device_name = "PlutoSDR"
73
+ _uri_auto = "ip:pluto.local"
74
+
75
+ def __repr__(self): # ! UNTESTED !
76
+ return try_get("__repr__", self.token)
77
+
78
+ #region ad9364
79
+ """AD9364 Transceiver"""
80
+
81
+ @property
82
+ def filter(self):
83
+ return try_get("filter", self.token)
84
+
85
+ @filter.setter
86
+ def filter(self, value):
87
+ try_set("filter", value, self.token)
88
+
89
+ @property
90
+ def loopback(self):
91
+ """loopback: Set loopback mode. Options are:
92
+ 0 (Disable), 1 (Digital), 2 (RF)"""
93
+ return try_get("loopback", self.token)
94
+
95
+ @loopback.setter
96
+ def loopback(self, value):
97
+ try_set("loopback", value, self.token)
98
+
99
+ @property
100
+ def gain_control_mode_chan0(self):
101
+ """gain_control_mode_chan0: Mode of receive path AGC. Options are:
102
+ slow_attack, fast_attack, manual"""
103
+ return try_get("gain_control_mode_chan0", self.token)
104
+
105
+ @gain_control_mode_chan0.setter
106
+ def gain_control_mode_chan0(self, value):
107
+ try_set("gain_control_mode_chan0", value, self.token)
108
+
109
+ @property
110
+ def rx_hardwaregain_chan0(self):
111
+ """rx_hardwaregain_chan0: Gain applied to RX path. Only applicable when
112
+ gain_control_mode is set to 'manual'"""
113
+ return try_get("rx_hardwaregain_chan0", self.token)
114
+
115
+ @rx_hardwaregain_chan0.setter
116
+ def rx_hardwaregain_chan0(self, value):
117
+ try_set("rx_hardwaregain_chan0", value, self.token)
118
+
119
+ @property
120
+ def tx_hardwaregain_chan0(self):
121
+ """tx_hardwaregain_chan0: Attenuation applied to TX path"""
122
+ return try_get("tx_hardwaregain_chan0", self.token)
123
+
124
+ @tx_hardwaregain_chan0.setter
125
+ def tx_hardwaregain_chan0(self, value):
126
+ try_set("tx_hardwaregain_chan0", value, self.token)
127
+
128
+ @property
129
+ def rx_rf_bandwidth(self):
130
+ """rx_rf_bandwidth: Bandwidth of front-end analog filter of RX path"""
131
+ return try_get("rx_rf_bandwidth", self.token)
132
+
133
+ @rx_rf_bandwidth.setter
134
+ def rx_rf_bandwidth(self, value):
135
+ try_set("rx_rf_bandwidth", value, self.token)
136
+
137
+ @property
138
+ def tx_rf_bandwidth(self):
139
+ """tx_rf_bandwidth: Bandwidth of front-end analog filter of TX path"""
140
+ return try_get("tx_rf_bandwidth", self.token)
141
+
142
+ @tx_rf_bandwidth.setter
143
+ def tx_rf_bandwidth(self, value):
144
+ try_set("tx_rf_bandwidth", value, self.token)
145
+
146
+ @property
147
+ def sample_rate(self): # ! UNTESTED !
148
+ """sample_rate: Sample rate RX and TX paths in samples per second"""
149
+ return try_get("sample_rate", self.token)
150
+
151
+ @sample_rate.setter
152
+ def sample_rate(self, rate): # ! UNTESTED !
153
+ try_set("sample_rate", rate, self.token)
154
+
155
+ @property
156
+ def rx_lo(self):
157
+ """rx_lo: Carrier frequency of RX path"""
158
+ return try_get("rx_lo", self.token)
159
+
160
+ @rx_lo.setter
161
+ def rx_lo(self, value):
162
+ try_set("rx_lo", value, self.token)
163
+
164
+ @property
165
+ def tx_lo(self):
166
+ """tx_lo: Carrier frequency of TX path"""
167
+ return try_get("tx_lo", self.token)
168
+
169
+ @tx_lo.setter
170
+ def tx_lo(self, value):
171
+ try_set("tx_lo", value, self.token)
172
+
173
+ @property
174
+ def tx_cyclic_buffer(self):
175
+ """tx_cyclic_buffer: Size of cyclic buffer"""
176
+ return try_get("tx_cyclic_buffer", self.token)
177
+
178
+ @tx_cyclic_buffer.setter
179
+ def tx_cyclic_buffer(self, value):
180
+ try_set("tx_cyclic_buffer", value, self.token)
181
+
182
+ def tx_destroy_buffer(self):
183
+ try_call_0_arg("tx_destroy_buffer", self.token)
184
+
185
+ def rx_destroy_buffer(self):
186
+ try_call_0_arg("rx_destroy_buffer", self.token)
187
+
188
+ #endregion
189
+
190
+ #region rx_def
191
+
192
+ def rx(self):
193
+ return try_get("rx", self.token)
194
+
195
+ @property
196
+ def rx_buffer_size(self):
197
+ return try_get("rx_buffer_size", self.token)
198
+
199
+ @rx_buffer_size.setter
200
+ def rx_buffer_size(self, value):
201
+ try_set("rx_buffer_size", value, self.token)
202
+
203
+ #endregion
204
+
205
+ #region tx_def
206
+
207
+ def tx(self, value):
208
+ return try_call_1_arg("tx", value, self.token)
209
+
210
+ # @tx.setter
211
+ # def tx(self, value):
212
+ # try_set("tx", value, self.token)
213
+
214
+ #endregion
215
+
216
+ #region tx
217
+
218
+ #endregion
219
+
220
+ #region _dec_int_fpga_filter
221
+
222
+ """Decimator and interpolator fpga filter controls"""
223
+
224
+ def _get_rates(self, dev, output): # ! UNTESTED !
225
+ """Get the decimation and interpolation rates"""
226
+ return try_get("rates", self.token)
227
+
228
+ @property
229
+ def rx_dec8_filter_en(self) -> bool: # ! UNTESTED !
230
+ """rx_dec8_filter_en: Enable decimate by 8 filter in FPGA"""
231
+ return try_get("rx_dec8_filter_en", self.token)
232
+
233
+ @rx_dec8_filter_en.setter
234
+ def rx_dec8_filter_en(self, value: bool): # ! UNTESTED !
235
+ """rx_dec8_filter_en: Enable decimate by 8 filter in FPGA"""
236
+ return try_set("rx_dec8_filter_en", value, self.token)
237
+
238
+ @property
239
+ def tx_int8_filter_en(self) -> bool: # ! UNTESTED !
240
+ """tx_int8_filter_en: Enable interpolate by 8 filter in FPGA"""
241
+ return try_get("tx_int8_filter_en", self.token)
242
+
243
+ @tx_int8_filter_en.setter
244
+ def tx_int8_filter_en(self, value: bool): # ! UNTESTED !
245
+ """tx_int8_filter_en: Enable interpolate by 8 filter in FPGA"""
246
+ return try_set("tx_int8_filter_en", value, self.token)
247
+
248
+ #endregion
249
+
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: remoterf
3
+ Version: 0.0.7.41
4
+ Summary: A python API to remotely access signal centric hardware. Client-side only! Courtesy of Wireless Lab @ UCLA & Prof. Ian Roberts.
5
+ Author: Ethan Ge
6
+ Author-email: ethoGalaxy@gmail.com
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: License :: OSI Approved :: MIT License
9
+ Classifier: Operating System :: OS Independent
10
+ Requires-Python: >=3.10
11
+ Description-Content-Type: text/markdown
12
+ Requires-Dist: grpcio==1.71.0
13
+ Requires-Dist: protobuf<6.0.0,>=5.0.0
14
+ Requires-Dist: numpy
15
+ Requires-Dist: prompt_toolkit
16
+ Requires-Dist: python-dotenv
17
+ Dynamic: author
18
+ Dynamic: author-email
19
+ Dynamic: classifier
20
+ Dynamic: description
21
+ Dynamic: description-content-type
22
+ Dynamic: requires-dist
23
+ Dynamic: requires-python
24
+ Dynamic: summary
25
+
26
+ # Remote RF
27
+
28
+ A python API to remotely access signal centric hardware.
29
+
30
+ Courtesy of Wireless Lab @ UCLA. - Ethan Ge
31
+
32
+ ## Prerequisites
33
+
34
+ - **Python 3.10**: This package works in Python 3.10+. If you don’t have Python installed, you can download it from the [official Python website](https://www.python.org/downloads/).
35
+
36
+ To check your current Python version, open a terminal and run:
37
+
38
+ ```bash
39
+ python --version
40
+ ```
41
+
42
+ - **UCLA VPN**: Please ensure that you are connected to the UCLA VPN. You can download and configure the VPN client from the following link: [UCLA VPN Client Download](https://www.it.ucla.edu/it-support-center/services/virtual-private-network-vpn-clients). If you’re not connected to the VPN, you will not have access to the lab servers.
43
+
44
+ ## Installation
45
+
46
+ Use the package manager [pip](https://pip.pypa.io/en/stable/) to install remoteRF. It is recommended that you install this package within a [virtual environment](https://docs.python.org/3/library/venv.html).
47
+
48
+ ```bash
49
+ python3 -m venv venv # Create virtual environment
50
+ source venv/bin/activate # Activate virtual environment
51
+
52
+ pip install remoteRF # Install remoteRF
53
+ ```
54
+
55
+ If `pip install` doesn't work, you can clone the [source](https://github.com/WirelessLabAtUCLA/RemoteRF-Client) directly from github.
56
+
57
+ <!-- 1. **Clone the repository:**
58
+ ```bash
59
+ git clone https://github.com/WirelessLabAtUCLA/RemoteRF-Client
60
+ cd repository-name
61
+ ```
62
+ 2. **Install the package using** `pip` **in editable mode:**
63
+ ```bash
64
+ pip install -e .
65
+ ```
66
+ This command installs the package in "editable" mode, allowing for modifications to the local code without reinstalling. For more details on installing packages from local directories, refer to Python Packaging: [Installing from Local Archives](https://packaging.python.org/en/latest/tutorials/installing-packages/#installing-packages-from-local-archives). -->
67
+
68
+ ## Reservation
69
+
70
+ Usage of the platform requires you to register a account and reserve a device in order to run scripts remotely.
71
+
72
+ ### 1. **Start UCLA VPN**
73
+
74
+ - Start the CISCO Secure client, login and connect to any of the options.
75
+
76
+ ### 2. **Register a account**:
77
+ ```bash
78
+ remoterf-login
79
+ # Run in the terminal
80
+ # where the Python library is installed
81
+
82
+ # Typically, this will be the terminal where you’ve activated the virtual environment if you’re using one
83
+ ```
84
+
85
+ - Input `r` to register a account, or `l` to login to a existing one.
86
+
87
+ <!-- 2. **You will be prompted with this**: -->
88
+ ```bash
89
+ Welcome to Remote RF Account System.
90
+ Please login or register to continue. (l/r):
91
+ ```
92
+
93
+ - Once in, input `help` to see all avaliable commands.
94
+
95
+ ### 3. **Reserve Device**:
96
+ ```bash
97
+ getdev # To view all avaliable devices
98
+
99
+ # Note the device ID. You will need this later to reserve said device
100
+ ```
101
+
102
+ ```bash
103
+ getres # To view times not avaliable
104
+
105
+ # Optionally, you can also view all reservations, and determine a time slot you want a specific device reserved
106
+ ```
107
+ ```bash
108
+ perms # To view your permissions
109
+
110
+ # Depending on your permission levels, you will be given different restrictions
111
+ ```
112
+
113
+ ```bash
114
+ resdev # To reserve a device
115
+
116
+ # Input the number of days you want to view, and it will display available reservations in that time span.
117
+
118
+ Reservation successful. Thy Token -> example_token
119
+
120
+ # Take note of this token. You will need it to actually access the device.
121
+ ```
122
+
123
+ ## Remote Access
124
+
125
+ With this token, you can now run scripts remotely. Please keep in mind that you MUST be connected to the UCLA VPN for this to work.
126
+ Here is a explained sample script to get you going!
127
+
128
+ #### Python Script:
129
+
130
+ ```python
131
+ from remoteRF.drivers.adalm_pluto import * # Imports device Pluto SDR remote drivers. Change depending on desired device.
132
+
133
+ sdr = adi.Pluto( # Device initialization.
134
+ token = 'example_token' # Place the prior token here.
135
+ )
136
+
137
+ # You can now use this 'sdr' as you normally would with the default Pluto drivers.
138
+ ```
139
+
140
+ If converting a existing `non-remoteRF` compatible script:
141
+
142
+ ```diff
143
+ - import existing_device_drivers
144
+
145
+ + from remoteRF.drivers.device_drivers import *
146
+
147
+ - device = device(init)
148
+
149
+ + device = device(token = 'sample_token')
150
+ ```
151
+
152
+ Nothing else needs changing!
153
+
154
+ ## Closing
155
+
156
+ This is fundamentally a experimental platform, and there will be many unknown bugs and issues. Some devices do not have universal support for all its functions at the moment, I am working on that aspect.
157
+
158
+ **So please submit feedback!**
@@ -0,0 +1,33 @@
1
+ remoteRF/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ remoteRF/common/__init__.py,sha256=8naT0ZphJxv_6uz7RRGvqfNB-UEznkzipJSVPD5n6iM,40
3
+ remoteRF/common/grpc/__init__.py,sha256=GYLHC7riDbjdx2cNOhWymt0GLZ4mtGhuzZAXVRfNynw,37
4
+ remoteRF/common/grpc/grpc_pb2.py,sha256=iMdLw3xly_2WjirEmVaxf7I8iiUmk-3YRqqIiRdNkPs,4082
5
+ remoteRF/common/grpc/grpc_pb2_grpc.py,sha256=NofKaB3t0nAm_uxDgA5WXhWcsRWqsyfuMEEdBrosVKk,3368
6
+ remoteRF/common/utils/__init__.py,sha256=JTP8gH-340HZI4F8oagPW-kxRCoVUnQB-_acmgXPaK4,204
7
+ remoteRF/common/utils/ansi_codes.py,sha256=knGLOJK-lyDjfQHL0Upq5UPTg6J_6WYldga-ZOaerSs,3052
8
+ remoteRF/common/utils/api_token.py,sha256=CdgnAIcKqhkJB_XqrshgJVZzfQIO-xeR8hVMi5bYPSI,1260
9
+ remoteRF/common/utils/list_string.py,sha256=qsch666vX2e3CZ2W5EdYi62dOk37k1v2yPpHHm47a7A,156
10
+ remoteRF/common/utils/process_arg.py,sha256=J1REqgjm-1daqTBdVASgDd-16y-KneOJpCZXPEOklVk,2971
11
+ remoteRF/core/__init__.py,sha256=XQiCe8kyzM7XLxA883-uDndBmbr-NXo1uvtMJT2h6oA,73
12
+ remoteRF/core/acc_login.py,sha256=UcY3rDLAwHoJ9lYXRfm26z_6yJX0JSoKv-u1mF6n0Gs,49
13
+ remoteRF/core/app.py,sha256=xNWRweioFqxX2IjRcvUTBguDmbPDSdn0xzfluBsJwYw,22545
14
+ remoteRF/core/cert_fetcher.py,sha256=blKLtvTA2r1WRRbwNjMHF_FxEalYD3aVQC9XCdyoO7A,4326
15
+ remoteRF/core/config.py,sha256=JoL9NIzSf79dDL5JHaJI2TjUF5JQovse7dFDfLVXDCU,4251
16
+ remoteRF/core/grpc_acc.py,sha256=bspLTzblhqYVVEFPwdvXrDZjREBWJVvD_SaT_cja6kU,2441
17
+ remoteRF/core/grpc_client.py,sha256=540JkGsJ8_poN_aRn3FJmuGN4078or06ke00T6A7qEo,3143
18
+ remoteRF/core/version.py,sha256=iMcmRB5ZxCliJZgPU6utwCia5M9HJ-J8E-LpPmcEgS8,182
19
+ remoteRF/core/certs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ remoteRF/core/certs/ca.crt,sha256=Rp8V8Mi413an0rO_dy7sH32j77ppVP1POZ-g7_eVtDU,2004
21
+ remoteRF/core/certs/ca.key,sha256=h5UQDlCcf7munMLTROYk6TGt9Guf0ar9aHoRPlsR2sk,3272
22
+ remoteRF/core/certs/cert.pem,sha256=d90GwpyubEcyp1WUcyMCpn93HI8RUY96sMg5ynHrIMM,1127
23
+ remoteRF/core/certs/key.pem,sha256=cWJ4BYX47boqXBcPmN5r_9KqYS4gLyGXnHGPMwwrNMo,1704
24
+ remoteRF/core/certs/server.crt,sha256=iBGe9iepYA0bBK1NV4lUrnp64qbLOcCq07hmO8-2aK8,1151
25
+ remoteRF/core/certs/server.key,sha256=aUbQk7TKZJyhp-l5noj4nnfmtLDendTiR_sGq4amX6U,1704
26
+ remoteRF/drivers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
27
+ remoteRF/drivers/adalm_pluto/__init__.py,sha256=_IOOeQXR6paCP7Eciw2aeKBUNvZs-jeBTwW8QqUlFyU,33
28
+ remoteRF/drivers/adalm_pluto/pluto_remote.py,sha256=6TTp6v6HCXnULHFh90GVbLDWk7RXY2oZo7iiCl8EZdI,7460
29
+ remoterf-0.0.7.41.dist-info/METADATA,sha256=hbNUv9q9L75X0Htp34UopOR88A_UYXuRQcJv5fbHM90,5173
30
+ remoterf-0.0.7.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
31
+ remoterf-0.0.7.41.dist-info/entry_points.txt,sha256=A4FjVWS1Q0s0Yyv6tApbZcI6ZUzwe-KyppVfp4seA-w,148
32
+ remoterf-0.0.7.41.dist-info/top_level.txt,sha256=XQJoVTmAOsHV9qtPSP_QSh0ma4jKxsDkxn4IjM_ZuZk,9
33
+ remoterf-0.0.7.41.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,4 @@
1
+ [console_scripts]
2
+ remoterf-config = remoteRF.core.config:main
3
+ remoterf-login = remoteRF.core.acc_login:main
4
+ remoterf-v = remoteRF.core.version:main
@@ -0,0 +1 @@
1
+ remoteRF