Skip to content

Use short form SCPI in Enums #201

Description

@brocci-ks

It would be better to use short form SCPI in enumeration to enable use of templates. For example:

        public enum MeasurementFormatEnum
        {
            [Display("Lin Mag")]
            MLINear,
            [Display("Log Mag")]
            MLOGarithmic,
            [Display("Phase")]
            PHASe,
            [Display("Unwrapped Phase")]
            UPHase,
            [Display("Imaginary")]
            IMAGinary,
            [Display("Real")]
            REAL,
            [Display("Polar")]
            POLar,
            [Display("Smith")]
            SMITh,
            [Display("Inverted Smith")]
            SADMittance,
            [Display("SWR")]
            SWR,
            [Display("Group Delay")]
            GDELay,
            [Display("Kelvin")]
            KELVin,
            [Display("Fahrenheit")]
            FAHRenheit,
            [Display("Celsius")]
            CELSius,
            [Display("Positive Phase")]
            PPHase,
            [Display("Complex")]
            COMPlex
        }

This is causing the following to fail:

MeasurementFormatEnum measFormat = PNAX.ScpiQuery<MeasurementFormatEnum>($"CALCulate{channel}:MEASure{measurementNumber}:FORMat?");

with a System.Collections.Generic.KeyNotFoundException.

This would work:

        public enum MeasurementFormatEnum
        {
            [Display("Lin Mag")]
            MLIN,
            [Display("Log Mag")]
            MLOG,
            [Display("Phase")]
            PHAS,
            [Display("Unwrapped Phase")]
            UPH,
            [Display("Imaginary")]
            IMAG,
            [Display("Real")]
            REAL,
            [Display("Polar")]
            POL,
            [Display("Smith")]
            SMIT,
            [Display("Inverted Smith")]
            SADM,
            [Display("SWR")]
            SWR,
            [Display("Group Delay")]
            GDE,
            [Display("Kelvin")]
            KELV,
            [Display("Fahrenheit")]
            FAHR,
            [Display("Celsius")]
            CELS,
            [Display("Positive Phase")]
            PPH,
            [Display("Complex")]
            COMP
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions