using System; using Xylem.Common.Hardware.Interfaces.Ports.PortCore; using Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol; namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisConfig { /// /// Setup of communication timeouts and retries for request and streaming protocol, /// this timeout starts the retry. /// /// The individual timings of the hardware will be covert by the /// /// injected by the different transmit protocols: /// /// /// /// /// public static class CommunicationConfig { private static Int32 _requestRetries = DefaultRequestRetries; /// /// Maximum retries for one command at request protocol /// at missing response. /// public static Int32 RequestRetries { get => _requestRetries; set => _requestRetries = value > MaxRequestRetries ? MaxRequestRetries : value; } /// /// Acceptable error code as valid answer to skip retries, /// this might be 0x0004 for not installed application. /// public const UInt16 SkipRetryErrorCode = 0x0004; /// /// Default retries for one command at request protocol /// at missing response. /// public const Int32 DefaultRequestRetries = 2; /// /// Limit retries to this value. /// public const Int32 MaxRequestRetries = 6; /// /// Send delay between records in milliseconds before /// new record is going to be sent or between retries, /// this time is independent of the timeout, it is /// used to delay the next send record after successful /// response from meter. /// public const Int32 InterRecordSendDelayMs = 5; //public const Int32 InterRecordSendDelayMs = 50; /// /// Timeout before retry will be initiated in milliseconds /// for the response of the request protocol. This is an /// offset value, the transmission specific timing will be /// added from the transmit protocol timeout. This timeout /// will be multiplied with the (retry + 1)! /// public const Int32 ResponseTimeoutMs = 250; // public const Int32 ResponseTimeoutMs = 100; /// /// Timeout before retry will be initiated if the meter is /// not ready indicated by a wakeup-message or decoding error. /// public const Int32 BusyTimeoutMs = 500; // public const Int32 BusyTimeoutMs = 1000; /// /// Time to avoid automatic lock off of genesis device due to /// missing communication with request protocol in seconds /// public const Int32 KeepSessionTimeS = 60 * 3; /// /// Time to update intermediate record for overflow detection /// during a measurement and update of short-term measurement /// in seconds /// public const Int32 MeasurementUpdateTimeS = 10; } }