@@ -96,6 +96,10 @@ def add_attribute(self, attribute, value):
96
96
"""
97
97
self .attributes [attribute ] = value
98
98
99
+ def del_attribute (self , attribute ):
100
+ if attribute in self .attributes :
101
+ del self .attributes [attribute ]
102
+
99
103
def add_comment (self , comment ):
100
104
"""
101
105
Set Board unit comment.
@@ -1143,6 +1147,7 @@ class CanMatrix(object):
1143
1147
signal_defines = attr .ib (type = dict , factory = dict )
1144
1148
frame_defines = attr .ib (type = dict , factory = dict )
1145
1149
global_defines = attr .ib (type = dict , factory = dict )
1150
+ env_defines = attr .ib (type = dict , factory = dict )
1146
1151
ecu_defines = attr .ib (type = dict , factory = dict )
1147
1152
value_tables = attr .ib (type = dict , factory = dict )
1148
1153
env_vars = attr .ib (type = dict , factory = dict )
@@ -1157,6 +1162,12 @@ def __iter__(self):
1157
1162
def add_env_var (self , name , envVarDict ):
1158
1163
self .env_vars [name ] = envVarDict
1159
1164
1165
+ def add_env_attribute (self , env_name , attribute_name , attribute_value ):
1166
+ if env_name in self .env_vars :
1167
+ if not "attributes" in self .env_vars [env_name ]:
1168
+ self .env_vars [env_name ]["attributes" ] = dict ()
1169
+ self .env_vars [env_name ]["attributes" ][attribute_name ] = attribute_value
1170
+
1160
1171
@property
1161
1172
def contains_fd (self ):
1162
1173
for frame in self .frames :
@@ -1234,6 +1245,16 @@ def add_ecu_defines(self, type, definition):
1234
1245
if type not in self .ecu_defines :
1235
1246
self .ecu_defines [type ] = Define (definition )
1236
1247
1248
+ def add_env_defines (self , type , definition ):
1249
+ """
1250
+ Add enviroment variable-attribute definition to canmatrix.
1251
+
1252
+ :param str type: enviroment variable type
1253
+ :param str definition: enviroment variable definition as string
1254
+ """
1255
+ if type not in self .env_defines :
1256
+ self .env_defines [type ] = Define (definition )
1257
+
1237
1258
def add_global_defines (self , type , definition ):
1238
1259
"""
1239
1260
Add global-attribute definition to canmatrix.
0 commit comments