1、目的
本文介绍在ARXML的自动解析库基础上如何进行修改,以支持配置工具的操作。
2、模块配置模版 ECUCMODULEDEF
2.1、ECUCMODULEDEF()
ECUCMODULEDEF moduleDef:用于创建的模型模版
ECUCMODULECONFIGURATIONVALUES moduleData:非空时,支持从配置数据创建
string moduleDefParentPath:用于创建的父路径
格式:/AUTOSAR/EcucDefs/CanIf/CanIfInitCfg
public partial class ECUCMODULEDEF : INotifyPropertyChanged
{
public ECUCMODULEDEF(ECUCMODULEDEF moduleDef, ECUCMODULECONFIGURATIONVALUES moduleData, string moduleDefParentPath)
{
if (moduleDef != null)
{
this.PARAMTER_DEF_SHORT_NAME = moduleDef.SHORTNAME.Value;
}
if (moduleData != null)
{
this.SHORTNAME = moduleData.SHORTNAME;
this.PARAMTER_DEF_FULL_URL_PATH = moduleData.DEFINITIONREF.Value;
this.cONFIGURATIONVALUESField = moduleData;
this.cONFIGURATIONCLASSField = moduleData.IMPLEMENTATIONCONFIGVARIANT;
}
else
{
this.SHORTNAME = moduleDef.SHORTNAME;
this.PARAMTER_DEF_FULL_URL_PATH = moduleDefParentPath + "/" + moduleDef.SHORTNAME.Value;
cONFIGURATIONVALUESField = new ECUCMODULECONFIGURATIONVALUES(moduleDef.SHORTNAME.Value, PARAMTER_DEF_FULL_URL_PATH);
}
this.LOWERMULTIPLICITY = moduleDef.LOWERMULTIPLICITY;
this.UPPERMULTIPLICITY = moduleDef.UPPERMULTIPLICITY;
this.UPPERMULTIPLICITYINFINITE = moduleDef.UPPERMULTIPLICITYINFINITE;
this.REFINEDMODULEDEFREF = moduleDef.REFINEDMODULEDEFREF;
this.DESC = moduleDef.DESC;
this.INTRODUCTION = moduleDef.INTRODUCTION;
this.LONGNAME = moduleDef.LONGNAME;
this.SUPPORTEDCONFIGVARIANTS = moduleDef.SUPPORTEDCONFIGVARIANTS;
CreateContainers(moduleDef, moduleData, moduleDefParentPath);
}
}
2.2、CreateContainers()
ECUCMODULEDEF moduleDef:用于创建的模型模版
ECUCMODULECONFIGURATIONVALUES moduleData:非空时,支持从配置数据创建
string moduleDefParentPath:用于创建的父路径
public void CreateContainers(ECUCMODULEDEF moduleDef, ECUCMODULECONFIGURATIONVALUES moduleData, string moduleDefParentPath)
{
// 检查多重性为 (1:1)的子容器
if (moduleDef.CONTAINERS != null)
{
//ObservableCollection<Object> containers = new ObservableCollection<object>();
//List<Object> containers = new List<object>();
this.CONTAINERS = new ObservableCollection<Object>();
foreach (object container in moduleDef.CONTAINERS)
{
string containerType = container.GetType().ToString();
if (containerType == Common.AR_NAME_SPACE + ".ECUCCHOICECONTAINERDEF")
{
if (Common.IsMultiplicityObject(container))
{
ECUCPARAMCONFCONTAINERDEF paramContainer = new ECUCPARAMCONFCONTAINERDEF((ECUCCHOICECONTAINERDEF)container,