wbackup83
-
Gesamte Inhalte
11 -
Benutzer seit
-
Letzter Besuch
Posts erstellt von wbackup83
-
-
This works if I put the tag on the reader when i run the main... What i need is to scan and be active for other tags ... for this reason I don't understand where to put the loop ...
-
can you please attach the code or paste it?
-
Nope...it does not enter in the state ...never..
I attach the java file so you can try it if you want
thanks again for the support
-
https://www.amazon.it/gp/product/B01FLOQNMI/ref=oh_aui_detailpage_o02_s00?ie=UTF8&psc=1
I have these... I tried with another tag of the same brand and it's the same...
-
If you intend as it is reported there with the print of the state commented, NO, I do not get any state at all...
-
What i would expect it would be to access the STATE_AUTHENTICATING_MIFARE_CLASSIC_PAGE_READY state after calling authenticateMifareClassicPage(). But this does not happen...
-
Thanks for the reply...but it is the same: it always returns the same page with different tags and the other states are never accessed.
nr.addStateChangedListener(new BrickletNFCRFID.StateChangedListener() {
public void stateChanged(short state, boolean idle) {
//System.out.println(state);
try {
if(idle) {
currentTagType = 0;
//(short)((currentTagType + 1) % 3);
nr.requestTagID(currentTagType);
}
if(state == BrickletNFCRFID.STATE_REQUEST_TAG_ID_READY) {
BrickletNFCRFID.TagID tagID = nr.getTagID();
String s = "Found tag of type " + tagID.tagType +
" with ID [" + Integer.toHexString(tagID.tid[0]);
for(int i = 1; i < tagID.tidLength; i++) {
s += " " + Integer.toHexString(tagID.tid);
}
s += "]";
System.out.println(s);
//added code
short[] keys= {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
nr.authenticateMifareClassicPage(5, (short) 0,keys);
nr.requestPage(5);
short[] data=nr.getPage();
System.out.println(Arrays.toString(data));
}
if(state == BrickletNFCRFID.STATE_AUTHENTICATING_MIFARE_CLASSIC_PAGE_READY) {
System.out.println("Ready");
}
if(state == BrickletNFCRFID.STATE_AUTHENTICATING_MIFARE_CLASSIC_PAGE_ERROR) {
System.out.println("error");
}
} catch(Exception e) {
System.out.println(e);
}
}
});
// Start scan loop
nr.requestTagID(BrickletNFCRFID.TAG_TYPE_MIFARE_CLASSIC);
System.out.println("Press key to exit"); System.in.read();
ipcon.disconnect();
-
I don't understand why using a mifare tag using the provided code i can read the tag page without authenticating ...moreover the state page ready is never accessed... for this reason the page if i change the tag still remains the same...
can you take a look at my code to understand if i m missing something or what?
Tags are found, i can print the page content without authenticating it...(commented)
public class ExampleScanForTags {
private static final String HOST = "localhost";
private static final int PORT = 4223;
// Change XYZ to the UID of your NFC/RFID Bricklet
private static final String UID = "uqB";
private static short currentTagType = 0;
// Note: To make the example code cleaner we do not handle exceptions. Exceptions
// you might normally want to catch are described in the documentation
public static void main(String args[]) throws Exception {
IPConnection ipcon = new IPConnection(); // Create IP connection
// Note: Declare nr as final, so the listener can access it
final BrickletNFCRFID nr = new BrickletNFCRFID(UID, ipcon); // Create device object
ipcon.connect(HOST, PORT); // Connect to brickd
// Don't use device before ipcon is connected
// Add state changed listener
nr.addStateChangedListener(new BrickletNFCRFID.StateChangedListener() {
public void stateChanged(short state, boolean idle) {
//System.out.println(state);
try {
if(idle) {
currentTagType = 0;
//(short)((currentTagType + 1) % 3);
nr.requestTagID(currentTagType);
}
if(state == BrickletNFCRFID.STATE_REQUEST_TAG_ID_READY) {
BrickletNFCRFID.TagID tagID = nr.getTagID();
String s = "Found tag of type " + tagID.tagType +
" with ID [" + Integer.toHexString(tagID.tid[0]);
for(int i = 1; i < tagID.tidLength; i++) {
s += " " + Integer.toHexString(tagID.tid);
}
s += "]";
System.out.println(s);
//added code
short[] keys= {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
//nr.authenticateMifareClassicPage(5, (short) 0,keys);
short[] data=nr.getPage();
System.out.println(Arrays.toString(data));
}
if(state == BrickletNFCRFID.STATE_AUTHENTICATING_MIFARE_CLASSIC_PAGE_READY) {
System.out.println("Ready");
}
if(state == BrickletNFCRFID.STATE_AUTHENTICATING_MIFARE_CLASSIC_PAGE_ERROR) {
System.out.println("error");
}
} catch(Exception e) {
System.out.println(e);
}
}
});
// Start scan loop
nr.requestTagID(BrickletNFCRFID.TAG_TYPE_MIFARE_CLASSIC);
System.out.println("Press key to exit"); System.in.read();
ipcon.disconnect();
}
}
-
Thanks i managed to reset it with an android app...
-
I ve made a mistake...i wrote on the first page of the tag and now the reading returns error 196. Also using brickv says tag found but i can't write tag. Is there a way to reset the tag or it s just dead?
NFC reader with mifare tags
in General Discussion
Geschrieben
It works like a charm! thanks again for your kind support...I really appreciated