init
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// From which event do we want to download data?
|
||||
/// </summary>
|
||||
public ushort EventNumber { get; set; }
|
||||
/// <summary>
|
||||
/// How much data is there?
|
||||
/// </summary>
|
||||
public ulong TotalByteCount { get; set; }
|
||||
/// <summary>
|
||||
/// Where in the data did the trigger occur?
|
||||
/// </summary>
|
||||
public ulong TriggerByteCount { get; set; }
|
||||
/// <summary>
|
||||
/// Where in the data did the fault occur?
|
||||
/// </summary>
|
||||
public ulong FaultByteCount { get; set; }
|
||||
/// <summary>
|
||||
/// When did the UART stream start?
|
||||
/// </summary>
|
||||
public ulong StartTimestamp { get; set; }
|
||||
/// <summary>
|
||||
/// When did the UART stream end?
|
||||
/// </summary>
|
||||
public ulong EndTimestamp { get; set; }
|
||||
/// <summary>
|
||||
/// What was the baud rate during recording?
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user