Files
V2GDecoderC/Port/dotnet/EXI/DinEXIDocument.cs
chiDT d5263abab0 feat: Perfect C# structure alignment with VC2022 for exact debugging
Major architectural refactoring to achieve 1:1 structural compatibility:

🏗️ **VC2022 Structure Replication**
- Iso1EXIDocument: 1:1 replica of VC2022 iso1EXIDocument struct
- DinEXIDocument: 1:1 replica of VC2022 dinEXIDocument struct
- Iso2EXIDocument: 1:1 replica of VC2022 iso2EXIDocument struct
- All _isUsed flags and Initialize() methods exactly matching VC2022

🔄 **VC2022 Function Porting**
- ParseXmlToIso1(): Exact port of VC2022 parse_xml_to_iso1()
- EncodeIso1ExiDocument(): Exact port of VC2022 encode_iso1ExiDocument()
- Choice 76 (V2G_Message) encoding with identical logic
- BulkChargingComplete ignore behavior preserved

 **Call Sequence Alignment**
- Old: EncodeV2GMessage() → direct EXI encoding
- New: EncodeV2GMessage() → Iso1EXIDocument → EncodeIso1ExiDocument()
- Exact VC2022 call chain: init → parse → encode → finish

🔍 **1:1 Debug Comparison Ready**
- C# exiDoc.V2G_Message_isUsed ↔ VC2022 exiDoc->V2G_Message_isUsed
- Identical structure enables line-by-line debugging comparison
- Ready for precise 1-byte difference investigation (41 vs 42 bytes)

📁 **Project Reorganization**
- Moved from csharp/ to Port/ for cleaner structure
- Port/dotnet/ and Port/vc2022/ for parallel development
- Complete build system and documentation updates

🎯 **Achievement**: 97.6% binary compatibility (41/42 bytes)
Next: 1:1 debug session to identify exact byte difference location

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-10 22:01:08 +09:00

120 lines
5.1 KiB
C#

/*
* Copyright (C) 2007-2024 C# Port
* Original Copyright (C) 2007-2018 Siemens AG
*
* DinEXIDocument - 1:1 replica of VC2022 dinEXIDocument structure
* DIN SPEC 70121 version
*/
using V2GDecoderNet.V2G;
namespace V2GDecoderNet.EXI
{
/// <summary>
/// 1:1 replica of VC2022's struct dinEXIDocument for DIN SPEC 70121
/// This enables exact debugging comparison and identical call sequences
/// </summary>
public class DinEXIDocument
{
// Core V2G_Message for DIN
public bool V2G_Message_isUsed { get; set; }
public V2GMessageExact V2G_Message { get; set; } = new V2GMessageExact();
// DIN-specific message types
public bool SessionSetupReq_isUsed { get; set; }
public bool SessionSetupRes_isUsed { get; set; }
public bool ServiceDiscoveryReq_isUsed { get; set; }
public bool ServiceDiscoveryRes_isUsed { get; set; }
public bool ServicePaymentSelectionReq_isUsed { get; set; }
public bool ServicePaymentSelectionRes_isUsed { get; set; }
public bool PaymentDetailsReq_isUsed { get; set; }
public bool PaymentDetailsRes_isUsed { get; set; }
public bool ContractAuthenticationReq_isUsed { get; set; }
public bool ContractAuthenticationRes_isUsed { get; set; }
public bool ChargeParameterDiscoveryReq_isUsed { get; set; }
public bool ChargeParameterDiscoveryRes_isUsed { get; set; }
public bool PowerDeliveryReq_isUsed { get; set; }
public bool PowerDeliveryRes_isUsed { get; set; }
public bool ChargingStatusReq_isUsed { get; set; }
public bool ChargingStatusRes_isUsed { get; set; }
public bool MeteringReceiptReq_isUsed { get; set; }
public bool MeteringReceiptRes_isUsed { get; set; }
public bool SessionStopReq_isUsed { get; set; }
public bool SessionStopRes_isUsed { get; set; }
// DIN DC charging specific
public bool CableCheckReq_isUsed { get; set; }
public bool CableCheckRes_isUsed { get; set; }
public bool PreChargeReq_isUsed { get; set; }
public bool PreChargeRes_isUsed { get; set; }
public bool CurrentDemandReq_isUsed { get; set; }
public bool CurrentDemandRes_isUsed { get; set; }
public bool WeldingDetectionReq_isUsed { get; set; }
public bool WeldingDetectionRes_isUsed { get; set; }
// DIN-specific data types
public bool BodyElement_isUsed { get; set; }
public bool DC_EVStatus_isUsed { get; set; }
public bool DC_EVSEStatus_isUsed { get; set; }
public bool EVChargeParameter_isUsed { get; set; }
public bool EVSEChargeParameter_isUsed { get; set; }
// Certificate and security related (DIN)
public bool CertificateInstallationReq_isUsed { get; set; }
public bool CertificateInstallationRes_isUsed { get; set; }
public bool CertificateUpdateReq_isUsed { get; set; }
public bool CertificateUpdateRes_isUsed { get; set; }
/// <summary>
/// Initialize document structure - equivalent to init_dinEXIDocument()
/// </summary>
public void Initialize()
{
// Reset all _isUsed flags to false (VC2022 behavior)
V2G_Message_isUsed = false;
SessionSetupReq_isUsed = false;
SessionSetupRes_isUsed = false;
ServiceDiscoveryReq_isUsed = false;
ServiceDiscoveryRes_isUsed = false;
ServicePaymentSelectionReq_isUsed = false;
ServicePaymentSelectionRes_isUsed = false;
PaymentDetailsReq_isUsed = false;
PaymentDetailsRes_isUsed = false;
ContractAuthenticationReq_isUsed = false;
ContractAuthenticationRes_isUsed = false;
ChargeParameterDiscoveryReq_isUsed = false;
ChargeParameterDiscoveryRes_isUsed = false;
PowerDeliveryReq_isUsed = false;
PowerDeliveryRes_isUsed = false;
ChargingStatusReq_isUsed = false;
ChargingStatusRes_isUsed = false;
MeteringReceiptReq_isUsed = false;
MeteringReceiptRes_isUsed = false;
SessionStopReq_isUsed = false;
SessionStopRes_isUsed = false;
CableCheckReq_isUsed = false;
CableCheckRes_isUsed = false;
PreChargeReq_isUsed = false;
PreChargeRes_isUsed = false;
CurrentDemandReq_isUsed = false;
CurrentDemandRes_isUsed = false;
WeldingDetectionReq_isUsed = false;
WeldingDetectionRes_isUsed = false;
BodyElement_isUsed = false;
DC_EVStatus_isUsed = false;
DC_EVSEStatus_isUsed = false;
EVChargeParameter_isUsed = false;
EVSEChargeParameter_isUsed = false;
CertificateInstallationReq_isUsed = false;
CertificateInstallationRes_isUsed = false;
CertificateUpdateReq_isUsed = false;
CertificateUpdateRes_isUsed = false;
// Initialize V2G_Message structure
V2G_Message = new V2GMessageExact();
}
}
}