Skip to main content

Interfaces

What You Will Do​

In this chapter you create the two interfaces the SW-Cs communicate through: the sender-receiver interface IfSpeed for the speed value, and the client-server interface IfScale for the scale request.

Before You Begin​

InterfaceTabElementNameType or direction
IfSpeedSENDER-RECEIVERData elementspeedTYPE SpeedType
IfScaleCLIENT-SERVEROperationGetScale
IfScaleCLIENT-SERVERArgument of GetScalescaleDIRECTION OUT, TYPE SpeedType

Creating IfSpeed​

  1. Click Interface under DESIGN, click the SENDER-RECEIVER tab, and click + above the INTERFACES list.

    The SENDER-RECEIVER tab

    Figure 3-1. ① SENDER-RECEIVER, ② + (Add Interface).

  2. Enter IfSpeed in NAME and press Tab.

  3. Click + on the DATA ELEMENTS header. In the new row, enter speed in NAME, open TYPE, type SpeedType and click it in the list.

    Choosing the type of the data element

    Figure 3-2. ① The interface NAME, ② the data element NAME, ③ SpeedType in the TYPE list.

Creating IfScale​

  1. Click the CLIENT-SERVER tab and click + above the INTERFACES list. Enter IfScale in NAME and press Tab.

  2. Click + on the OPERATIONS header and enter GetScale in the operation's NAME.

  3. Click + on the ARGUMENTS header. Enter scale in the argument's NAME, select OUT in DIRECTION, and select SpeedType in TYPE.

  4. Save with Ctrl+S.

    The finished IfScale

    Figure 3-3. ① CLIENT-SERVER, ② the interface NAME, ③ the operation NAME, ④ DIRECTION, ⑤ TYPE, ⑥ the argument NAME. The ARGS column of the operation row reads (SpeedType *scale): an OUT argument is passed as a pointer.

Why Is It Designed This Way?​

  • Two kinds of interface. Sender-receiver sends a value and does not wait for anyone. Client-server asks and gets an answer. This design uses one of each, so you meet both in one small example.

Checklist​

  • The SENDER-RECEIVER tab lists IfSpeed with the data element speed of type SpeedType.
  • The CLIENT-SERVER tab lists IfScale with the operation GetScale and its argument scale.
  • The tab VehicleDesign:Interface carries no modified mark.

Next Step​

In SW-Cs and Ports you create the two SW-Cs and type their ports with these interfaces.