///// <summary>
 ///// MBUS protocol initialization
 ///// </summary>
 ///// <param name="cCommLayer">Interface responsible for providing the communication</param>
 ///// <param name="cProtParameters">Protocol parameters</param>
 ///// <param name="cStatistic">Statistical information about the communication performance</param>
 ///// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 //internal MODBProtocol
 //  ( ICommunicationLayer cCommLayer, ProtocolParameters cProtParameters,
 //  BaseStation.Management.IProtocolParent cStatistic, SesDBufferPool<MBUS_message> cPool
 //  )
 //  : base( cCommLayer, cProtParameters, cStatistic )
 //{
 //  this.m_Pool = cPool;
 //}
 /// <summary>
 /// SBUS protocol initialization
 /// </summary>
 /// <param name="pCommLayer">Interface responsible for providing the communication</param>
 /// <param name="pProtParameters">Protocol parameters</param>
 /// <param name="pStatistic">Statistical information about the communication performance</param>
 /// <param name="pPool">Empty data messages pool to be used by the protocol.</param>
 internal MBUSProtocol
     (ICommunicationLayer pCommLayer, ProtocolParameters pProtParameters,
     CAS.Lib.RTLib.Management.IProtocolParent pStatistic, SesDBufferPool <MBUS_message> pPool)
     : base(pCommLayer, pProtParameters, pStatistic)
 {
     this.m_Pool = pPool;
 }
 internal SBUS_ApplicationLayerSlave
     (SBUSProtocol cALProtocol, SesDBufferPool <SBUSbase_message> cPool)
     :
     base(cALProtocol.GetICommunicationLayer)
 {
     m_ALProtocol = cALProtocol;
     m_Pool       = cPool;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// ApplicationLayerMaster creator
 /// </summary>
 /// <param name="cProtocol">Protocol to be used to transfer data.</param>
 /// <param name="cPool">Empty frames pool to be used by the protocol.</param>
 public ApplicationLayerMaster(ALProtocol <T_ALMessage> cProtocol, SesDBufferPool <T_ALMessage> cPool)
     : base(cProtocol.GetICommunicationLayer)
 {
     this.m_protocol  = cProtocol;
     this.m_Pool      = cPool;
     this.m_Statistic = cProtocol.GetIProtocolParent;
     InterfrarmeStopwatch.Start();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Clears the port and sets the starting conditions
 /// </summary>
 internal virtual void Release()
 {
     myDBufferPool = null;
     buff_RxMess.Clear();
     buff_RxMess.Open();
     buff_TxMess.TxDataClear();
     NCCI = 0;
     Disconnect_B3_Pending = false;
     accept         = true;
     NCCIPCurrState = NCCI_States.N0;
     IsConnectedCon.NotifyAll();
     B3_config = null;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Requests for connection
        /// </summary>
        /// <param name="portID">Class that represents the logical connection</param>
        /// <param name="telNum">Called party number</param>
        /// <param name="B1_conf">B1 protocol configuration</param>
        /// <param name="B2_conf">B2 protocol configuration</param>
        /// <param name="B3_conf">B3 protocol configuration</param>
        /// <param name="userDBufferPool">Buffer pool for data</param>
        /// <param name="timeout">timeout</param>
        /// <returns>Success if parties are connected, otherwise appropriate error code</returns>
        public TSessionError ConnectReq
        (
            out object portID,
            string telNum,
            IB1_Proto B1_conf,
            IB2_Proto B2_conf,
            IB3_Proto B3_conf,
            SesDBufferPool userDBufferPool,
            int timeout
        )
        {
            portID = null;
            if (!CAPI_Interface.IsRegistered)
            {
                return(TSessionError.Session_NotRegistered);
            }
            C_PLCIState port = Connections.NewPLCIPort();

            portID = port;
            if (port == null)
            {
                return(TSessionError.ConnectReq_Failure);
            }
            port.portTelNumber   = telNum;
            port.B1_config       = B1_conf;
            port.B2_config       = B2_conf;
            port.B3_config       = B3_conf;
            port.userDBufferPool = userDBufferPool;
            port.SM_PLCI(CAPI_Wrapper.comsub.CONNECT_REQ);
            if (port.IsConnectedWait(timeout))
            {
                return(TSessionError.Success);
            }
            else
            {
                //  port.Release();
                Connections.ClosePLCIPort(ref port);
            }
            return(TSessionError.ConnectReq_Failure);
        }
 public ModBusProtocol(ICommunicationLayer pCommLayer, ProtocolParameters pProtParameters, RTLib.Management.IProtocolParent pStatistic, SesDBufferPool <ModBusMessage> pPool) :
     base(pCommLayer, pProtParameters, pStatistic, pPool)
 {
 }
 /// <summary>
 /// MODBUS protocol initialization
 /// </summary>
 /// <param name="communicationLayer">Interface responsible for providing the communication</param>
 /// <param name="protocolParameters">Protocol parameters</param>
 /// <param name="protocolParent">Statistical information about the communication performance</param>
 /// <param name="pool">Empty data messages pool to be used by the protocol.</param>
 public ModbusProtocol(ICommunicationLayer communicationLayer, ProtocolParameters protocolParameters, IProtocolParent protocolParent, SesDBufferPool <ModBusMessage> pool)
     : base(communicationLayer, protocolParameters, protocolParent)
 {
     this.m_Pool = pool;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Waits for incoming connection
        /// </summary>
        /// <param name="portID">Class that represents the logical connection</param>
        /// <param name="timeout">Desired time to wait</param>
        /// <param name="B1_conf">B1 protocol configuration</param>
        /// <param name="B2_conf">B2 protocol configuration</param>
        /// <param name="B3_conf">B3 protocol configuration</param>
        /// <param name="userDBufferPool">Buffer pool for data</param>
        /// <returns>Success if parties are connected, otherwise appropriate error code</returns>
        public TSessionError ConnectInd
            (out object portID, int timeout, IB1_Proto B1_conf, IB2_Proto B2_conf, IB3_Proto B3_conf, SesDBufferPool userDBufferPool)
        {
            portID = null;
            if (!CAPI_Interface.IsRegistered)
            {
                return(TSessionError.Session_NotRegistered);
            }
            //MPNI to jest zle - trzeba szukaæ czy ind nie pojawi³o siê wczeœniej
            C_PLCIState port = Connections.NewPLCIPort();

            portID = port;
            if (port == null)
            {
                return(TSessionError.ConnectReq_Failure);
            }
            port.B1_config       = B1_conf;
            port.B2_config       = B2_conf;
            port.B3_config       = B3_conf;
            port.userDBufferPool = userDBufferPool;
            port.SM_PLCI(CAPI_Wrapper.comsub.INTERNAL_WaitFConnInd);
            if (port.IsConnectedWait(timeout))
            {
                return(TSessionError.Success);
            }
            else
            {
                //port.Release();
                Connections.ClosePLCIPort(ref port);
                return(TSessionError.ConnectReq_Failure);
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// ApplicationLayerMaster creator
 /// </summary>
 /// <param name="pool">A pool of empty data messages to be used by the protocol.</param>
 /// <param name="protocol">Protocol to be used.</param>
 public ModBus_ApplicationLayerMaster(SesDBufferPool <TModBusMessage> pool, ALProtocol <TModBusMessage> protocol)
     : base(protocol, pool)
 {
 }
 /// <summary>
 /// ApplicationLayerMaster creator
 /// </summary>
 /// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 /// <param name="cProt">Protocol to be used.</param>
 internal SBUS_ApplicationLayerMaster
     (SesDBufferPool <FrameStateMachine> cPool, SBUSProtocol cProt)
     : base(cProt, cPool)
 {
 }
Ejemplo n.º 11
0
 private ISesDBuffer f(SesDBufferPool source)
 {
     return(new _MyMessage(source));
 }
 /// <summary>
 /// ApplicationLayerMaster creator
 /// </summary>
 /// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 /// <param name="cProt">Protocol to be used.</param>
 internal MBUS_ApplicationLayerMaster(SesDBufferPool <MBUS_message> cPool, MBUSProtocol cProt)
     : base(cProt, cPool)
 {
 }
Ejemplo n.º 13
0
 protected override ModBusProtocol CreateModBusProtocol(ICommunicationLayer communicationLayer, ModBus_ProtocolParameters parameters, IProtocolParent protocolParent, SesDBufferPool <ModBusMessage> pool)
 {
     return(new ModBusProtocol(communicationLayer, parameters, protocolParent, pool));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// ApplicationLayerMaster creator
 /// </summary>
 /// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 /// <param name="cProt">Protocol to be used.</param>
 internal Master(SesDBufferPool <Message> cPool, Protocol cProt)
     : base(cProt, cPool)
 {
 }
 protected abstract TModbusMessage CreateModBusMessage(SesDBufferPool <TModbusMessage> pool, TProtocolParameters parameters);
 protected abstract TModbusProtocol CreateModBusProtocol(ICommunicationLayer communicationLayer, TProtocolParameters parameters, IProtocolParent protocolParent, SesDBufferPool <TModbusMessage> pool);
 protected abstract IApplicationLayerMaster CreateModBus_ApplicationLayerMaster(SesDBufferPool <TModbusMessage> pool, TModbusProtocol protocol);
Ejemplo n.º 18
0
 protected override ModBusMessage CreateModBusMessage(SesDBufferPool <ModBusMessage> pool, ModBus_ProtocolParameters parameters)
 {
     return(new ModBusMessage(pool, parameters));
 }
 ///// <summary>
 ///// SBUS protocol initialization
 ///// </summary>
 ///// <param name="cCommLayer">Interface responsible for providing the communication</param>
 ///// <param name="cProtParameters">Protocol parameters</param>
 ///// <param name="cStatistic">Statistical information about the communication performance</param>
 ///// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 //internal SBUSProtocol
 //  ( ICommunicationLayer cCommLayer, ProtocolParameters cProtParameters,
 //  BaseStation.Management.IProtocolParent cStatistic, SesDBufferPool<SBUSbase_message> cPool
 //  )
 //  : base( cCommLayer, cProtParameters, cStatistic )
 //{
 //  this.m_Pool = cPool;
 //}
 /// <summary>
 /// SBUS protocol initialization
 /// </summary>
 /// <param name="pStatistic">Statistical information about the communication performance</param>
 /// <param name="pCommLayer">Interface responsible for providing the communication</param>
 /// <param name="pProtParameters">Protocol parameters</param>
 /// <param name="cPool">Empty data messages pool to be used by the protocol.</param>
 internal SBUSProtocol(IProtocolParent pStatistic, ICommunicationLayer pCommLayer,
                       ProtocolParameters pProtParameters, SesDBufferPool <FrameStateMachine> cPool)
     : base(pCommLayer, pProtParameters, pStatistic)
 {
     this.m_Pool = cPool;
 }
Ejemplo n.º 20
0
 protected override IApplicationLayerMaster CreateModBus_ApplicationLayerMaster(SesDBufferPool <ModBusMessage> pool, ModBusProtocol protocol)
 {
     return(new CAS.CommServer.DataProvider.MODBUSCore.ModBus_ApplicationLayerMaster <ModBusMessage>(pool, protocol));
 }
Ejemplo n.º 21
0
 public _MyMessage(SesDBufferPool source)
     : base(300, false) //MZTC - tu dopisalem false - ale to wszystko jedno
 {
     pool = source;
 }