Skip to content

Commit

Permalink
Updated ApduTester source code to match PerformanceTester-1_3_0
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] authored and [email protected] committed Nov 6, 2012
1 parent 7b893f8 commit b2ecf59
Show file tree
Hide file tree
Showing 25 changed files with 1,822 additions and 40 deletions.
5 changes: 3 additions & 2 deletions samples/ApduTester/ApduTester/.classpath
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
21 changes: 11 additions & 10 deletions samples/ApduTester/ApduTester/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.gieseckedevrient.android.apdutester"
android:versionCode="1"
android:versionName="0.1">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
package="com.gieseckedevrient.android.apdutester" android:versionName="1.3.1" android:versionCode="3">
<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="false" android:description="@string/about_text">
<uses-library android:name="org.simalliance.openmobileapi" android:required="true"/>
<activity android:name="com.gieseckedevrient.android.apdutester.gui.MainActivity" android:configChanges="orientation|keyboardHidden" android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

</application>
<activity android:name="com.gieseckedevrient.android.apdutester.gui.AboutActivity" android:theme="@android:style/Theme.Dialog"/>
<activity android:name="com.gieseckedevrient.android.apdutester.gui.SettingsActivity" />
</application>
<uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD"/>
</manifest>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="org.simalliance.openmobileapi.SMARTCARD">
</uses-permission>
</manifest>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
#
# This file must be checked in Version Control Systems.
#
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# "ant.properties", and override values to adapt the script to your
# project structure.

# Project target.
target=android-7
# Indicates whether an apk should be generated for each density.
split.density=false
# Project target.
target=Giesecke & Devrient GmbH:Open Mobile API:15
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions samples/ApduTester/ApduTester/res/layout/about.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#FFFFFF"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="15dip">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:isScrollContainer="true"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical">
<ImageView
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginRight="10dp" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical"/>
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:text="@string/app_name"
android:textStyle="bold"
android:textColor="#000000"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/app_version"
android:textColor="#000000"
android:textSize="11.5sp"
android:typeface="monospace"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@string/about_text"
android:textColor="#000000"
android:textSize="12.5sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<TextView
android:text="@string/about_copyright"
android:textColor="#000000"
android:textSize="11.0sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp" />
<TextView
android:text="@string/about_rights"
android:textColor="#000000"
android:textSize="11.0sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:text="@string/about_url"
android:textColor="#000000"
android:textSize="11.0sp"
android:layout_width="wrap_content"
android:layout_height="35sp"
android:layout_marginTop="8dp"
android:clickable="true"
android:autoLink="web"/>
<TextView
android:id="@+id/about_info_headline"
android:textColor="#000000"
android:textSize="11.0sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/app_info"
android:textColor="#000000"
android:textSize="9.5sp"
android:typeface="monospace"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</LinearLayout>
</ScrollView>
50 changes: 48 additions & 2 deletions samples/ApduTester/ApduTester/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,52 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/linearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Spinner
android:id="@+id/spinnerDataLen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Spinner
android:id="@+id/spinnerLoops"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
<RelativeLayout
android:id="@+id/linearLayout"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/startButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:enabled="false"
android:text="Start test" />
<Button
android:id="@+id/stopButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:visibility="invisible"
android:text="Stop test" />
</RelativeLayout>
<ScrollView
android:id="@+id/scrollView"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView"
android:typeface="monospace"
android:textSize="10sp"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
</TextView>
</ScrollView>
</LinearLayout>
8 changes: 6 additions & 2 deletions samples/ApduTester/ApduTester/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">APDU Stress</string>
<string name="app_name">ApduTester</string>
<string name="subline">Giesecke &amp; Devrient GmbH, 2011</string>
<string name="about_text">SmartCard API verification</string>
<string name="about_copyright">Copyright © 2011, Giesecke &amp; Devrient</string>
<string name="about_rights">All rights reserved.</string>
<string name="about_url">http://seek-for-android.googlecode.com</string>
</resources>
31 changes: 31 additions & 0 deletions samples/ApduTester/ApduTester/res/xml/settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="Logfile directory">
<EditTextPreference android:key="logpath"
android:dialogTitle="Logfile directory" android:title="/sdcard" android:summary="Empty string will omit saving a logfile"/>
</PreferenceCategory>

<PreferenceCategory android:title="Communication channel">
<ListPreference android:key="communicationChannel" android:dialogTitle="Communication channel" android:title="Basic channel"/>
</PreferenceCategory>

<PreferenceCategory android:title="Include delays between test cases">
<CheckBoxPreference android:key="delays" android:title="Delays" android:summaryOn="Random delays between test cases" android:summaryOff="No delays between test cases"/>
</PreferenceCategory>

<PreferenceCategory android:title="Stop test run on error">
<CheckBoxPreference android:key="errors" android:title="Error handling" android:summaryOn="Stop after error occured" android:summaryOff="Don't stop on errors"/>
</PreferenceCategory>

<PreferenceCategory android:title="Test cases">
<CheckBoxPreference android:key="case1"
android:title="Case-1" android:summaryOn="Test Case-1 APDU commands" android:summaryOff="Don't test Case-1 APDU commands" />
<CheckBoxPreference android:key="case2"
android:title="Case-2" android:summaryOn="Test Case-2 APDU commands" android:summaryOff="Don't test Case-2 APDU commands" />
<CheckBoxPreference android:key="case3"
android:title="Case-3" android:summaryOn="Test Case-3 APDU commands" android:summaryOff="Don't test Case-3 APDU commands" />
<CheckBoxPreference android:key="case4"
android:title="Case-4" android:summaryOn="Test Case-4 APDU commands" android:summaryOff="Don't test Case-4 APDU commands" />
</PreferenceCategory>
</PreferenceScreen>
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/**
* Copyright 2011 Giesecke & Devrient GmbH.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.gieseckedevrient.android.apdutester;

import java.io.File;

import android.os.Environment;

public class DataContainer {

public static final byte[] APPLET_AID = new byte[] { (byte) 0xD2, 0x76, 0x00, 0x01, 0x18, 0x01, 0x01 };

private static DataContainer instance = null;

private boolean basicChannel = false;
private boolean delays = false;
private boolean errors = true;
private boolean case1 = true;
private boolean case2 = true;
private boolean case3 = true;
private boolean case4 = true;
private int loops = 1;
private int dataLength = 250;
private String logPath = "/sdcard";


private DataContainer() {
logPath = "";
try {
File path = new File(Environment.getExternalStorageDirectory().toString());
if (path.isDirectory() && path.canWrite())
logPath = path.getAbsolutePath();
} catch (Exception e) {
}
}

public static DataContainer getInstance() {
if (instance == null) {
instance = new DataContainer();
}
return instance;
}

public void setBasicChannel(boolean basicChannel) {
this.basicChannel = basicChannel;
}

public boolean getBasicChannel() {
return basicChannel;
}

public void setDelays(boolean delays) {
this.delays = delays;
}

public boolean getDelays() {
return delays;
}

public void setErrors(boolean errors) {
this.errors = errors;
}

public boolean getErrors() {
return errors;
}

public void setCase1(boolean case1) {
this.case1 = case1;
}

public boolean getCase1() {
return case1;
}

public void setCase2(boolean case2) {
this.case2 = case2;
}

public boolean getCase2() {
return case2;
}

public void setCase3(boolean case3) {
this.case3 = case3;
}

public boolean getCase3() {
return case3;
}

public void setCase4(boolean case4) {
this.case4 = case4;
}

public boolean getCase4() {
return case4;
}

public void setLoops(int loops) {
this.loops = loops;
}

public int getLoops() {
return loops;
}

public void setDataLength(int dataLength) {
this.dataLength = dataLength;
}

public int getDataLength() {
return dataLength;
}

public void setLogPath(String logPath) {
this.logPath = logPath;
}

public String getLogPath() {
return logPath;
}
}
Loading

0 comments on commit b2ecf59

Please sign in to comment.