remotivelabs-cli 0.0.36__tar.gz → 0.0.38__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.
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/PKG-INFO +1 -1
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/lib/broker.py +8 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/signals.py +29 -2
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/connect/connect.py +5 -1
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/connect/protopie/protopie.py +8 -4
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/errors.py +2 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/pyproject.toml +1 -1
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/LICENSE +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/README.md +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/brokers.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/export.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/files.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/lib/__about__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/license_flows.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/licenses.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/playback.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/record.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/broker/scripting.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/auth/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/auth/cmd.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/auth/login.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/auth_tokens.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/brokers.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/cloud_cli.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/configs.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/organisations.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/projects.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/recordings.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/recordings_playback.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/rest_helper.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/resumable_upload.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/sample_recordings.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/service_account_tokens.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/service_accounts.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/storage/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/storage/cmd.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/storage/copy.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/storage/uri_or_path.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/cloud/uri.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/connect/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/remotive.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/settings/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/settings/cmd.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/settings/core.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/settings/token_file.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/tools/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/tools/can/RemotiveLabs.can1.log +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/tools/can/__init__.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/tools/can/can.py +0 -0
- {remotivelabs_cli-0.0.36 → remotivelabs_cli-0.0.38}/cli/tools/tools.py +0 -0
@@ -14,6 +14,7 @@ from threading import Thread
|
|
14
14
|
from typing import Any, Callable, Dict, Iterable, List, Sequence, Union
|
15
15
|
|
16
16
|
import grpc
|
17
|
+
import remotivelabs.broker.generated.sync.network_api_pb2 as network_api
|
17
18
|
import remotivelabs.broker.generated.sync.traffic_api_pb2 as traffic_api
|
18
19
|
import remotivelabs.broker.sync as br
|
19
20
|
import remotivelabs.broker.sync.helper as br_helper
|
@@ -220,6 +221,13 @@ class Broker:
|
|
220
221
|
self.play(recording_and_namespace)
|
221
222
|
callback(offset_length, total_length, get_mode(mode))
|
222
223
|
|
224
|
+
def listen_on_frame_distribution(self, namespace: str, callback: Callable[[Dict[str, Any]], None]) -> None:
|
225
|
+
config = network_api.FramesDistributionConfig(namespace=br.common_pb2.NameSpace(name=namespace))
|
226
|
+
frame_distribution_stream = self.network_stub.SubscribeToFramesDistribution(config)
|
227
|
+
for frame in frame_distribution_stream:
|
228
|
+
f = MessageToDict(frame, including_default_value_fields=True, preserving_proto_field_name=True)
|
229
|
+
callback(f)
|
230
|
+
|
223
231
|
def pause(self, namespace: str, path: str, silent: bool = False) -> br.traffic_api_pb2.PlaybackInfos:
|
224
232
|
playback_list = [
|
225
233
|
{
|
@@ -4,6 +4,7 @@ import json
|
|
4
4
|
import numbers
|
5
5
|
import os
|
6
6
|
import signal as os_signal
|
7
|
+
from datetime import datetime
|
7
8
|
from pathlib import Path
|
8
9
|
from typing import Any, Dict, Iterable, List, TypedDict, Union
|
9
10
|
|
@@ -64,7 +65,7 @@ def read_scripted_code_file(file_path: Path) -> bytes:
|
|
64
65
|
def subscribe( # noqa: C901
|
65
66
|
url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
|
66
67
|
api_key: str = typer.Option(None, help="Cloud Broker API-KEY or access token", envvar="REMOTIVE_BROKER_API_KEY"),
|
67
|
-
signal: List[str] = typer.Option(
|
68
|
+
signal: List[str] = typer.Option([], help="Signal names to subscribe to, mandatory when not using script"),
|
68
69
|
script: Path = typer.Option(
|
69
70
|
None,
|
70
71
|
exists=True,
|
@@ -96,7 +97,7 @@ def subscribe( # noqa: C901
|
|
96
97
|
|
97
98
|
if script is None:
|
98
99
|
if len(signal) == 0:
|
99
|
-
ErrorPrinter.print_generic_error("You must use
|
100
|
+
ErrorPrinter.print_generic_error("You must use --signal or use --script when subscribing")
|
100
101
|
exit(1)
|
101
102
|
|
102
103
|
if script is not None:
|
@@ -194,3 +195,29 @@ def namespaces(
|
|
194
195
|
print(json.dumps(namespaces_json))
|
195
196
|
except grpc.RpcError as rpc_error:
|
196
197
|
ErrorPrinter.print_grpc_error(rpc_error)
|
198
|
+
|
199
|
+
|
200
|
+
@app.command()
|
201
|
+
def frame_distribution(
|
202
|
+
url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
|
203
|
+
api_key: str = typer.Option(None, help="Cloud Broker API-KEY or access token", envvar="REMOTIVE_BROKER_API_KEY"),
|
204
|
+
namespace: str = typer.Option(..., help="Namespace"),
|
205
|
+
) -> None:
|
206
|
+
"""
|
207
|
+
Use this command to get frames currently available on the specified namespace.
|
208
|
+
"""
|
209
|
+
try:
|
210
|
+
broker = Broker(url, api_key)
|
211
|
+
|
212
|
+
def on_data(data: Dict[str, Any]) -> None:
|
213
|
+
timestamp: str = datetime.now().strftime("%H:%M:%S")
|
214
|
+
distribution = data["countsByFrameId"]
|
215
|
+
if len(distribution) == 0:
|
216
|
+
ErrorPrinter.print_hint(f"{timestamp} - No frames available")
|
217
|
+
else:
|
218
|
+
for d in distribution:
|
219
|
+
ErrorPrinter.print_generic_message(f"{timestamp}: {d}")
|
220
|
+
|
221
|
+
broker.listen_on_frame_distribution(namespace, on_data)
|
222
|
+
except grpc.RpcError as rpc_error:
|
223
|
+
ErrorPrinter.print_grpc_error(rpc_error)
|
@@ -27,10 +27,13 @@ def protopie( # pylint: disable=R0913
|
|
27
27
|
resolve_path=True,
|
28
28
|
help="Configuration file with signal subscriptions and mapping if needed",
|
29
29
|
),
|
30
|
-
signal: List[str] = typer.Option(
|
30
|
+
signal: List[str] = typer.Option([], help="Signal names to subscribe to, mandatory when not using script"),
|
31
31
|
signal_name_expression: str = typer.Option(
|
32
32
|
None, help='[Experimental] Python expression to rename signal names, i.e \'lower().replace(".","_")\''
|
33
33
|
),
|
34
|
+
changed_values_only: bool = typer.Option(
|
35
|
+
True, help="Only receive signal when its value is changed to minimize amount of data received"
|
36
|
+
),
|
34
37
|
broker_url: str = typer.Option(..., help="Broker URL", envvar="REMOTIVE_BROKER_URL"),
|
35
38
|
api_key: str = typer.Option(None, help="Cloud Broker API-KEY", envvar="REMOTIVE_BROKER_API_KEY"),
|
36
39
|
pp_connect_host: str = typer.Option("http://localhost:9981", help="ProtoPie Connect URL"),
|
@@ -111,4 +114,5 @@ def protopie( # pylint: disable=R0913
|
|
111
114
|
expression=signal_name_expression,
|
112
115
|
config=config,
|
113
116
|
signals=signals_to_subscribe_to,
|
117
|
+
on_change_only=changed_values_only,
|
114
118
|
)
|
@@ -85,6 +85,7 @@ def _connect_to_broker(
|
|
85
85
|
config: Union[Path, None] = None,
|
86
86
|
signals_to_subscribe_to: Union[List[SubscribableSignal], None] = None,
|
87
87
|
expression: str = "",
|
88
|
+
on_change_only: bool = False,
|
88
89
|
) -> None: # noqa: C901
|
89
90
|
signals, namespaces, sub = get_signals_and_namespaces(config, signals_to_subscribe_to)
|
90
91
|
|
@@ -107,10 +108,12 @@ def _connect_to_broker(
|
|
107
108
|
signal_name = get_signal_name(expression, s.name())
|
108
109
|
io.emit("ppMessage", {"messageId": signal_name, "value": str(s.value())})
|
109
110
|
|
110
|
-
grpc_connect(on_signals, signals_to_subscribe_to)
|
111
|
+
grpc_connect(on_signals, signals_to_subscribe_to, on_change_only)
|
111
112
|
|
112
113
|
|
113
|
-
def grpc_connect(
|
114
|
+
def grpc_connect(
|
115
|
+
on_signals: Any, signals_to_subscribe_to: Union[List[SignalIdentifier], None] = None, on_change_only: bool = False
|
116
|
+
) -> None:
|
114
117
|
try:
|
115
118
|
pretty_print("Connecting and subscribing to broker...")
|
116
119
|
subscription = None
|
@@ -121,7 +124,7 @@ def grpc_connect(on_signals: Any, signals_to_subscribe_to: Union[List[SignalIden
|
|
121
124
|
if signals_to_subscribe_to is None:
|
122
125
|
print("No sigs")
|
123
126
|
return
|
124
|
-
subscription = client.subscribe(signals_to_subscribe_to=signals_to_subscribe_to, changed_values_only=
|
127
|
+
subscription = client.subscribe(signals_to_subscribe_to=signals_to_subscribe_to, changed_values_only=on_change_only)
|
125
128
|
pretty_print("Subscription to broker completed")
|
126
129
|
pretty_print("Waiting for signals...")
|
127
130
|
|
@@ -158,6 +161,7 @@ def do_connect(
|
|
158
161
|
config: Union[Path, None],
|
159
162
|
signals: List[SubscribableSignal],
|
160
163
|
expression: Union[str, None],
|
164
|
+
on_change_only: bool = False,
|
161
165
|
) -> None:
|
162
166
|
global broker
|
163
167
|
global x_api_key
|
@@ -180,7 +184,7 @@ def do_connect(
|
|
180
184
|
while is_connected is None:
|
181
185
|
time.sleep(1)
|
182
186
|
# if expression is not None:
|
183
|
-
_connect_to_broker(signals_to_subscribe_to=signals, config=config, expression=expression)
|
187
|
+
_connect_to_broker(signals_to_subscribe_to=signals, config=config, expression=expression, on_change_only=on_change_only)
|
184
188
|
except SocketIoConnectionError as e:
|
185
189
|
err_console.print(":boom: [bold red]Failed to connect to ProtoPie Connect[/bold red]")
|
186
190
|
err_console.print(e)
|
@@ -7,6 +7,8 @@ from rich.console import Console
|
|
7
7
|
err_console = Console(stderr=True)
|
8
8
|
|
9
9
|
|
10
|
+
# This should be renamed to Printer since print_generic_message is not an error message.
|
11
|
+
# Then we can also add more things here
|
10
12
|
class ErrorPrinter:
|
11
13
|
@staticmethod
|
12
14
|
def print_grpc_error(error: grpc.RpcError) -> None:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|