Initial commit: managed .NET 10 AVEVA Historian SDK + reverse-engineering toolkit
Full read-only SDK (src/AVEVA.Historian.Client) implementing the CLAUDE.md required
surface against AVEVA Historian's binary WCF protocol — no native AVEVA runtime
dependency. All operations live-verified against a local Historian:
- ProbeAsync, ReadRawAsync, ReadAggregateAsync, ReadAtTimeAsync, ReadEventsAsync
- BrowseTagNamesAsync, GetTagMetadataAsync (17 native data-type codes mapped)
- GetConnectionStatusAsync, GetStoreForwardStatusAsync, GetSystemParameterAsync
- 108/108 unit + integration tests pass
Includes the reverse-engineering toolkit (tools/AVEVA.Historian.ReverseEngineering)
used to decode the protocol: WCF probes, IL inspection via dnlib, and IL-rewrite
instrumentation (instrument-wcf-{write,read}message etc.) plus the .NET Framework
trace harness (tools/AVEVA.Historian.NativeTraceHarness) for parity testing.
Sanitized handoff evidence under docs/reverse-engineering/. Native AVEVA binaries
(current/, aveva-install-x64/, aveva-install-x86/) are gitignored — fetch separately
from the AVEVA installer.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System.Text;
|
||||
using AVEVA.Historian.Client.Protocol;
|
||||
|
||||
namespace AVEVA.Historian.Client.Tests;
|
||||
|
||||
public sealed class BinaryPrimitiveTests
|
||||
{
|
||||
[Fact]
|
||||
public void ToFileTimeUtc_TreatsUnspecifiedAsUtc()
|
||||
{
|
||||
DateTime value = new(2020, 4, 5, 10, 7, 42, DateTimeKind.Unspecified);
|
||||
|
||||
long actual = HistorianBinaryPrimitives.ToFileTimeUtc(value);
|
||||
|
||||
Assert.Equal(DateTime.SpecifyKind(value, DateTimeKind.Utc).ToFileTimeUtc(), actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteUtf16NullTerminated_WritesUnicodeWithTerminator()
|
||||
{
|
||||
using MemoryStream stream = new();
|
||||
|
||||
HistorianBinaryPrimitives.WriteUtf16NullTerminated(stream, "UTC");
|
||||
|
||||
Assert.Equal(Encoding.Unicode.GetBytes("UTC\0"), stream.ToArray());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteFileTimeUtc_WritesLittleEndianUInt64()
|
||||
{
|
||||
DateTime value = new(2020, 4, 5, 10, 7, 42, DateTimeKind.Utc);
|
||||
using MemoryStream stream = new();
|
||||
|
||||
HistorianBinaryPrimitives.WriteFileTimeUtc(stream, value);
|
||||
|
||||
Assert.Equal(BitConverter.GetBytes(value.ToFileTimeUtc()), stream.ToArray());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user