From 1bc1acff2127d61b359800096ad5b904370d9176 Mon Sep 17 00:00:00 2001 From: zuojincheng <lf_zuo@163.com> Date: 星期三, 26 三月 2025 09:25:47 +0800 Subject: [PATCH] refactor(nfc): 重构 NFC 读写助手类 --- generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt b/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt index 7a8f09f..0429fcf 100644 --- a/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt +++ b/generallibrary/src/main/java/com/dayu/general/bean/card/BaseCard.kt @@ -1,12 +1,12 @@ package com.dayu.general.bean.card -import com.dayu.baselibrary.tools.HexUtil +import com.dayu.baselibrary.tools.BaseCard import com.dayu.general.bean.db.CardData import com.dayu.general.dao.AppDataBase import com.dayu.general.tool.CardCommon import com.tencent.bugly.crashreport.CrashReport -open class BaseCard { +open class BaseCard : BaseCard() { var cardData: String? = null //鏍囪瘑鐮� companion object { @@ -33,25 +33,25 @@ } - /** - * 鍓�15涓瓧鑺傜畻鏈疮鍔犲拰 涓嶅惈杩涗綅 - * - * @param data 婧愭暟鎹� - * @return 16杩涘埗 - */ - fun getByteSum(data: ByteArray?): Byte { - if (data != null) { - var sum = 0 - for (b in data) { - sum += b.toInt() and 0xFF // & 0xFF 鍙互灏嗗瓧鑺傛墿灞曚负姝f暣鏁帮紝閬垮厤绗﹀彿浣嶇殑褰卞搷 - } - var hex = HexUtil.get10to16CompleteHex(sum) - hex = HexUtil.spaceHex(hex) - val hexArr = hex.split(" ".toRegex()).dropLastWhile { it.isEmpty() } - .toTypedArray() - return HexUtil.hexToByte(hexArr[hexArr.size - 1]) - } - return 0 - } +// /** +// * 鍓�15涓瓧鑺傜畻鏈疮鍔犲拰 涓嶅惈杩涗綅 +// * +// * @param data 婧愭暟鎹� +// * @return 16杩涘埗 +// */ +// fun getByteSum(data: ByteArray?): Byte { +// if (data != null) { +// var sum = 0 +// for (b in data) { +// sum += b.toInt() and 0xFF // & 0xFF 鍙互灏嗗瓧鑺傛墿灞曚负姝f暣鏁帮紝閬垮厤绗﹀彿浣嶇殑褰卞搷 +// } +// var hex = HexUtil.get10to16CompleteHex(sum) +// hex = HexUtil.spaceHex(hex) +// val hexArr = hex.split(" ".toRegex()).dropLastWhile { it.isEmpty() } +// .toTypedArray() +// return HexUtil.hexToByte(hexArr[hexArr.size - 1]) +// } +// return 0 +// } } \ No newline at end of file -- Gitblit v1.8.0