RFID.RFIDInterface.Source_GPIO.store C# (CSharp) Method

store() public method

public store ( rfid transport, UInt32 readerHandle ) : rfid.Constants.Result
transport rfid
readerHandle System.UInt32
return rfid.Constants.Result
        public rfid.Constants.Result store(
            rfid.Linkage transport,
            UInt32       readerHandle
        )
        {
            // TODO : validate that when doin store the given pin has
            //        access flag in SET mode (?)

            // Configure pin to set mode

            rfid.Constants.Result result = rfid.Constants.Result.OK;

            result = transport.API_GpioSetPinsConfiguration( (byte)this.nativePin,
                                                             (byte)this.nativePin  );

            if ( rfid.Constants.Result.OK != result )
            {
                this.status = OpResult.FAILURE;

                return result;
            }

            //2011.12.30 check state
            if(this.state != OpState.HI && this.state != OpState.LO)
            {
                this.status = OpResult.FAILURE;

                return rfid.Constants.Result.INVALID_ANTENNA;
            }

            //Set state
            result = transport.API_GpioWritePins
                                ( (byte)this.nativePin,
                                  (byte)(OpState.LO == this.state ? 0 : this.nativePin) );

            if ( rfid.Constants.Result.OK != result )
            {
                this.status = OpResult.FAILURE;
            }
            else
            {
                this.status = OpResult.SUCCESS;
            }

            return result;
        }