1.修复河南版本域名卡结构不同问题
2.修复齐河版本最终购水日期的bug
| | |
| | | applicationId "com.dayu.recharge" |
| | | minSdk 23 |
| | | targetSdk 26 |
| | | versionCode 24 |
| | | versionName "2.4" |
| | | versionCode 253 |
| | | versionName "2.5.3" |
| | | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
| | | |
| | | // ndk { |
| | | // abiFilters 'armeabi-v7a' |
| | | // } |
| | | ndk { |
| | | abiFilters 'armeabi-v7a','arm64-v8a' |
| | | } |
| | | signingConfig signingConfigs.debug |
| | | |
| | | } |
| | |
| | | } |
| | | if (this.getIntent().hasExtra("domainCard_luyi")) { |
| | | domainCard = (DomainCard) this.getIntent().getSerializableExtra("domainCard_luyi"); |
| | | binding.cardData.setText("制作设置新乡域名卡"); |
| | | binding.cardData.setText("制作设置鹿邑域名卡"); |
| | | } |
| | | if (this.getIntent().hasExtra("testCard")) { |
| | | testCard = (TestCard) this.getIntent().getSerializableExtra("testCard"); |
| | |
| | | } |
| | | |
| | | private void setmanageCard(Intent intent, final ManageCard manageCard) { |
| | | manageCardFlag = NFCWriteHelper.getInstence(intent, this).writeData(manageCard.toZeroByte(baseDao), 1, 0); |
| | | try { |
| | | manageCardFlag = NFCWriteHelper.getInstence(intent, this).writeData(manageCard.toZeroByte(baseDao), 1, 0); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param clearOrInitCard |
| | | */ |
| | | private void setClean(Intent intent, final CleanCard clearOrInitCard) { |
| | | cleanFlag = NFCWriteHelper.getInstence(intent, this).writeData(clearOrInitCard.toByte(baseDao), 1, 0); |
| | | try { |
| | | cleanFlag = NFCWriteHelper.getInstence(intent, this).writeData(clearOrInitCard.toByte(baseDao), 1, 0); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | * @param registeredCard |
| | | */ |
| | | private void setRegisteredCard(Intent intent, RegisteredCard registeredCard) { |
| | | registeredFlag = NFCWriteHelper.getInstence(intent, this).writeData(registeredCard.toByte(baseDao), 1, 0); |
| | | try { |
| | | registeredFlag = NFCWriteHelper.getInstence(intent, this).writeData(registeredCard.toByte(baseDao), 1, 0); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | * @param cleanUserCard |
| | | */ |
| | | private void setCleanUserCard(Intent intent, CleanUserCard cleanUserCard) { |
| | | cleanUserCardFlag = NFCWriteHelper.getInstence(intent, this).writeData(cleanUserCard.toByte(baseDao), 1, 0); |
| | | try { |
| | | cleanUserCardFlag = NFCWriteHelper.getInstence(intent, this).writeData(cleanUserCard.toByte(baseDao), 1, 0); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | domainCrdFlag = NFCWriteHelper.getInstence(intent, this).writeData(domainXinXiangCard.getTwoByte(), 1, 2); |
| | | } catch (Exception e) { |
| | | domainCrdFlag = false; |
| | | throw new RuntimeException(e); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | configPowerFlag = NFCWriteHelper.getInstence(intent, this).writeData(configurationPowerCard.toByte(baseDao), 1, 0); |
| | | } catch (Exception e) { |
| | | configPowerFlag = false; |
| | | throw new RuntimeException(e); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | public byte[] toByte() { |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | domainLength = domainName.length(); |
| | | // 域名卡新乡C1后有01==0,鹿邑没有01==1 |
| | | if (type == 0) { |
| | | if (domainNumber != null) { |
| | | byte[] domainNumbers = BcdUtil.strToBcd(domainNumber); |
| | | data[1] = domainNumbers[0]; |
| | | } |
| | | domainLength = domainName.length(); |
| | | data[2] = HexUtil.hexToByte(HexUtil.get10to16(domainLength)); |
| | | String portStr = String.valueOf(port); |
| | | int lenght = portStr.length(); |
| | |
| | | } |
| | | String ascii = IDN.toASCII(domainName + "," + portStr + "#"); |
| | | asciiByte = ascii.getBytes(); |
| | | if (asciiByte.length < 12) { |
| | | System.arraycopy(asciiByte, 0, data, 3, asciiByte.length); |
| | | } else { |
| | | System.arraycopy(asciiByte, 0, data, 3, 12); |
| | | } |
| | | System.arraycopy(asciiByte, 0, data, 3, Math.min(asciiByte.length, 12)); |
| | | } else { |
| | | data[1] = HexUtil.hexToByte(HexUtil.get10to16(domainLength)); |
| | | String portStr = String.valueOf(port); |
| | |
| | | } |
| | | String ascii = IDN.toASCII(domainName + "," + portStr + "#"); |
| | | asciiByte = ascii.getBytes(); |
| | | if (asciiByte.length < 13) { |
| | | System.arraycopy(asciiByte, 0, data, 1, asciiByte.length); |
| | | } else { |
| | | System.arraycopy(asciiByte, 0, data, 1, 13); |
| | | } |
| | | |
| | | |
| | | System.arraycopy(asciiByte, 0, data, 2, Math.min(asciiByte.length, 13)); |
| | | |
| | | } |
| | | |
| | |
| | | |
| | | public byte[] toBytes() { |
| | | byte[] data = new byte[16]; |
| | | if (type==0){ |
| | | if (asciiByte.length > 12) { |
| | | if (asciiByte.length - 12 < 15) { |
| | | System.arraycopy(asciiByte, 12, data, 0, asciiByte.length - 12); |
| | | } else { |
| | | System.arraycopy(asciiByte, 12, data, 0, 15); |
| | | } |
| | | } |
| | | }else { |
| | | if (asciiByte.length > 13) { |
| | | if (asciiByte.length - 13 < 15) { |
| | | System.arraycopy(asciiByte, 13, data, 0, asciiByte.length - 12); |
| | | } else { |
| | | System.arraycopy(asciiByte, 13, data, 0, 15); |
| | | } |
| | | } |
| | | int offset = (type == 0) ? 12 : 13; |
| | | |
| | | if (asciiByte.length > offset) { |
| | | System.arraycopy(asciiByte, offset, data, 0, Math.min(asciiByte.length - offset, 15)); |
| | | } |
| | | |
| | | data[15] = getByteSum(data); |
| | |
| | | public class Two extends BaseCard { |
| | | public byte[] toBytes() { |
| | | byte[] data = new byte[16]; |
| | | if (type==0){ |
| | | if (asciiByte.length > (12 + 15)) { |
| | | if (asciiByte.length - (12 + 15) < 15) { |
| | | System.arraycopy(asciiByte, 12 + 15, data, 0, asciiByte.length - (12 + 15)); |
| | | } else { |
| | | System.arraycopy(asciiByte, 12 + 15, data, 0, 15); |
| | | } |
| | | } |
| | | }else { |
| | | if (asciiByte.length > (13 + 15)) { |
| | | if (asciiByte.length - (13 + 15) < 15) { |
| | | System.arraycopy(asciiByte, 13 + 15, data, 0, asciiByte.length - (12 + 15)); |
| | | } else { |
| | | System.arraycopy(asciiByte, 13 + 15, data, 0, 15); |
| | | } |
| | | } |
| | | int offset = (type == 0) ? 27 : 28; // 12 + 15 and 13 + 15 |
| | | if (asciiByte.length > offset) { |
| | | int lengthToCopy = Math.min(asciiByte.length - offset, 15); |
| | | System.arraycopy(asciiByte, offset, data, 0, lengthToCopy); |
| | | } |
| | | |
| | | data[15] = getByteSum(data); |
| | | return data; |
| | | } |