rccn-gen 1.0.0__py3-none-any.whl → 1.0.2__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.
rccn_gen/systems.py
CHANGED
@@ -2,6 +2,7 @@ from yamcs.pymdb import System, Subsystem, Command
|
|
2
2
|
import shutil
|
3
3
|
import difflib
|
4
4
|
import datetime
|
5
|
+
from caseconverter import *
|
5
6
|
from importlib.resources import files
|
6
7
|
from .utils import *
|
7
8
|
from .telemetry import *
|
@@ -16,6 +17,7 @@ class Application(Subsystem):
|
|
16
17
|
system: System,
|
17
18
|
name: str,
|
18
19
|
apid: int,
|
20
|
+
vcid: int = 0,
|
19
21
|
export_file_path = '.',
|
20
22
|
snapshot_file_path = './.rccn_snapshots',
|
21
23
|
diff_file_path = './.rccn_diffs',
|
@@ -26,12 +28,13 @@ class Application(Subsystem):
|
|
26
28
|
super().__init__(system=system, name=name, *args, **kwargs)
|
27
29
|
|
28
30
|
self.apid = apid
|
31
|
+
self.vcid = vcid
|
29
32
|
system._subsystems_by_name[name] = self
|
30
33
|
self.export_file_path = export_file_path
|
31
34
|
self.snapshot_file_path = snapshot_file_path
|
32
35
|
self.snapshot_generated_file_path = os.path.join(snapshot_file_path, 'auto_generated')
|
33
36
|
self.diff_file_path = diff_file_path
|
34
|
-
self.text_modules_path = files('
|
37
|
+
self.text_modules_path = files('rccn_gen').joinpath('text_modules')
|
35
38
|
print(self.text_modules_path)
|
36
39
|
self.text_modules_main_path = os.path.join(self.text_modules_path, 'main')
|
37
40
|
print(self.text_modules_main_path)
|
@@ -45,12 +48,12 @@ class Application(Subsystem):
|
|
45
48
|
|
46
49
|
def file_paths(self):
|
47
50
|
paths = {
|
48
|
-
'main': os.path.join(self.export_file_path, 'rccn_usr_'+
|
49
|
-
'main_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+
|
50
|
-
'main_user_snapshot': os.path.join(self.user_snapshot_path(), 'rccn_usr_'+
|
51
|
-
'main_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+
|
51
|
+
'main': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.name), 'src', 'main.rs'),
|
52
|
+
'main_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+snakecase(self.name), 'src', 'main.rs'),
|
53
|
+
'main_user_snapshot': os.path.join(self.user_snapshot_path(), 'rccn_usr_'+snakecase(self.name), 'src', 'main.rs'),
|
54
|
+
'main_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+snakecase(self.name), 'src', 'main.diff'),
|
52
55
|
'main_template': os.path.join(self.text_modules_main_path, 'main.txt'),
|
53
|
-
'cargo_toml': os.path.join(self.export_file_path, 'rccn_usr_'+
|
56
|
+
'cargo_toml': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.name), 'Cargo.toml'),
|
54
57
|
'cargo_toml_template': os.path.join(self.text_modules_path, 'cargo_toml', 'cargo.txt'),
|
55
58
|
}
|
56
59
|
return paths
|
@@ -62,11 +65,11 @@ class Application(Subsystem):
|
|
62
65
|
return [subsystem for subsystem in self.subsystems if isinstance(subsystem, Service)]
|
63
66
|
|
64
67
|
def create_rccn_directories(self):
|
65
|
-
app_src_dir = os.path.join(self.export_file_path, 'rccn_usr_'+
|
68
|
+
app_src_dir = os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.name), 'src')
|
66
69
|
if not os.path.exists(app_src_dir):
|
67
70
|
os.makedirs(app_src_dir)
|
68
71
|
for service in self.services():
|
69
|
-
service_dir = os.path.join(app_src_dir,
|
72
|
+
service_dir = os.path.join(app_src_dir, snakecase(service.name))
|
70
73
|
if not os.path.exists(service_dir):
|
71
74
|
os.makedirs(service_dir)
|
72
75
|
|
@@ -98,7 +101,8 @@ class Application(Subsystem):
|
|
98
101
|
# Find and replace service variable keywords
|
99
102
|
var_translation = {
|
100
103
|
'<<VAR_APID>>':str(self.apid),
|
101
|
-
'<<
|
104
|
+
'<<VAR_VCID>>':str(self.vcid),
|
105
|
+
'<<VAR_APP_NAME_SCASE>>':snakecase(self.name),
|
102
106
|
}
|
103
107
|
var_keywords = get_var_keywords(text)
|
104
108
|
for var_keyword in var_keywords:
|
@@ -125,7 +129,7 @@ class Application(Subsystem):
|
|
125
129
|
if not os.path.exists(service.file_paths()['mod']):
|
126
130
|
service.generate_mod_file()
|
127
131
|
service.generate_telemetry_file()
|
128
|
-
service.generate_rccn_command_file(os.path.join(self.export_file_path, 'rccn_usr_'+
|
132
|
+
service.generate_rccn_command_file(os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.name), 'src'), os.path.join(self.text_modules_path, 'command'))
|
129
133
|
self.delete_old_snapshots()
|
130
134
|
|
131
135
|
def generate_snapshot(self, current_file_reference, snapshot_file_reference):
|
@@ -197,7 +201,7 @@ class Service(Subsystem):
|
|
197
201
|
self.init_kwargs = kwargs
|
198
202
|
self.name = name
|
199
203
|
self.service_id = service_id
|
200
|
-
self.text_modules_path = files('
|
204
|
+
self.text_modules_path = files('rccn_gen').joinpath('text_modules')
|
201
205
|
self.text_modules_service_path = os.path.join(self.text_modules_path, 'service')
|
202
206
|
self.text_modules_command_path = os.path.join(self.text_modules_path, 'command')
|
203
207
|
self.text_modules_telemetry_path = os.path.join(self.text_modules_path, 'telemetry')
|
@@ -233,22 +237,22 @@ class Service(Subsystem):
|
|
233
237
|
|
234
238
|
def file_paths(self):
|
235
239
|
paths = {
|
236
|
-
'service': os.path.join(self.export_file_path, 'rccn_usr_'+
|
237
|
-
'service_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+
|
238
|
-
'service_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+
|
239
|
-
'service_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+
|
240
|
+
'service': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'service.rs'),
|
241
|
+
'service_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'service.rs'),
|
242
|
+
'service_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'service.rs'),
|
243
|
+
'service_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'service.diff'),
|
240
244
|
'service_template': os.path.join(self.text_modules_service_path, 'service.txt'),
|
241
|
-
'command': os.path.join(self.export_file_path, 'rccn_usr_'+
|
242
|
-
'command_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+
|
243
|
-
'command_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+
|
244
|
-
'command_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+
|
245
|
+
'command': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'command.rs'),
|
246
|
+
'command_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'command.rs'),
|
247
|
+
'command_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'command.rs'),
|
248
|
+
'command_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'command.diff'),
|
245
249
|
'command_template': os.path.join(self.text_modules_command_path, 'command.txt'),
|
246
|
-
'mod': os.path.join(self.export_file_path, 'rccn_usr_'+
|
250
|
+
'mod': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'mod.rs'),
|
247
251
|
'mod_template': os.path.join(self.text_modules_path, 'mod', 'mod.txt'),
|
248
|
-
'telemetry': os.path.join(self.export_file_path, 'rccn_usr_'+
|
249
|
-
'telemetry_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+
|
250
|
-
'telemetry_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+
|
251
|
-
'telemetry_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+
|
252
|
+
'telemetry': os.path.join(self.export_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'telemetry.rs'),
|
253
|
+
'telemetry_generated_snapshot': os.path.join(self.snapshot_file_path, 'generated', 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'telemetry.rs'),
|
254
|
+
'telemetry_user_snapshot': os.path.join(self.snapshot_file_path, 'user', datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S"), 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'command.rs'),
|
255
|
+
'telemetry_diff': os.path.join(self.diff_file_path, 'rccn_usr_'+snakecase(self.system.name), 'src', snakecase(self.name), 'telemetry.diff'),
|
252
256
|
'telemetry_template': os.path.join(self.text_modules_telemetry_path, 'telemetry.txt'),
|
253
257
|
}
|
254
258
|
return paths
|
@@ -272,7 +276,7 @@ class Service(Subsystem):
|
|
272
276
|
|
273
277
|
# Call keyword replacement for all associated commands (Later, there needs to be checking to account for user changes to the generated files)
|
274
278
|
if len(self.rccn_commands()) == 0:
|
275
|
-
print('Service '+self.name+' does not have any commands associated with it.')
|
279
|
+
print('RCCN-Gen: Service '+self.name+' does not have any commands associated with it.')
|
276
280
|
for command in self.rccn_commands():
|
277
281
|
text = command.find_and_replace_keywords(text, text_modules_path)
|
278
282
|
|
@@ -281,7 +285,7 @@ class Service(Subsystem):
|
|
281
285
|
service_var_translation = {
|
282
286
|
'<<VAR_SERVICE_NAME>>': self.name,
|
283
287
|
'<<VAR_SERVICE_ID>>': str(self.service_id),
|
284
|
-
'<<VAR_SERVICE_NAME_UCASE>>':
|
288
|
+
'<<VAR_SERVICE_NAME_UCASE>>': pascalcase(self.name),
|
285
289
|
'<<VAR_SERVICE_TELEMETRY>>': self.generate_rust_telemetry_definition(),
|
286
290
|
}
|
287
291
|
for var_keyword in var_keywords:
|
@@ -323,12 +327,12 @@ class Service(Subsystem):
|
|
323
327
|
self.generate_snapshot('command', 'command_user_snapshot')
|
324
328
|
# Generate command.rs file
|
325
329
|
if len(self.rccn_commands()) == 0:
|
326
|
-
print('Service '+self.name+' has no implemented commands. Generation of command.rs file will be skipped.')
|
330
|
+
print('RCCN-Gen: Service '+self.name+' has no implemented commands. Generation of command.rs file will be skipped.')
|
327
331
|
return
|
328
332
|
command_file_path = self.file_paths()['command_template']
|
329
333
|
with open(command_file_path, 'r') as file:
|
330
334
|
command_file_text = file.read()
|
331
|
-
command_export_file_path = os.path.join(export_file_dir,
|
335
|
+
command_export_file_path = os.path.join(export_file_dir, snakecase(self.name), 'command.rs')
|
332
336
|
with open(command_export_file_path, 'w') as file:
|
333
337
|
file.write(self.find_and_replace_keywords(command_file_text, text_modules_path))
|
334
338
|
# Create snapshot of command.rs if instructed
|
@@ -427,7 +431,7 @@ class RCCNCommand(Command):
|
|
427
431
|
# Find and replace command variable keywords
|
428
432
|
command_var_keywords = get_var_keywords(text)
|
429
433
|
command_var_translation = {
|
430
|
-
'<<VAR_COMMAND_NAME_UCASE>>':
|
434
|
+
'<<VAR_COMMAND_NAME_UCASE>>': pascalcase(self.name),
|
431
435
|
'<<VAR_COMMAND_NAME>>': self.name,
|
432
436
|
'<<VAR_COMMAND_SUBTYPE>>': str(self.assignments['subtype']),
|
433
437
|
'<<VAR_COMMAND_STRUCT>>': self.struct_definition()
|
@@ -447,7 +451,7 @@ class RCCNCommand(Command):
|
|
447
451
|
def struct_definition(self):
|
448
452
|
if len(self.arguments) == 0:
|
449
453
|
return ''
|
450
|
-
struct_definition_text = "#[derive(BitStruct, Debug, PartialEq)]\npub struct "+
|
454
|
+
struct_definition_text = "#[derive(BitStruct, Debug, PartialEq)]\npub struct "+pascalcase(self.name)+" {\n"
|
451
455
|
for argument in self.arguments:
|
452
456
|
struct_definition_text += rust_type_definition(argument)[0]
|
453
457
|
struct_definition_text += "}\n"
|
@@ -5,18 +5,17 @@ use rccn_usr::zenoh::key_expr::OwnedKeyExpr;
|
|
5
5
|
<<SERVICE_MODULE_MOD_SERVICE>>
|
6
6
|
|
7
7
|
const APID: u16 = <<VAR_APID>>;
|
8
|
+
const VCID: u8 = <<VAR_VCID>>;
|
8
9
|
|
9
10
|
fn main() -> Result<()> {
|
10
11
|
env_logger::init();
|
11
12
|
let mut app = PusApp::new(APID);
|
12
13
|
|
13
14
|
app
|
14
|
-
.add_tc_tm_channel(
|
15
|
-
OwnedKeyExpr::new("vc/bus_realtime/rx").unwrap(),
|
16
|
-
OwnedKeyExpr::new("vc/bus_realtime/tx").unwrap(),
|
17
|
-
)
|
15
|
+
.add_tc_tm_channel(VCID)
|
18
16
|
.unwrap();
|
19
17
|
|
18
|
+
|
20
19
|
<<SERVICE_MODULE_REGISTER_SERVICE>>
|
21
20
|
|
22
21
|
app.run();
|
rccn_gen/utils.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
import re
|
2
|
+
import inflect
|
2
3
|
import os
|
4
|
+
from caseconverter import *
|
3
5
|
from yamcs.pymdb import IntegerArgument, FloatArgument, BooleanArgument, EnumeratedArgument, StringArgument
|
4
6
|
|
5
7
|
|
@@ -106,18 +108,36 @@ def get_data_type(parent_classes):
|
|
106
108
|
return class_name
|
107
109
|
return None
|
108
110
|
|
109
|
-
def
|
110
|
-
|
111
|
+
def get_base_type(parent_classes):
|
112
|
+
for base_type in ["Argument", "Member", "Parameter"]:
|
113
|
+
if base_type in parent_classes:
|
114
|
+
return base_type
|
115
|
+
if "DataType" in parent_classes:
|
116
|
+
return "DataType"
|
117
|
+
return None
|
118
|
+
|
119
|
+
def rust_type_definition(pymdb_data_instance, parent_name="MyStruct"):
|
111
120
|
parent_classes = list(map(lambda type: type.__name__, type(pymdb_data_instance).mro()))
|
112
121
|
data_type = get_data_type(parent_classes)
|
113
|
-
base_type =
|
122
|
+
base_type = get_base_type(parent_classes)
|
123
|
+
if base_type is None:
|
124
|
+
base_type = pymdb_data_instance.__class__.__name__
|
114
125
|
if data_type is None:
|
115
|
-
raise ValueError("Data type not found in parent classes.")
|
126
|
+
raise ValueError("RCCN-Gen: Data type not found in parent classes.")
|
127
|
+
if not hasattr(pymdb_data_instance, 'name') or pymdb_data_instance.name is None:
|
128
|
+
p = inflect.engine()
|
129
|
+
singular_name = p.singular_noun(parent_name)
|
130
|
+
if singular_name is False:
|
131
|
+
pymdb_data_instance.name = parent_name
|
132
|
+
else:
|
133
|
+
pymdb_data_instance.name = singular_name
|
134
|
+
print("RCCN-Gen: Information: An unnamed "+base_type+" has been named \""+pascalcase(pymdb_data_instance.name)+"\" in the generated RCCN code.")
|
135
|
+
sc_instance_name = snakecase(pymdb_data_instance.name)
|
116
136
|
|
117
137
|
if data_type == 'IntegerDataType':
|
118
138
|
if pymdb_data_instance.encoding is None or pymdb_data_instance.encoding.bits is None:
|
119
139
|
raw_bit_number = 8
|
120
|
-
print("Warning: No encoding for "+base_type+" "+pymdb_data_instance.name+" found. Using 8 as default for raw bit number.")
|
140
|
+
print("RCCN-Gen: Warning: No encoding for "+base_type+" "+pymdb_data_instance.name+" found. Using 8 as default for raw bit number.")
|
121
141
|
else:
|
122
142
|
raw_bit_number = pymdb_data_instance.encoding.bits
|
123
143
|
raw_bit_number_str = str(raw_bit_number)
|
@@ -127,7 +147,7 @@ def rust_type_definition(pymdb_data_instance):
|
|
127
147
|
if pymdb_data_instance.signed:
|
128
148
|
definition_text[0] += ("\tpub "+sc_instance_name+": i"+eng_bit_number_str+",\n")
|
129
149
|
else:
|
130
|
-
definition_text += ("\tpub "+sc_instance_name+": u"+eng_bit_number_str+",\n")
|
150
|
+
definition_text[0] += ("\tpub "+sc_instance_name+": u"+eng_bit_number_str+",\n")
|
131
151
|
definition_text.append("")
|
132
152
|
|
133
153
|
elif data_type == 'BooleanDataType':
|
@@ -138,22 +158,26 @@ def rust_type_definition(pymdb_data_instance):
|
|
138
158
|
definition_text = ["\t#[null_terminated]\n\tpub "+sc_instance_name+": String,\n", ""]
|
139
159
|
|
140
160
|
elif data_type == 'ArrayDataType':
|
141
|
-
|
142
|
-
definition_text = [
|
143
|
-
definition_text.append("pub struct "+struct_name+" {\n")
|
144
|
-
for member in pymdb_data_instance.data_type.members:
|
145
|
-
definition_text[1] += rust_type_definition(member)[0]
|
146
|
-
definition_text[1] += "}\n"
|
147
|
-
for member in pymdb_data_instance.data_type.members:
|
148
|
-
definition_text[1] += rust_type_definition(member)[1]
|
161
|
+
definition_text = rust_type_definition(pymdb_data_instance.data_type, parent_name=pymdb_data_instance.name)
|
162
|
+
definition_text[0] = definition_text[0].replace(': ', ': Vec<').replace(',\n', '>,\n')
|
149
163
|
|
150
164
|
elif data_type == 'EnumeratedDataType':
|
151
|
-
definition_text = ["\tpub "+pymdb_data_instance.name+": "+
|
152
|
-
definition_text.append("pub enum "+
|
165
|
+
definition_text = ["\tpub "+pymdb_data_instance.name+": "+pascalcase(pymdb_data_instance.name)+",\n"]
|
166
|
+
definition_text.append("pub enum "+pascalcase(pymdb_data_instance.name)+" {\n")
|
153
167
|
for choice in pymdb_data_instance.choices:
|
154
168
|
definition_text[1] += "\t"+str(choice[1])+" = "+str(choice[0])+",\n"
|
155
169
|
definition_text[1] += "}\n"
|
156
170
|
|
171
|
+
elif data_type == 'AggregateDataType':
|
172
|
+
struct_name = pascalcase(pymdb_data_instance.name)
|
173
|
+
definition_text = ["\tpub "+sc_instance_name+": "+struct_name+",\n"]
|
174
|
+
definition_text.append("pub struct "+struct_name+" {\n")
|
175
|
+
for member in pymdb_data_instance.members:
|
176
|
+
definition_text[1] += rust_type_definition(member, parent_name=pymdb_data_instance.name)[0]
|
177
|
+
definition_text[1] += "}\n"
|
178
|
+
for member in pymdb_data_instance.members:
|
179
|
+
definition_text[1] += rust_type_definition(member, parent_name=pymdb_data_instance.name)[1]
|
180
|
+
|
157
181
|
else:
|
158
182
|
definition_text = ["\t// Please implement datatype "+data_type+" here.\n", ""]
|
159
183
|
return definition_text
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: rccn_gen
|
3
|
-
Version: 1.0.
|
3
|
+
Version: 1.0.2
|
4
4
|
Summary: A python based generator for RACCOON OS source files in Rust from yamcs-pymdb config files.
|
5
5
|
Project-URL: Homepage, https://gitlab.com/rccn/pymdb_code_generation
|
6
6
|
Project-URL: Issues, https://gitlab.com/rccn/pymdb_code_generation/issues
|
@@ -9,6 +9,8 @@ License-Expression: GPL-3.0
|
|
9
9
|
Classifier: Operating System :: OS Independent
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Requires-Python: >=3.8
|
12
|
+
Requires-Dist: case-converter>=1.2.0
|
13
|
+
Requires-Dist: inflect>=7.5.0
|
12
14
|
Requires-Dist: yamcs-pymdb>=0.1.0
|
13
15
|
Description-Content-Type: text/markdown
|
14
16
|
|
@@ -16,7 +18,7 @@ Description-Content-Type: text/markdown
|
|
16
18
|
This generator is used to generate Rust files to deploy on the RACCOON OS satellite based on the pymdb config files used to generate the ground station XTCE files.
|
17
19
|
## Setup
|
18
20
|
- Pull the repo
|
19
|
-
- Set up a virtual python environment with
|
21
|
+
- Set up a virtual python environment with `python3` and activate:
|
20
22
|
```zsh
|
21
23
|
python -m venv .venv
|
22
24
|
source .venv/bin/activate
|
@@ -24,10 +26,12 @@ This generator is used to generate Rust files to deploy on the RACCOON OS satell
|
|
24
26
|
- Install pymdb with `pip install yamcs-pymdb`
|
25
27
|
|
26
28
|
## Using the Generator
|
27
|
-
The generator is based on pymdb and uses the same structure. Where pymdb gives the user freedom in defining systems, subsystems and their respective relations, the definitions for rust code generation is more restricted. For the rust generation, the user is
|
29
|
+
The generator is based on [`pymdb`](https://github.com/yamcs/pymdb) and uses the same structure. Where `pymdb` gives the user freedom in defining systems, subsystems and their respective relations, the definitions for rust code generation is more restricted. For the rust generation, the user is bound to the following classes:
|
28
30
|
- Application,
|
29
31
|
- Service, and
|
30
|
-
-
|
32
|
+
- `Application`,
|
33
|
+
- `Service`, and
|
34
|
+
- `RCCNCommand`.
|
31
35
|
|
32
36
|
All classes inherit from pymdb's Subsystem class and extend their functionality. This means that an existing pymdb definition can be used to generate rust code by renaming the respective instances. No functionality for pymdb's XTCE generation will be lost.
|
33
37
|
|
@@ -117,7 +121,7 @@ The sequence from above is changed accordingly if no previous snapshot exists. I
|
|
117
121
|
Snapshots of the .rs files in the export directory are stored in `/user/`. These can be used to undo code regeneration if conflicts arise during the patching. Please note that by default, only the last 10 user snapshots are stored. You can change this property with the following command.
|
118
122
|
|
119
123
|
```python
|
120
|
-
app.keep_snapshots = 15 #
|
124
|
+
app.keep_snapshots = 15 # Whatever value you want
|
121
125
|
```
|
122
126
|
|
123
127
|
With the sequence from above, it becomes apperant that changes to the .rs file in the export directory always trump changes to the pymdb config. If for example, a main.rs file is generated for an application with and APID of 42, and this apid is changed in the main.rs file to 45, this change will persist after regenerating from the python config. Even if changes to the pymdb config where made after the changes to the main.rs file.
|
@@ -2,14 +2,14 @@ rccn_gen/LICENSE,sha256=ixuiBLtpoK3iv89l7ylKkg9rs2GzF9ukPH7ynZYzK5s,35148
|
|
2
2
|
rccn_gen/__init__.py,sha256=XVvKYcWw9K1P3J1BTbzbODY71Nc1FApCc0wf7ezd4Gc,193
|
3
3
|
rccn_gen/application.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
4
|
rccn_gen/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
rccn_gen/systems.py,sha256=
|
5
|
+
rccn_gen/systems.py,sha256=ibpegtBKPF-w6hmiWC_-TgJII6uvWP8wRSDpwEq8rjY,26755
|
6
6
|
rccn_gen/telemetry.py,sha256=huVcqGs95IXlpETWdlIyR9lK4ctZUsq7czgJwvTYtBk,3855
|
7
|
-
rccn_gen/utils.py,sha256=
|
7
|
+
rccn_gen/utils.py,sha256=HF79aMpovRdqLdVjL1w0iEPTEvOl7VSPrf_9QifUyoc,7290
|
8
8
|
rccn_gen/text_modules/cargo_toml/cargo.txt,sha256=2e6xKomkml6-onfQ0QHNqvKnhGLYMUl8zYgbykmm83Y,292
|
9
9
|
rccn_gen/text_modules/command/command.txt,sha256=8Y-uJilhFLoinftIbn7uKfia9LLMZno2LkoDJ-4Y-9M,345
|
10
10
|
rccn_gen/text_modules/command/command_module_enum.txt,sha256=ApzRDQIs-BHJHtFA4ysfpYuWElGntXakkzZkgy57b74,94
|
11
11
|
rccn_gen/text_modules/command/command_module_struct.txt,sha256=FT7Ke0uOVxWYpGC_oj9zafr1ahrH-nf0nSxQje6kToY,22
|
12
|
-
rccn_gen/text_modules/main/main.txt,sha256=
|
12
|
+
rccn_gen/text_modules/main/main.txt,sha256=UQ0oHbzH7H3G4mxfeiTh5UeQ-X4C0Fw7IrCyZNH2clQ,426
|
13
13
|
rccn_gen/text_modules/main/service_module_import_service.txt,sha256=qPrU4fLs7Y65X5KJ868ut-izV5pHq7hU2nVRLxPnFCE,57
|
14
14
|
rccn_gen/text_modules/main/service_module_mod_service.txt,sha256=guvXFdV_-YezhTD_PWA-Z0tL8ReSZc0rh3RuWraJnQE,25
|
15
15
|
rccn_gen/text_modules/main/service_module_register_service.txt,sha256=4EIsgaxDLh51u0WjXfy7Xgo-6UFTdb4Nh2O4J7uFjS0,115
|
@@ -17,6 +17,6 @@ rccn_gen/text_modules/mod/mod.txt,sha256=BF8LablBE4ddutdl5m0prvpvLdBRejueVOujkyr
|
|
17
17
|
rccn_gen/text_modules/service/command_module_match_cmd.txt,sha256=eVGo6ltuerG37rVxpXtL-JYuLyLW4c0i6NXb5g1_U-A,89
|
18
18
|
rccn_gen/text_modules/service/service.txt,sha256=0KwwrfrjXuY4e3VNpCdTTzgW8bmYRQ21i-Lvhkz3hVA,691
|
19
19
|
rccn_gen/text_modules/telemetry/telemetry.txt,sha256=Re1d3BfpyXT_CEe7jJzLF3MARik0-J-K98K85iPOE40,193
|
20
|
-
rccn_gen-1.0.
|
21
|
-
rccn_gen-1.0.
|
22
|
-
rccn_gen-1.0.
|
20
|
+
rccn_gen-1.0.2.dist-info/METADATA,sha256=SmSD9_-46j9ZXvYAhuVPr2hINx0_xHOihSPJ31vfwVc,8260
|
21
|
+
rccn_gen-1.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
22
|
+
rccn_gen-1.0.2.dist-info/RECORD,,
|
File without changes
|