Java Code Examples for com.gizwits.gizwifisdk.enumration.GizWifiConfigureMode

The following examples show how to use com.gizwits.gizwifisdk.enumration.GizWifiConfigureMode. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: GOpenSource_AppKit_Android_AS   Author: gizwits   File: GosConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void readyToSoftAP() {

		// 切换至设备热点
		WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
		WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		manager.connect(softSSID, SoftAP_PSW, cipherType);
		IntentFilter filter = new IntentFilter();
		filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);

		workSSID = spf.getString("workSSID", "");
		workSSIDPsw = spf.getString("workSSIDPsw", "");
		final Timer mtimer = new Timer();
		mtimer.schedule(new TimerTask() {

			@Override	
			public void run() {
				if (progressDialog.isShowing()) {
					progressDialog.cancel();
					mtimer.cancel();
					String failText=(String) getText(R.string.configuration_failed);
					Message msg=new Message();
					msg.what=handler_key.FAILED.ordinal();
					msg.obj=failText;
					handler.sendMessage(msg);
				} else {
					mtimer.cancel();
				}
			}
		}, 10 * 1000);
		isChecked = true;
		while (isChecked) {
			String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this);
			if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) {
				if (checkNetwork(GosConfigCountdownActivity.this)) {
					
					progressDialog.cancel();
					isChecked = false;
					handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());
					GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw,
							GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null);
				//	handler.sendEmptyMessageDelayed(handler_key.OFFTIME.ordinal(), 2000);
				}
				if(broadcase==null){
					broadcase = new GosWifiChangeReciver();
					registerReceiver(broadcase, filter);
				}
				
			}
		}
	}
 
Example #2
Source Project: GOpenSource_AppKit_Android_AS   Author: gizwits   File: GosAirlinkConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void startAirlink() {
	GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw,
			GizWifiConfigureMode.GizWifiAirLink, null, 60, modeList);
	handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());

}
 
Example #3
Source Project: Gizwits-SmartBuld_Android   Author: gizwits   File: GosConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void readyToSoftAP() {

		// 切换至设备热点
		WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID);
		manager.connect(softSSID, SoftAP_PSW, cipherType);
		IntentFilter filter = new IntentFilter();
		filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);

		workSSID = spf.getString("workSSID", "");
		workSSIDPsw = spf.getString("workSSIDPsw", "");
		final Timer mtimer = new Timer();
		mtimer.schedule(new TimerTask() {

			@Override
			public void run() {
				if (progressDialog.isShowing()) {
					progressDialog.cancel();
					mtimer.cancel();
					handler.sendEmptyMessage(handler_key.FAILED.ordinal());
				} else {
					mtimer.cancel();
				}
			}
		}, 10 * 1000);
		isChecked = true;
		while (isChecked) {
			String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this);
			if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) {
				if (checkNetwork(GosConfigCountdownActivity.this)) {
					GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw,
							GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null);
					progressDialog.cancel();
					isChecked = false;
					handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());
				}
				registerReceiver(broadcase, filter);
			}
		}
	}
 
Example #4
Source Project: Gizwits-SmartBuld_Android   Author: gizwits   File: GosAirlinkConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void startAirlink() {
	GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw, GizWifiConfigureMode.GizWifiAirLink,
			null, 60, modeList);
	handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());

}
 
Example #5
Source Project: gokit-android   Author: gizwits   File: GosConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void readyToSoftAP() {

		// 切换至设备热点
		WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
		WifiCipherType cipherType = WifiAutoConnectManager.getCipherType(GosConfigCountdownActivity.this, softSSID);
		WifiAutoConnectManager manager = new WifiAutoConnectManager(wifiManager);
		manager.connect(softSSID, SoftAP_PSW, cipherType);
		IntentFilter filter = new IntentFilter();
		filter.addAction(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION);

		workSSID = spf.getString("workSSID", "");
		workSSIDPsw = spf.getString("workSSIDPsw", "");
		final Timer mtimer = new Timer();
		mtimer.schedule(new TimerTask() {

			@Override	
			public void run() {
				if (progressDialog.isShowing()) {
					progressDialog.cancel();
					mtimer.cancel();
					String failText=(String) getText(R.string.configuration_failed);
					Message msg=new Message();
					msg.what=handler_key.FAILED.ordinal();
					msg.obj=failText;
					handler.sendMessage(msg);
				} else {
					mtimer.cancel();
				}
			}
		}, 10 * 1000);
		isChecked = true;
		while (isChecked) {
			String presentSSID = NetUtils.getCurentWifiSSID(GosConfigCountdownActivity.this);
			if (!TextUtils.isEmpty(presentSSID) && presentSSID.contains(SoftAP_Start)) {
				if (checkNetwork(GosConfigCountdownActivity.this)) {
					GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw,
							GizWifiConfigureMode.GizWifiSoftAP, presentSSID, 60, null);
					progressDialog.cancel();
					isChecked = false;
					handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());
				}
				if(broadcase==null){
					broadcase = new GosWifiChangeReciver();
					registerReceiver(broadcase, filter);
				}
				
			}
		}
	}
 
Example #6
Source Project: gokit-android   Author: gizwits   File: GosAirlinkConfigCountdownActivity.java    License: MIT License 4 votes vote down vote up
private void startAirlink() {
	GizWifiSDK.sharedInstance().setDeviceOnboarding(workSSID, workSSIDPsw,
			GizWifiConfigureMode.GizWifiAirLink, null, 60, modeList);
	handler.sendEmptyMessage(handler_key.START_TIMER.ordinal());

}