import java.applet.Applet;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.util.Formatter;
import org.xvolks.jnative.JNative;
import org.xvolks.jnative.Type;
import org.xvolks.jnative.exceptions.NativeException;
public class TestApplet extends Applet {
private static final int version = 11;
private static Boolean synchro = new Boolean(true);
private Exception lastException;
private String passwordCipher;
private int symCipherKeySize;
private boolean debug;
private boolean raiseExceptions;
private String signature;
private boolean persistPrivateKey;
private boolean statePrepared;
private String stMacAddress;
private String stNewWorkKey;
private String stCardDetails;
@Override
public void init() {
System.out.println("initializing");
statePrepared = false;
}
@Override
public void start() {
System.out.println("Start method()");
try {
System.out.println("Pin Block:"+callGenPinBlock("","6220180080000133217|49 01|6220180080000133217D49011018620000000|Dhivya C |10081567"));
}catch(Exception e) {
System.out.println("Exception in callGenPinBlock() :"+e);
}
}
public boolean isPrepared() {
System.out.println("isPrepared()");
return statePrepared;
}
@Override
public void stop() {
System.out.println("stopping");
}
@Override
public void destroy() {
System.out.println("destroying");
}
public Exception getLastException() {
return lastException;
}
public String getLastExceptionStackTrace() {
if (lastException == null) {
return null;
} else {
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw, true);
lastException.printStackTrace(pw);
pw.close();
return sw.toString();
}
}
private void handleException(Exception e) throws Exception {
lastException = e;
if (raiseExceptions) {
throw e;
} else {
e.printStackTrace();
}
}
public int getVersion() {
return version;
}
public String getJavaVersion() {
return System.getProperty("java.version");
}
public String callGenPinBlock(String stBlank,String cardDetails) {
String retValue = null;
try
{
JNative BlockInput = new JNative("C:\\NEWDLL_TEST"+"\\kioskPinPad", "GenPinBlock");
BlockInput.setRetVal(Type.STRING);
BlockInput.setParameter(0,stBlank);
BlockInput.setParameter(1,cardDetails);
BlockInput.invoke();
retValue = BlockInput.getRetVal();
BlockInput.dispose();
}
catch(NativeException exp)
{
exp.printStackTrace();
return "error in calling";
}
catch(IllegalAccessException exp)
{
exp.printStackTrace();
return "error in calling";
}
catch(Exception exp)
{
exp.printStackTrace();
return "error in calling";
}
return retValue;
}
}