主要内容

本页翻译不是最新的。点击此处可查看最新英文版本。

autosar.api.getAUTOSARProperties

以编程方式配置 AUTOSAR 软件组件元素和属性

说明

在 AUTOSAR 软件组件模型中,使用 AUTOSAR 属性函数在 AUTOSAR 组件透视中配置 AUTOSAR 元素。您可以通过编程方式执行以下操作:添加 AUTOSAR 元素,查找元素,获取和设置元素的属性,删除元素,定义元素的 ARXML 打包。

创建对象

描述

arProps = autosar.api.getAUTOSARProperties(model) 创建对象 arProps,该对象表示 model 的 AUTOSAR 属性信息。指定的模型必须处于打开状态。

示例

arProps = autosar.api.getAUTOSARproperties(dictName) 创建对象 arProps,该对象表示 dictName 的 AUTOSAR 属性信息。指定的数据字典必须处于打开状态。

示例

输入参量

全部展开

要为其创建 AUTOSAR 属性对象的模型,指定为一个表示模型名称的句柄、字符向量或字符串标量。在模型修改过程中,请在调用 autosar.api.getAUTOSARproperties 对象之前编译模型。

示例: "my_model"

要为其创建 AUTOSAR 属性对象的数据字典,指定为一个表示数据字典名称的句柄、字符向量或字符串标量。

示例: "myDataDictionary.sldd"

对象函数

addAdd property to AUTOSAR element
addPackageableElement将元素添加到模型中的 AUTOSAR 包
createEnumerationCreate Simulink enumeration data type definition from imported AUTOSAR data elements
createManifestCreate manifest file for AUTOSAR adaptive model
createNumericTypeCreate Simulink numeric data type definition from imported AUTOSAR data elements
delete删除 AUTOSAR 元素
deleteUnmappedComponentsDelete unmapped AUTOSAR components from model
findFind AUTOSAR elements
getGet property of AUTOSAR element
setSet property of AUTOSAR element

示例

全部折叠

调用 autosar.api.getAUTOSARProperties 函数以创建对象 arProps,该对象表示模型 autosar_swc_slfcns 的 AUTOSAR 属性信息。使用返回的对象将客户端-服务器接口 CSIfIsService 属性设置为 true (1),指示该端口接口用于 AUTOSAR 服务。有关 AUTOSAR 元素属性(如 IsService)的详细信息,请参阅 AUTOSAR Element Properties

hModel = "autosar_swc_slfcns";
openExample(hModel);
arProps = autosar.api.getAUTOSARProperties(hModel);
set(arProps,"CSIf","IsService",true);
isService = get(arProps,"CSIf","IsService")
isService =
  logical
   1

调用 autosar.api.getAUTOSARProperties 函数以创建对象 arProps,该对象表示数据字典 myInterfaces.sldd 的 AUTOSAR 属性信息。使用返回的对象将 XmlOptionsSource 属性设置为 Inlined。有关“XML 选项”设置的详细信息,请参阅 AUTOSAR XML Options Settings

dictName = "myInterfaces.sldd";
arProps = autosar.api.getAUTOSARProperties(dictName);
set(arProps,"XmlOptionsSource","Inlined");

调用 autosar.api.getAUTOSARProperties 函数以创建对象 ddProps,该对象表示数据字典 myCSInterfaces.sldd 的 AUTOSAR 属性信息。使用返回的对象获取和设置客户端-服务器操作 ReadBlockSwCalibrationAccess 属性。

ddProps = autosar.api.getAUTOSARProperties("myCSInterfaces.sldd");
csOp = 'ReadBlock';
ifPaths = find(ddProps,[],"ClientServerInterface",...
    "PathType","FullyQualified");
argsReadBlockPaths = get(ddProps, [ifPaths{1} '/' csOp],...
    "Arguments","PathType","FullyQualified");
argReadBlockPath = argsReadBlockPaths{2};
set(arProps,[argReadBlockPath],...
    "SwCalibrationAccess","NotAccessible");

版本历史记录

在 R2013b 中推出