slightly better ui messages

This commit is contained in:
Frank Morgner
2014-09-26 02:46:21 +02:00
parent bb6f28a9fa
commit 0d8d325f12
3 changed files with 14 additions and 17 deletions

View File

@@ -105,7 +105,6 @@ public class MainActivity extends Activity {
private EditText editTextVPCDHost; private EditText editTextVPCDHost;
private EditText editTextVPCDPort; private EditText editTextVPCDPort;
private TextView textViewVPCDStatus; private TextView textViewVPCDStatus;
private TextView textViewInfo;
private Button button; private Button button;
private ProgressBar spinner; private ProgressBar spinner;
private VPCDHandler handler; private VPCDHandler handler;
@@ -119,7 +118,6 @@ public class MainActivity extends Activity {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
textViewInfo = (TextView) findViewById(R.id.textViewInfo);
editTextVPCDHost = (EditText) findViewById(R.id.editTextHostname); editTextVPCDHost = (EditText) findViewById(R.id.editTextHostname);
editTextVPCDPort = (EditText) findViewById(R.id.editTextPort); editTextVPCDPort = (EditText) findViewById(R.id.editTextPort);
textViewVPCDStatus = (TextView) findViewById(R.id.textViewLog); textViewVPCDStatus = (TextView) findViewById(R.id.textViewLog);
@@ -169,7 +167,6 @@ public class MainActivity extends Activity {
vpcdDisconnect(); vpcdDisconnect();
} }
public void buttonOnClickDisConnect(View view) { public void buttonOnClickDisConnect(View view) {
if (testing) { if (testing) {
testing = false; testing = false;

View File

@@ -89,6 +89,7 @@ public class VPCDWorker implements Runnable, Closeable {
case VPCD_CTRL_ON: case VPCD_CTRL_ON:
reader.powerOn(); reader.powerOn();
messageSender.sendOn(); messageSender.sendOn();
messageSender.sendATR(Hex.getHexString(reader.getATR()));
break; break;
case VPCD_CTRL_RESET: case VPCD_CTRL_RESET:
reader.reset(); reader.reset();
@@ -96,7 +97,6 @@ public class VPCDWorker implements Runnable, Closeable {
break; break;
case VPCD_CTRL_ATR: case VPCD_CTRL_ATR:
out = reader.getATR(); out = reader.getATR();
//messageSender.sendATR(Hex.getHexString(out));
break; break;
default: default:
throw new IOException("Unhandled command from VPCD."); throw new IOException("Unhandled command from VPCD.");
@@ -114,8 +114,6 @@ public class VPCDWorker implements Runnable, Closeable {
if (doRun) { if (doRun) {
e.printStackTrace(); e.printStackTrace();
messageSender.sendError(e.getMessage()); messageSender.sendError(e.getMessage());
} else {
messageSender.sendDisconnected("");
} }
} }
} }
@@ -167,8 +165,12 @@ public class VPCDWorker implements Runnable, Closeable {
} }
private void vpcdDisconnect() throws IOException { private void vpcdDisconnect() throws IOException {
if (reader != null) {
reader.eject();
}
if (socket != null) { if (socket != null) {
socket.close(); socket.close();
messageSender.sendDisconnected("");
} }
} }
} }

View File

@@ -9,23 +9,21 @@
<string name="hint_vpcd_port">port</string> <string name="hint_vpcd_port">port</string>
<string name="hint_vpcd_hostname">VPCD hostname</string> <string name="hint_vpcd_hostname">VPCD hostname</string>
<string name="vpcd_config_info">Settings for <a href="http://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html">remote smart card reader driver (VPCD)</a> of the host computer.</string> <string name="vpcd_config_info">Settings for <a href="http://frankmorgner.github.io/vsmartcard/virtualsmartcard/README.html">remote smart card reader driver (VPCD)</a> of the host computer. Tap a contact-less card when configured.</string>
<string name="status_error">Error</string> <string name="status_error">Error</string>
<string name="status_disconnected">Disconnected</string> <string name="status_disconnected">Disconnected from VPCD</string>
<string name="status_connected_to">Connected to</string> <string name="status_connected_to">Connected to</string>
<string name="status_atr">ATR</string> <string name="status_atr">ATR</string>
<string name="status_capdu">C-APDU</string> <string name="status_capdu">C-APDU</string>
<string name="status_rapdu">R-APDU</string> <string name="status_rapdu">R-APDU</string>
<string name="status_on">On</string> <string name="status_on">Powered up the card</string>
<string name="status_off">Off</string> <string name="status_off">Powered down the card (cold reset)</string>
<string name="status_reset">Reset</string> <string name="status_reset">Resetted the card (warm reset)</string>
<string name="status_unknown">Unknown Event</string> <string name="status_unknown">Unable to perform unknown Event</string>
<string name="status_tag_discovered">Contact-less card discovered.</string> <string name="status_tag_discovered">Contact-less card discovered</string>
<string name="status_dummy_start">Using a dummy card to test the connection.</string> <string name="status_dummy_start">Using a dummy card to test the connection</string>
<string name="status_default_port">Using default port.</string> <string name="status_default_port">Using default port</string>
<string name="menu_copy_to_clipboard">Copy</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="verbose">Verbose logging</string> <string name="verbose">Verbose logging</string>