3c2353cd
杜方
1、畅游通核销app源码提交;
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
package com.ectrip.cyt.config;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import com.basewin.services.DeviceInfoBinder;
import com.basewin.services.PrinterBinder;
import com.basewin.services.ScanBinder;
import com.basewin.services.ServiceManager;
/**
* 仅使用于盛本的红色pos机
* 用于绑定系统AIDL服务
* @author Administrator
*
*/
public class BindService {
private DeviceInfoBinder deviceinfo = null; // 设备信息
private PrinterBinder printer=null; //打印模块
private ScanBinder scan = null; //扫描模块
private static BindService instance = null;
private boolean bindService;
public static BindService getInstance() {
if (instance==null) {
synchronized (BindService.class) {
instance=new BindService();
}
}
return instance;
}
public DeviceInfoBinder getDeviceInfo() {
if (deviceinfo==null) {
synchronized (BindService.class) {
try {
deviceinfo = ServiceManager.getInstence().getDeviceinfo();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return deviceinfo;
}
public PrinterBinder getPrinter() {
if (printer==null) {
synchronized (BindService.class) {
try {
printer = ServiceManager.getInstence().getPrinter();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return printer;
}
public ScanBinder getScan() {
if (printer==null) {
synchronized (BindService.class) {
try {
scan = ServiceManager.getInstence().getScan();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return scan;
}
public boolean isBasewin() {
if (deviceinfo==null) {
synchronized (BindService.class) {
try {
deviceinfo = ServiceManager.getInstence().getDeviceinfo();
} catch (Exception e) {
bindService = false;
e.printStackTrace();
}
}
}
try {
String sn = deviceinfo.getDeviceType();
Log.d("SN",sn);
if (TextUtils.isEmpty(sn)){
bindService=false;
}else {
if (sn.equals("P2000L")){
bindService=true;
}else {
bindService=false;
}
}
} catch (RemoteException e) {
bindService = false;
e.printStackTrace();
}
return bindService;
}
}
|