状态机解析

本文深入探讨了状态机的概念,详细解释了如何设计和实现一个状态机,包括其转换规则和事件驱动机制。通过实例分析,阐述了状态机在软件工程中的应用,如状态管理、流程控制等场景。
摘要由CSDN通过智能技术生成

输出:


processMsg: Controller$DefaultState
ApStaDisabledState-->enter()
状态栈中存在2个状态分别为
msg = 1
0  DefaultState      state=Controller$DefaultState,parent=null
1  ApStaDisabledState      state=Controller$ApStaDisabledState,parent=Controller$DefaultState
=============================================
processMsg: Controller$ApStaDisabledState
processMsg: Controller$DefaultState
invokeExitMethods: Controller$ApStaDisabledState
ApStaDisabledState-->exit() 
StaEnabledState -->enter()
状态栈中存在2个状态分别为
msg = 2
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
=============================================
processMsg: Controller$StaEnabledState
DeviceActiveState -->enter()
状态栈中存在3个状态分别为
msg = 3
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceActiveState      state=Controller$DeviceActiveState,parent=Controller$StaEnabledState
=============================================
processMsg: Controller$DeviceActiveState
processMsg: Controller$StaEnabledState
invokeExitMethods: Controller$DeviceActiveState
DeviceActiveState -->exit() 
DeviceInactiveState -->enter()
状态栈中存在3个状态分别为
msg = 4
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceInactiveState      state=Controller$DeviceInactiveState,parent=Controller$StaEnabledState
=============================================
processMsg: Controller$DeviceInactiveState
ScanOnlyLockHeldState -->enter()
状态栈中存在4个状态分别为
msg = 5
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceInactiveState      state=Controller$DeviceInactiveState,parent=Controller$StaEnabledState
3  ScanOnlyLockHeldState      state=Controller$ScanOnlyLockHeldState,parent=Controller$DeviceInactiveState
=============================================
processMsg: Controller$ScanOnlyLockHeldState
processMsg: Controller$DeviceInactiveState
invokeExitMethods: Controller$ScanOnlyLockHeldState
ScanOnlyLockHeldState -->exit() 
FullLockHeldState -->enter()
状态栈中存在4个状态分别为
msg = 6
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceInactiveState      state=Controller$DeviceInactiveState,parent=Controller$StaEnabledState
3  FullLockHeldState      state=Controller$FullLockHeldState,parent=Controller$DeviceInactiveState
=============================================
processMsg: Controller$FullLockHeldState
processMsg: Controller$DeviceInactiveState
invokeExitMethods: Controller$FullLockHeldState
FullLockHeldState -->exit() 
FullHighPerfLockHeldState -->enter()
状态栈中存在4个状态分别为
msg = 7
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceInactiveState      state=Controller$DeviceInactiveState,parent=Controller$StaEnabledState
3  FullHighPerfLockHeldState      state=Controller$FullHighPerfLockHeldState,parent=Controller$DeviceInactiveState
=============================================
processMsg: Controller$FullHighPerfLockHeldState
processMsg: Controller$DeviceInactiveState
invokeExitMethods: Controller$FullHighPerfLockHeldState
FullHighPerfLockHeldState -->exit() 
NoLockHeldState -->enter()
状态栈中存在4个状态分别为
msg = 8
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaEnabledState      state=Controller$StaEnabledState,parent=Controller$DefaultState
2  DeviceInactiveState      state=Controller$DeviceInactiveState,parent=Controller$StaEnabledState
3  NoLockHeldState      state=Controller$NoLockHeldState,parent=Controller$DeviceInactiveState
=============================================
processMsg: Controller$NoLockHeldState
processMsg: Controller$DeviceInactiveState
processMsg: Controller$StaEnabledState
processMsg: Controller$DefaultState
invokeExitMethods: Controller$NoLockHeldState
NoLockHeldState -->exit() 
invokeExitMethods: Controller$DeviceInactiveState
DeviceInactiveState -->exit() 
invokeExitMethods: Controller$StaEnabledState
StaEnabledState -->exit() 
StaDisabledWithScanState -->enter()
状态栈中存在2个状态分别为
msg = 9
0  DefaultState      state=Controller$DefaultState,parent=null
1  StaDisabled
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值