ExperionCrawler First Commit
This commit is contained in:
80
src/Core/Application/Interfaces/IExperionServices.cs
Normal file
80
src/Core/Application/Interfaces/IExperionServices.cs
Normal file
@@ -0,0 +1,80 @@
|
||||
using ExperionCrawler.Core.Domain.Entities;
|
||||
|
||||
namespace ExperionCrawler.Core.Application.Interfaces;
|
||||
|
||||
// ── Certificate ──────────────────────────────────────────────────────────────
|
||||
|
||||
public interface IExperionCertificateService
|
||||
{
|
||||
/// <summary>인증서가 없으면 생성, 있으면 기존 반환</summary>
|
||||
Task<ExperionCertResult> EnsureCertificateAsync(
|
||||
string applicationUri,
|
||||
string clientHostName,
|
||||
IEnumerable<string> subjectAltNames,
|
||||
string pfxPassword = "");
|
||||
|
||||
bool CertificateExists(string clientHostName);
|
||||
ExperionCertInfo GetCertificateInfo(string clientHostName);
|
||||
}
|
||||
|
||||
// ── OPC UA Client ────────────────────────────────────────────────────────────
|
||||
|
||||
public interface IExperionOpcClient
|
||||
{
|
||||
Task<ExperionConnectResult> TestConnectionAsync(ExperionServerConfig cfg);
|
||||
Task<ExperionReadResult> ReadTagAsync(ExperionServerConfig cfg, string nodeId);
|
||||
Task<IEnumerable<ExperionReadResult>> ReadTagsAsync(ExperionServerConfig cfg, IEnumerable<string> nodeIds);
|
||||
Task<ExperionBrowseResult> BrowseNodesAsync(ExperionServerConfig cfg, string? startNodeId = null);
|
||||
Task<ExperionNodeMapResult> BrowseAllNodesAsync(ExperionServerConfig cfg, int maxDepth = 10, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
// ── CSV ──────────────────────────────────────────────────────────────────────
|
||||
|
||||
public interface IExperionCsvService
|
||||
{
|
||||
Task<string> ExportAsync(IEnumerable<ExperionRecord> records, string fileName);
|
||||
Task<IEnumerable<ExperionRecord>> ImportAsync(string filePath);
|
||||
IEnumerable<string> GetAvailableFiles();
|
||||
Task<string> ExportNodeMapAsync(IEnumerable<ExperionNodeMapEntry> entries, string fileName);
|
||||
}
|
||||
|
||||
// ── Database ─────────────────────────────────────────────────────────────────
|
||||
|
||||
public interface IExperionDbService
|
||||
{
|
||||
Task<bool> InitializeAsync();
|
||||
Task<int> SaveRecordsAsync(IEnumerable<ExperionRecord> records);
|
||||
Task<int> ClearRecordsAsync();
|
||||
Task<int> BuildMasterFromRawAsync(bool truncate = false);
|
||||
Task<IEnumerable<ExperionRecord>> GetRecordsAsync(DateTime? from = null, DateTime? to = null, int limit = 1000);
|
||||
Task<int> GetTotalCountAsync();
|
||||
Task<IEnumerable<string>> GetNameListAsync();
|
||||
Task<NodeMapStats> GetMasterStatsAsync();
|
||||
Task<NodeMapQueryResult> QueryMasterAsync(
|
||||
int? minLevel, int? maxLevel, string? nodeClass,
|
||||
IEnumerable<string>? names, string? nodeId, string? dataType,
|
||||
int limit, int offset);
|
||||
}
|
||||
|
||||
// ── Status Code ──────────────────────────────────────────────────────────────
|
||||
|
||||
public interface IExperionStatusCodeService
|
||||
{
|
||||
ExperionStatusCodeInfo? GetByHex(string hexCode);
|
||||
ExperionStatusCodeInfo? GetByUint(uint statusCode);
|
||||
int LoadedCount { get; }
|
||||
}
|
||||
|
||||
// ── Result records ───────────────────────────────────────────────────────────
|
||||
|
||||
public record ExperionCertResult (bool Success, string Message, string? ThumbPrint = null);
|
||||
public record ExperionCertInfo (bool Exists, string? SubjectName, DateTime? NotAfter, string? ThumbPrint, string FilePath);
|
||||
public record ExperionConnectResult(bool Success, string Message, string? SessionId = null, string? PolicyUri = null);
|
||||
public record ExperionReadResult (bool Success, string NodeId, object? Value, string StatusCode,
|
||||
string? ErrorMessage = null, DateTime? Timestamp = null);
|
||||
public record ExperionBrowseResult(bool Success, IEnumerable<ExperionNodeInfo> Nodes, string? ErrorMessage = null);
|
||||
public record ExperionNodeInfo (string NodeId, string DisplayName, string NodeClass, bool HasChildren);
|
||||
public record ExperionNodeMapEntry(int Level, string NodeClass, string DisplayName, string NodeId, string DataType);
|
||||
public record ExperionNodeMapResult(bool Success, IEnumerable<ExperionNodeMapEntry> Nodes, int TotalCount, string? ErrorMessage = null);
|
||||
public record NodeMapStats(int Total, int ObjectCount, int VariableCount, int MaxLevel, IEnumerable<string> DataTypes);
|
||||
public record NodeMapQueryResult(int Total, IEnumerable<NodeMapMaster> Items);
|
||||
Reference in New Issue
Block a user