示例#1
0
 public void Copy(Source_GPIO from)
 {
     this.nativePin = from.nativePin;
     this.access    = from.access;
     this.state     = from.state;
     this.status    = from.status;
 }
示例#2
0
 public Source_GPIO(
     rfid.Constants.GpioPin nativePin,
     OpState                state
 )
     : base()
 {
     this.nativePin = nativePin;
     this.access    = OpAccess.SET;
     this.state     = state;
     this.status    = OpResult.FAILURE;
 }
示例#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);
        }
示例#4
0
 public Source_GPIO
 (
     rfid.Constants.GpioPin nativePin,
     OpState state
 )
     :
     base( )
 {
     this.nativePin = nativePin;
     this.access    = OpAccess.SET;
     this.state     = state;
     this.status    = OpResult.FAILURE;
 }
示例#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);
            }
        }
示例#6
0
 public void Copy( Source_GPIO from )
 {
     this.nativePin = from.nativePin;
     this.access    = from.access;
     this.state     = from.state;
     this.status    = from.status;
 }