Files

100 lines
4.4 KiB
C#
Raw Permalink Normal View History

2026-04-17 14:55:32 -04:00
using System;
namespace DTS.Common.Interface.DASFactory.Download
{
public interface IDownload
{
/// <summary>
/// What do you want to download?
/// </summary>
IDownloadRequest WhatToDownload { get; set; }
void SetWhatToDownload(IDownloadRequest request, bool bSetInDb = true);
/// <summary>
/// The Retrieved information about stored events.
/// </summary>
IDownloadReport EventInfo { get; set; }
void SetEventInfo(IDownloadReport eventInfo, bool bSetInDb = true);
/// <summary>
/// QueryDownloadedStatus will fill this array (indexed by event number, true if
/// HasBeenDownloaded was set for this event, false otherwise)
/// </summary>
bool[] EventDownloadedStatus { get; set; }
void SetEventDownloadStatus(bool[] status, bool storeInDb = true);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
Guid[] EventGuids { get; set; }
void SetEventGuids(Guid[] guids, bool storeInDb = true);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
ushort[] FaultFlags { get; set; }
void SetEventFaultFlags(ushort[] flags, bool storeInDb = true);
/// <summary>
/// any extended fault flags1, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags1 { get; set; }
/// <summary>
/// any extended fault flags2, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags2 { get; set; }
/// <summary>
/// any extended fault flags3, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags3 { get; set; }
/// <summary>
/// any extended fault flags4, if there are multiple events then each event is an additional index
/// however downloads are always done one event at a time
/// </summary>
uint[] ExtendedFaultFlags4 { get; set; }
/// <summary>
/// sets the properties for extended fault flags, first array is always events, second array is extended fault flags
/// there are currently 4 extended fault flags in SLICE
/// http://manuscript.dts.local/f/cases/39223/
/// </summary>
/// <param name="flags"></param>
void SetExtendedFaultFlags(uint[][] flags);
/// <summary>
/// DASFactory will fill this array (indexed by event number).
/// </summary>
byte[] ArmAttempts { get; set; }
void SetEventArmAttemps(byte[] armAttempts, bool storeInDb = true);
}
public interface IDownloadPathAware
{
string EventPath { get; set; }
}
public static class DownloadExtendedFaultFunctions
{
public static void SetExtendedFaultFlags(uint[][] flags, IDownload download)
{
if (null == flags || 0 == flags.Length)
{
ClearExtendedFaultFlags(download);
return;
}
download.ExtendedFaultFlags1 = new uint[flags.Length];
download.ExtendedFaultFlags2 = new uint[flags.Length];
download.ExtendedFaultFlags3 = new uint[flags.Length];
download.ExtendedFaultFlags4 = new uint[flags.Length];
for (var i = 0; i < flags.Length; i++)
{
download.ExtendedFaultFlags1[i] = flags[i].Length > 0 ? flags[i][0] : 0;
download.ExtendedFaultFlags2[i] = flags[i].Length > 1 ? flags[i][1] : 0;
download.ExtendedFaultFlags3[i] = flags[i].Length > 2 ? flags[i][2] : 0;
download.ExtendedFaultFlags4[i] = flags[i].Length > 3 ? flags[i][3] : 0;
}
}
public static void ClearExtendedFaultFlags(IDownload download)
{
download.ExtendedFaultFlags1 = null;
download.ExtendedFaultFlags2 = null;
download.ExtendedFaultFlags3 = null;
download.ExtendedFaultFlags4 = null;
}
}
}