using System; using System.Runtime.Remoting.Messaging; using DASFactoryDb.Download; using DTS.Common.Interface.DASFactory; using DTS.Common.Interface.DASFactory.Download; using DTS.Common.Utilities.Logging; namespace DTS.DASLib.Service { public class UARTDownloadRequest : IUARTDownloadRequest { /// /// From which event do we want to download data? /// public ushort EventNumber { get; set; } /// /// How much data is there? /// public ulong TotalByteCount { get; set; } /// /// Where in the data did the trigger occur? /// public ulong TriggerByteCount { get; set; } /// /// Where in the data did the fault occur? /// public ulong FaultByteCount { get; set; } /// /// When did the UART stream start? /// public ulong StartTimestamp { get; set; } /// /// When did the UART stream end? /// public ulong EndTimestamp { get; set; } /// /// What was the baud rate during recording? /// public int BaudRate { get; set; } public static void SetWhatToDownload(IDASCommunication das, IUARTDownloadRequest request, bool bSetInDb) { if (!(das is IUARTDownload udas)) return; udas.WhatUARTToDownload = request; if (!bSetInDb || !DASFactoryDb.DbWrapper.Connected) { return; } try { Download.ClearExistingUARTDownloadRequests(das.RecordId); if (null != request) { Download.UARTDownloadRequestInsert(das.RecordId, request.EventNumber, request.TotalByteCount, request.TriggerByteCount, request.FaultByteCount, request.StartTimestamp, request.EndTimestamp, request.BaudRate); } } catch (Exception ex) { APILogger.Log(ex); } } } }