diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..237a4de
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+pax_kiosk_im30
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 9925b15..a197096 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -35,6 +35,8 @@
+
+
diff --git a/app/build.gradle b/app/build.gradle
index 8aadf21..4a294a3 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -7,7 +7,7 @@ android {
defaultConfig {
applicationId "com.cst.im30"
- minSdkVersion 25
+ minSdkVersion 22
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 28
versionCode 5
diff --git a/app/src/androidTest/java/com/cst/im30/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/cst/im30/ExampleInstrumentedTest.java
deleted file mode 100644
index fcf9504..0000000
--- a/app/src/androidTest/java/com/cst/im30/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.cst.im30;
-
-import static org.junit.Assert.assertEquals;
-
-import android.content.Context;
-
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.platform.app.InstrumentationRegistry;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * @see Testing documentation
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
- @Test
- public void useAppContext() {
- // Context of the app under test.
- Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
- assertEquals("com.cst.im30", appContext.getPackageName());
- }
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index a6b29f2..ec4b979 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -27,14 +27,7 @@
-
-
+ tools:ignore="LockedOrientationActivity" >
@@ -46,6 +39,15 @@
+
+
+
+
info = (ArrayList) msg.obj;
- if (info.get(0).trim().equals("")) {
- pd.dismiss();
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ICCActivity.this);
- LayoutInflater inflater = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View dialogView = inflater.inflate(R.layout.confirm, null);
-
- TextView textMessage = dialogView.findViewById(R.id.text_message_confirm);
- TextView textTitle = dialogView.findViewById(R.id.text_title_confirm);
-
- textTitle.setText("Error");
- textMessage.setText("Cannot read card / Invalid card.\nPlease try again.");
-
- dialogBuilder.setPositiveButton("OK", (dialog, which) -> {
- stopChecking = false;
- insertCard();
- });
- dialogBuilder.setCancelable(false);
- dialogBuilder.setView(dialogView);
-
- AlertDialog alertDialog = dialogBuilder.create();
- alertDialog.show();
- } else {
- name = info.get(1).trim();
- cardNo = info.get(0).trim();
+ handlerGotCardHandler(msg);
+ break;
+ case 1: //no card
+ handlerNoCardHandler(msg);
+ break;
+ case 2: //invalid card
+ handlerInvalidCard(msg);
+ break;
+ default:
+ break;
+ }
+ }
+ };
- AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ICCActivity.this);
- LayoutInflater inflater = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View dialogView = inflater.inflate(R.layout.confirm, null);
+ @SuppressLint("SetTextI18n")
+ private void handlerGotCardHandler(Message msg) {
+ iccDetectedThread.interrupt();
+ NRICData nricData = (NRICData) msg.obj;
- TextView textMessage = dialogView.findViewById(R.id.text_message_confirm);
- TextView textTitle = dialogView.findViewById(R.id.text_title_confirm);
+ String cardNo = nricData.getNric();
+ String name = nricData.getFinalName();
- textTitle.setText("Read Success");
- textMessage.setText("Please remove card.");
+ if (cardNo.trim().equals("")) {
+ onGotCardCannotReadCard();
+ } else {
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ICCActivity.this);
+ LayoutInflater inflater = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View dialogView = inflater.inflate(R.layout.confirm_read, null);
- dialogBuilder.setCancelable(false);
- dialogBuilder.setView(dialogView);
+ TextView textTitle = dialogView.findViewById(R.id.text_title_confirm);
+ ImageView imageView = dialogView.findViewById(R.id.image_view);
+ TextView textMessage = dialogView.findViewById(R.id.text_message);
+ TextView textConfirm = dialogView.findViewById(R.id.text_message_confirm);
- alertDialogPromptCard = dialogBuilder.create();
- alertDialogPromptCard.show();
+ textTitle.setText("Read Success");
- checkCard();
- }
- break;
- case 1: //no card
- iccDetectedThread.interrupt();
- pd.dismiss();
+ Bitmap bmp = BitmapFactory.decodeByteArray(nricData.getPhoto(), 0, nricData.getPhoto().length);
+ imageView.setImageBitmap(bmp);
- AlertDialog.Builder dialogBuilder1 = new AlertDialog.Builder(ICCActivity.this);
- LayoutInflater inflater1 = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View dialogView1 = inflater1.inflate(R.layout.confirm, null);
+ String message = "";
+ message += nricData.getNric() + "\n" + nricData.getFinalName();
+ textMessage.setText(message);
- TextView textMessage1 = dialogView1.findViewById(R.id.text_message_confirm);
- TextView textTitle1 = dialogView1.findViewById(R.id.text_title_confirm);
+ imageView.setVisibility(View.VISIBLE);
+ textMessage.setVisibility(View.VISIBLE);
- textTitle1.setText("Error");
- textMessage1.setText("No card detected. Please insert card to read.");
+ textConfirm.setText("Please remove card.");
- dialogBuilder1.setPositiveButton("OK", (dialog, which) -> {
- stopChecking = false;
- insertCard();
- });
- dialogBuilder1.setCancelable(false);
- dialogBuilder1.setView(dialogView1);
+ dialogBuilder.setCancelable(false);
+ dialogBuilder.setView(dialogView);
- AlertDialog alertDialog1 = dialogBuilder1.create();
- alertDialog1.show();
+ alertDialogPromptCard = dialogBuilder.create();
+ alertDialogPromptCard.show();
- break;
+ checkCard();
+ }
+ }
- case 2: //invalid card
- iccDetectedThread.interrupt();
- pd.dismiss();
+ @SuppressLint("SetTextI18n")
+ private void onGotCardCannotReadCard() {
+ pd.dismiss();
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(ICCActivity.this);
+ LayoutInflater inflater = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View dialogView = inflater.inflate(R.layout.confirm, null);
- AlertDialog.Builder dialogBuilder2 = new AlertDialog.Builder(ICCActivity.this);
- LayoutInflater inflater2 = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- View dialogView2 = inflater2.inflate(R.layout.confirm, null);
+ TextView textMessage = dialogView.findViewById(R.id.text_message_confirm);
+ TextView textTitle = dialogView.findViewById(R.id.text_title_confirm);
- TextView textMessage2 = dialogView2.findViewById(R.id.text_message_confirm);
- TextView textTitle2 = dialogView2.findViewById(R.id.text_title_confirm);
+ textTitle.setText("Error");
+ textMessage.setText("Cannot read card / Invalid card.\nPlease try again.");
- textTitle2.setText("Error");
- textMessage2.setText(msg.obj.toString());
+ dialogBuilder.setPositiveButton("OK", (dialog, which) -> {
+ stopChecking = false;
+ insertCard();
+ });
+ dialogBuilder.setCancelable(false);
+ dialogBuilder.setView(dialogView);
- dialogBuilder2.setPositiveButton("OK", (dialog, which) -> {
- stopChecking = false;
- insertCard();
- });
- dialogBuilder2.setCancelable(false);
- dialogBuilder2.setView(dialogView2);
+ AlertDialog alertDialog = dialogBuilder.create();
+ alertDialog.show();
+ }
- AlertDialog alertDialog2 = dialogBuilder2.create();
- alertDialog2.show();
+ private void handlerNoCardHandler(Message msg) {
+ iccDetectedThread.interrupt();
+ pd.dismiss();
- break;
+ AlertDialog.Builder dialogBuilder1 = new AlertDialog.Builder(ICCActivity.this);
+ LayoutInflater inflater1 = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View dialogView1 = inflater1.inflate(R.layout.confirm, null);
+
+ TextView textMessage1 = dialogView1.findViewById(R.id.text_message_confirm);
+ TextView textTitle1 = dialogView1.findViewById(R.id.text_title_confirm);
+
+ textTitle1.setText("Error");
+ textMessage1.setText("No card detected. Please insert card to read.");
+
+ dialogBuilder1.setPositiveButton("OK", (dialog, which) -> {
+ stopChecking = false;
+ insertCard();
+ });
+ dialogBuilder1.setCancelable(false);
+ dialogBuilder1.setView(dialogView1);
+
+ AlertDialog alertDialog1 = dialogBuilder1.create();
+ alertDialog1.show();
+ }
+
+ private void handlerInvalidCard(Message msg) {
+ iccDetectedThread.interrupt();
+ pd.dismiss();
+
+ AlertDialog.Builder dialogBuilder2 = new AlertDialog.Builder(ICCActivity.this);
+ LayoutInflater inflater2 = (LayoutInflater) ICCActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+ View dialogView2 = inflater2.inflate(R.layout.confirm, null);
+
+ TextView textMessage2 = dialogView2.findViewById(R.id.text_message_confirm);
+ TextView textTitle2 = dialogView2.findViewById(R.id.text_title_confirm);
+
+ textTitle2.setText("Error");
+ textMessage2.setText(msg.obj.toString());
+
+ dialogBuilder2.setPositiveButton("OK", (dialog, which) -> {
+ stopChecking = false;
+ insertCard();
+ });
+ dialogBuilder2.setCancelable(false);
+ dialogBuilder2.setView(dialogView2);
+
+ AlertDialog alertDialog2 = dialogBuilder2.create();
+ alertDialog2.show();
+
+ }
- default:
- break;
- }
- }
- };
@SuppressLint("HandlerLeak")
private final Handler handlerCard = new Handler() {
public void handleMessage(Message msg) {
@@ -180,9 +211,9 @@ public class ICCActivity extends AppCompatActivity {
Logger.logD(name + ":" + cardNo);
setResult(RESULT_OK, outgoingIntent);
- finish();
+ //finish();
- //reset();
+ reset();
break;
default:
break;
@@ -363,9 +394,6 @@ public class ICCActivity extends AppCompatActivity {
public void run() {
super.run();
- String nric = "";
- String name = "";
- String cardVer = "";
IccTester.getInstance(ICCActivity.this).light(true);
while (!Thread.interrupted()) {
@@ -393,38 +421,57 @@ public class ICCActivity extends AppCompatActivity {
if (isoRes != null) {
+ NRICData nricData = new NRICData();
try {
- nric = NRICApduUtils.getIDNum(getApplicationContext());
+ // NRIC
+ nricData.setNric(NRICApduUtils.getIDNum(getApplicationContext()));
+ // Name
String orgName = NRICApduUtils.getOriginalName(getApplicationContext());
String gmpcName = NRICApduUtils.getGMPCName(getApplicationContext());
String kptName = NRICApduUtils.getKPTName(getApplicationContext());
-
+ nricData.setOrgName(orgName);
+ nricData.setGmpcName(gmpcName);
+ nricData.setKptName(kptName);
String selectedName = orgName;
- if (selectedName.length() < gmpcName.length()) {
- selectedName = gmpcName;
- }
- if (selectedName.length() < kptName.length()) {
- selectedName = kptName;
- }
- name = selectedName;
+ if (selectedName.length() < gmpcName.length()) { selectedName = gmpcName; }
+ if (selectedName.length() < kptName.length()) { selectedName = kptName; }
+ nricData.setFinalName(selectedName);
- byte[] isoResC = IccTester.getInstance(getApplicationContext()).isoCommand((byte) 0, readCard);
- Log.d("ZZZ8", getHexValue(isoResC));
+ nricData.setGender(NRICApduUtils.getGender(getApplicationContext()));
- byte[] isoResC1 = IccTester.getInstance(getApplicationContext()).isoCommand((byte) 0, readCard1);
- Log.d("ZZZ9", getHexValue(isoResC1));
+ //NRICApduUtils.getOldIDNum(getApplicationContext());
+ //NRICApduUtils.getBirthDate(getApplicationContext());
- byte[] isoResC2 = IccTester.getInstance(getApplicationContext()).isoCommand((byte) 0, readCard2);
- Log.d("ZZZ10", getHexValue(isoResC2));
+ nricData.setBirthPlace(NRICApduUtils.getBirthPlace(getApplicationContext()));
- byte[] cardBytes = Arrays.copyOfRange(isoResC2, 0, isoResC2.length - 2);
- Log.d("ZZZ11", getHexValue(cardBytes));
- Log.d("ZZZ11", new String(cardBytes));
+ //NRICApduUtils.getDateIssued(getApplicationContext());
- cardVer = new String(cardBytes);
+ nricData.setCitizenship(NRICApduUtils.getCitizenship(getApplicationContext()));
+ nricData.setRace(NRICApduUtils.getRace(getApplicationContext()));
+ nricData.setReligion(NRICApduUtils.getReligion(getApplicationContext()));
+ nricData.setEastMalaysian(NRICApduUtils.getEastMalaysian(getApplicationContext()));
- nric += getHexValue(cardBytes);
+ /*
+ NRICApduUtils.getRJ(getApplicationContext());
+ NRICApduUtils.getKT(getApplicationContext());
+ NRICApduUtils.getOtherID(getApplicationContext());
+ NRICApduUtils.getCategory(getApplicationContext());
+ NRICApduUtils.getCardVersion(getApplicationContext());
+ NRICApduUtils.getGreenCardExpiry(getApplicationContext());
+ NRICApduUtils.getGreenCardNationality(getApplicationContext());
+ */
+
+ // Photo
+ nricData.setPhoto(NRICApduUtils.getPhoto(getApplicationContext()));
+
+ // Address
+ nricData.setAddress1(NRICApduUtils.getAddress1(getApplicationContext()));
+ nricData.setAddress2(NRICApduUtils.getAddress2(getApplicationContext()));
+ nricData.setAddress3(NRICApduUtils.getAddress3(getApplicationContext()));
+ //NRICApduUtils.getPostcode(getApplicationContext());
+ nricData.setCity(NRICApduUtils.getCity(getApplicationContext()));
+ nricData.setState(NRICApduUtils.getState(getApplicationContext()));
} catch (Exception e) {
ICCActivity.appendLog(e);
@@ -433,14 +480,9 @@ public class ICCActivity extends AppCompatActivity {
IccTester.getInstance(getApplicationContext()).close((byte) 0);
IccTester.getInstance(getApplicationContext()).light(false);
- ArrayList info = new ArrayList<>();
- info.add(nric);
- info.add(name);
- info.add(cardVer);
-
Message message = Message.obtain();
message.what = 0;
- message.obj = info;
+ message.obj = nricData;
handler.sendMessage(message);
} else {
Message message = Message.obtain();
@@ -450,7 +492,6 @@ public class ICCActivity extends AppCompatActivity {
}
} else {
- //resString = getResources().getString(R.string.icc_detect_nocard);
Message message = Message.obtain();
message.what = 1;
message.obj = "No card.";
diff --git a/app/src/main/java/com/cst/im30/model/NRICData.java b/app/src/main/java/com/cst/im30/model/NRICData.java
new file mode 100644
index 0000000..f13b38a
--- /dev/null
+++ b/app/src/main/java/com/cst/im30/model/NRICData.java
@@ -0,0 +1,22 @@
+package com.cst.im30.model;
+
+import java.io.Serializable;
+
+import lombok.Data;
+
+@Data
+public class NRICData implements Serializable {
+
+ String nric;
+ String orgName;
+ String gmpcName;
+ String kptName;
+
+ byte[] photo;
+
+ String finalName; // Longest String of orgName / gmpcName / kptName
+
+ String gender, birthPlace, citizenship, race, religion, eastMalaysian;
+
+ String address1, address2, address3, city, state;
+}
diff --git a/app/src/main/java/com/cst/im30/utility/NRICApduUtils.java b/app/src/main/java/com/cst/im30/utility/NRICApduUtils.java
index 53bc2e8..70d1b6c 100644
--- a/app/src/main/java/com/cst/im30/utility/NRICApduUtils.java
+++ b/app/src/main/java/com/cst/im30/utility/NRICApduUtils.java
@@ -1,7 +1,10 @@
package com.cst.im30.utility;
import android.content.Context;
+import android.util.Log;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
import java.util.Arrays;
@SuppressWarnings({"unused"})
@@ -15,10 +18,20 @@ public class NRICApduUtils {
return IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectJpn);
}
+ // JPN - 1 - 1
+
public static String getOriginalName(Context applicationContext) {
- byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x96, (byte) 0x00};
- byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x03, (byte) 0x00, (byte) 0x96, (byte) 0x00};
- byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x96};
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x96, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x03, (byte) 0x00,
+ (byte) 0x96, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x96
+ };
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
@@ -34,9 +47,17 @@ public class NRICApduUtils {
}
public static String getGMPCName(Context applicationContext) {
- byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x50, (byte) 0x00};
- byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x99, (byte) 0x00, (byte) 0x50, (byte) 0x00};
- byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x50};
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x50, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x99, (byte) 0x00,
+ (byte) 0x50, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x50
+ };
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
@@ -52,9 +73,17 @@ public class NRICApduUtils {
}
public static String getKPTName(Context applicationContext) {
- byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x28, (byte) 0x00};
- byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0xE9, (byte) 0x00, (byte) 0x28, (byte) 0x00};
- byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x28};
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x28, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0xE9, (byte) 0x00,
+ (byte) 0x28, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x28
+ };
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
@@ -70,9 +99,17 @@ public class NRICApduUtils {
}
public static String getIDNum(Context applicationContext) {
- byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00, (byte) 0x0D, (byte) 0x00};
- byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08, (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00, (byte) 0x11, (byte) 0x01, (byte) 0x0D, (byte) 0x00};
- byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00, (byte) 0x0D};
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0D, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x11, (byte) 0x01,
+ (byte) 0x0D, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0D
+ };
byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
@@ -86,4 +123,636 @@ public class NRICApduUtils {
return str;
}
+
+ public static String getGender(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x01,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 2);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Gender:" + str);
+
+ return str;
+ }
+
+ public static String getOldIDNum(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x08, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x1F, (byte) 0x01,
+ (byte) 0x08, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x08
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_OldIDNum:" + str);
+
+ return str;
+ }
+
+ //TODO date object, dunno how to convert
+ public static String getBirthDate(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x27, (byte) 0x01,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_BirthDate:" + str);
+
+ return str;
+ }
+
+ public static String getBirthPlace(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x2B, (byte) 0x01,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_BirthPlace:" + str);
+
+ return str;
+ }
+
+ //TODO date object, dunno how to convert
+ public static String getDateIssued(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x44, (byte) 0x01,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_DateIssued:" + str);
+
+ return str;
+ }
+
+ public static String getCitizenship(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x12, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x48, (byte) 0x01,
+ (byte) 0x12, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x12
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Citizenship:" + str);
+
+ return str;
+ }
+
+ public static String getRace(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x5A, (byte) 0x01,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Race:" + str);
+
+ return str;
+ }
+
+ public static String getReligion(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0B, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x73, (byte) 0x01,
+ (byte) 0x0B, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0B
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Religion:" + str);
+
+ return str;
+ }
+
+ public static String getEastMalaysian(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x7E, (byte) 0x01,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 2);
+
+ String str = new String(trimmedBytes);
+
+ Logger.logD("JPN_EastMalaysian:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getRJ(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x7F, (byte) 0x01,
+ (byte) 0x02, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_RJ:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getKT(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x81, (byte) 0x01,
+ (byte) 0x02, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x02
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_KT:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getOtherID(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0B, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x83, (byte) 0x01,
+ (byte) 0x0B, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x0B
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_OtherID:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getCategory(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x8E, (byte) 0x01,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Category:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getCardVersion(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x8F, (byte) 0x01,
+ (byte) 0x01, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x01
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 0);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_CardVersion:" + str);
+
+ return str;
+ }
+
+ //TODO date object, dunno how to convert
+ public static String getGreenCardExpiry(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x90, (byte) 0x01,
+ (byte) 0x04, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x04
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_GreenCardExpiry:" + str);
+
+ return str;
+ }
+
+ // ?
+ public static String getGreenCardNationality(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x14, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x01, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x94, (byte) 0x01,
+ (byte) 0x14, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x14
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_GreenCardNationality:" + str);
+
+ return str;
+ }
+
+ // JPN - 1 - 2
+
+ public static byte[] getPhoto(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte)0xC8, (byte)0x32, (byte)0x00, (byte)0x00,(byte)0x05, (byte)0x08, (byte)0x00, (byte)0x00,
+ (byte)0xA0, (byte)0x0F // Length - 4000 Little-Endian
+ };
+ byte[] selectInfoByte = new byte[]{(byte)0xCC, (byte)0x00, (byte)0x00, (byte)0x00,(byte)0x08,
+ (byte)0x02, (byte)0x00, (byte)0x01, (byte)0x00, // JPN-1-2
+ (byte)0x03, (byte)0x00, // Offset - Little-Endian
+ (byte)0xA0, (byte)0x0F // Length - 4000 Little-Endian
+ };
+ byte[] readInfoByte = new byte[]{(byte)0xCC, (byte)0x06, (byte)0x00, (byte)0x00,
+ (byte)0xFF // Read Length - 255
+ };
+ byte[] readInfoByteFinal = new byte[]{(byte)0xCC, (byte)0x06, (byte)0x00, (byte)0x00,
+ (byte)0xAF // Read Length 175
+ };
+ int fullReads = (int) Math.floor((double)4000 / (double)255);
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+
+ for (int i = 0; i < fullReads; i++) {
+ byte[] tmp = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+ byte[] finalTmp = Arrays.copyOfRange(tmp, 0 , tmp.length -2);
+ try {
+ outputStream.write( finalTmp );
+ } catch (IOException e) {
+ Logger.logE(Log.getStackTraceString(e));
+ e.printStackTrace();
+ return null;
+ }
+ }
+ byte[] tmp = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByteFinal);
+ byte[] finalTmp = Arrays.copyOfRange(tmp, 0 , tmp.length -2);
+ try {
+ outputStream.write( finalTmp );
+ } catch (IOException e) {
+ Logger.logE(Log.getStackTraceString(e));
+ e.printStackTrace();
+ return null;
+ }
+
+ return outputStream.toByteArray();
+ }
+
+ // JPN - 1 - 4
+
+ public static String getAddress1(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x03, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Address1:" + str);
+
+ return str;
+ }
+
+ public static String getAddress2(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x21, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Address2:" + str);
+
+ return str;
+ }
+
+ public static String getAddress3(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x3F, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Address3:" + str);
+
+ return str;
+ }
+
+ //TODO postcode object, dunno how to convert
+ public static String getPostcode(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x03, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x5D, (byte) 0x00,
+ (byte) 0x03, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x03
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_Postcode:" + str);
+
+ return str;
+ }
+
+ public static String getCity(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x60, (byte) 0x00,
+ (byte) 0x19, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x19
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_City:" + str);
+
+ return str;
+ }
+
+ public static String getState(Context applicationContext) {
+ byte[] setLengthByte = new byte[]{(byte) 0xC8, (byte) 0x32, (byte) 0x00, (byte) 0x00, (byte) 0x05, (byte) 0x08, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] selectInfoByte = new byte[]{(byte) 0xCC, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x08,
+ (byte) 0x04, (byte) 0x00, (byte) 0x01, (byte) 0x00,
+ (byte) 0x79, (byte) 0x00,
+ (byte) 0x1E, (byte) 0x00
+ };
+ byte[] readInfoByte = new byte[]{(byte) 0xCC, (byte) 0x06, (byte) 0x00, (byte) 0x00,
+ (byte) 0x1E
+ };
+
+ byte[] setLengthByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, setLengthByte);
+ byte[] selectInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, selectInfoByte);
+ byte[] readInfoByteResponse = IccTester.getInstance(applicationContext).isoCommand((byte) 0, readInfoByte);
+
+ byte[] trimmedBytes = Arrays.copyOfRange(readInfoByteResponse, 0, readInfoByteResponse.length - 3);
+
+ String str = new String(trimmedBytes).trim();
+
+ Logger.logD("JPN_State:" + str);
+
+ return str;
+ }
}
diff --git a/app/src/main/res/layout/confirm_read.xml b/app/src/main/res/layout/confirm_read.xml
new file mode 100644
index 0000000..fe33044
--- /dev/null
+++ b/app/src/main/res/layout/confirm_read.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/cst/im30/ExampleUnitTest.java b/app/src/test/java/com/cst/im30/ExampleUnitTest.java
deleted file mode 100644
index 8e9fb92..0000000
--- a/app/src/test/java/com/cst/im30/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.cst.im30;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see Testing documentation
- */
-public class ExampleUnitTest {
- @Test
- public void addition_isCorrect() {
- assertEquals(4, 2 + 2);
- }
-}
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 332f54e..a5eee53 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,2 +1,2 @@
-rootProject.name = "kiosk-im30"
+rootProject.name = "pax_kiosk_im30"
include ':app'