|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMifareWriter
public class MifareWriter
MifareWriter is responsible for communication with the java card application
Field Summary | |
---|---|
private byte[] |
buf
|
private java.lang.String |
BUSY_READING_TICKET
|
private java.lang.String |
BUSY_SAVING_TICKET
|
private java.lang.String |
BUSY_TICKET_READ
|
private java.lang.String |
BUSY_TICKET_SAVED
|
private static byte |
CMD_TICKET
|
private ConfirmationAlert |
confAlert
|
private java.lang.String |
CONFIRMATION_TITLE
|
private int |
count
|
private static byte[] |
MF_PASSWORD
|
private byte[] |
newTotal
|
private boolean |
read
|
private byte[] |
readticket
|
private SecureChipHandler |
secureChip
|
private static byte[] |
SELECT
|
private TicketingSystemMIDlet |
ts
|
private int |
value
|
private byte[] |
writeticket
|
Constructor Summary | |
---|---|
MifareWriter(SecureChipHandler sc,
TicketingSystemMIDlet ts,
byte[] data,
boolean read)
Initiates the communication with the MIFARE memory |
Method Summary | |
---|---|
private static java.lang.String |
getHexString(byte[] data)
Converts a byte array to string representation |
private int |
getShort(byte[] data)
Reads a short and return it as an int |
void |
getTicket()
Reads the existing ticket |
byte[] |
readFromChip(int pos)
Reads the ticket from the MIFARE memory |
void |
run()
Sets the communication mode of the secure chip to internal Identifies the operation, either read or write |
private void |
sleep()
Puts the current thread to sleep |
private void |
update()
Gets the existing credit on the secure chip and adds the credit from the new ticket |
void |
writeShort(int theShort)
Writes an int to a short |
private void |
writeToChip(int pos,
byte[] ticket)
Writes to the MIFARE memory |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final java.lang.String CONFIRMATION_TITLE
private final java.lang.String BUSY_READING_TICKET
private final java.lang.String BUSY_SAVING_TICKET
private final java.lang.String BUSY_TICKET_SAVED
private final java.lang.String BUSY_TICKET_READ
private byte[] buf
private byte[] newTotal
private byte[] readticket
private byte[] writeticket
private int count
private int value
private ConfirmationAlert confAlert
private SecureChipHandler secureChip
private TicketingSystemMIDlet ts
private boolean read
private static final byte CMD_TICKET
private static final byte[] MF_PASSWORD
private static final byte[] SELECT
Constructor Detail |
---|
public MifareWriter(SecureChipHandler sc, TicketingSystemMIDlet ts, byte[] data, boolean read)
sc
- The handler of the communication with the secure chipts
- The MIDletdata
- The new ticketread
- The task to be done, true when readMethod Detail |
---|
public void run()
run
in interface java.lang.Runnable
private void update()
private void writeToChip(int pos, byte[] ticket) throws java.io.IOException, APDUCommandException, java.lang.Exception
pos
- The block number to writeticket
- The ticket to write
java.io.IOException
APDUCommandException
java.lang.Exception
public void getTicket()
public byte[] readFromChip(int pos) throws java.io.IOException, APDUCommandException
pos
- The block # to read
java.io.IOException
APDUCommandException
private static java.lang.String getHexString(byte[] data)
data
- The byte array to
private int getShort(byte[] data)
java.lang.Exception
- when failing to read the shortByteArrayInputStream
,
DataInputStream
public void writeShort(int theShort) throws java.lang.Exception
theShort
- The int value to write
java.lang.Exception
ByteArrayOutputStream
,
DataOutputStream
private void sleep()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |