开启左侧

JKI -case 分支拆解

[复制链接]
wenluderen 发表于 2021-3-26 14:14:03 | 显示全部楼层 |阅读模式
本帖最后由 wenluderen 于 2021-3-26 15:03 编辑

JKI -case 分支拆解××××××××××××
当没有消息的时候,执行默认分支
就是: "", "Idle"
××
在这个分支里面 是一个 用户事件机构

后续代码书写 ,主要就是在这个事件结构里面完成的

比如说, 给SMO添加了事件(不论是是公开的  还是私有的),都是先到  "Events: Register"  里面注册 ,然后就可以在 "", "Idle" 里面的事件结构里面去写响应函数了
1.jpg
2.jpg


 楼主| wenluderen 发表于 2021-3-26 15:08:39 | 显示全部楼层
---------- Core ----------
"---------- Data ----------"
"---------- UI ----------"
"---------- Macro ----------"
"---------- Process ----------"
"---------- Events ----------"
"---------- Action ----------"
××××
以上七个分支,全部都是屁事不干的分支,仅仅用于凑整齐 ,让代码看上去有条理而已

3.jpg


里面是三个主要数据流,是每个分支都必须有的
从上往下分别是:
1)当前对象
2)捆绑的数据, 相当于本SMO的全局变量

3)消息队列
4.jpg




 楼主| wenluderen 发表于 2021-3-26 15:25:09 | 显示全部楼层
分支: Default
×××
这个分支的说明:(this is used to capture unhandled states and typos)--->(这用于捕获未处理的状态和错别字)

1.jpg

2.jpg


Handle mistyped state name (developer tool)-------》处理输入错误的状态名称(开发人员工具)


(具体是什么情况下爱执行这个分支,还有待确认)

 楼主| wenluderen 发表于 2021-3-26 15:30:03 | 显示全部楼层

分支: "Initialize Core Data"
×××(this is used to determine panel behavior on exit)------------------->
(这用于确定退出时的面板行为)

4.jpg




***************





 楼主| wenluderen 发表于 2021-3-26 15:33:58 | 显示全部楼层

"Error Handler"

  ,当出现SMO无法处理的消息的时候,  或者系统产生了错误的时候 , 就会执行这个分支

打开 消息解析函数:Parse State Queue__jki_lib_state_machine.vi
看下他框图
当出现错误后  当前状态被修改为:Error Handler


3.jpg

**
Overwrite this method to handle errors and pass to parent if not handled. Parent will fire a public event if the error is not handled up the

覆盖此方法以处理错误,如果未处理,则传递给父方法。 如果未解决错误,则家长会触发公共事件
&&
5.jpg
 楼主| wenluderen 发表于 2021-3-26 15:35:23 | 显示全部楼层
"Exit"
***
这个没啥好说的

退出while循环, 结束SMO(状态机)的运行
6.jpg
 楼主| wenluderen 发表于 2021-3-26 15:39:13 | 显示全部楼层
"Data: Initialize"
××××××××××××××
Initialize the shift-register data, here.
(data names are defined by what you wire into the bundle function)

在此初始化移位寄存器数据。
(数据名称由您绑定到捆绑功能中的内容定义)


××
之前就说过  ,SMO里面的状态机 ,有三个全局的数据流
在这个分支里面
就是 对 类这个数据流  和簇这个数据流赋值
×××
1.jpg
 楼主| wenluderen 发表于 2021-3-26 15:40:38 | 显示全部楼层
"Data: Cleanup"
×××
Cleanup any data and references, here.
(this is called automatically, by the Macro: Exit)

××
在此处清理所有数据和参考。
(这被宏自动调用:退出)

××
官方已经说的很清楚了 我就不赘述了
2.jpg
 楼主| wenluderen 发表于 2021-3-26 15:46:25 | 显示全部楼层
"UI: Initialize"
×××
Initialize the User Interface, here.
(this is called automatically, by the Macro: Init)


在此处初始化用户界面。
(这是由宏自动调用的:Init)

×××
GSZ:对前面板的空间初始化, 比如图表里面 的注释的清除


××××××××××××××××××××××××××××××××××××

"UI: Cursor Set"

Initialize the User Interface, here.
(this is called automatically, by the Macro: Init)

在此处初始化用户界面。
(这是由宏自动调用的:Init)

GSZ:这个非常重要的,特别是处理一些耗时的结构,需要先把鼠标 变成等待模式 ,就是打圈圈,  让鼠标不起作用,防止人误操作。
等待耗时的分支处理结束后, 在把鼠标变成可以用的状态
×××





"UI: Front Panel State"

Set Front Panel Open or Closed
(Usage: "UI: Front Panel State >> Open|Close")


设置前面板打开或关闭
(用法:“ UI:前面板状态>>打开|关闭”)


GSZ:FP  就是Front Panel  的缩写,这个分支没没啥好说的
×××

 楼主| wenluderen 发表于 2021-3-26 15:53:35 | 显示全部楼层
"Macro: Initialize" (Macro  是宏的意思)
(×××
SMO刚启动的时候的初始化流程分支, 连续向消息队列里写消息,
Initialization Macro
(This is called once, when the VI starts)



初始化宏
(当VI启动时,将被调用一次)

、×××××××××××××××××
3.jpg



××××××××××
"Macro: Exit"    也是宏分支

就是确定程序退出的过程
Exit Macro
(This is called once, when the VI exits)


退出宏
(当VI退出时,将被调用一次)


4.jpg
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表