Exemple #1
0
        static ProtocolParameterAdapterBase()
        {
            IPropertyAdapterFactory <ProtocolParameterAdapterBase> PropertyFactory = ObservableObject.GetPropertyAdapterFactory <ProtocolParameterAdapterBase>();

            ProtocolParameterAdapterBase.protocolParameterBytes = PropertyFactory.Create(
                nameof(ProtocolParameterAdapterBase.ProtocolParameterBytes),
                instance => instance.protocolParameters.ParameterBytes,
                (instance, parameterByte) => ProtocolParameterByteAdapterBase.GetObject(parameterByte)
                );
        }
        static GlobalInterfaceBytesAdapter()
        {
            IPropertyAdapterFactory <GlobalInterfaceBytesAdapter> PropertyFactory = ObservableObject.GetPropertyAdapterFactory <GlobalInterfaceBytesAdapter>();

            GlobalInterfaceBytesAdapter.protocolParameterBytes = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.ProtocolParameterBytes),
                instance => instance.globalInterfaceBytes.ParameterBytes,
                (instance, parameterByte) => ProtocolParameterByteAdapterBase.GetObject(parameterByte)
                );

            GlobalInterfaceBytesAdapter.diAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.Di),
                instance => EnumerationAdapter <Di> .GetInstanceFor(instance.globalInterfaceBytes.DiValue),
                (instance, value) => instance.globalInterfaceBytes.SetDiFiFmax(value, instance.globalInterfaceBytes.FiFmaxValue)
                );
            GlobalInterfaceBytesAdapter.fiFmaxAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.FiFmax),
                instance => EnumerationAdapter <FiFmax> .GetInstanceFor(instance.globalInterfaceBytes.FiFmaxValue),
                (instance, value) => instance.globalInterfaceBytes.SetDiFiFmax(instance.globalInterfaceBytes.DiValue, value)
                );
            GlobalInterfaceBytesAdapter.etuAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.Etu),
                instance => GlobalInterfaceBytesAdapter.CalculateEtu(instance.globalInterfaceBytes.FiFmaxValue, instance.globalInterfaceBytes.DiValue)
                );
            GlobalInterfaceBytesAdapter.diFiIsDefaultAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.DiFiIsDefault),
                instance => instance.globalInterfaceBytes.Di.HasValue == false && instance.globalInterfaceBytes.FiFmax.HasValue == false
                );
            GlobalInterfaceBytesAdapter.extraGuardTimeAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.ExtraGuardTime),
                instance => instance.globalInterfaceBytes.ExtraGuardTimeValue,
                (instance, value) => instance.globalInterfaceBytes.ExtraGuardTime = value
                );
            GlobalInterfaceBytesAdapter.extraGuardTimeIsDefaultAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.ExtraGuardTimeIsDefault),
                instance => instance.globalInterfaceBytes.ExtraGuardTime.HasValue == false
                );

            GlobalInterfaceBytesAdapter.specificModeSupportedAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpecificModeSupported),
                instance => instance.globalInterfaceBytes.CanChangeNegotiableSpecificMode.HasValue ||
                instance.globalInterfaceBytes.SpecificModeImplicitFiDi.HasValue ||
                instance.globalInterfaceBytes.SpecificModeProtocol.HasValue
                );
            GlobalInterfaceBytesAdapter.canChangeNegotiableSpecificModeAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.CanChangeNegotiableSpecificMode),
                instance => instance.globalInterfaceBytes.CanChangeNegotiableSpecificMode.HasValue
                          ? instance.globalInterfaceBytes.CanChangeNegotiableSpecificMode.Value
                          : false
                );
            GlobalInterfaceBytesAdapter.specificModeImplicitFiDiAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpecificModeImplicitFiDi),
                instance => instance.globalInterfaceBytes.SpecificModeImplicitFiDi.HasValue
                          ? instance.globalInterfaceBytes.SpecificModeImplicitFiDi.Value
                          : false
                );
            GlobalInterfaceBytesAdapter.specificModeProtocolAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpecificModeProtocol),
                instance => instance.globalInterfaceBytes.SpecificModeProtocol.HasValue
                          ? EnumerationAdapter <ProtocolType> .GetInstanceFor(instance.globalInterfaceBytes.SpecificModeProtocol.Value)
                          : null
                );
            GlobalInterfaceBytesAdapter.clockStopSupportAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.ClockStopSupport),
                instance => EnumerationAdapter <ClockStopSupport> .GetInstanceFor(instance.globalInterfaceBytes.ClockStopSupportValue)
                );
            GlobalInterfaceBytesAdapter.clockStopSupportAndOperatingConditionsIsDefaultAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.ClockStopSupportAndOperatingConditionsIsDefault),
                instance => instance.globalInterfaceBytes.ClockStopSupport.HasValue == false || instance.globalInterfaceBytes.OperatingConditions.HasValue == false
                );
            GlobalInterfaceBytesAdapter.operatingConditionsAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.OperatingConditions),
                instance => EnumerationAdapter <OperatingConditions> .GetInstanceFor(instance.globalInterfaceBytes.OperatingConditionsValue)
                );
            GlobalInterfaceBytesAdapter.spuUseAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuUse),
                instance => EnumerationAdapter <SpuUse> .GetInstanceFor(instance.globalInterfaceBytes.SpuUseValue)
                );
            GlobalInterfaceBytesAdapter.spuUseIsDefaultAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuUseIsDefault),
                instance => instance.globalInterfaceBytes.SpuUse.HasValue == false
                );
            GlobalInterfaceBytesAdapter.spuUseIsNotUsedAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuUseIsNotUsed),
                instance => instance.globalInterfaceBytes.SpuUse == Classes.ATR.SpuUse.NotUsed
                );
            GlobalInterfaceBytesAdapter.spuUseIsStandardAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuUseIsStandard),
                instance => instance.globalInterfaceBytes.SpuUse == Classes.ATR.SpuUse.Standard
                );
            GlobalInterfaceBytesAdapter.spuUseIsProprietaryAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuUseIsProprietary),
                instance => instance.globalInterfaceBytes.SpuUse == Classes.ATR.SpuUse.Proprietary
                );
            GlobalInterfaceBytesAdapter.spuIsInUseAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuIsInUse),
                instance => instance.globalInterfaceBytes.SpuUseValue != Classes.ATR.SpuUse.NotUsed
                );
            GlobalInterfaceBytesAdapter.spuTypeAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuType),
                instance => instance.globalInterfaceBytes.SpuType != null ? instance.globalInterfaceBytes.SpuType.Value.ToHexString() : null
                );
            GlobalInterfaceBytesAdapter.spuTypeEtsiCodingAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.SpuTypeEtsiCoding),
                instance => instance.globalInterfaceBytes.SpuType != null && instance.globalInterfaceBytes.SpuType.EtsiCoding != null ? new SpuTypeEtsiCodingAdapter(instance.globalInterfaceBytes, instance.globalInterfaceBytes.SpuType.EtsiCoding) : null
                );

            GlobalInterfaceBytesAdapter.isVppConnectedAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.IsVppConnected),
                instance => instance.globalInterfaceBytes.IsVppConnected
                );
            GlobalInterfaceBytesAdapter.isVppConnectedisDefaultAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.IsVppConnectedIsDefault),
                instance => instance.globalInterfaceBytes.IsVppConnected.HasValue == false
                );
            GlobalInterfaceBytesAdapter.vppProgrammingVoltageAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.VppProgrammingVoltage),
                instance => instance.globalInterfaceBytes.VppProgrammingVoltage != null?instance.globalInterfaceBytes.VppProgrammingVoltage.Value.ToString("F1"):null
                );
            GlobalInterfaceBytesAdapter.vppProgrammingCurrentAdapter = PropertyFactory.Create(
                nameof(GlobalInterfaceBytesAdapter.VppProgrammingCurrent),
                instance => EnumerationAdapter <VppProgrammingCurrent> .GetInstanceFor(instance.globalInterfaceBytes.VppProgrammingCurrent)
                );
        }