Page 83 - 3-2
P. 83

return sb.toString();
                        } catch(Exception e){
                            Log.d(" 여긴가", "9.8_del_all_table3,  완료못함");
                            return new String("Exception: " + e.getMessage());
                        }
                    }


                }




                private class ReadMifareClassicTask extends AsyncTask<Void, Void, Void> {


                    /*
                    MIFARE Classic tags are divided into sectors, and each sector is sub-divided into blocks.
                    Block size is always 16 bytes (BLOCK_SIZE). Sector size varies.
                    MIFARE Classic 1k are 1024 bytes (SIZE_1K), with 16 sectors each of 4 blocks.
                    */


                    MifareClassic taskTag;
                    int numOfBlock;
                    final int FIX_SECTOR_COUNT = 16;
                    boolean success;
                    final int numOfSector = 16;
                    final int numOfBlockInSector = 4;
                    byte[][][] buffer = new byte[numOfSector][numOfBlockInSector][MifareClassic.BLOCK_SIZE];


                    ReadMifareClassicTask(MifareClassic tag){
                        taskTag = tag;
                        success = false;
                    }


                    @Override
                    protected Void doInBackground(Void... params) {


                        try {
                            taskTag.connect();


                            for(int s=0; s<numOfSector; s++){
                                if(taskTag.authenticateSectorWithKeyA(s, MifareClassic.KEY_DEFAULT)) {
                                    for(int b=0; b<numOfBlockInSector; b++){
                                        int blockIndex = (s * numOfBlockInSector) + b;
                                        buffer[s][b] = taskTag.readBlock(blockIndex);
                                    }
                                }
                            }


                                                         - 83 -
   78   79   80   81   82   83   84   85   86   87   88