public void onStateChange(int slotNum) { System.Console.WriteLine("onStateChange=" + " " + slotNum); logMsg(DateTime.Now + ":: Line:152 " + "slotNum-" + slotNum + " IS OPEN " + mReader.IsOpened); try { logMsg(DateTime.Now + ":: Line:156 GET STATE-" + mReader.GetState(0)); if (mReader.GetState(0) == 1) { try { mReader.Power(0, Com.Acs.Smartcard.Reader.CardWarmReset); mReader.SetProtocol(0, Com.Acs.Smartcard.Reader.ProtocolT0); byte[] command = { (byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x00 }; byte[] rcvbuffer = new byte[300]; mReader.Control(0, Com.Acs.Smartcard.Reader.IoctlCcidEscape, command, command.Length, rcvbuffer, rcvbuffer.Length); byte[] response = new byte[300]; string commandString = "FF CA 00 00 04"; string cmdStr = toHexString(mReadKeyOption.ToByteArray()); byte[] command1 = toByteArray(commandString.Substring(0)); int key = Com.Acs.Smartcard.Reader.IoctlCcidEscape; int responseLength; if (key < 0) { responseLength = mReader.Transmit(0, command, command.Length, response, response.Length); } else { responseLength = mReader.Control(0, key, command, command.Length, response, response.Length); } ResponseResult result = this.parseResponse(response, responseLength); logMsg(DateTime.Now + ":: Line: 181, GET RESULT-" + result); if (result != null) { } } catch (ReaderException ex) { System.Console.WriteLine("ReaderException=" + " " + ex.Message); logMsg(DateTime.Now + ":: Line:191 GET READER EXCEPTION-" + ex.Message); } } } catch (Java.Lang.Exception ex) { } }
public void OnStateChange(int p0, int p1, int p2) { System.Console.WriteLine("Implement Interface"); logMsg(DateTime.Now + ":: Line:42 READER IS OPEN " + mReader.IsOpened); try { logMsg(DateTime.Now + ":: Line:45 GET STATE-" + mReader.GetState(0)); if (mReader.GetState(0) == 2) { logMsg(DateTime.Now + ":: Line:47 GET STATE IF"); try { logMsg(DateTime.Now + ":: Line:50 TRY1"); mReader.Power(0, Com.Acs.Smartcard.Reader.CardWarmReset); logMsg(DateTime.Now + ":: Line:52 TRY2"); mReader.SetProtocol(0, Com.Acs.Smartcard.Reader.ProtocolT0); logMsg(DateTime.Now + ":: Line:53 TRY3"); byte[] command = { (byte)0xFF, (byte)0xCA, (byte)0x00, (byte)0x00, (byte)0x00 }; byte[] rcvbuffer = new byte[300]; mReader.Control(0, Com.Acs.Smartcard.Reader.IoctlCcidEscape, command, command.Length, rcvbuffer, rcvbuffer.Length); byte[] response = new byte[300]; string commandString = "FF CA 00 00 04"; string cmdStr = toHexString(mReadKeyOption.ToByteArray()); byte[] command1 = toByteArray(commandString.Substring(0)); int key = Com.Acs.Smartcard.Reader.IoctlCcidEscape; int responseLength; if (key < 0) { responseLength = mReader.Transmit(0, command, command.Length, response, response.Length); } else { responseLength = mReader.Control(0, key, command, command.Length, response, response.Length); } ResponseResult result = this.parseResponse(response, responseLength); logMsg(DateTime.Now + ":: Line: 73, GET STATUS=" + result.status); if (result.status) { logMsg(DateTime.Now + ":: Line: 77 RESULT NOT NULL"); logMsg("Card HEX ID:" + result.hex_id); logMsg("Reverse Card HEX ID:" + result.reverse_hex_id); logMsg("Card ID:" + result.id); logMsg("Reverse Card ID:" + result.revers_id); string cardId = result.id; logMsg(DateTime.Now + ":: Line:88 Object calling method"); main.RunOnUiThread(() => { logMsg(DateTime.Now + ":: Line:95 RunOnUiThread"); main.printCardId(cardId); }); logMsg(DateTime.Now + ":: Line:89 PRINT DONE"); logMsg("************"); } } catch (ReaderException ex) { logMsg(DateTime.Now + ":: Line:94 GET READER EXCEPTION-" + ex.Message); } } else { logMsg(DateTime.Now + ":: Line:92 GET STATE ELSE"); } logMsg(DateTime.Now + ":: Line:94 END OnStateChange"); } catch (Java.Lang.Exception ex) { logMsg(DateTime.Now + ":: Line:99 EXCEPTION-" + ex.Message); throw new NotImplementedException(); } logMsg(DateTime.Now + ":: Line:102 END OnStateChange"); }