private static int getFile(int file) {
return (byte)((file << 3) | 4);
}
public static void seviceTest() throws Exception {
SmartCardServer service = new SmartCardServer();
service.addCardListener(new NewSocialCardListener() {
@Override
public void onCardInsert(SmartCard smartcard) {
NewSocialCardService service;
try {
service = new NewSocialCardService(smartcard);
System.out.println("New social cart inserted :"
+ "\n F.I.O.: " + service.getFIO()
+ "\n Sex: " + service.getSex()
+ "\n Address: " + service.getAddress()
+ "\n Birthday: " + service.getBirthDay()
+ "\n Serial: " + service.getSerial()
+ "\n SNILS: " + service.getSnils()
+ "\n INN: " + service.getInn());
for(int i=0; i<12; i++) {
Excemption exc = service.getExcemption(i);
if(exc == null) {
continue;
}
System.out.println(" excemption " + i
+ ": type:" + exc.type
+ ", begin:" + exc.begin
+ ", end:" + exc.end);
}
System.out.println("card end ");
} catch (CardException ex) {
System.out.println("New Social read error :" + ex.getMessage());
}
}
});
service.addCardListener(new OldSocialCardListener() {
@Override
public void onCardInsert(SmartCard smartcard) {
OldSocialCardService service = new OldSocialCardService(smartcard);
try {
System.out.println("Old Social cart inserted :" + service.readID());
} catch (CardException ex) {
System.out.println("Old Social read error :" + ex.getMessage());
}
}
});
service.start();
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
while (true) {
System.out.println("Нажмите 0 для выхода");
String ln = input.readLine();
if (ln == null || ln.equals("0")) {
break;
}
}
service.stop();
}