From f5180b600511d1871635bd364beb5bdd15f6ae88 Mon Sep 17 00:00:00 2001
From: zuojincheng <lf_zuo@163.com>
Date: 星期三, 26 三月 2025 18:05:07 +0800
Subject: [PATCH] feat(nfc): 优化 NFC写卡功能并添加新方法- 在 BaseNfcWriteHelper 中添加了新的 writeData 方法,增加了 isConnect 参数 - 优化了 NativeNfcWriteHelper 中的 writeData 实现,支持选择性连接 NFC - 更新了 NfcWriteAdapter,支持新的 writeData 方法- 修改了 NfcWreatHelper 中的 writeData 方法,使用新的接口 - 优化了 NfcWreatActivity 中的写卡逻辑

---
 qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/ElectricPriceCard.java |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/ElectricPriceCard.java b/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/ElectricPriceCard.java
index 9adf95a..f6aa469 100644
--- a/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/ElectricPriceCard.java
+++ b/qihealonelibrary/src/main/java/com/dayu/qihealonelibrary/card/ElectricPriceCard.java
@@ -59,12 +59,16 @@
             byte[] data = new byte[16];
             data[0] = HexUtil.hexToByte(cardType);
 
-            byte[] regionBytes = HexUtil.hexToByteArray(cardData);
+            byte[] regionBytes = new byte[4];
+            byte[] regionDatas = HexUtil.hexToByteArray(cardData);
+            System.arraycopy(regionDatas, 0, regionBytes, 0, regionDatas.length);
             if (regionBytes != null) {
                 System.arraycopy(regionBytes, 0, data, 1, regionBytes.length);
             }
 
-            byte[] controllerCodelBytes = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice));
+            byte[] controllerCodelBytes = new byte[4];
+            byte[] controllerCodelDatas = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice));
+            System.arraycopy(controllerCodelDatas, 0, controllerCodelBytes, 0, controllerCodelDatas.length);
             if (controllerCodelBytes != null) {
                 System.arraycopy(controllerCodelBytes, 0, data, 5, controllerCodelBytes.length);
             }

--
Gitblit v1.8.0