@@ -170,13 +170,16 @@ def copy_frame(frame_id, source_db, target_db):
170
170
copy_ecu (source_ecu , source_db , target_db )
171
171
172
172
# copy all frame-defines
173
- attributes = frame .attributes
174
- for attribute in attributes :
173
+ for attribute in source_db .frame_defines :
175
174
if attribute not in target_db .frame_defines :
176
175
target_db .add_frame_defines (
177
176
copy .deepcopy (attribute ), copy .deepcopy (source_db .frame_defines [attribute ].definition ))
178
177
target_db .add_define_default (
179
178
copy .deepcopy (attribute ), copy .deepcopy (source_db .frame_defines [attribute ].defaultValue ))
179
+ # only default value exists in source but is different to default value in target
180
+ if attribute not in frame .attributes and \
181
+ frame .attribute (attribute , source_db ) != frame .attribute (attribute , target_db ):
182
+ target_db .frame_by_id (frame .arbitration_id ).add_attribute (attribute , frame .attribute (attribute , source_db ))
180
183
# update enum data types if needed:
181
184
if source_db .frame_defines [attribute ].type == 'ENUM' :
182
185
temp_attr = frame .attribute (attribute , db = source_db )
@@ -187,7 +190,7 @@ def copy_frame(frame_id, source_db, target_db):
187
190
# trigger all signals of Frame
188
191
for sig in frame .signals :
189
192
# delete all 'unknown' attributes
190
- for attribute in sig . attributes :
193
+ for attribute in source_db . signal_defines :
191
194
target_db .add_signal_defines (
192
195
copy .deepcopy (attribute ), copy .deepcopy (source_db .signal_defines [attribute ].definition ))
193
196
target_db .add_define_default (
@@ -198,5 +201,9 @@ def copy_frame(frame_id, source_db, target_db):
198
201
if temp_attr not in target_db .signal_defines [attribute ].values :
199
202
target_db .signal_defines [attribute ].values .append (copy .deepcopy (temp_attr ))
200
203
target_db .signal_defines [attribute ].update ()
204
+ # only default value exists in source but is different to default value in target
205
+ if attribute not in sig .attributes and \
206
+ sig .attribute (attribute , source_db ) != sig .attribute (attribute , target_db ):
207
+ target_db .frame_by_id (frame .arbitration_id ).signal_by_name (sig .name ).add_attribute (attribute , sig .attribute (attribute , source_db ))
201
208
202
209
return True
0 commit comments