左晓为主开发手持机充值管理机
zuoxiao
2023-11-24 c1d325aeb5bfc710b1ef4d801619ffb65e0afe90
app/src/main/java/com/dayu/recharge/activity/RechargeActivity.java
@@ -96,6 +96,7 @@
                    String initCode = DeviceNumberUtils.getDeviceNumber();
                    if (TextUtils.isEmpty(initCode)) {
                        TipUtil.show(RechargeActivity.this, "设备注册号为空,请先设置IP和管理员地址");
                        return;
                    }
                    Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class);
                    intent.putExtra("morny", morny);
@@ -179,14 +180,19 @@
                        try {
                            stateText = new StringBuffer();
                            String state = BcdUtil.bcdToStr(readData.getBodyBytes()[2]);  //BCD码00启用 01禁用 02隶属信息不符 03无此卡信息 04其它s
                            int balance = 0;
                            //只有启动状态才能充值
                            //金额
                            byte[] blanceByte = Arrays.copyOfRange(readData.getBodyBytes(), 3, 7);
                            int balance = SocketUtil.get16to10LowHigh(blanceByte);
                            //姓名
                            byte[] nameByte = Arrays.copyOfRange(readData.getBodyBytes(), 7, 19);
                            userName = SocketUtil.fromHexString(SocketUtil.bytesToHexClean0(nameByte));
                            try {
                                //只有启动状态才能充值
                                //金额
                                byte[] blanceByte = Arrays.copyOfRange(readData.getBodyBytes(), 3, 7);
                                balance = SocketUtil.get16to10LowHigh(blanceByte);
                                //姓名
                                byte[] nameByte = Arrays.copyOfRange(readData.getBodyBytes(), 7, 19);
                                userName = SocketUtil.fromHexString(SocketUtil.bytesToHexClean0(nameByte));
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                            binding.rechargeLL.setVisibility(View.VISIBLE);
                            binding.rechargeRegistBtn.setVisibility(View.VISIBLE);
                            binding.rechargeReadLL.setVisibility(View.GONE);