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); }
public rfid.Constants.Result load ( rfid.Linkage transport, UInt32 readerHandle ) { // TODO : validate that when doin store the given pin has // access flag in GET mode (?) // Configure pin to set mode rfid.Constants.Result result = rfid.Constants.Result.OK; rfid.Constants.Result resultErr = rfid.Constants.Result.OK; uint uiCurError = 0; uint uiLastError = 0; byte getValue = 0; //Set access to "Get" result = transport.API_GpioSetPinsConfiguration((byte)this.nativePin, 0); if (rfid.Constants.Result.OK != result) { //Get error resultErr = transport.API_MacGetError(ref uiCurError, ref uiLastError); //Can't get error if (resultErr != rfid.Constants.Result.OK) { this.status = OpResult.FAILURE; return(resultErr); } //If error = 0x2B, it means doesn't support this pin if (uiCurError == 0x2B) { this.status = OpResult.UNSUPPORTED; return(result); } else { this.status = OpResult.FAILURE; return(result); } } //Get GPIO Status result = transport.API_GpioReadPins((byte)this.nativePin, ref getValue); if (rfid.Constants.Result.OK == result) { this.state = (( UInt32 )this.nativePin & getValue) == 0 ? OpState.LO : OpState.HI; this.status = OpResult.SUCCESS; } else { this.state = OpState.FAILURE; this.status = OpResult.FAILURE; } return(result); }