我希望能够使用NfcA?Android 上的标签技术在 MIFARE Ultralight EV1 (MFOUL21) 标签上设置和取消设置密码保护。
我知道我会为此使用该nfcA.transceive()方法,但我不确定该方法的参数是什么,所以任何人都可以提供代码片段来设置和取消设置密码吗?
更新:
对于 TapLinx 库,我基本上希望nfcA.transceive(...)代码片段相当于:
ultralightEV1.programPwd(passwordBytes);ultralightEV1.programPack(packBytes);ultralightEV1.enablePasswordProtection(enabled, fromPageNum);ultralightEV1.authenticatePwd(passwordBytes);我是新来的NFC Android和我一直在坚持了几天试图获得第4页至第7页NTAG212的Mifare超轻与验证,我已经有PWD和包装做PWD_AUTH基础上,NTAG212文档.
我这样做...
//assume password as array of bytes
//assume pack as array of bytes
try{
nfc.connect();
byte[] cmd1 = nfc.transceive(new byte[]{ (byte) 0x30, (byte) 0x00 }); //read the page 0 to make the NFC active
nfc.transceive(new byte[]{
(byte) 0x1B, //command for PWD_AUTH
pass[0],
pass[1],
pass[2],
pass[3]
});
byte[] cmd4 = nfc.transceive(new byte[]{ (byte) 0x30, (byte) 0x04 }); //read the page 4
}catch(TagLostException e){
e.printStackTrace();
}catch(IOException e){
e.printStachTrace();
}finally{
try{
nfc.close();
}catch(Exception e){
//display …Run Code Online (Sandbox Code Playgroud)