public void Copy(Source_GPIO from)
 {
     this.nativePin = from.nativePin;
     this.access    = from.access;
     this.state     = from.state;
     this.status    = from.status;
 }
 public Source_GPIO(
     rfid.Constants.GpioPin nativePin,
     OpState                state
 )
     : base()
 {
     this.nativePin = nativePin;
     this.access    = OpAccess.SET;
     this.state     = state;
     this.status    = OpResult.FAILURE;
 }
Exemple #3
0
        // Attempt to locate gpio with matching ( native ) pin

        public Source_GPIO FindByPin(rfid.Constants.GpioPin pin)
        {
            Source_GPIO result = this.Find
                                 (
                delegate(Source_GPIO gpio)
            {
                return(gpio.nativePin == pin);
            }
                                 );

            return(result);
        }
 public Source_GPIO
 (
     rfid.Constants.GpioPin nativePin,
     OpState state
 )
     :
     base( )
 {
     this.nativePin = nativePin;
     this.access    = OpAccess.SET;
     this.state     = state;
     this.status    = OpResult.FAILURE;
 }
Exemple #5
0
        public override object ConvertFrom
        (
            System.ComponentModel.ITypeDescriptorContext context,
            System.Globalization.CultureInfo culture,
            Object value
        )
        {
            if (String.IsNullOrEmpty(value as string))
            {
                return(null); // TODO : supply err msg
            }

            String[] gpioData = (value as String).Split(new Char[] { ',' });

            if (null == gpioData)
            {
                return(null); // TODO : supply err msg ~ improper arg
            }

            if (2 > gpioData.Length || 3 < gpioData.Length)
            {
                return(null); // TODO : supply err msg ~ improper arg count
            }

            try
            {
                rfid.Constants.GpioPin nativePin =
                    (rfid.Constants.GpioPin)Enum.Parse
                    (
                        typeof(Source_GPIO.OpAccess),
                        gpioData[0]
                    );

                Source_GPIO.OpAccess access =
                    (Source_GPIO.OpAccess)Enum.Parse
                    (
                        typeof(Source_GPIO.OpAccess),
                        gpioData[1]
                    );

                Source_GPIO.OpState state = Source_GPIO.OpState.FAILURE;

                if (3 == gpioData.Length)
                {
                    state = (Source_GPIO.OpState)Enum.Parse
                            (
                        typeof(Source_GPIO.OpState),
                        gpioData[2]
                            );
                }

                Source_GPIO gpio = new Source_GPIO(nativePin, access);

                gpio.State  = state;
                gpio.Status = Source_GPIO.OpResult.FAILURE;

                return(gpio);
            }
            catch (Exception)
            {
                // TODO : supply err msg ~ bad arg

                return(null);
            }
        }
 public void Copy( Source_GPIO from )
 {
     this.nativePin = from.nativePin;
     this.access    = from.access;
     this.state     = from.state;
     this.status    = from.status;
 }