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;
}