| | |
| | | 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); |
| | |
| | | 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); |