Skip to content

Commit 2aa02c4

Browse files
author
Evgeniy Sinev
committed
Added USB terminals (Verifone, Pax)
1 parent 91eafd1 commit 2aa02c4

File tree

5 files changed

+71
-1
lines changed

5 files changed

+71
-1
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies {
3636
compile 'com.google.code.gson:gson:2.3.1'
3737

3838
// Reader SDK
39-
def readerVersion = '1.4-53'
39+
def readerVersion = '1.4-54'
4040
compile 'com.payneteasy.android.reader:api:' + readerVersion
4141
compile 'com.payneteasy.android.reader:lib:' + readerVersion
4242
compile 'com.payneteasy.android.reader.readers:readers-common-bluetooth:' + readerVersion

app/src/main/AndroidManifest.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
<action android:name="android.intent.action.MAIN"/>
3535
<category android:name="android.intent.category.LAUNCHER"/>
3636
</intent-filter>
37+
38+
<!-- USB -->
39+
<intent-filter>
40+
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
41+
</intent-filter>
42+
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" android:resource="@xml/device_filter" />
43+
3744
</activity>
3845

3946
<activity android:name="com.payneteasy.example.ReaderActivity" android:configChanges="orientation|keyboardHidden" />

app/src/main/java/com/payneteasy/example/MainActivity.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
import com.payneteasy.android.sdk.reader.CardReaderInfo;
1111
import com.payneteasy.android.sdk.reader.CardReaderProblem;
1212
import com.payneteasy.android.sdk.reader.CardReaderType;
13+
import com.payneteasy.android.sdk.reader.CardReaderVersion;
14+
import com.payneteasy.android.sdk.usb.UsbPermissionResolver;
1315
import com.payneteasy.example.app1.R;
1416
import com.payneteasy.example.util.ActivityUtil;
1517
import com.payneteasy.paynet.processing.response.StatusResponse;
@@ -18,10 +20,27 @@
1820

1921
public class MainActivity extends Activity {
2022

23+
private final UsbPermissionResolver usbPermissionResolver = new UsbPermissionResolver();
24+
2125
@Override
2226
protected void onCreate(Bundle savedInstanceState) {
2327
super.onCreate(savedInstanceState);
2428
setContentView(R.layout.activity_main);
29+
30+
setTitle("Example, sdk version " + CardReaderVersion.getVersion());
31+
usbPermissionResolver.checkPermission(getIntent(), this);
32+
}
33+
34+
@Override
35+
protected void onNewIntent(Intent intent) {
36+
super.onNewIntent(intent);
37+
usbPermissionResolver.checkPermission(intent, this);
38+
}
39+
40+
@Override
41+
protected void onDestroy() {
42+
super.onDestroy();
43+
usbPermissionResolver.unregister(this);
2544
}
2645

2746
public void startMiura(View aView) {
@@ -42,6 +61,24 @@ public void startTest(View aView) {
4261
ActivityUtil.startActivityForResult(10, this, ReaderActivity.class, CardReaderInfo.TEST, null);
4362
}
4463

64+
public void startVerifoneUsb(View aView) {
65+
ActivityUtil.startActivityForResult(10
66+
, this
67+
, ReaderActivity.class
68+
, new CardReaderInfo("verifone", CardReaderType.INPAS_VERIFONE_USB, null)
69+
, new BigDecimal("1.02")
70+
);
71+
}
72+
73+
public void startPaxUsb(View aView) {
74+
ActivityUtil.startActivityForResult(10
75+
, this
76+
, ReaderActivity.class
77+
, new CardReaderInfo("pax", CardReaderType.INPAS_PAX_USB, null)
78+
, new BigDecimal("1.02")
79+
);
80+
}
81+
4582
@Override
4683
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
4784
if(data == null) {

app/src/main/res/layout/activity_main.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,20 @@
2727
android:id="@+id/button3" android:layout_gravity="center_horizontal" android:onClick="startTest"
2828
android:visibility="gone"
2929
/>
30+
31+
<Button
32+
android:layout_margin="10dp"
33+
android:layout_width="wrap_content"
34+
android:layout_height="wrap_content"
35+
android:text="Run with Verifone USB"
36+
android:id="@+id/button4" android:layout_gravity="center_horizontal" android:onClick="startVerifoneUsb"
37+
/>
38+
39+
<Button
40+
android:layout_margin="10dp"
41+
android:layout_width="wrap_content"
42+
android:layout_height="wrap_content"
43+
android:text="Run with PAX USB"
44+
android:id="@+id/button5" android:layout_gravity="center_horizontal" android:onClick="startPaxUsb"
45+
/>
3046
</LinearLayout>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
4+
<!-- 0x1234 / 0x0101 PAX / S80 -->
5+
<usb-device vendor-id="4660" product-id="257" class="255" subclass="0" protocol="0"/>
6+
7+
<!-- 0x11CA / 0x0219 VeriFone Inc / Trident USB Device 1.1 / bInterfaceClass = 10 CDC Data -->
8+
<usb-device vendor-id="4554" product-id="537" class="10" subclass="0" protocol="0"/>
9+
10+
</resources>

0 commit comments

Comments
 (0)