//****************************************************************************************************** // ConnectionParameters.cs - Gbtc // // Copyright © 2012, Grid Protection Alliance. All Rights Reserved. // // Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See // the NOTICE file distributed with this work for additional information regarding copyright ownership. // The GPA licenses this file to you under the MIT License (MIT), the "License"; you may // not use this file except in compliance with the License. You may obtain a copy of the License at: // // http://www.opensource.org/licenses/MIT // // Unless agreed to in writing, the subject software distributed under the License is distributed on an // "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the // License for the specific language governing permissions and limitations. // // Code Modification History: // ---------------------------------------------------------------------------------------------------- // 04/27/2009 - J. Ritchie Carroll // Generated original version of source code. // 09/15/2009 - Stephen C. Wills // Added new header and license agreement. // 12/17/2012 - Starlynn Danyelle Gilliam // Modified Header. // //****************************************************************************************************** using System; using System.ComponentModel; using System.Runtime.Serialization; namespace GSF.PhasorProtocols.SelFastMessage { /// /// Represents the extra connection parameters required for a connection to a SEL device. /// /// /// This class is designed to be exposed by a "PropertyGrid" so a UI can request protocol specific connection parameters. /// As a result the and elements should be defined for /// each of the exposed properties. /// [Serializable] public class ConnectionParameters : ConnectionParametersBase { #region [ Members ] // Fields private MessagePeriod m_messagePeriod; #endregion #region [ Constructors ] /// /// Creates a new . /// public ConnectionParameters() { m_messagePeriod = MessagePeriod.DefaultRate; } /// /// Creates a new from serialization parameters. /// /// The with populated with data. /// The source for this deserialization. protected ConnectionParameters(SerializationInfo info, StreamingContext context) { // Deserialize connection parameters m_messagePeriod = info.GetOrDefault("messagePeriod", MessagePeriod.DefaultRate); } #endregion #region [ Properties ] /// /// Gets or sets desired for SEL device. /// [Category("Optional Connection Parameters"), Description("Defines desired message period for SEL device. Default rate is 20 messages per second. Note that slower rates (i.e., 20 messages per minute down to 1 message per minute) are only supported by the SEL 300 series relays."), DefaultValue(typeof(MessagePeriod), "DefaultRate")] public MessagePeriod MessagePeriod { get => m_messagePeriod; set => m_messagePeriod = value; } #endregion #region [ Methods ] /// /// Populates a with the data needed to serialize the target object. /// /// The to populate with data. /// The destination for this serialization. public override void GetObjectData(SerializationInfo info, StreamingContext context) { // Serialize connection parameters info.AddValue("messagePeriod", m_messagePeriod, typeof(MessagePeriod)); } #endregion } }