/// <summary> /// Recherche en mode Iso15693 /// </summary> /// <param name="read"></param> /// <returns></returns> private bool SearISO15693(out byte[] read) { Int32 ret = -1; Int32 lnRet = 0; byte[] bufferIN; byte[] bufferOut; bufferIN = new byte[] { 0x80, 0x04, 0x15, 0x01, 0x26, 0x00, 0x00, 0x00, 0x00 }; bufferOut = new byte[50]; Int32 len = bufferIN.Length - 2; if ((ret = CSC.AddCRC(bufferIN, ref len)) == CSC.RCSC_Ok) { ret = CSC.SendReceive(2000, bufferIN, bufferIN.Length, bufferOut, ref lnRet); if (ret == CSC.RCSC_Ok && lnRet > 9) { read = new byte[lnRet]; Array.Copy(bufferOut, read, lnRet - 1); return(true); } } bufferIN = null; bufferOut = null; System.GC.Collect(); IsOnline = true; read = new byte[0]; return(false); }
/// <summary> /// Constructeur du Wrapper /// </summary> /// <param name="delegationRead">Méthode déléguée appellé si lecture</param> /// <param name="ISO15693">Mode d'utilisation Iso15693 si true</param> public RDReaderWrapperNET(CSC.ReadCard delegationRead, bool ISO15693) { /// Recherche d'un lecteur ASK if (CSC.SearchCSC() != CSC.RCSC_Ok) { this._isOnline = false; return; } try { if (delegationRead != null) { this.onReadCard = delegationRead; } byte[] version = new byte[CSC.VERSIONLENGTH]; CSC.VersionDLL(version); this._version = UnicodeEncoding.ASCII.GetString(version); this._isOnline = true; //Initilialisation de la méthode ISO15693 if (ISO15693) { IsOnline = false; this._Iso15693 = true; Int32 ret = -1; Int32 lnRet = 0; byte[] bufferOut = new byte[50]; #region Initialisation du champON byte[] bufferIN = { 0x80, 0x05, 0x01, 0x0E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00 }; Int32 len = bufferIN.Length - 2; if ((ret = CSC.AddCRC(bufferIN, ref len)) == CSC.RCSC_Ok) { ret = CSC.SendReceive(2000, bufferIN, bufferIN.Length, bufferOut, ref lnRet); if (ret != CSC.RCSC_Ok) { return; } } else { return; } #endregion #region Initialisation du mode ISO15693 bufferIN = null; bufferOut = null; System.GC.Collect(); bufferIN = new byte[] { 0x80, 0x05, 0x10, 0x01, 0x02, 0x0C, 0x02, 0x00, 0x00, 0x00 }; bufferOut = new byte[50]; if ((ret = CSC.AddCRC(bufferIN, ref len)) == CSC.RCSC_Ok) { ret = CSC.SendReceive(2000, bufferIN, bufferIN.Length, bufferOut, ref lnRet); if (ret != CSC.RCSC_Ok) { return; } } else { return; } bufferIN = null; bufferOut = null; System.GC.Collect(); IsOnline = true; #endregion } } catch (Exception ex) { this._version = ex.Message; } }