remotivelabs-cli 0.0.9__tar.gz → 0.0.11__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 (39) hide show
  1. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/PKG-INFO +1 -1
  2. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/scripting.py +19 -2
  3. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/connect/protopie/protopie.py +1 -4
  4. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/pyproject.toml +1 -1
  5. remotivelabs_cli-0.0.9/cli/tools/can/decoders.py +0 -162
  6. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/LICENSE +0 -0
  7. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/README.md +0 -0
  8. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/__about__.py +0 -0
  9. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/__init__.py +0 -0
  10. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/brokers.py +0 -0
  11. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/export.py +0 -0
  12. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/files.py +0 -0
  13. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/lib/__about__.py +0 -0
  14. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/lib/broker.py +0 -0
  15. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/playback.py +0 -0
  16. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/record.py +0 -0
  17. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/broker/signals.py +0 -0
  18. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/__init__.py +0 -0
  19. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/auth.py +0 -0
  20. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/auth_tokens.py +0 -0
  21. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/brokers.py +0 -0
  22. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/cloud_cli.py +0 -0
  23. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/configs.py +0 -0
  24. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/projects.py +0 -0
  25. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/recordings.py +0 -0
  26. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/rest_helper.py +0 -0
  27. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/sample_recordings.py +0 -0
  28. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/service_account_tokens.py +0 -0
  29. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/cloud/service_accounts.py +0 -0
  30. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/connect/__init__.py +0 -0
  31. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/connect/connect.py +0 -0
  32. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/errors.py +0 -0
  33. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/remotive.py +0 -0
  34. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/requirements.txt +0 -0
  35. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/settings.py +0 -0
  36. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/tools/__init__.py +0 -0
  37. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/tools/can/__init__.py +0 -0
  38. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/tools/can/can.py +0 -0
  39. {remotivelabs_cli-0.0.9 → remotivelabs_cli-0.0.11}/cli/tools/tools.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: remotivelabs-cli
3
- Version: 0.0.9
3
+ Version: 0.0.11
4
4
  Summary: CLI for operating RemotiveCloud and RemotiveBroker
5
5
  Author: Johan Rask
6
6
  Author-email: johan.rask@remotivelabs.com
@@ -33,7 +33,7 @@ def new_script(
33
33
  def to_subscribable_signal(sig: str) -> tuple[str, str]:
34
34
  arr = sig.split(":")
35
35
  if len(arr) != 2:
36
- ErrorPrinter.print_hint(f"--signal must have format namespace:signal ({sig})")
36
+ ErrorPrinter.print_hint(f"--input-signal must have format namespace:signal ({sig})")
37
37
  exit(1)
38
38
  return arr[0], arr[1]
39
39
 
@@ -53,6 +53,9 @@ def new_script(
53
53
 
54
54
  template = Template(
55
55
  """
56
+ --
57
+ -- Docs available at https://docs.remotivelabs.com/docs/remotive-broker/scripted_signals
58
+ --
56
59
 
57
60
  local local_signals = {$local_signals
58
61
  }
@@ -63,10 +66,24 @@ function input_signals()
63
66
  end
64
67
 
65
68
  -- Provided parameters are used for populating metadata when listing signals.
66
- function output_signals()
69
+ function output_signal()
67
70
  return "$output_signal"
68
71
  end
69
72
 
73
+ local local_frequency_hz = 0
74
+
75
+ -- Required, declare what frequency you like to get "timer" invoked. 0 means no calls to "timer".
76
+ function timer_frequency_hz()
77
+ return local_frequency_hz
78
+ end
79
+
80
+ -- Invoked with the frequecy returned by "timer_frequency_hz".
81
+ -- @param system_timestamp_us: system time stamp.
82
+ function timer(system_timestamp_us)
83
+ return return_value_or_bytes("your value")
84
+ end
85
+
86
+
70
87
  -- Invoked when ANY signal declared in "local_signals" arrive
71
88
  -- @param signals_timestamp_us: signal time stamp
72
89
  -- @param system_timestamp_us
@@ -37,10 +37,7 @@ def on_connect():
37
37
  is_connected = True
38
38
 
39
39
 
40
- @io.on("ppMessage")
41
- def on_message(data):
42
- # Not used but possible. Could be used to send commands like start, pause, stop
43
- print(f"message from connect: {data}")
40
+ # TODO - Receive message from ProtoPie connect
44
41
 
45
42
 
46
43
  def get_signals_and_namespaces(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "remotivelabs-cli"
3
- version = "0.0.9"
3
+ version = "0.0.11"
4
4
  description = "CLI for operating RemotiveCloud and RemotiveBroker"
5
5
  authors = ["Johan Rask <johan.rask@remotivelabs.com>"]
6
6
  readme = "README.md"
@@ -1,162 +0,0 @@
1
- import os.path
2
- from typing import Union
3
-
4
- import can
5
- import cantools
6
- from can import Message as CanMessage
7
- from cantools.database import Database, Message
8
- from cantools.database.errors import DecodeError
9
- from cantools.database.namedsignalvalue import NamedSignalValue
10
- from cantools.typechecking import DecodeResultType
11
-
12
-
13
- class CanDecoder:
14
- def __init__(self, signal_db_path: str, namespace: str = None):
15
- self.signal_db: Union[Database, Database] = cantools.database.load_file(signal_db_path)
16
- self.signal_db_path = signal_db_path
17
- self.failed_arb_id = list()
18
- self.successful_arb_id = list()
19
- self.namespace = namespace
20
-
21
- def decode_log_file_legacy(self, filename: str):
22
- file1 = open(filename, "r")
23
- Lines = file1.readlines()
24
- return list(map(self.decode_log_line, Lines))
25
-
26
- def decode_log_file(self, filename):
27
- with can.LogReader(filename) as reader:
28
- return list(map(self.__do_decode, reader))
29
-
30
- def decode_log_line(self, line: str):
31
- try:
32
- time_ns_rawframe = line.split(" ")
33
- ts = float(time_ns_rawframe[0][1:18])
34
- ns = time_ns_rawframe[1]
35
- rawframe = time_ns_rawframe[2]
36
- arbid_and_data = rawframe.split("#")
37
- arb_id = int(arbid_and_data[0], 16)
38
-
39
- frame_infos = list(filter(lambda m: m.frame_id == arb_id, self.signal_db.messages))
40
-
41
- if len(frame_infos) == 0:
42
- return None
43
-
44
- # message('PHEV_Battery_Data1_HS3', 0x3d4, False, 8, None)
45
- frame_info: Message = frame_infos[0]
46
-
47
- data = bytes.fromhex(arbid_and_data[1])
48
- # print(frame)
49
- # print(frame.name)
50
- except Exception as e:
51
- print(e)
52
- return None
53
-
54
- try:
55
- # {'BattTracSoc_Pc_Dpltd': 4.5}
56
- signal: DecodeResultType = self.signal_db.decode_message(arb_id, data)
57
- # if frame_info.name == 'TransGearData_HS1':
58
- # for s in list(signal):
59
- # print(f"signal {s} - {signal[s].value} - {type(signal[s])}")
60
-
61
- def signal_value(some_signal_value):
62
- # NamedSignalValue contains name: int pair where "name" is the
63
- # explanation or str version of the int from my understanding
64
- # Sample from dbc file
65
- #
66
- # SignalName
67
- # 0 AutonomousBrkPedalMove
68
- # 1 NoAutonomousBrkPdlMovement
69
- # 2 DriverApplyingBrakePedal
70
- # 3 Unknown
71
- if isinstance(some_signal_value, NamedSignalValue):
72
- return some_signal_value.value
73
- else:
74
- return some_signal_value
75
-
76
- all_signals = map(lambda m: {"type": type(signal[m]).__name__, "name": m, "value": signal_value(signal[m])}, list(signal))
77
- numeric_signals_kv = list(filter(lambda m: type(m["value"]) is float or type(m["value"]) is int, all_signals))
78
-
79
- self.successful_arb_id.append(arb_id)
80
- return {
81
- "name": frame_info.name,
82
- "timestamp": ts,
83
- "signal_db": os.path.basename(self.signal_db_path),
84
- "namespace": ns,
85
- "signals": list(numeric_signals_kv),
86
- }
87
-
88
- except KeyError as e:
89
- print(e)
90
- # print(f"Failed to parse msg for {arb_id} {str(e)}")
91
- self.failed_arb_id.append(arb_id)
92
- return
93
-
94
- except Exception as e:
95
- print(e)
96
- self.failed_arb_id.append(arb_id)
97
- return
98
- # print(f"EX: Failed to parse msg for {arb_id} + {str(ex)}")
99
- # print(str(e))
100
-
101
- def decode_asc_file(self, filename, **kwargs):
102
- logfile = os.path.join(os.path.dirname(__file__), "data", filename)
103
- print(logfile)
104
-
105
- with can.ASCReader(filename, "hex", False, **kwargs) as reader:
106
- return list(map(self.__do_decode, reader))
107
-
108
- def asc2blf(self, asc_file, blf_file, **kwargs):
109
- with open(asc_file, "r") as f_in:
110
- log_in = can.io.ASCReader(f_in, "hex", False)
111
-
112
- with open(blf_file, "wb") as f_out:
113
- log_out = can.io.BLFWriter(f_out)
114
- for msg in log_in:
115
- log_out.on_message_received(msg)
116
- log_out.stop()
117
-
118
- def log2asc(self, log_file, asc_file, **kwargs):
119
- with can.LogReader(log_file) as log_in:
120
- with open(asc_file, "w") as f_out:
121
- log_out = can.io.ASCWriter(f_out)
122
- for msg in log_in:
123
- log_out.on_message_received(msg)
124
- log_out.stop()
125
-
126
- def decode_blf_file(self, filename, **kwargs):
127
- logfile = os.path.join(os.path.dirname(__file__), "data", filename)
128
- print(logfile)
129
- with can.BLFReader(filename, **kwargs) as reader:
130
- return list(map(self.__do_decode, reader))
131
-
132
- def __do_decode(self, mesg: CanMessage):
133
- try:
134
- signal: DecodeResultType = self.signal_db.decode_message(mesg.arbitration_id, mesg.data)
135
- message = self.signal_db.get_message_by_frame_id(mesg.arbitration_id)
136
- numeric_signals_kv = list(
137
- filter(
138
- lambda m: type(m["value"]) is float or type(m["value"]) is int,
139
- map(lambda m: {"name": m, "value": signal[m]}, list(signal)),
140
- )
141
- )
142
- self.successful_arb_id.append(mesg.arbitration_id)
143
- return {
144
- "name": message.name,
145
- "timestamp": mesg.timestamp,
146
- "signal_db": os.path.basename(self.signal_db_path),
147
- "namespace": self.namespace,
148
- "signals": list(numeric_signals_kv),
149
- }
150
- except KeyError:
151
- # print(e)
152
- self.failed_arb_id.append(mesg.arbitration_id)
153
- return None
154
-
155
- except DecodeError:
156
- # print(e)
157
- self.failed_arb_id.append(mesg.arbitration_id)
158
- return None
159
- except Exception:
160
- # print(e)
161
- self.failed_arb_id.append(mesg.arbitration_id)
162
- return None