remoteRF-server-testing 0.0.0__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.
Files changed (44) hide show
  1. remoteRF_server/__init__.py +0 -0
  2. remoteRF_server/common/__init__.py +0 -0
  3. remoteRF_server/common/grpc/__init__.py +1 -0
  4. remoteRF_server/common/grpc/grpc_host_pb2.py +63 -0
  5. remoteRF_server/common/grpc/grpc_host_pb2_grpc.py +97 -0
  6. remoteRF_server/common/grpc/grpc_pb2.py +59 -0
  7. remoteRF_server/common/grpc/grpc_pb2_grpc.py +97 -0
  8. remoteRF_server/common/idl/__init__.py +1 -0
  9. remoteRF_server/common/idl/device_schema.py +39 -0
  10. remoteRF_server/common/idl/pluto_schema.py +174 -0
  11. remoteRF_server/common/idl/schema.py +358 -0
  12. remoteRF_server/common/utils/__init__.py +6 -0
  13. remoteRF_server/common/utils/ansi_codes.py +120 -0
  14. remoteRF_server/common/utils/api_token.py +21 -0
  15. remoteRF_server/common/utils/db_connection.py +35 -0
  16. remoteRF_server/common/utils/db_location.py +24 -0
  17. remoteRF_server/common/utils/list_string.py +5 -0
  18. remoteRF_server/common/utils/process_arg.py +80 -0
  19. remoteRF_server/drivers/__init__.py +0 -0
  20. remoteRF_server/drivers/adalm_pluto/__init__.py +0 -0
  21. remoteRF_server/drivers/adalm_pluto/pluto_remote_server.py +105 -0
  22. remoteRF_server/host/__init__.py +0 -0
  23. remoteRF_server/host/host_auth_token.py +292 -0
  24. remoteRF_server/host/host_directory_store.py +142 -0
  25. remoteRF_server/host/host_tunnel_server.py +1388 -0
  26. remoteRF_server/server/__init__.py +0 -0
  27. remoteRF_server/server/acc_perms.py +317 -0
  28. remoteRF_server/server/cert_provider.py +184 -0
  29. remoteRF_server/server/device_manager.py +688 -0
  30. remoteRF_server/server/grpc_server.py +1023 -0
  31. remoteRF_server/server/reservation.py +811 -0
  32. remoteRF_server/server/rpc_manager.py +104 -0
  33. remoteRF_server/server/user_group_cli.py +723 -0
  34. remoteRF_server/server/user_group_handler.py +1120 -0
  35. remoteRF_server/serverrf_cli.py +1377 -0
  36. remoteRF_server/tools/__init__.py +191 -0
  37. remoteRF_server/tools/gen_certs.py +274 -0
  38. remoteRF_server/tools/gist_status.py +139 -0
  39. remoteRF_server/tools/gist_status_testing.py +67 -0
  40. remoterf_server_testing-0.0.0.dist-info/METADATA +612 -0
  41. remoterf_server_testing-0.0.0.dist-info/RECORD +44 -0
  42. remoterf_server_testing-0.0.0.dist-info/WHEEL +5 -0
  43. remoterf_server_testing-0.0.0.dist-info/entry_points.txt +2 -0
  44. remoterf_server_testing-0.0.0.dist-info/top_level.txt +1 -0
File without changes
File without changes
@@ -0,0 +1 @@
1
+ from . import grpc_pb2, grpc_pb2_grpc
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: grpc_host.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'grpc_host.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from . import grpc_pb2 as grpc__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fgrpc_host.proto\x12\x08remoterf\x1a\ngrpc.proto\"A\n\tHostHello\x12\x0f\n\x07host_id\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x12\n\nhost_token\x18\x03 \x01(\t\"^\n\nDeviceInfo\x12\x10\n\x08local_id\x18\x01 \x01(\r\x12\r\n\x05label\x18\x02 \x01(\t\x12\x11\n\tdevice_id\x18\x03 \x01(\t\x12\x0e\n\x06serial\x18\x04 \x01(\t\x12\x0c\n\x04kind\x18\x05 \x01(\t\"_\n\x0e\x44\x65viceAnnounce\x12%\n\x07\x64\x65vices\x18\x01 \x03(\x0b\x32\x14.remoterf.DeviceInfo\x12\x0f\n\x07unix_ms\x18\x02 \x01(\x04\x12\x15\n\rfull_snapshot\x18\x03 \x01(\x08\"\xab\x01\n\nRpcRequest\x12\x0e\n\x06req_id\x18\x01 \x01(\t\x12\x18\n\x10global_device_id\x18\x02 \x01(\r\x12\x17\n\x0flocal_device_id\x18\x03 \x01(\r\x12\x11\n\tdevice_id\x18\x04 \x01(\t\x12-\n\x07request\x18\x05 \x01(\x0b\x32\x1c.remote_rf.GenericRPCRequest\x12\x18\n\x10\x64\x65\x61\x64line_unix_ms\x18\x06 \x01(\x04\"i\n\x0bRpcResponse\x12\x0e\n\x06req_id\x18\x01 \x01(\t\x12\n\n\x02ok\x18\x02 \x01(\x08\x12/\n\x08response\x18\x03 \x01(\x0b\x32\x1d.remote_rf.GenericRPCResponse\x12\r\n\x05\x65rror\x18\x04 \x01(\t\"\x1c\n\tHeartbeat\x12\x0f\n\x07unix_ms\x18\x01 \x01(\x04\"\x18\n\x06\x43\x61ncel\x12\x0e\n\x06req_id\x18\x01 \x01(\t\"e\n\x0bMetaRequest\x12\x0e\n\x06req_id\x18\x01 \x01(\t\x12\x18\n\x10include_platform\x18\x02 \x01(\x08\x12\x13\n\x0binclude_env\x18\x03 \x01(\x08\x12\x17\n\x0finclude_devices\x18\x04 \x01(\x08\"\xb7\x01\n\x08HostMeta\x12\x0f\n\x07host_id\x18\x01 \x01(\t\x12\x0f\n\x07version\x18\x02 \x01(\t\x12\x0f\n\x07unix_ms\x18\x03 \x01(\x04\x12&\n\x02kv\x18\x04 \x03(\x0b\x32\x1a.remoterf.HostMeta.KvEntry\x12%\n\x07\x64\x65vices\x18\x05 \x03(\x0b\x32\x14.remoterf.DeviceInfo\x1a)\n\x07KvEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\t:\x02\x38\x01\"[\n\x0cMetaResponse\x12\x0e\n\x06req_id\x18\x01 \x01(\t\x12\n\n\x02ok\x18\x02 \x01(\x08\x12\r\n\x05\x65rror\x18\x03 \x01(\t\x12 \n\x04meta\x18\x04 \x01(\x0b\x32\x12.remoterf.HostMeta\"\xf7\x02\n\tHostFrame\x12$\n\x05hello\x18\x01 \x01(\x0b\x32\x13.remoterf.HostHelloH\x00\x12\x33\n\x0f\x64\x65vice_announce\x18\x02 \x01(\x0b\x32\x18.remoterf.DeviceAnnounceH\x00\x12+\n\x0brpc_request\x18\x03 \x01(\x0b\x32\x14.remoterf.RpcRequestH\x00\x12-\n\x0crpc_response\x18\x04 \x01(\x0b\x32\x15.remoterf.RpcResponseH\x00\x12(\n\theartbeat\x18\x05 \x01(\x0b\x32\x13.remoterf.HeartbeatH\x00\x12\"\n\x06\x63\x61ncel\x18\x06 \x01(\x0b\x32\x10.remoterf.CancelH\x00\x12-\n\x0cmeta_request\x18\x07 \x01(\x0b\x32\x15.remoterf.MetaRequestH\x00\x12/\n\rmeta_response\x18\x08 \x01(\x0b\x32\x16.remoterf.MetaResponseH\x00\x42\x05\n\x03msg2E\n\nHostTunnel\x12\x37\n\x07\x43onnect\x12\x13.remoterf.HostFrame\x1a\x13.remoterf.HostFrame(\x01\x30\x01\x62\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'grpc_host_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ DESCRIPTOR._loaded_options = None
35
+ _globals['_HOSTMETA_KVENTRY']._loaded_options = None
36
+ _globals['_HOSTMETA_KVENTRY']._serialized_options = b'8\001'
37
+ _globals['_HOSTHELLO']._serialized_start=41
38
+ _globals['_HOSTHELLO']._serialized_end=106
39
+ _globals['_DEVICEINFO']._serialized_start=108
40
+ _globals['_DEVICEINFO']._serialized_end=202
41
+ _globals['_DEVICEANNOUNCE']._serialized_start=204
42
+ _globals['_DEVICEANNOUNCE']._serialized_end=299
43
+ _globals['_RPCREQUEST']._serialized_start=302
44
+ _globals['_RPCREQUEST']._serialized_end=473
45
+ _globals['_RPCRESPONSE']._serialized_start=475
46
+ _globals['_RPCRESPONSE']._serialized_end=580
47
+ _globals['_HEARTBEAT']._serialized_start=582
48
+ _globals['_HEARTBEAT']._serialized_end=610
49
+ _globals['_CANCEL']._serialized_start=612
50
+ _globals['_CANCEL']._serialized_end=636
51
+ _globals['_METAREQUEST']._serialized_start=638
52
+ _globals['_METAREQUEST']._serialized_end=739
53
+ _globals['_HOSTMETA']._serialized_start=742
54
+ _globals['_HOSTMETA']._serialized_end=925
55
+ _globals['_HOSTMETA_KVENTRY']._serialized_start=884
56
+ _globals['_HOSTMETA_KVENTRY']._serialized_end=925
57
+ _globals['_METARESPONSE']._serialized_start=927
58
+ _globals['_METARESPONSE']._serialized_end=1018
59
+ _globals['_HOSTFRAME']._serialized_start=1021
60
+ _globals['_HOSTFRAME']._serialized_end=1396
61
+ _globals['_HOSTTUNNEL']._serialized_start=1398
62
+ _globals['_HOSTTUNNEL']._serialized_end=1467
63
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,97 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from . import grpc_host_pb2 as grpc__host__pb2
7
+
8
+ GRPC_GENERATED_VERSION = '1.78.1'
9
+ GRPC_VERSION = grpc.__version__
10
+ _version_not_supported = False
11
+
12
+ try:
13
+ from grpc._utilities import first_version_is_lower
14
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
15
+ except ImportError:
16
+ _version_not_supported = True
17
+
18
+ if _version_not_supported:
19
+ raise RuntimeError(
20
+ f'The grpc package installed is at version {GRPC_VERSION},'
21
+ + ' but the generated code in grpc_host_pb2_grpc.py depends on'
22
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
23
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
24
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
25
+ )
26
+
27
+
28
+ class HostTunnelStub(object):
29
+ """Missing associated documentation comment in .proto file."""
30
+
31
+ def __init__(self, channel):
32
+ """Constructor.
33
+
34
+ Args:
35
+ channel: A grpc.Channel.
36
+ """
37
+ self.Connect = channel.stream_stream(
38
+ '/remoterf.HostTunnel/Connect',
39
+ request_serializer=grpc__host__pb2.HostFrame.SerializeToString,
40
+ response_deserializer=grpc__host__pb2.HostFrame.FromString,
41
+ _registered_method=True)
42
+
43
+
44
+ class HostTunnelServicer(object):
45
+ """Missing associated documentation comment in .proto file."""
46
+
47
+ def Connect(self, request_iterator, context):
48
+ """Missing associated documentation comment in .proto file."""
49
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
50
+ context.set_details('Method not implemented!')
51
+ raise NotImplementedError('Method not implemented!')
52
+
53
+
54
+ def add_HostTunnelServicer_to_server(servicer, server):
55
+ rpc_method_handlers = {
56
+ 'Connect': grpc.stream_stream_rpc_method_handler(
57
+ servicer.Connect,
58
+ request_deserializer=grpc__host__pb2.HostFrame.FromString,
59
+ response_serializer=grpc__host__pb2.HostFrame.SerializeToString,
60
+ ),
61
+ }
62
+ generic_handler = grpc.method_handlers_generic_handler(
63
+ 'remoterf.HostTunnel', rpc_method_handlers)
64
+ server.add_generic_rpc_handlers((generic_handler,))
65
+ server.add_registered_method_handlers('remoterf.HostTunnel', rpc_method_handlers)
66
+
67
+
68
+ # This class is part of an EXPERIMENTAL API.
69
+ class HostTunnel(object):
70
+ """Missing associated documentation comment in .proto file."""
71
+
72
+ @staticmethod
73
+ def Connect(request_iterator,
74
+ target,
75
+ options=(),
76
+ channel_credentials=None,
77
+ call_credentials=None,
78
+ insecure=False,
79
+ compression=None,
80
+ wait_for_ready=None,
81
+ timeout=None,
82
+ metadata=None):
83
+ return grpc.experimental.stream_stream(
84
+ request_iterator,
85
+ target,
86
+ '/remoterf.HostTunnel/Connect',
87
+ grpc__host__pb2.HostFrame.SerializeToString,
88
+ grpc__host__pb2.HostFrame.FromString,
89
+ options,
90
+ channel_credentials,
91
+ insecure,
92
+ call_credentials,
93
+ compression,
94
+ wait_for_ready,
95
+ timeout,
96
+ metadata,
97
+ _registered_method=True)
@@ -0,0 +1,59 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: grpc.proto
5
+ # Protobuf Python Version: 5.29.0
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 5,
15
+ 29,
16
+ 0,
17
+ '',
18
+ 'grpc.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+
26
+
27
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\ngrpc.proto\x12\tremote_rf\"\xa2\x01\n\x11GenericRPCRequest\x12\x15\n\rfunction_name\x18\x01 \x01(\t\x12\x34\n\x04\x61rgs\x18\x02 \x03(\x0b\x32&.remote_rf.GenericRPCRequest.ArgsEntry\x1a@\n\tArgsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.remote_rf.Argument:\x02\x38\x01\"\x96\x01\n\x12GenericRPCResponse\x12;\n\x07results\x18\x01 \x03(\x0b\x32*.remote_rf.GenericRPCResponse.ResultsEntry\x1a\x43\n\x0cResultsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\"\n\x05value\x18\x02 \x01(\x0b\x32\x13.remote_rf.Argument:\x02\x38\x01\"\x19\n\nArrayShape\x12\x0b\n\x03\x64im\x18\x01 \x03(\x05\"+\n\rComplexNumber\x12\x0c\n\x04real\x18\x01 \x01(\x02\x12\x0c\n\x04imag\x18\x02 \x01(\x02\"a\n\x11\x43omplexNumpyArray\x12$\n\x05shape\x18\x01 \x01(\x0b\x32\x15.remote_rf.ArrayShape\x12&\n\x04\x64\x61ta\x18\x02 \x03(\x0b\x32\x18.remote_rf.ComplexNumber\"D\n\x0eRealNumpyArray\x12$\n\x05shape\x18\x01 \x01(\x0b\x32\x15.remote_rf.ArrayShape\x12\x0c\n\x04\x64\x61ta\x18\x02 \x03(\x02\"\xd7\x01\n\x08\x41rgument\x12\x16\n\x0cstring_value\x18\x01 \x01(\tH\x00\x12\x15\n\x0bint64_value\x18\x02 \x01(\x03H\x00\x12\x15\n\x0b\x66loat_value\x18\x03 \x01(\x02H\x00\x12\x14\n\nbool_value\x18\x04 \x01(\x08H\x00\x12\x35\n\rcomplex_array\x18\x05 \x01(\x0b\x32\x1c.remote_rf.ComplexNumpyArrayH\x00\x12/\n\nreal_array\x18\x06 \x01(\x0b\x32\x19.remote_rf.RealNumpyArrayH\x00\x42\x07\n\x05value2Q\n\nGenericRPC\x12\x43\n\x04\x43\x61ll\x12\x1c.remote_rf.GenericRPCRequest\x1a\x1d.remote_rf.GenericRPCResponseB\x1e\n\x10\x63om.example.demoB\nDemoProtosb\x06proto3')
28
+
29
+ _globals = globals()
30
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
31
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'grpc_pb2', _globals)
32
+ if not _descriptor._USE_C_DESCRIPTORS:
33
+ _globals['DESCRIPTOR']._loaded_options = None
34
+ _globals['DESCRIPTOR']._serialized_options = b'\n\020com.example.demoB\nDemoProtos'
35
+ _globals['_GENERICRPCREQUEST_ARGSENTRY']._loaded_options = None
36
+ _globals['_GENERICRPCREQUEST_ARGSENTRY']._serialized_options = b'8\001'
37
+ _globals['_GENERICRPCRESPONSE_RESULTSENTRY']._loaded_options = None
38
+ _globals['_GENERICRPCRESPONSE_RESULTSENTRY']._serialized_options = b'8\001'
39
+ _globals['_GENERICRPCREQUEST']._serialized_start=26
40
+ _globals['_GENERICRPCREQUEST']._serialized_end=188
41
+ _globals['_GENERICRPCREQUEST_ARGSENTRY']._serialized_start=124
42
+ _globals['_GENERICRPCREQUEST_ARGSENTRY']._serialized_end=188
43
+ _globals['_GENERICRPCRESPONSE']._serialized_start=191
44
+ _globals['_GENERICRPCRESPONSE']._serialized_end=341
45
+ _globals['_GENERICRPCRESPONSE_RESULTSENTRY']._serialized_start=274
46
+ _globals['_GENERICRPCRESPONSE_RESULTSENTRY']._serialized_end=341
47
+ _globals['_ARRAYSHAPE']._serialized_start=343
48
+ _globals['_ARRAYSHAPE']._serialized_end=368
49
+ _globals['_COMPLEXNUMBER']._serialized_start=370
50
+ _globals['_COMPLEXNUMBER']._serialized_end=413
51
+ _globals['_COMPLEXNUMPYARRAY']._serialized_start=415
52
+ _globals['_COMPLEXNUMPYARRAY']._serialized_end=512
53
+ _globals['_REALNUMPYARRAY']._serialized_start=514
54
+ _globals['_REALNUMPYARRAY']._serialized_end=582
55
+ _globals['_ARGUMENT']._serialized_start=585
56
+ _globals['_ARGUMENT']._serialized_end=800
57
+ _globals['_GENERICRPC']._serialized_start=802
58
+ _globals['_GENERICRPC']._serialized_end=883
59
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,97 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ from . import grpc_pb2 as grpc__pb2
7
+
8
+ GRPC_GENERATED_VERSION = '1.71.0'
9
+ GRPC_VERSION = grpc.__version__
10
+ _version_not_supported = False
11
+
12
+ try:
13
+ from grpc._utilities import first_version_is_lower
14
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
15
+ except ImportError:
16
+ _version_not_supported = True
17
+
18
+ if _version_not_supported:
19
+ raise RuntimeError(
20
+ f'The grpc package installed is at version {GRPC_VERSION},'
21
+ + f' but the generated code in grpc_pb2_grpc.py depends on'
22
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
23
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
24
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
25
+ )
26
+
27
+
28
+ class GenericRPCStub(object):
29
+ """Missing associated documentation comment in .proto file."""
30
+
31
+ def __init__(self, channel):
32
+ """Constructor.
33
+
34
+ Args:
35
+ channel: A grpc.Channel.
36
+ """
37
+ self.Call = channel.unary_unary(
38
+ '/remote_rf.GenericRPC/Call',
39
+ request_serializer=grpc__pb2.GenericRPCRequest.SerializeToString,
40
+ response_deserializer=grpc__pb2.GenericRPCResponse.FromString,
41
+ _registered_method=True)
42
+
43
+
44
+ class GenericRPCServicer(object):
45
+ """Missing associated documentation comment in .proto file."""
46
+
47
+ def Call(self, request, context):
48
+ """Missing associated documentation comment in .proto file."""
49
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
50
+ context.set_details('Method not implemented!')
51
+ raise NotImplementedError('Method not implemented!')
52
+
53
+
54
+ def add_GenericRPCServicer_to_server(servicer, server):
55
+ rpc_method_handlers = {
56
+ 'Call': grpc.unary_unary_rpc_method_handler(
57
+ servicer.Call,
58
+ request_deserializer=grpc__pb2.GenericRPCRequest.FromString,
59
+ response_serializer=grpc__pb2.GenericRPCResponse.SerializeToString,
60
+ ),
61
+ }
62
+ generic_handler = grpc.method_handlers_generic_handler(
63
+ 'remote_rf.GenericRPC', rpc_method_handlers)
64
+ server.add_generic_rpc_handlers((generic_handler,))
65
+ server.add_registered_method_handlers('remote_rf.GenericRPC', rpc_method_handlers)
66
+
67
+
68
+ # This class is part of an EXPERIMENTAL API.
69
+ class GenericRPC(object):
70
+ """Missing associated documentation comment in .proto file."""
71
+
72
+ @staticmethod
73
+ def Call(request,
74
+ target,
75
+ options=(),
76
+ channel_credentials=None,
77
+ call_credentials=None,
78
+ insecure=False,
79
+ compression=None,
80
+ wait_for_ready=None,
81
+ timeout=None,
82
+ metadata=None):
83
+ return grpc.experimental.unary_unary(
84
+ request,
85
+ target,
86
+ '/remote_rf.GenericRPC/Call',
87
+ grpc__pb2.GenericRPCRequest.SerializeToString,
88
+ grpc__pb2.GenericRPCResponse.FromString,
89
+ options,
90
+ channel_credentials,
91
+ insecure,
92
+ call_credentials,
93
+ compression,
94
+ wait_for_ready,
95
+ timeout,
96
+ metadata,
97
+ _registered_method=True)
@@ -0,0 +1 @@
1
+ from .schema import DeviceSchema, idl_register, idl_expose
@@ -0,0 +1,39 @@
1
+ # remoteRF_server/common/idl/schema_template.py
2
+
3
+ # Include any necessary device imports, etc!
4
+
5
+ # todo: 'throws error' if stuff isn't implemented, etc.
6
+ # todo: have device_manifest live in .config, etc. (not in codebase)
7
+
8
+ from . import *
9
+
10
+ # todo: would import the decorators from remoteRF_server ... -> which allows any admin script to run with the platform!
11
+ # todo: you would run a 'baking the driver' (so it populates onto the .config or something with the proper version, etc. so the server knows!)
12
+
13
+ class DeviceSchema:
14
+
15
+ device_type = "template" # MUST match device_type in the device manifest!
16
+ driver_version = "0.0.1"
17
+
18
+ # Returns instance of the device (ie: a class, etc!)
19
+ # Used by the server to actually 'connect' to the hardware devices!
20
+ # Define the proper args in the device Manifest -> pipes to this factory method to populate device list!
21
+ # todo: kwargs are EXACTLY the 'init' section of the device manifest!
22
+ @staticmethod
23
+ def make_device(**kwargs):
24
+ # Implement whatever logic you need to connect to the device (or init parameters, like BW, etc.)
25
+ raise NotImplementedError
26
+
27
+ # Called by the server on init!
28
+ def __init__(self, device_instance):
29
+ self.device = device_instance
30
+
31
+ @idl_expose # Decorators for each 'exposed' method/property!
32
+ def schema_info(self) -> float:
33
+ return f"{self.device_type} v{self.driver_version}"
34
+
35
+ # Example exposed method:
36
+ @idl_expose # Decorators for each 'exposed' method/property!
37
+ def some_method(self, arg1: float, arg2: float) -> float:
38
+ return self.device.some_method(arg1, arg2) # EXAMPLE
39
+ # raise NotImplementedError
@@ -0,0 +1,174 @@
1
+ # ~/.config/remoterf/drivers/pluto_schema.py
2
+ #
3
+ # Admin-written schema for ADALM-Pluto devices.
4
+ # Drop this file into the drivers folder, restart the server. Done.
5
+
6
+ from . import *
7
+
8
+ import subprocess
9
+ import re
10
+ import adi
11
+
12
+ # ========================= PLUTO Connection Logic =========================
13
+
14
+ def connect_pluto(*, serial: str):
15
+ serial = (serial or "").strip()
16
+ if not serial:
17
+ print("A Pluto serial must be provided")
18
+ return None
19
+
20
+ try:
21
+ out = subprocess.check_output(
22
+ ["iio_info", "-s"],
23
+ text=True,
24
+ stderr=subprocess.STDOUT
25
+ )
26
+
27
+ usb = None
28
+ for line in out.splitlines():
29
+ if (f"serial={serial}" in line) or (f"hw_serial={serial}" in line):
30
+ m = re.search(r"\[usb:([^\]]+)\]", line)
31
+ if m:
32
+ usb = m.group(1).strip()
33
+ break
34
+
35
+ if not usb:
36
+ print(f"No device found with serial {serial}")
37
+ return None
38
+
39
+ dev = adi.Pluto(f"usb:{usb}")
40
+ print(f"Connected to Pluto serial={serial} via usb:{usb}")
41
+ return dev
42
+
43
+ except Exception as e:
44
+ print(f"Failed to connect to Pluto serial={serial}: {e}")
45
+ return None
46
+
47
+ # ========================= PLUTO Schema =========================
48
+
49
+ @idl_register("pluto")
50
+ class PlutoSchema(DeviceSchema):
51
+
52
+ device_type = "pluto"
53
+ driver_version = "0.0.1"
54
+
55
+ @staticmethod
56
+ def make_device(**kwargs):
57
+ serial = kwargs.get("serial")
58
+ return connect_pluto(serial=serial)
59
+
60
+ # region ad9364
61
+
62
+ @idl_expose(kind="get")
63
+ def get_filter(self):
64
+ return self.device.filter
65
+
66
+ @idl_expose(kind="set")
67
+ def set_filter(self, value):
68
+ self.device.filter = value
69
+
70
+ @idl_expose(kind="get")
71
+ def get_loopback(self):
72
+ return self.device.loopback
73
+
74
+ @idl_expose(kind="set")
75
+ def set_loopback(self, value):
76
+ self.device.loopback = value
77
+
78
+ @idl_expose(kind="get")
79
+ def get_gain_control_mode_chan0(self):
80
+ return self.device.gain_control_mode_chan0
81
+
82
+ @idl_expose(kind="set")
83
+ def set_gain_control_mode_chan0(self, value):
84
+ self.device.gain_control_mode_chan0 = value
85
+
86
+ @idl_expose(kind="get")
87
+ def get_rx_hardwaregain_chan0(self):
88
+ return self.device.rx_hardwaregain_chan0
89
+
90
+ @idl_expose(kind="set")
91
+ def set_rx_hardwaregain_chan0(self, value):
92
+ self.device.rx_hardwaregain_chan0 = value
93
+
94
+ @idl_expose(kind="get")
95
+ def get_tx_hardwaregain_chan0(self):
96
+ return self.device.tx_hardwaregain_chan0
97
+
98
+ @idl_expose(kind="set")
99
+ def set_tx_hardwaregain_chan0(self, value):
100
+ self.device.tx_hardwaregain_chan0 = value
101
+
102
+ @idl_expose(kind="get")
103
+ def get_rx_rf_bandwidth(self):
104
+ return self.device.rx_rf_bandwidth
105
+
106
+ @idl_expose(kind="set")
107
+ def set_rx_rf_bandwidth(self, value):
108
+ self.device.rx_rf_bandwidth = value
109
+
110
+ @idl_expose(kind="get")
111
+ def get_tx_rf_bandwidth(self):
112
+ return self.device.tx_rf_bandwidth
113
+
114
+ @idl_expose(kind="set")
115
+ def set_tx_rf_bandwidth(self, value):
116
+ self.device.tx_rf_bandwidth = value
117
+
118
+ @idl_expose(kind="get")
119
+ def get_sample_rate(self):
120
+ return self.device.sample_rate
121
+
122
+ @idl_expose(kind="set")
123
+ def set_sample_rate(self, value):
124
+ self.device.sample_rate = value
125
+
126
+ @idl_expose(kind="get")
127
+ def get_rx_lo(self):
128
+ return self.device.rx_lo
129
+
130
+ @idl_expose(kind="set")
131
+ def set_rx_lo(self, value):
132
+ self.device.rx_lo = value
133
+
134
+ @idl_expose(kind="get")
135
+ def get_tx_lo(self):
136
+ return self.device.tx_lo
137
+
138
+ @idl_expose(kind="set")
139
+ def set_tx_lo(self, value):
140
+ self.device.tx_lo = value
141
+
142
+ @idl_expose(kind="get")
143
+ def get_tx_cyclic_buffer(self):
144
+ return self.device.tx_cyclic_buffer
145
+
146
+ @idl_expose(kind="set")
147
+ def set_tx_cyclic_buffer(self, value):
148
+ self.device.tx_cyclic_buffer = value
149
+
150
+ # region RX/TX
151
+
152
+ @idl_expose(kind="call")
153
+ def call_rx(self):
154
+ return self.device.rx()
155
+
156
+ @idl_expose(kind="get")
157
+ def get_rx_buffer_size(self):
158
+ return self.device.rx_buffer_size
159
+
160
+ @idl_expose(kind="set")
161
+ def set_rx_buffer_size(self, value):
162
+ self.device.rx_buffer_size = value
163
+
164
+ @idl_expose(kind="call")
165
+ def call_rx_destroy_buffer(self):
166
+ self.device.rx_destroy_buffer()
167
+
168
+ @idl_expose(kind="call")
169
+ def call_tx(self, value):
170
+ self.device.tx(value)
171
+
172
+ @idl_expose(kind="call")
173
+ def call_tx_destroy_buffer(self):
174
+ self.device.tx_destroy_buffer()