Operation

XML tag

<CLIENT-SERVER-OPERATION>

Module

autosar.portinterface

Inherits

autosar.element.Element

An operation of a client-server port interface.

Factory Methods

Attributes

For inherited attributes see autosar.element.Element.

Name

Type

Description

arguments

list(Arguments)

List of operation arguments

errorRefs

list(str)

References to ApplicationError objects that this operation can return

Properties

possibleErrors

This is a convenience property setter for seclecting one or more error codes that this operation can possibly return. You can assign either a string or a list of strings to this property. The object will automatically validate if the name(s) are possible errors that have been previously assigned to the port interface (its parent object). The object will convert the names of the errors in to actual references by updating the self.errorRefs list

Example

import autosar

ws = autosar.workspace("4.2.2")
package = ws.createPackage('PortInterfaces', role = "PortInterface")

portInterface=package.createClientServerInterface("Example_I",
    operations = ["Invalidate"],
    errors = autosar.ApplicationError("E_NOT_OK", 1),
    isService=True)

portInterface["Invalidate"].possibleErrors = "E_NOT_OK"

ws.saveXML('PortInterfaces.arxml', filters=['/PortInterfaces'])

Public Methods

Method Description

createOutArgument

Operation.createOutArgument(name, typeRef[, swCalibrationAccess = None][, serverArgumentImplPolicy=None])

Creates a new argument with direction set to ‘OUT’.

参数
  • name (str) – Name of the new argument

  • typeRef (str) – Reference to data type.

  • swCalibrationAccess (str) – Optional swCalibrationAccess string.

  • serverArgumentImplPolicy (str) – Optional serverArgumentImplPolicy string.

返回类型

Argument

createInOutArgument

Operation.createInOutArgument(name, typeRef[, swCalibrationAccess = None][, serverArgumentImplPolicy=None])

Creates a new argument with direction set to ‘INOUT’.

参数
  • name (str) – Name of the new argument

  • typeRef (str) – Reference to data type.

  • swCalibrationAccess (str) – Optional swCalibrationAccess string.

  • serverArgumentImplPolicy (str) – Optional serverArgumentImplPolicy string.

返回类型

Argument

createInArgument

Operation.createInArgument(name, typeRef[, swCalibrationAccess = None][, serverArgumentImplPolicy=None])

Creates a new argument with direction set to ‘IN’.

参数
  • name (str) – Name of the new argument

  • typeRef (str) – Reference to data type.

  • swCalibrationAccess (str) – Optional swCalibrationAccess string.

  • serverArgumentImplPolicy (str) – Optional serverArgumentImplPolicy string.

返回类型

Argument

append

Operation.append(elem)

Adds element to either the self.arguments or self.errorRefs depending on its type.

参数

elem (Argument or str) – Element