Contenuto principale

Simulink.dictionary.archdata.FunctionElement

R2026b

Function in client-server interface

Since R2023b

Description

A Simulink.dictionary.archdata.FunctionElement object describes the attributes of a function in a client-server interface. The client-server interface is a Simulink.dictionary.archdata.ServiceInterface.

Creation

Create a Simulink.dictionary.archdata.FunctionElement object using the addElement function.

functionElement = addElement(serviceInterface,"f0")

Properties

expand all

Function prototype to define the function name, and input and output arguments, specified as a character vector or string scalar.

Data Types: char | string

Whether the function element is asynchronous, specified as a logical.

Data Types: logical

Whether the function element is configured for one-way client-server communication, specified as a logical. When set to true, no client assigned the service interface can request a response from the server, and the function prototype cannot include output arguments.

You can set this property only when the function prototype has no output arguments.

Data Types: logical

Function arguments, specified as an array of Simulink.dictionary.archdata.FunctionArgument objects.

Function element name, specified as a character vector or string scalar.

Data Types: char | string

Service interface containing the function element, specified as a Simulink.dictionary.archdata.ServiceInterface object.

Object Functions

moveToDictionaryMove architectural data of Simulink data dictionary to another data dictionary
moveToDesignDataMove objects in Architectural Data section of Simulink data dictionary to Design Data section of the same data dictionary
showView architectural data of Simulink data dictionary in Architectural Data Editor
destroyDelete data element and remove from data interface

Examples

collapse all

Modify properties of function elements directly. When you edit the properties of a function element the changes are applied to all ports that represent the function element in a Simulink® model. In this example, you get an existing function element and set the ServerResponseNotRequired property.

Open existing example data dictionary speedometerInterfaces.sldd, and get service interface SpeedInterface.

openExample("autosarblockset/AssembleAUTOSARSWCInArchExample","supportingFile","speedometerInterfaces.sldd");
archData = Simulink.dictionary.archdata.open("speedometerInterfaces.sldd");
speedService = getInterface(archData,"SpeedInterface")
speedService = 
  ServiceInterface with properties:

           Name: 'SpeedInterface'
    Description: ''
       Elements: [1×1 Simulink.dictionary.archdata.FunctionElement]
          Owner: [1×1 Simulink.dictionary.ArchitecturalData]

Get the existing function element and view its ServerResponseNotRequired property which is true for this function element.

notifyElem = getElement(speedService,"notifySpeedLimitExceeded")
notifyElem = 
  FunctionElement with properties:

            FunctionPrototype: 'notifySpeedLimitExceeded(newlimit)'
                 Asynchronous: 0
    ServerResponseNotRequired: 1
            FunctionArguments: [1×1 Simulink.dictionary.archdata.FunctionArgument]
                         Name: 'notifySpeedLimitExceeded'
                        Owner: [1×1 Simulink.dictionary.archdata.ServiceInterface]

Change the function prototype of the function element by editing the property directly.

notifyElem.FunctionPrototype = "notifySpeedLimitExceeded(oldLimit,newLimit)"
notifyElem = 
  FunctionElement with properties:

            FunctionPrototype: 'notifySpeedLimitExceeded(oldLimit,newLimit)'
                 Asynchronous: 0
    ServerResponseNotRequired: 1
            FunctionArguments: [1×2 Simulink.dictionary.archdata.FunctionArgument]
                         Name: 'notifySpeedLimitExceeded'
                        Owner: [1×1 Simulink.dictionary.archdata.ServiceInterface]

Version History

Introduced in R2023b

expand all