| New file | 
|  |  |  | 
|---|
|  |  |  | package com.dy.rtuMw.server; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.dy.common.mw.protocol.MidResultAction; | 
|---|
|  |  |  | import com.dy.common.mw.protocol.Notify; | 
|---|
|  |  |  | import com.dy.common.mw.protocol.ProtocolConfigVo; | 
|---|
|  |  |  | import com.dy.common.mw.protocol.ProtocolUnitAdapter; | 
|---|
|  |  |  | import com.dy.rtuMw.server.forTcp.MidResultActionError; | 
|---|
|  |  |  | import com.dy.rtuMw.server.forTcp.MidResultActionFromRtu; | 
|---|
|  |  |  | import com.dy.rtuMw.server.forTcp.MidResultActionToRtu; | 
|---|
|  |  |  | import com.dy.rtuMw.server.rtuStateFrProt.RtuInfoNotify; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public class AdapterImp_ProtocolUnit implements ProtocolUnitAdapter { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final MidResultAction toRtu = new MidResultActionToRtu() ; | 
|---|
|  |  |  | private static final MidResultAction fromRtu = new MidResultActionFromRtu() ; | 
|---|
|  |  |  | private static final MidResultAction error = new MidResultActionError() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private static final RtuInfoNotify notify = new RtuInfoNotify() ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private ProtocolConfigVo configVo = null ; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public ProtocolConfigVo getConfig() { | 
|---|
|  |  |  | return this.configVo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void setConfig(ProtocolConfigVo configVo) { | 
|---|
|  |  |  | this.configVo = configVo; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单线程环境中运行,得到单个RTU信息通知器 | 
|---|
|  |  |  | * @param protocolName 协议名称 | 
|---|
|  |  |  | * @return Notify | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Notify getSingleRtuInfoNotify(String protocolName) { | 
|---|
|  |  |  | return notify ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单线程环境中运行,得到单个 处理RTU下行数据的MidResultAction执行对象 | 
|---|
|  |  |  | * @param protocolName 协议名称 | 
|---|
|  |  |  | * @return MidResultAction | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public MidResultAction getSingleActionToRtu(String protocolName) { | 
|---|
|  |  |  | return toRtu ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单线程环境中运行,得到单个处理RTU上行数据的MidResultAction执行对象 | 
|---|
|  |  |  | * @param protocolName 协议名称 | 
|---|
|  |  |  | * @return MidResultAction | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public MidResultAction getSingleActionFromRtu(String protocolName) { | 
|---|
|  |  |  | return fromRtu ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 单线程环境中运行,得到单个处理出错的MidResultAction执行对象 | 
|---|
|  |  |  | * @param protocolName 协议名称 | 
|---|
|  |  |  | * @return MidResultAction | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public MidResultAction getSingleActionError(String protocolName) { | 
|---|
|  |  |  | return error ; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|