/// <summary> /// 读ISO15693卡的块内容 /// </summary> /// <param name="readMode"> /// Select_flag、Addres_flag位不能同时设为1; /// 若Select_flag = 1,只有处于SELECT状态的卡执行该命令; /// 若Addres_flag = 1,只有UID符合的卡执行该命令; /// 若Option_flag = 0,pData数据格式为:4字节Data,根据需要重复; /// 若Option_flag = 1,pData数据格式为:1字节Block security status + 4字节Data,根据需要重复; /// </param> /// <param name="uid">8字节UID</param> /// <param name="blockID">块号</param> /// <param name="autoLength">自动获取数据块长度</param> /// <param name="readNum">读取的块数</param> /// <returns></returns> public (byte[] Data, byte[] Status) Read(ISO15693_Mode readMode, string uid, uint blockID, bool autoLength = false, ushort readNum = 1) { try { byte[] uids = HfrdApi.ToDigitsBytes(uid); var or = Read(readMode, uids, blockID, autoLength, readNum); return(or.Data, or.Status); } catch (Exception) { throw; } }
/// <summary> /// 写1块内容到ISO15693卡 /// </summary> /// <param name="writeMode">操作类型</param> /// <param name="uid">十六进制UID</param> /// <param name="blockID">区块号</param> /// <param name="data">最多写入6位字符</param> /// <returns></returns> public int Write(ISO15693_Mode writeMode, string uid, uint blockID, string data) { var dataLength = data.Length; if (dataLength > 8) { throw new ArgumentOutOfRangeException($"最多写入8位字符,但是欲写入{dataLength}位字符"); } byte[] uids = HfrdApi.ToDigitsBytes(uid); byte[] tempData = HfrdApi.ToDigitsBytes(data); var or = Write(writeMode, uids, blockID, tempData); return(or); }