c95824a65d
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>
47 lines
2.1 KiB
C#
47 lines
2.1 KiB
C#
using AVEVA.Historian.Client.Wcf;
|
|
|
|
namespace AVEVA.Historian.Client.Tests;
|
|
|
|
public sealed class WcfEventQueryProtocolTests
|
|
{
|
|
[Fact]
|
|
public void SerializerMatchesInstrumentedNativeEventRequest()
|
|
{
|
|
HistorianEventQueryAttempt attempt = Assert.Single(HistorianEventQueryProtocol.CreateStartEventQueryAttempts(
|
|
new DateTime(2026, 4, 25, 14, 39, 36, 800, DateTimeKind.Utc).AddTicks(1646),
|
|
new DateTime(2026, 5, 2, 14, 39, 36, 800, DateTimeKind.Utc).AddTicks(1646),
|
|
3));
|
|
|
|
byte[] expected = Convert.FromBase64String(
|
|
"BQBuHAVXwdTcAW5c6X9B2twBAwAAAAAAAAAAAAEAAAAAAAAAAAAAAQADAAAAVQBUAEMAAQEAAAEAAAEAAAAAAAA=");
|
|
|
|
Assert.Equal(expected, attempt.RequestBuffer);
|
|
Assert.Equal("6b955b02087047a3199a8c74f3eee85c3b49aaa29b05de12eff2dd536f2da0d5", attempt.RequestSha256);
|
|
}
|
|
|
|
[Fact]
|
|
public void NativeEmptyFilterAttemptMatchesDecompiledSaveOrder()
|
|
{
|
|
HistorianEventQueryAttempt attempt = Assert.Single(HistorianEventQueryProtocol.CreateStartEventQueryAttempts(
|
|
new DateTime(2026, 1, 1, 0, 0, 0, DateTimeKind.Utc),
|
|
new DateTime(2026, 1, 1, 0, 1, 0, DateTimeKind.Utc),
|
|
3));
|
|
|
|
byte[] actual = attempt.RequestBuffer;
|
|
|
|
Assert.Equal("native-empty-filter-version5", attempt.Name);
|
|
Assert.Equal(3, HistorianEventQueryProtocol.QueryRequestTypeEvent);
|
|
Assert.Equal(65, actual.Length);
|
|
Assert.Equal([0x05, 0x00], actual[..2]);
|
|
Assert.Equal(3u, BitConverter.ToUInt32(actual, 18));
|
|
Assert.Equal(0u, BitConverter.ToUInt32(actual, 22));
|
|
Assert.Equal(0, BitConverter.ToUInt16(actual, 26));
|
|
Assert.Equal(1, BitConverter.ToUInt16(actual, 28));
|
|
Assert.Equal([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00], actual[30..37]);
|
|
Assert.Equal(65_536u, BitConverter.ToUInt32(actual, 37));
|
|
Assert.Equal([0x03, 0x00, 0x00, 0x00, 0x55, 0x00, 0x54, 0x00, 0x43, 0x00], actual[41..51]);
|
|
Assert.Equal([0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00], actual[51..61]);
|
|
Assert.Equal([0x00, 0x00, 0x00, 0x00], actual[^4..]);
|
|
}
|
|
}
|