/// <summary>
 /// Creates the application layer slave.
 /// </summary>
 /// <param name="cCommFactory">The communication layer factory.</param>
 /// <param name="cProtParameters">The protocol parameters.</param>
 /// <param name="cStatistic">The statistic.</param>
 /// <param name="cName">Name </param>
 /// <param name="cID">The Identifier</param>
 /// <param name="cParent">The parent common bus control.</param>
 /// <returns></returns>
 public IApplicationLayerSlave CreateApplicationLayerSlave
     (ICommunicationLayerFactory cCommFactory, ProtocolParameters cProtParameters,
     out IProtocolParent cStatistic, string cName, ulong cID, CommonBusControl cParent
     )
 {
     throw new ApplicationLayerInterfaceNotImplementedException();
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a collection of all plug-ins that are available in the executing folder.
        /// </summary>
        /// <param name="pParent">Parent class <seealso cref="CommonBusControl"/></param>
        public PluginCollection(CommonBusControl pParent)
        {
            m_TraceSource = pParent.GetTraceSource;
            string ialphmFiltr = typeof(IDataProviderID).ToString();
            //Przeszukujemy katalog w poszykiwaniu odpowiedniego pluginu
            string lPathToScann = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);

            foreach (string fileOn in Directory.GetFiles(lPathToScann))
            {
                System.IO.FileInfo file = new System.IO.FileInfo(fileOn);
                //roszerzenie powinno byæ dll
                if (file.Extension.ToLower().Equals(".dll") && file.Name.ToLower().Contains("plugin"))
                {
                    m_TraceSource.TraceEvent
                        (TraceEventType.Verbose, 148, "NetworkConfiguration: Trying to find helper interface in file: {0}", fileOn);
                    try
                    {
                        //Create a new assembly from the plugin we're reading
                        System.Reflection.Assembly pluginAssembly = System.Reflection.Assembly.LoadFrom(fileOn);
                        //Gets a type object of the interface we need the plugins to match
                        foreach (Type pluginType in pluginAssembly.GetExportedTypes())
                        {
                            m_TraceSource.TraceEvent
                                (TraceEventType.Verbose, 158, "NetworkConfiguration: Checking if {0} implements the helper interface", pluginType.ToString());
                            if (pluginType.IsPublic && !pluginType.IsAbstract && pluginType.GetInterface(ialphmFiltr) != null) //Only look at public types
                            {
                                m_TraceSource.TraceEvent
                                    (TraceEventType.Verbose, 162, "NetworkConfiguration: Trying to create helper.");
                                IDataProviderID lHelper = (IDataProviderID)Activator.CreateInstance(pluginType);
                                m_SortedDic.Add(lHelper.GetDataProviderDescription.Identifier, lHelper);
                                m_TraceSource.TraceEvent
                                    (TraceEventType.Verbose, 158, "NetworkConfiguration: {0} has benn added to the plugins collection.", pluginType.ToString());
                            }
                            else
                            {
                                m_TraceSource.TraceEvent
                                    (TraceEventType.Verbose, 158, "NetworkConfiguration: {0} does not implement the helper interface", pluginType.ToString());
                            }
                        } //foreach (Type pluginType in pluginAssembly.GetTypes())
                    }     //try
                    catch (BadImageFormatException)//w przypadku biblioteki nie .NET - np WtOPCSvr.dll
                    {
                        m_TraceSource.TraceEvent
                            (TraceEventType.Warning, 211, "NetworkConfiguration: The file {0} image is invalid.", fileOn);
                    }
                    catch (LicenseException ex)
                    {
                        m_TraceSource.TraceEvent
                            (TraceEventType.Warning, 217,
                            "NetworkConfiguration: The component cannot be granted a license for the type: {0}.", ex.LicensedType.ToString());
                    }
                    catch (Exception ex)
                    {
                        m_TraceSource.TraceEvent
                            (TraceEventType.Warning, 223,
                            "Some problem encountered while trying to connect a plugin in file {0}. An exception was thrown: {1}", fileOn, ex.Message);
                    }
                } //if(file.Extension.Equals(".dll"))
            }     //foreach(string fileOn in System.IO.Directory.GetFiles(Win32API.Application.Path))
        }
 protected void InitializeOperation(IDataProviderID dataProviderID, CommonBusControl commonBusControl, IProtocolParent protocolParent, bool readOperation)
 {
     m_ResourceSelected     = ResourceSelected;
     m_StationAddress       = StationAddress;
     m_RegisterAddress      = RegisterStartAddress;
     m_DataTypeOfConversion = DataTypeOfConversion;
     m_Length = Length;
     if (m_DataTypeOfConversion == typeof(string))
     {
         m_RegistersCount = 1;
     }
     else
     {
         m_RegistersCount = Length;
     }
     m_CommLayerAddress     = Commlayeraddress;
     ApplicationLayerMaster = dataProviderID.GetApplicationLayerMaster(protocolParent, commonBusControl);
     if (readOperation)
     {
         m_DoOperation = ReadOperation;
     }
     else
     {
         m_ValueToBeWritten = ValueToBeWritten(m_DataTypeOfConversion);
         m_DoOperation      = WriteOperation;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AvailableDPTree"/> class.
 /// </summary>
 /// <param name="pParent">The parent CommonBusControl.</param>
 /// <param name="pOKCnacelForm">The reference to parent form with interface ICanBeAccepted.</param>
 public AvailableDPTree(CommonBusControl pParent, ICanBeAccepted pOKCnacelForm)
     : this()
 {
     m_OKCnacelForm = pOKCnacelForm;
     //m_OKCnacelForm.SetUserControl = this;
     m_PluginCollection = new PluginCollection(pParent);
     FillTree(m_PluginCollection);
 }
        /// <summary>
        /// Instantiate object providing  <see cref="IApplicationLayerMaster"/> - an object implementing
        /// master (playing the role on the field network of the master station,) interfaces defined for the application layer.
        /// </summary>
        /// <param name="pStatistic">Statistical information about the communication performance.</param>
        /// <param name="pParent"><seealso cref="CommonBusControl"/> - Base class responsible for all of resources management used
        /// by the component and providing tracing sources.</param>
        /// <returns>Return an object implementing IApplicationLayerMaster.</returns>
        /// <exception cref="System.ComponentModel.LicenseException">The type is licensed, but a <see cref="System.ComponentModel.License"/> cannot be granted.</exception>
        public override IApplicationLayerMaster GetApplicationLayerMaster
            (IProtocolParent pStatistic, CommonBusControl pParent)
        {
            SBUS_ApplicationLayerPluginHelper m_ApplicationLayerPluginHelper = new SBUS_ApplicationLayerPluginHelper(pParent);

            return(m_ApplicationLayerPluginHelper.CreateApplicationLayerMaster
                       (pStatistic, this.CreateCommunicationLayer(pParent), m_ProtocolParameters));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Instantiate object providing  <see cref="IApplicationLayerMaster"/> - an object implementing
        /// master (playing the role on the field network of the master station,) interfaces defined for the application layer.
        /// </summary>
        /// <param name="pStatistic">Statistical information about the communication performance.</param>
        /// <param name="pParent"><seealso cref="CommonBusControl"/> - Base class responsible for all of resources management used
        /// by the component and providing tracing sources.</param>
        /// <returns>Return an object implementing IApplicationLayerMaster.</returns>
        public override IApplicationLayerMaster GetApplicationLayerMaster
            (IProtocolParent pStatistic, CommonBusControl pParent)
        {
            EC2_3SYM2_ApplicationLayerPluginHelper m_ApplicationLayerPluginHelper = new EC2_3SYM2_ApplicationLayerPluginHelper(pParent);

            return(m_ApplicationLayerPluginHelper.CreateApplicationLayerMaster
                       (pStatistic, this.CreateCommunicationLayer(pParent), m_ErrorFrequency));
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Creator for RS_to_Serial it sets the inistial setting for serial port
 /// </summary>
 /// <param name="pSettings">Setting for serial port</param>
 /// <param name="pParent">Parent component class <seealso cref="CommonBusControl"/>providing needed resources.</param>
 internal RS_to_Serial(SerialPortSettings pSettings, CommonBusControl pParent)
     : base("COM" + pSettings.PortName.ToString(), pParent)
 {
     m_SerialPort.PortName     = "COM" + pSettings.PortName.ToString();
     m_SerialPort.BaudRate     = (int)pSettings.BaudRate;
     m_SerialPort.Parity       = pSettings.Parity;
     m_SerialPort.StopBits     = pSettings.StopBits;
     m_SerialPort.DataBits     = pSettings.DataBits;
     m_SerialPort.WriteTimeout = c_WriteTimeoutDefault_ms;
     //m_SerialPort.Handshake = Handshake.None;
     //m_SerialPort.ReadTimeout = 500;
     m_SerialPort.Encoding = System.Text.Encoding.UTF8;
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Instantiate object providing  <see cref="IApplicationLayerMaster"/> - an object implementing
        /// master (playing the role on the field network of the master station,) interfaces defined for the application layer.
        /// </summary>
        /// <param name="pStatistic">Statistical information about the communication performance.</param>
        /// <param name="pParent"><seealso cref="CommonBusControl"/> - Base class responsible for all of resources management used
        /// by the component and providing tracing sources.</param>
        /// <returns>Return an object implementing IApplicationLayerMaster.</returns>
        /// <exception cref="System.ComponentModel.LicenseException">The type is licensed, but a <see cref="System.ComponentModel.License"/> cannot be granted.</exception>
        public override IApplicationLayerMaster GetApplicationLayerMaster(CAS.Lib.RTLib.Management.IProtocolParent pStatistic, CommonBusControl pParent)
        {
            ModBus_ApplicationLayerPluginHelper m_ApplicationLayerPluginHelper = new ModBus_ApplicationLayerPluginHelper();

            return(m_ApplicationLayerPluginHelper.CreateApplicationLayerMaster(pStatistic, this.CreateCommunicationLayer(pParent), m_ProtocolParameters));
        }
Ejemplo n.º 9
0
 /// <summary>
 /// Creates the net communication layer.
 /// </summary>
 /// <param name="sockedNum">The socked num.</param>
 /// <param name="protocol">The protocol.</param>
 /// <param name="pTraceName">Name of the trace.</param>
 /// <param name="pParent">The parent common bus control.</param>
 /// <returns>Communication layer</returns>
 public static ICommunicationLayer CreateNetCommunicationLayer(short sockedNum, ProtocolType protocol, string pTraceName, CommonBusControl pParent)
 {
     return(new CAS.Lib.CommonBus.CommunicationLayer.Net.NetCommunicationLayerID().CreateCommunicationLayer(
                new object [] { sockedNum, protocol, pTraceName, pParent }));
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Instantiate new object providing <see>ICommunicationLayer</see> functionality.
 /// </summary>
 /// <param name="pParent">Base class responsible for the resources management.</param>
 /// An object providing the <returns><see>ICommunicationLayer</see>functionality</returns>
 public ICommunicationLayer CreateCommunicationLayer(CommonBusControl pParent)
 {
     m_DDECommunicationLayerDescription.SetSettings(m_ServerDDE);
     return(new DDE_to_Serial(m_ServerDDE, pParent));
 }
Ejemplo n.º 11
0
 internal NULL_to_Serial(string pTraceName, CommonBusControl pParent) : base(pTraceName, pParent)
 {
 }
Ejemplo n.º 12
0
        ///// <summary>
        ///// Gets or sets serial numer
        ///// </summary>
        //[
        //BrowsableAttribute( true ),
        //CategoryAttribute( "Serial: Global Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "Defines Serial Number - must be unique" )
        //]
        //public short SerialNum
        //{
        //  get
        //  {
        //    return ( m_Parent.SerialNum );
        //  }
        //  set
        //  {
        //    m_Parent.SerialNum = value;
        //  }
        //}

        ///// <summary>
        ///// Gets or sets optional parity bit follows the data bits in the character frame
        ///// </summary>
        //[
        //BrowsableAttribute( true ),
        //CategoryAttribute( "Serial: Data Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "An optional parity bit follows the data bits in the character frame" )
        //]
        //public sbyte Parity
        //{
        //  get
        //  {
        //    return ( m_Parent2.Parity );
        //  }
        //  set
        //  {
        //    m_Parent2.Parity = value;
        //  }
        //}
        ///// <summary>
        ///// Gets or sets number of data bits are transmitted in one unit
        ///// </summary>
        //[
        //BrowsableAttribute( true ),
        //CategoryAttribute( "Serial: Data Settings" ),
        //DefaultValueAttribute( 8 ),
        //DescriptionAttribute( "Number of data bits are transmitted in one unit" )
        //]
        //public sbyte DataBits
        //{
        //  get
        //  {
        //    return ( m_Parent2.DataBits );
        //  }
        //  set
        //  {
        //    m_Parent2.DataBits = value;
        //  }
        //}
        ///// <summary>
        ///// Gets or setsumber of bits in the last part of a character frame
        ///// </summary>
        //[
        //BrowsableAttribute( true ),
        //CategoryAttribute( "Serial: Data Settings" ),
        //DefaultValueAttribute( 1 ),
        //DescriptionAttribute( "Number of bits in the last part of a character frame [1, 1.5, or 2 stop bits]" )
        //]
        //public sbyte StopBits
        //{
        //  get
        //  {
        //    return ( m_Parent2.StopBits );
        //  }
        //  set
        //  {
        //    m_Parent2.StopBits = value;
        //  }
        //}

        //#region Flow Control
        ///*Following attributes shall be browsable only in software/hardware flow control CASE*/
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "Transmit CTS control" )
        //]
        //public bool TxFlowCTS
        //{
        //  get { return ( m_Parent2.TxFlowCTS ); }
        //  set { m_Parent2.TxFlowCTS = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "Transmit DSR control" )
        //]
        //public bool TxFlowDSR
        //{
        //  get { return ( m_Parent2.TxFlowDSR ); }
        //  set { m_Parent2.TxFlowDSR = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "Transmit ??????" )
        //]
        //public bool TxFlowX
        //{
        //  get { return ( m_Parent2.TxFlowX ); }
        //  set { m_Parent2.TxFlowX = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public bool TxWhenRxXoff
        //{
        //  get { return ( m_Parent2.TxWhenRxXoff ); }
        //  set { m_Parent2.TxWhenRxXoff = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public bool RxGateDSR
        //{
        //  get { return ( m_Parent2.RxGateDSR ); }
        //  set { m_Parent2.RxGateDSR = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "Receive ??????" )
        //]
        //public bool RxFlowX
        //{
        //  get { return ( m_Parent2.RxFlowX ); }
        //  set { m_Parent2.RxFlowX = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public sbyte UseRTS
        //{
        //  get { return ( m_Parent2.UseRTS ); }
        //  set { m_Parent2.UseRTS = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public sbyte UseDTR
        //{
        //  get { return ( m_Parent2.UseDTR ); }
        //  set { m_Parent2.UseDTR = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public sbyte XonChar
        //{
        //  get { return ( m_Parent2.XonChar ); }
        //  set { m_Parent2.XonChar = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public sbyte XoffChar
        //{
        //  get { return ( m_Parent2.XoffChar ); }
        //  set { m_Parent2.XoffChar = value; }
        //}

        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong rxHighWater
        //{
        //  get { return ( m_Parent2.rxHighWater ); }
        //  set { m_Parent2.rxHighWater = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong rxLowWater
        //{
        //  get { return ( m_Parent2.rxLowWater ); }
        //  set { m_Parent2.rxLowWater = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong sendTimeoutMultiplier
        //{
        //  get { return ( m_Parent2.sendTimeoutMultiplier ); }
        //  set { m_Parent2.sendTimeoutMultiplier = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong sendTimeoutConstant
        //{
        //  get { return ( m_Parent2.sendTimeoutConstant ); }
        //  set { m_Parent2.sendTimeoutConstant = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong rxQueue
        //{
        //  get { return ( m_Parent2.rxQueue ); }
        //  set { m_Parent2.rxQueue = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public ulong txQueue
        //{
        //  get { return ( m_Parent2.txQueue ); }
        //  set { m_Parent2.txQueue = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public bool autoReopen
        //{
        //  get { return ( m_Parent2.autoReopen ); }
        //  set { m_Parent2.autoReopen = value; }
        //}
        //[
        //BrowsableAttribute( false ),
        //CategoryAttribute( "Flow Control Settings" ),
        //DefaultValueAttribute( 0 ),
        //DescriptionAttribute( "??????" )
        //]
        //public bool checkAllSends
        //{
        //  get { return ( m_Parent2.checkAllSends ); }
        //  set { m_Parent2.checkAllSends = value; }
        //}
        ////end of Flow Control
        //#endregion //Flow Control
        #endregion
        #endregion
        #region ICommunicationLayerFactory Members
        ICommunicationLayer ICommunicationLayerFactory.CreateCommunicationLayer(CommonBusControl cParent)
        {
            return(new RS_to_Serial(this, cParent));
        }
 internal DDE_to_Serial(string pTraceName, CommonBusControl pParent)
 {
     bytes = new byte[255];
 }
Ejemplo n.º 14
0
 public Medium_to_Serial(string pTraceName, CommonBusControl pParent)
 {
     m_traceName   = pTraceName + ": " + ((uint)m_InstanceNum++).ToString();
     m_TraceSource = pParent.GetTraceSource;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AvailableDPTree"/> class.
 /// </summary>
 /// <param name="pParent">The parent CommonBusControl.</param>
 /// <param name="pOKCnacelForm">The reference to parent form with interface ICanBeAccepted.</param>
 /// <param name="pSetting">The settings.</param>
 /// <param name="pGuid">The GUID.</param>
 public AvailableDPTree(CommonBusControl pParent, ICanBeAccepted pOKCnacelForm, string pSetting, Guid pGuid)
     :
     this(pParent, pOKCnacelForm)
 {
     m_PluginCollection.SetDefaultSsetting(pSetting, pGuid);
 }
Ejemplo n.º 16
0
 internal LocalOperation(Program parent, IDataProviderID dataProviderID, CommonBusControl commonBusControl, IProtocolParent protocolParent, bool readOperation)
 {
     Parent = parent;
     Delay  = System.Convert.ToInt32(parent.@_Delay.Text);
     InitializeOperation(dataProviderID, commonBusControl, protocolParent, readOperation);
 }
 /// <summary>
 /// When overridden in a derived class, instantiates object providing  <see cref="T:CAS.Lib.CommonBus.ApplicationLayer.IApplicationLayerMaster" /> - an object
 /// implementing master side (playing the role on the field network of the master station,) interface defined for the
 /// application layer.
 /// </summary>
 /// <param name="pStatistic">Statistical information about the communication performance.</param>
 /// <param name="pParent"><seealso cref="T:CAS.Lib.CommonBus.CommonBusControl" /> - Base class responsible for all of resources management used
 /// by the component.</param>
 /// <returns>Return an object implementing <see cref="IApplicationLayerMaster"/>.</returns>
 /// <exception cref="System.ArgumentNullException">
 /// </exception>
 public override IApplicationLayerMaster GetApplicationLayerMaster(IProtocolParent pStatistic, CommonBusControl pParent)
 {
     if (pStatistic == null)
     {
         throw new ArgumentNullException($"{pStatistic} cannot be null");
     }
     if (pParent == null)
     {
         throw new ArgumentNullException($"{pParent} cannot be null");
     }
     return(new TextReaderApplicationLayerMaster(pStatistic, pParent, ProtocolParameters));
 }
Ejemplo n.º 18
0
 protected CommBase(string pName, CommonBusControl pParent)
     : base(pName, pParent)
 {
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Instantiate new object providing <see>ICommunicationLayer</see> functionality.
 /// </summary>
 /// <param name="pParent">Base class responsible for the resources management.</param>
 /// An object providing the <returns><see>ICommunicationLayer</see>functionality</returns>
 public ICommunicationLayer CreateCommunicationLayer(CommonBusControl pParent)
 {
     m_CommunicationLayerDescription.SetSettings(m_SocketNumber, m_ProtocolType, m_LayerName);
     return(new Net_to_Serial(m_SocketNumber, m_ProtocolType, m_LayerName, pParent));
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Instantiate new object providing <see>ICommunicationLayer</see> functionality.
 /// </summary>
 /// <param name="pParent">Base class responsible for the resources management.</param>
 /// An object providing the <returns><see>ICommunicationLayer</see>functionality</returns>
 public ICommunicationLayer CreateCommunicationLayer(CommonBusControl pParent)
 {
     m_NullCommunicationLayerDescription.SetSettings(m_LayerName);
     return(new NULL_to_Serial(m_LayerName, pParent));
 }
Ejemplo n.º 21
0
 public override Lib.CommonBus.ApplicationLayer.IApplicationLayerMaster GetApplicationLayerMaster(IProtocolParent pStatistic, CommonBusControl pParent)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 22
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Net_to_Serial"/> class that implements
        /// of the <see cref="ICommunicationLayer"/> for the UDP and TCP protocols.
        /// </summary>
        /// <param name="sockedNum">
        /// The socked num used by the UDP protocol to send and receive packets.
        /// If 0 the underling service allocates dynamically appropriate number –
        /// it is preferred approach. For TCP this parameter is ignored.
        /// </param>
        /// <param name="protocol">The protocol type one of the <see cref="ProtocolType"/> values.</param>
        /// <param name="pTraceName">Name of the trace.</param>
        /// <param name="pParent">The parent component.</param>
        internal Net_to_Serial(short sockedNum, ProtocolType protocol, string pTraceName, CommonBusControl pParent)
            : base(pTraceName, pParent)
        {
            m_ProtocolType = protocol;
            m_SocketNum    = sockedNum;
            if (m_SocketNum < 0)
            {
                m_SocketNum = 0;
            }
            switch (protocol)
            {
            case ProtocolType.Tcp:
                TraceEvent(TraceEventType.Information, 361, "Creating TCP serial communication layer protocol ");
                break;

            case ProtocolType.Udp:
                TraceEvent(TraceEventType.Information, 364, "Creating UDP serial communication layer protocol ");
                break;

            default:
                throw (new ArgumentException("Net_to_Serial: ProtocolType not supported"));
            }
        }