• ¹ã¶«k1ÌåÓýÖǻۿƼ¼ÓÐÏÞ¹«Ë¾ÊÇÖйúרҵµÄÉí·ÝÖ¤ÔĶÁÆ÷¹©Ó¦ÉÌ£¬
  • רעÉí·ÝÖ¤ÔĶÁÆ÷¡¢Ö¸ÎƲɼ¯ÒÇ¡¢Éç±£¿¨¶Á¿¨Æ÷¡¢IC¿¨¶ÁдÆ÷µÄÒ»¼ÒÉí·ÝÖ¤Ó¦Ó÷þÎñƽ̨

k1ÌåÓýÖÇ»Û

µ±Ç°Î»Ö㺠k1ÌåÓý > ·þÎñÖ§³Ö×¨Çø > SDK¿ª·¢°ü > ÕýÎÄ

k1ÌåÓýIDR-100YBÔÆ½âÂëÀ¶ÑÀÉí·ÝÖ¤ÔĶÁÆ÷Android¿ª·¢°ü

À´Ô´£ºwww.mingcreate.cn   ±êÇ©£ºÔƽâÂë À¶ÑÀ IDR-100YB DK309   ×î½ü¸üУº2022-2-19

111.jpg

±¾¿ª·¢°üÖ§³Ök1ÌåÓýÔÆ½âÂëÀ¶ÑÀÉí·ÝÖ¤ÔĶÁÆ÷£¬Ö§³ÖÐͺÅIDR-100YB¡¢DK309ϵÁÐÔÆ½âÂë¶Á¿¨Æ÷¡£

µã»÷ÕâÀïÏÂÔØ¡ý



public class IDCardData {

    public final static int ID_TYPE_CN = 1;       //Éí·ÝÖ¤ÀàÐÍ-¾ÓÃñÉí·ÝÖ¤

    public final static int ID_TYPE_GAT = 2;      //Éí·ÝÖ¤ÀàÐÍ-¸Û°Ą̈¾ÓÃñÉí·ÝÖ¤

    public final static int ID_TYPE_FOREIGN = 3;  //Éí·ÝÖ¤ÀàÐÍ-Íâ¹úÈËÓÀ¾Ã¾ÓÁôÉí·ÝÖ¤


    public String Name = null;                   // ÐÕÃû

    public String Sex = null;                    //ÐÔ±ð

    public String Nation = null;                 //Ãû×å

    public String Born = null;                   //³öÉú

    public String Address = null;                //סַ

    public String IDCardNo = null;               //Éí·ÝÖ¤ºÅ

    public String GrantDept = null;              //Ç©·¢»ú¹Ø

    public String UserLifeBegin = null;          //ÓÐЧÆÚÆðʼÈÕÆÚ

    public String UserLifeEnd = null;            //ÓÐЧÆÚ½áÊøÈÕÆÚ

    public String passport = null;               //ͨÐÐÖ¤ºÅÂë

    public String issueNumber = null;            //Ç©·¢´ÎÊý


    public Bitmap PhotoBmp = null;

    public byte[] fingerprintBytes = null;       //Ö¸ÎÆÊý¾Ý

    public int type = 0;


    public IDCardData(byte[] idCardBytes){


        if (idCardBytes.length < 1295) {

            return;

        }


        if ( (idCardBytes[0] == (byte)0xaa)

                && (idCardBytes[1] == (byte)0xaa)

                && (idCardBytes[2] == (byte)0xaa)

                && (idCardBytes[3] == (byte)0x96)

                && (idCardBytes[4] == (byte)0x69)) {


            //int totalLen = ((idCardBytes[5] & 0xff) << 8) | (idCardBytes[6] & 0xff);

            int wordMsgBytesLen = ((idCardBytes[10] & 0xff) << 8) | (idCardBytes[11] & 0xff);

            int photoMsgBytesLen = ((idCardBytes[12] & 0xff) << 8) | (idCardBytes[13] & 0xff);


            byte[] wordMsgBytes = new byte[wordMsgBytesLen];

            byte[] photoMsgBytes = new byte[photoMsgBytesLen];


            if (idCardBytes.length == 1295) {   //²»´øÖ¸ÎÆ

                System.arraycopy(idCardBytes, 14, wordMsgBytes, 0, wordMsgBytesLen);

                System.arraycopy(idCardBytes, 14 + wordMsgBytesLen, photoMsgBytes, 0, photoMsgBytesLen);

            }

            else {   //´øÖ¸ÎÆ

                int fingerprintBytesLen = ((idCardBytes[14] & 0xff) << 8) | (idCardBytes[15] & 0xff);   //Ö¸ÎÆ³¤¶È

                fingerprintBytes = new byte[fingerprintBytesLen];

                System.arraycopy(idCardBytes, 16, wordMsgBytes, 0, wordMsgBytesLen);

                System.arraycopy(idCardBytes, 16 + wordMsgBytesLen, photoMsgBytes, 0, photoMsgBytesLen);

                System.arraycopy(idCardBytes, 16 + wordMsgBytesLen + photoMsgBytesLen, fingerprintBytes, 0, fingerprintBytesLen);

            }


            //ÅжÏÉí·ÝÖ¤µÄÀàÐÍÊÇ·ñΪ¸Û°Ą̈Éí·ÝÖ¤

            if (wordMsgBytes[248] == 'J') {

                type = ID_TYPE_GAT;

            }

            else if (wordMsgBytes[248] == 'I') {

                type = ID_TYPE_FOREIGN;

            }

            else {

                type = ID_TYPE_CN;

            }


            byte[] bytes;

            String str;

            int index = 0;


            //ÐÕÃû

            bytes = new byte[30];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                Name = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //ÐÔ±ð

            if (wordMsgBytes[30] == 0x31) {

                Sex = "ÄÐ";

            }

            else {

                Sex = "Å®";

            }

            index += 2;


            //Ãû×å

            if (type == ID_TYPE_CN) {

                bytes = new byte[4];

                System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

                try {

                    str = new String(bytes, "UTF_16LE");

                    if (str.length() == 2) {

                        int nationCode = Integer.valueOf(str, 10);

                        Nation = getNation(nationCode);

                    }

                } catch (Exception e) {

                    e.printStackTrace();

                }

            }

            index += 4;


            //³öÉú

            bytes = new byte[16];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                Born = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //סַ

            bytes = new byte[70];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                Address = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //Éí·ÝÖ¤ºÅ

            bytes = new byte[36];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                IDCardNo = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //Ç©·¢»ú¹Ø

            bytes = new byte[30];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                GrantDept = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //ÓÐЧÆðʼÈÕÆÚ

            bytes = new byte[16];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                UserLifeBegin = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //ÓÐЧ½áÊøÈÕÆÚ

            bytes = new byte[16];

            System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

            index += bytes.length;

            try {

                UserLifeEnd = new String(bytes, "UTF_16LE");

            } catch (UnsupportedEncodingException e) {

                e.printStackTrace();

            }


            //¸Û°Ą̈Éí·ÝÖ¤

            if (type == ID_TYPE_GAT) {

                //ͨÐÐÖ¤ºÅÂë

                bytes = new byte[18];

                System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

                index += bytes.length;

                try {

                    passport = new String(bytes, "UTF_16LE");

                } catch (UnsupportedEncodingException e) {

                    e.printStackTrace();

                }


                //Ç©·¢´ÎÊý

                bytes = new byte[4];

                System.arraycopy(wordMsgBytes, index, bytes, 0, bytes.length);

                index += bytes.length;

                try {

                    issueNumber = new String(bytes, "UTF_16LE");

                } catch (UnsupportedEncodingException e) {

                    e.printStackTrace();

                }

            }


            //ÕÕÆ¬½âÂë

            if (photoMsgBytesLen > 0) {

                try {

                    byte[] buf=new byte[Wlt2Bitmap.IMG_LENGTH];

                    if (1 == Wlt2Bitmap.wlt2Bmp (photoMsgBytes, buf)) {

                        PhotoBmp = Wlt2Bitmap.Bgr2Bitmap (buf);

                    }

                } catch (Exception e) {

                    e.printStackTrace();

                }

            }

        }

    }


    String getNation(int code){

        switch(code){

            case 01:  return "ºº";

            case 02:  return "ÃɹÅ";

            case 03:  return "»Ø";

            case 04:  return "²Ø";

            case 05:  return "άÎá¶û";

            case 06:  return "Ãç";

            case 07:  return "ÒÍ";

            case 8:   return "׳";

            case 9:   return "²¼ÒÀ";

            case 10:  return "³¯ÏÊ";

            case 11:  return "Âú";

            case 12:  return "¶±";

            case 13:  return "Ñþ";

            case 14:  return "°×";

            case 15:  return "ÍÁ¼Ò";

            case 16:  return "¹þÄá";

            case 17:  return "¹þÈø¿Ë";

            case 18:  return "´ö";

            case 19:  return "Àè";

            case 20:  return "ÀüËÛ";

            case 21:  return "Øô";

            case 22:  return "î´";

            case 23:  return "¸ßɽ";

            case 24:  return "À­ìï";

            case 25:  return "Ë®";

            case 26:  return "¶«Ïç";

            case 27:  return "ÄÉÎ÷";

            case 28:  return "¾°ÆÄ";

            case 29:  return "¿Â¶û¿Ë×Î";

            case 30:  return "ÍÁ";

            case 31:  return "´ïÎÓ¶û";

            case 32:  return "ØïÀÐ";

            case 33:  return "Ǽ";

            case 34:  return "²¼ÀÊ";

            case 35:  return "ÈöÀ­";

            case 36:  return "ëÄÏ";

            case 37:  return "ØîÀÐ";

            case 38:  return "Îý²®";

            case 39:  return "°¢²ý";

            case 40:  return "ÆÕÃ×";

            case 41:  return "Ëþ¼ª¿Ë";

            case 42:  return "Å­";

            case 43:  return "ÎÚ×αð¿Ë";

            case 44:  return "¶íÂÞ˹";

            case 45:  return "¶õοË";

            case 46:  return "µÂ°º";

            case 47:  return "±£°²";

            case 48:  return "Ô£¹Ì";

            case 49:  return "¾©";

            case 50:  return "ËþËþ¶û";

            case 51:  return "¶ÀÁú";

            case 52:  return "¶õÂ×´º";

            case 53:  return "ºÕÕÜ";

            case 54:  return "ÃŰÍ";

            case 55:  return "çó°Í";

            case 56:  return "»ùŵ";

            case 97:  return "ÆäËû";

            case 98:  return "Íâ¹úѪͳÖйú¼®ÈËÊ¿";

            default : return "";

        }

    }


    public String toString() {

        if (type == ID_TYPE_GAT) {

            return "\r\nÐÕ        Ãû£º" + Name

                    + "\r\nÐÔ        ±ð£º" + Sex

                    + "\r\n³öÉúÈÕÆÚ£º" + Born

                    + "\r\nס        Ö·£º" + Address

                    + "\r\nÉí·Ý Ö¤ºÅ£º" + IDCardNo

                    + "\r\nÇ©·¢ »ú¹Ø£º" + GrantDept

                    + "\r\nÓР Ч  ÆÚ£º" + UserLifeBegin + "-" + UserLifeEnd

                    + "\r\nͨÐÐ Ö¤ºÅ£º" + passport

                    + "\r\nÇ©·¢ ´ÎÊý£º" + issueNumber;

        }

        else {

            return "\r\nÐÕ        Ãû£º" + Name

                    + "\r\nÐÔ        ±ð£º" + Sex

                    + "\r\nÃû        ×壺" + Nation

                    + "\r\n³öÉúÈÕÆÚ£º" + Born

                    + "\r\nס        Ö·£º" + Address

                    + "\r\nÉí·Ý Ö¤ºÅ£º" + IDCardNo

                    + "\r\nÇ©·¢ »ú¹Ø£º" + GrantDept

                    + "\r\nÓР Ч  ÆÚ£º" + UserLifeBegin + "-" + UserLifeEnd;

        }

    }

}






£¨*ÓÉÓÚ²úÆ·Éý¼¶»òÆäËûÔ­Òò£¬k1ÌåÓýIDR-100YBÔÆ½âÂëÀ¶ÑÀÉí·ÝÖ¤ÔĶÁÆ÷Android¿ª·¢°ü²úƷʵ¼Ê²ÎÊýÓпÉÄܱä¸ü£¬ÒÔʵ¼Ê²úƷΪ׼¡£±¾ÎÄÖеÄËùÓгÂÊö¡¢ÐÅÏ¢ºÍ½¨ÒéÒ²²»¹¹³ÉÈκÎÃ÷ʾ»ò°µÊ¾µÄµ£±££©

¡¾ÍøÕ¾µØÍ¼¡¿¡¾sitemap¡¿