发送
1.通过"菜单名称"在menu.xml找到对应资源,通过文本资源ID即label-key找到对应的菜单项
<menu-item
label-key="M5_DEVICEINFO"
auth-info="2073006"
mnemonic="D"
enabled="true"
id="ID_M5_DEVICEINFO"
action-command="M5_MenuDEVICEINFO"
action-param="com.zte.ums.zxnm01.zxss.cm.wsf.MSG9000.V30000.config.M5config.panelDeviceInfo"
response-class="com.zte.ums.zxnm01.zxss.cm.wsf.MSG9000.V50000.app.PriMenuBar"/>
2.在PriMenuBar中找action-command
else if(command.equals("M5_MenuDEVICEINFO"))
{
panelDeviceInfo pane = new panelDeviceInfo();
CommonDialog dlg = new CommonDialog(frame, pane.getTitle());
dlg.AddPanel(pane);
pane.setOwner(dlg);
dlg.setTitle(CmComInfo.getNeNameByMoi(CmComInfo.getCurrMoi())
+ dlg.getTitle());
dlg.CenterShow();
pane.showContent(null);
}
命令发送在pane.showContent(null);
3.在panelDeviceInfo中查看showContent方法,其中关键方法为父类的mmlExec(EVENT_SHOW)
4.在JDmPanel中查看mmlExec(int Ret_Event),其中关键方法为executeMml(mmlList)
5.在JDmPanel中查看executeMml(ArrayList mmlList),其中关键方法为executeMml((String)mmlList.get(i))
6.在JDmPanel中查看executeMml(String mml),其中关键方法为WsfDataComm.DataOutSyn(this, CmComInfo.getNodeDataByMoi(getMoi()), mml)
DataOutSyn方法为同步发送方法,方法直接返回命令的发送结果。(异步方法后续自己学习)
接收
7.上述executeMml(String mml)中this.mmlRespond(retDataSet)为数据接收
8.在JDmPanel中查看mmlRespond(TDataSet tSet),其中关键方法为mmlRespond(currentCmdNo, tSet),此方法为子类覆写,见步骤9
mmlRespond(TDataSet tSet)方法做通用的逻辑处理,比如错误码处理,保存数据结果到文件
9.在panelDeviceInfo中查看方法mmlRespond(int commandno, TDataSet tSet),此方法完成数据显示
menu.xml
最新推荐文章于 2021-05-26 06:28:07 发布