protected void runDoTransactionEx() {
int appNumber;
TransactionIn transIn = new TransactionIn();
TransactionOut transOut = new TransactionOut();
transIn.setAmount(metStatic4.getText().toString());
transIn.setCurrencyCode(metStatic3.getText().toString());
transIn.setOperation(msSpinner1.getSelectedItem().toString().substring(0,1));
transIn.setTermNum(metStatic2.getText().toString());
transIn.setAuthorizationType(msSpinner2.getSelectedItem().toString());
transIn.setCtrlCheque(msSpinner3.getSelectedItem().toString());
transIn.setUserData1(metStatic5.getText().toString());
if (metStatic7.getText().length() == 0)
appNumber = 0;
else
appNumber = Integer.parseInt(metStatic7.getText().toString());
byte[] extDataIn = null;
try {
byte[] tmp = metStatic6.getText().toString().getBytes("ISO-8859-1");
if (mcbHexa.isChecked())
{
extDataIn = new byte[tmp.length/2];
int j=0;
for (int i=0; i<tmp.length; i++)
{
if (tmp[i] >= 'a' && tmp[i] <= 'f')
tmp[i] = (byte) (tmp[i] - 'a' + 10);
else if (tmp[i] >= 'A' && tmp[i] <= 'F')
tmp[i] = (byte) (tmp[i] - 'A' + 10);
else if (tmp[i] >= '0' && tmp[i] <= '9')
tmp[i] = (byte) (tmp[i] - '0');
}
for (int i=0; i<tmp.length; i+=2)
{
String str = String.format("%02x", tmp[i]*16 + tmp[i+1]);
extDataIn[j++] = (byte) Integer.parseInt(str, 16);
}
}
else
{
extDataIn = tmp;
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
mtvStatus.setText("TEST ERROR: UnsupportedEncodingException");
return;
}
byte[] extDataOut = new byte[5000];
Log.d(TAG, "Amount:" + transIn.getAmount() + " Currency:" + transIn.getCurrencyCode() + " Operation:" + transIn.getOperation());
Log.d(TAG, "TermNum:" + transIn.getTermNum() + " AuthoType:" + transIn.getAuthorizationType() + " CtrlCheque:" + transIn.getCtrlCheque());
Log.d(TAG, "UserData:" + transIn.getUserData1());
mtvStatus.setText("TEST STARTED ...\n");
mtvResult.setText("");
mPclService.registerCallback(mCallback);
mCallbackRegistered = true;
new DoTransactionExTask(transIn, transOut, appNumber, extDataIn, extDataOut).execute();
}