I have a Box full with empty Sitag S Cards (around 1000pcs.).
I'm trying to write with this example code:
Code: Select all
/*
* Copyright 2007 Phidgets Inc. All rights reserved.
*/
import com.phidgets.*;
import com.phidgets.event.*;
public class WriteACard
{
public static final void main(String args[]) throws Exception {
RFIDPhidget rfid;
System.out.println(Phidget.getLibraryVersion());
rfid = new RFIDPhidget();
rfid.addAttachListener(new AttachListener() {
public void attached(AttachEvent ae)
{
try
{
((RFIDPhidget)ae.getSource()).setAntennaOn(true);
((RFIDPhidget)ae.getSource()).setLEDOn(true);
}
catch (PhidgetException ex) { }
System.out.println("attachment of " + ae);
}
});
rfid.addDetachListener(new DetachListener() {
public void detached(DetachEvent ae) {
System.out.println("detachment of " + ae);
}
});
rfid.addErrorListener(new ErrorListener() {
public void error(ErrorEvent ee) {
System.out.println("error event for " + ee);
}
});
rfid.addTagGainListener(new TagGainListener()
{
public void tagGained(TagGainEvent oe)
{
System.out.println("Tag Gained: " +oe.getValue() + " (Proto:"+ oe.getProtocol()+")");
}
});
rfid.addTagLossListener(new TagLossListener()
{
public void tagLost(TagLossEvent oe)
{
System.out.println(oe);
System.out.println(oe.getValue());
}
});
rfid.addOutputChangeListener(new OutputChangeListener()
{
public void outputChanged(OutputChangeEvent oe)
{
System.out.println(oe);
}
});
rfid.open(331514);
System.out.println("waiting for RFID attachment...");
rfid.waitForAttachment(1000);
System.out.println("Serial: " + rfid.getSerialNumber());
System.out.println("Outputs: " + rfid.getOutputCount());
//System.out.println("Letzter Tag war: " + rfid.getLastTag());
//How to write a tag:
rfid.write("123456789a", RFIDPhidget.PHIDGET_RFID_PROTOCOL_EM4100, false);
System.out.println("Outputting events. Input to stop.");
System.in.read();
System.out.print("closing...");
rfid.close();
rfid = null;
System.out.println(" ok");
if (false) {
System.out.println("wait for finalization...");
System.gc();
}
}
}
but i'm getting this error:
Exception in thread "main" PhidgetException 13 (Given timeout has been exceeded.)
at com.phidgets.RFIDPhidget.write(Native Method)
at WriteACard.main(WriteACard.java:71)
I'm using Phidget21 - Version 2.1.8 - Built Aug 2 2013 09:32:33
looks like there's something wrong with this:
rfid.write("123456789a", RFIDPhidget.PHIDGET_RFID_PROTOCOL_EM4100, false);
But I don't find out what it is...
Even when I try to write with the Full example, I receive an error:
http://www.descom.ch/images/rfid
Does anyone know how to solve this?