private IApplicationLayerMaster CreateApplicationProtocol(ComunicationNet.ProtocolRow protocol, CommServerComponent parent, PluginCollection plugins, ISettingsBase settings) { CommServerComponent.Tracer.TraceVerbose(60, m_src, "Creating protocol: " + protocol.Name); if (protocol.IsDPIdentifierNull()) { //the protocol is not set so it cannot be created CommServerComponent.Tracer.TraceWarning(65, m_src, "The protocol is not set so it cannot be created, channel = " + this.myStatistics.myName); return(null); } CommServerComponent.Tracer.TraceVerbose(69, m_src, string.Format("Trying to find data provider: {0}", protocol.DPIdentifier.ToString())); try { IDataProviderID _DataProviderID = plugins[protocol.DPIdentifier]; if (_DataProviderID != null) { string _format = "OK I have got DataProvider. Name = {0} [{1}]"; CommServerComponent.Tracer.TraceVerbose(77, m_src, string.Format(_format, _DataProviderID.Title, _DataProviderID.GetDataProviderDescription.FullName)); try { _DataProviderID.SetSettings(protocol.DPConfig); } catch (XmlException xe) { _format = "Problem with: {0} because of Xml content: {1}."; CommServerComponent.Tracer.TraceWarning(85, m_src, string.Format(_format, protocol.DPConfig, xe.ToString())); } catch (Exception e) { _format = "Problem with: {0} because of general failure: {1}."; CommServerComponent.Tracer.TraceWarning(90, m_src, string.Format(_format, protocol.DPConfig, e.ToString())); } IProtocolParent cStatistic = Diagnostic.CommServerProtocol.CreateNewProtocol(protocol.DPConfig, protocol.Name, protocol.ProtocolID, _DataProviderID.GetSettingsHumanReadableFormat(), myStatistics, settings); IApplicationLayerMaster chnProtocol = _DataProviderID.GetApplicationLayerMaster(cStatistic, parent.m_CommonBusControl); CommServerComponent.Tracer.TraceVerbose(95, m_src, "I have created the DataProvider helper object."); return(chnProtocol); } else { string _message = "The data provider you are looking for is not available – check your configuration and execution path of the product."; CommServerComponent.Tracer.TraceInformation(102, m_src, _message); } }//try catch (System.ComponentModel.LicenseException ex) { string _format = "The component cannot be granted a license: {0}."; CommServerComponent.Tracer.TraceWarning(108, m_src, string.Format(_format, ex.LicensedType.ToString())); } catch (Exception _ex) { CommServerComponent.Tracer.TraceWarning(112, m_src, string.Format("Some problem encountered while trying to get a DataProvider. Exception {0}.", _ex.Message)); } return(null); }
internal NULL_ApplicationLayerSlave(ComunicationNet.ProtocolRow protDsc) { this.myStatistic = BaseStation.Management.Protocol.CreateNewProtocol("Ec23 slave protocol", protDsc.Name, protDsc.ProtocolID); }