|
@ -1,15 +1,22 @@
|
1
|
1
|
package com.ai.mobile.simcard;
|
2
|
2
|
|
|
3
|
import java.util.HashMap;
|
|
4
|
import java.util.Iterator;
|
|
5
|
|
3
|
6
|
import org.json.JSONArray;
|
4
|
7
|
import org.json.JSONException;
|
5
|
8
|
import org.json.JSONObject;
|
6
|
9
|
|
|
10
|
import android.content.Context;
|
|
11
|
import android.hardware.usb.UsbDevice;
|
|
12
|
import android.hardware.usb.UsbManager;
|
7
|
13
|
import android.os.Bundle;
|
8
|
14
|
import android.os.Handler;
|
9
|
15
|
import android.os.Message;
|
10
|
16
|
|
11
|
17
|
import com.ai.mobile.IpuApplication;
|
12
|
18
|
import com.ai.mobile.util.Constant;
|
|
19
|
import com.android.smartcard.Reader;
|
13
|
20
|
import com.wade.mobile.frame.IWadeMobile;
|
14
|
21
|
import com.wade.mobile.frame.plugin.Plugin;
|
15
|
22
|
import com.wade.mobile.util.Messages;
|
|
@ -118,18 +125,26 @@ public class SimCard extends Plugin {
|
118
|
125
|
}
|
119
|
126
|
|
120
|
127
|
public void getCardSN(JSONArray param) throws Exception {
|
121
|
|
if (IpuApplication.IS_USB_READY == false) {
|
122
|
|
JSONObject json = new JSONObject();
|
123
|
|
json.put("CODE", "99");
|
124
|
|
json.put("VALUE", "没有检测到外设,请确认手机是否支持OTG功能!【判别方法:写卡器插入支持OTG功能的手机,设备正面底部绿灯会连续慢闪!】");
|
125
|
|
callback(json.toString());
|
126
|
|
return;
|
|
128
|
UsbManager manager = (UsbManager) (this.context.getSystemService(Context.USB_SERVICE));
|
|
129
|
HashMap<String, UsbDevice> deviceList = manager.getDeviceList();
|
|
130
|
Iterator<UsbDevice> deviceIterator = deviceList.values().iterator();
|
|
131
|
while(deviceIterator.hasNext()){
|
|
132
|
UsbDevice device = deviceIterator.next();
|
|
133
|
Reader reader = new Reader(manager);
|
|
134
|
if(reader.isSupported(device)){
|
|
135
|
IpuApplication.SIMCARD_GETCARDSN_FLAG = true;
|
|
136
|
SimCardRunable SimCardRunable = new SimCardRunable(this.context, 2,
|
|
137
|
"".toCharArray(), "".toCharArray(), "".toCharArray(),
|
|
138
|
this.handler);
|
|
139
|
SimCardRunable.run();
|
|
140
|
return;
|
|
141
|
}
|
127
|
142
|
}
|
128
|
|
IpuApplication.SIMCARD_GETCARDSN_FLAG = true;
|
129
|
|
SimCardRunable SimCardRunable = new SimCardRunable(this.context, 2,
|
130
|
|
"".toCharArray(), "".toCharArray(), "".toCharArray(),
|
131
|
|
this.handler);
|
132
|
|
SimCardRunable.run();
|
|
143
|
JSONObject json = new JSONObject();
|
|
144
|
json.put("CODE", "99");
|
|
145
|
json.put("VALUE", "没有检测到外设,请确认手机是否支持OTG功能!【判别方法:写卡器插入支持OTG功能的手机,设备正面底部绿灯会连续慢闪!】");
|
|
146
|
callback(json.toString());
|
|
147
|
return;
|
133
|
148
|
}
|
134
|
149
|
|
135
|
150
|
public void getCardInfo(JSONArray param) throws Exception {
|