File tree Expand file tree Collapse file tree 1 file changed +29
-2
lines changed
core/java/android/nfc/technology Expand file tree Collapse file tree 1 file changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,15 @@ public int getSectorSize(int sector) {
205205 return getBlockCount (sector ) * 16 ;
206206 }
207207
208+ public int getTotalBlockCount () {
209+ int totalBlocks = 0 ;
210+ for (int sec = 0 ; sec < getSectorCount (); sec ++) {
211+ totalBlocks += getSectorSize (sec );
212+ }
213+
214+ return totalBlocks ;
215+ }
216+
208217 public int getBlockCount (int sector ) {
209218 if (sector >= getSectorCount ()) {
210219 throw new IllegalArgumentException ("this card only has " + getSectorCount () +
@@ -343,9 +352,27 @@ public void decrement(int block) throws IOException {
343352 checkConnected ();
344353
345354 byte addr = (byte ) block ;
346- byte [] incr_cmd = { (byte ) 0xC0 , (byte ) block };
355+ byte [] decr_cmd = { (byte ) 0xC0 , (byte ) block };
347356
348- transceive (incr_cmd );
357+ transceive (decr_cmd );
358+ }
359+
360+ public void transfer (int block ) throws IOException {
361+ checkConnected ();
362+
363+ byte addr = (byte ) block ;
364+ byte [] trans_cmd = { (byte ) 0xB0 , (byte ) block };
365+
366+ transceive (trans_cmd );
367+ }
368+
369+ public void restore (int block ) throws IOException {
370+ checkConnected ();
371+
372+ byte addr = (byte ) block ;
373+ byte [] rest_cmd = { (byte ) 0xC2 , (byte ) block };
374+
375+ transceive (rest_cmd );
349376 }
350377
351378 /**
You can’t perform that action at this time.
0 commit comments