Browse Source

【修改换卡器的驱动】

yuanhang 9 years ago
parent
commit
2d02e92be5

+ 1 - 0
multiple-client/src/com/ai/mobile/IpuApplication.java

@ -23,5 +23,6 @@ public class IpuApplication extends Application{
23 23
	public static MyHandler handler = null;  
24 24
	public static String focus = null;  
25 25
	public static final int KEYBOARD = 111;
26
	public static boolean IS_USB_READY = false; 
26 27
    
27 28
}

+ 9 - 0
multiple-client/src/com/ai/mobile/multiple/SubAppActivity.java

@ -3,10 +3,12 @@ package com.ai.mobile.multiple;
3 3
import java.util.HashMap;
4 4
import java.util.Map;
5 5

6
import android.content.IntentFilter;
6 7
import android.content.pm.PackageManager.NameNotFoundException;
7 8
import android.os.Bundle;
8 9
import android.view.View;
9 10

11
import com.ai.mobile.simcard.UsbMonitor;
10 12
import com.ailk.common.data.IData;
11 13
import com.ailk.common.data.impl.DataMap;
12 14
import com.wade.mobile.app.AppRecord;
@ -72,6 +74,13 @@ public class SubAppActivity extends TemplateMainActivity{
72 74
		indexPage = indexPage == null ? ServerConfig.getInstance().getValue("indexPage") : indexPage;
73 75
		MobileUI mobileUI = getPluginManager().getPlugin(MobileUI.class);
74 76
		mobileUI.openPage(indexPage, param);
77
		
78
		UsbMonitor mo = new UsbMonitor();
79
		IntentFilter filter = new IntentFilter();
80
		filter.addAction("android.hardware.usb.action.USB_DEVICE_ATTACHED");
81
		filter.addAction("android.hardware.usb.action.USB_DEVICE_DETACHED");
82
		SubAppActivity.this.registerReceiver(mo, filter);
83
		
75 84
	}
76 85
	
77 86
	/**

+ 7 - 0
multiple-client/src/com/ai/mobile/simcard/SimCard.java

@ -118,6 +118,13 @@ public class SimCard extends Plugin {
118 118
	}
119 119

120 120
	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;
127
		}
121 128
		IpuApplication.SIMCARD_GETCARDSN_FLAG = true;
122 129
		SimCardRunable SimCardRunable = new SimCardRunable(this.context, 2,
123 130
				"".toCharArray(), "".toCharArray(), "".toCharArray(),

+ 0 - 3
multiple-client/src/epsyl/phonecardwriter/funcjar/SimCardBuss.java

@ -206,9 +206,6 @@ public class SimCardBuss {
206 206
			setIsGetPermision(0);
207 207
			setIsOpened(0);
208 208
			setIsCardIn(0);
209
			Toast.makeText(activity, "没有检测到外设,请确认手机是否支持OTG功能!【判别方法:写卡器插入支持OTG功能的手机,设备正面底部绿灯会连续慢闪!】",
210
					Toast.LENGTH_SHORT).show();
211
			//throw new Exception("没有检测到外设,请确认手机是否支持OTG功能!【判别方法:写卡器插入支持OTG功能的手机,设备正面底部绿灯会连续慢闪!】");
212 209
		}
213 210
		System.out.println("openCardReader end,ret_configReader = "
214 211
				+ ret_configReader);