DEENESPTFRRUARHIKOZHNL

服务接口 StateMachineNotification

Als ara::com-Dienst modellierte Schnittstelle; Methoden/Felder werden über generierte Proxies/Skeletons aufgerufen (Parameterrichtung IN/OUT).

用户指南人工智能生成

向 Adaptive Application 通知状态机的当前状态和正在进行的转换。
AI 生成 未审核 模型: gemini-3.8-flash-medium · 推理强度: medium · 温度: 不可控 · 提示词: 6ddf9de6db11 来源 未决问题(1)
译自德文指南gemini-3.8-flash-low · 2026-10-13 · 德文原文

向 Adaptive Application 通知状态机的当前状态和正在进行的转换。

服务接口 StateMachineNotification 通过可读且可订阅的字段 CurrentState([SWS_SM_91028],[SWS_SM_91109])向 Adaptive Application 提供状态机的状态。在状态变更时,该字段在所有动作执行完毕之前一直指示中间值 "inTransition"([SWS_SM_00616])。该接口在状态机启动后提供,并在其终止时再次撤回([SWS_SM_00618],[SWS_SM_00619])。

服务接口的角色与系统上下文

服务接口 StateMachineNotification 由 AUTOSAR Adaptive Platform 的 State Management (SM) 模块提供([SWS_SM_91028])。当控制应用程序通过专用接口请求新的状态转换时,StateMachineNotification 主要在应用层与常规 Adaptive Application 进行交互(AUTOSAR_AP_SWS_StateManagement 第44页)。该服务充当提供者(Skeleton),而消费应用程序则作为使用者(Proxy)通过 ara::com 连接。如果针对特定状态机进行了配置,State Management 会实例化该接口自身的实例([SWS_SM_00665])。在某些状态机完全在内部工作且与应用程序无关的项目中,可以省略配置和提供(AUTOSAR_AP_SWS_StateManagement 第45页)。

方法、事件与字段

该接口未定义传统方法或纯事件,而是将受监控状态机的状态封装在一个中心字段中([SWS_SM_91109])。字段 CurrentState 具有数据类型 StateMachineStateNameType 并且设计为纯只读:它具有一个 Getter(HasGetter: true)和一个 Notifier(HasNotifier: true),但不具有 Setter(HasSetter: false)([SWS_SM_91109])。Adaptive Application 由此既可以通过 Getter 同步查询当前值,也可以订阅通知,以便在相应状态机发生状态变更时通过 ara::com 异步获知([SWS_SM_91109])。

一旦启动状态机的状态转换,字段 CurrentState 即采用固定值 "inTransition"([SWS_SM_00616])。无论触发源如何(例如 Execution Management、Platform Health Management 或控制应用程序),都会设置此中间状态,并且即使响应于错误通知而发生进一步的转换,该状态也会保持(AUTOSAR_AP_SWS_StateManagement 第67页)。只有当所有关联的动作都处理完毕后,该值才会更新为状态机的实际目标状态([SWS_SM_00617])。

通过 StateMachineNotification 进行状态观察Adaptive ApplicationState ManagementUse Case: Service-BereitstellungStartStateMachine verarbeitetOfferService(StateMachineNotification)CurrentState.Subscribe() / Get()CurrentState (Initialer Zustand)Use Case: 状态转换Zustandswechsel eingeleitetCurrentState.Update("inTransition")ActionListItems verarbeitetCurrentState.Update(Neuer Zustand)Use Case: 服务注销Beendigungsaktion verarbeitetStopOfferService()

时序图:通过 StateMachineNotification 进行状态转换时的提供、查询和 Notifier 通知。来源:[SWS_SM_00618],[SWS_SM_91109],[SWS_SM_00616],[SWS_SM_00617]

生命周期、提供和状态依赖关系

启动状态机是一个多步骤过程(AUTOSAR_AP_SWS_StateManagement 第59页)。从上级 Controller 的角度来看,只有当状态机存在且其分配的接口被提供时,状态机才被视为已启动(AUTOSAR_AP_SWS_StateManagement 第59页)。一旦成功处理了带有命令 StartStateMachine 的 ActionListItem([SWS_SM_00618]),每个配置的 StateMachineNotification 实例都会通过 ara::com 进行提供(offered)。这使应用程序能够及早绑定到该服务。

如果状态机终止或缩减,该服务将被再次撤回:从处理相应终止动作的时间点起,该接口不再可用(StopOffer)([SWS_SM_00619])。如果状态机由 Controller 控制,元模型还要求每个动作列表都引用受控 Agent 的完整集合([SWS_SM_CONSTR_00016])。

错误处理与边界条件

由于接口以纯观察方式工作且不提供修改方法([SWS_SM_91109]),因此在接口模型中没有为 StateMachineNotification 定义其专有的应用特定 Application Error(例如 kOperationRejected)。错误处理依赖于查询字段时 ara::com 的通信机制以及对状态 "inTransition" 的评估:消费者可以将该中间值解释为正在进行的切换或错误恢复流程的标识(AUTOSAR_AP_SWS_StateManagement 第67页)。

本指南完全基于 AUTOSAR Adaptive Platform R25-11 的规范节选。

Mitglieder

成员图

详细视图

请在大纲中选择一个条目。

字段

CurrentState 服务字段

This field represents the current state of StateMachine. If StateMachine is currently in transition between two different states, then the value of this field is set to "InTransition". Adaptive Applications can use this field for notifications if they are interested in state changes of a particular StateMachine.

CurrentState : StateMachineStateNameType // Field (Getter, Notifier)

数据类型

文档

服务字段 CurrentState [SWS_SM_91109] Upstream: RS_SM_00001, RS_SM_00004

CurrentState : StateMachineStateNameType  // Field (Getter, Notifier)

This field represents the current state of StateMachine. If StateMachine is currently in transition between two different states, then the value of this field is set to "InTransition". Adaptive Applications can use this field for notifications if they are interested in state changes of a particular StateMachine.

Scopeservice interface StateMachineNotification
TypStateMachineStateNameType
Version1.0
HasGettertrue
HasSetterfalse
HasNotifiertrue

Request a governed re-review of this record. The record is not changed immediately.

Record
AUTOSAR/AP/record/SWS_SM_91109
Status
valid/unmigrated
Version
AUTOSAR/AP/record/SWS_SM_91109@rel:R25-11#44111b68
Content hash
44111b68
Source
https://www.autosar.org/fileadmin/standards/R25-11/AP/AUTOSAR_AP_SWS_StateManagement.pdf#nameddest=SWS_SM_91109
Status: valid/unmigrated Version: rel:R25-11#9a559903 Versionshistorie & Revisions (1 transition, 3 revision)
Current State
valid/unmigrated
Reason
mechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record
Campaign
2026-08-13-status-backfill
Active Version
AUTOSAR/AP/record/SWS_SM_91109@rel:R25-11#9a559903
Point-in-Time History:
Recorded Revisions (3):
  • R25-11rel:R25-11#d52d9c602026-09-30
  • R24-11rel:R24-11#7c70cc8c2026-10-14
  • R25-11rel:R25-11#9a5599032026-10-14 active
DateActorTransitionReason / RationaleCampaign
2026-08-13toolnone → valid/unmigratedmechanically backfilled by migriere_status_backfill.py -- no per-field curation history exists yet for this record2026-08-13-status-backfill