qualisys / qualisys_dotnet_sdk

C# (.NET) implementation of the real-time protocol for Qualisys Track Manager
MIT License
8 stars 5 forks source link

Handle Enum -> object xml parsing difficulties when encountering xml enum values not recognized #19

Closed mlveggo closed 3 years ago

mlveggo commented 4 years ago

Now all enum types have a Unknown value which it will default to if xml parsing isn't possible (no throws in deserialization).

qjgn commented 4 years ago

A bunch of fields are missing the special treatment. Even if they are unlikely to fail I think it's good to have a uniform approach. see public struct SettingsExternalTimeBase

mlveggo commented 4 years ago

Adding a new member in settingsexternaltimebase structure will not cause a xml deserialization exception. Only enum types require this treatment.

qjgn commented 4 years ago
    public struct SettingsExternalTimeBase
    {
        [XmlElement("Enabled")]
        public bool Enabled;
        [XmlElement("Signal_Source")]
        public SignalSource SignalSource; <-- member field missing special treatment
        [XmlElement("Signal_Mode")]
        public SignalMode SignalMode; <-- member field missing special treatment
        [XmlElement("Frequency_Multiplier")]
        public int FreqMultiplier;
        [XmlElement("Frequency_Divisor")]
        public int FreqDivisor;
        [XmlElement("Frequency_Tolerance")]
        public int FreqTolerance;
        [XmlElement("Nominal_Frequency")]
        public float NominalFrequency;
        [XmlElement("Signal_Edge")]
        public SignalEdge SignalEdge; <-- member field missing special treatment
        [XmlElement("Signal_Shutter_Delay")]
        public int SignalShutterDelay;
        [XmlElement("Non_Periodic_Timeout")]
        public float NonPeriodicTimeout;
    }