Java Code Examples for com.gizwits.gizwifisdk.enumration.GizWifiErrorCode#GIZ_SDK_SUCCESS

The following examples show how to use com.gizwits.gizwifisdk.enumration.GizWifiErrorCode#GIZ_SDK_SUCCESS . 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
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			if (GosDeploy.setAnonymousLogin()) {
				tryUserLoginAnonymous();
			}

		}
	}
 
Example 2
@Override
protected void didSetSubscribe(GizWifiErrorCode result, GizWifiDevice device, boolean isSubscribed) {
	// TODO 控制页面跳转
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
		msg.what = TOCONTROL;
		msg.obj = device;
	} else {
		if (device.isBind()) {
			msg.what = TOAST;
			// String setSubscribeFail = (String)
			// getText(R.string.setsubscribe_failed);
			msg.obj = toastError(result);// setSubscribeFail + "\n" + arg0;
		}
	}
	handler.sendMessage(msg);
}
 
Example 3
/** 重置密码回调 */
@Override
public void didChangeUserPassword(GizWifiErrorCode result) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String resetFailed = (String) getText(R.string.reset_failed);
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);// resetFailed + "\n" + errorMessage;
		handler.sendMessage(msg);
	} else {
		msg.what = handler_key.TOAST.ordinal();
		String resetSuccessful = (String) getText(R.string.reset_successful);
		msg.obj = resetSuccessful;
		handler.sendMessage(msg);
	}
}
 
Example 4
/**
 * 设备配置回调
 * 
 * @param result
 *            错误码
 * @param mac
 *            MAC
 * @param did
 *            DID
 * @param productKey
 *            PK
 */
protected void didSetDeviceOnboarding(GizWifiErrorCode result, String mac,
		String did, String productKey) {
	if (GizWifiErrorCode.GIZ_SDK_DEVICE_CONFIG_IS_RUNNING == result) {
		return;
	}

	if (timer != null) {
		timer.cancel();
	}
	Message message = new Message();
	if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
		message.what = handler_key.SUCCESSFUL.ordinal();
	} else {
		message.what = handler_key.FAILED.ordinal();
		message.obj = toastError(result);
	}
	Log.i("Apptest", result.toString());
	handler.sendMessage(message);
}
 
Example 5
Source Project: gokit-android   File: GosDeviceListActivity.java    License: MIT License 6 votes vote down vote up
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			if(GosDeploy.setAnonymousLogin()){
				tryUserLoginAnonymous();
			}
			
		}
	}
 
Example 6
/** 手机验证码回调 */
@Override
protected void didRequestSendPhoneSMSCode(GizWifiErrorCode result, String token) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String sendFailed = (String) getText(R.string.send_failed);
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);// sendFailed + "\n" +
										// errorMessage;toastError(errorCode)
		handler.sendMessage(msg);
	} else {
		handler.sendEmptyMessage(handler_key.SENDSUCCESSFUL.ordinal());
		msg.what = handler_key.TOAST.ordinal();
		String sendSuccessful = (String) getText(R.string.send_successful);
		msg.obj = sendSuccessful;
		handler.sendMessage(msg);
	}
}
 
Example 7
/** 重置密码回调 */
@Override
public void didChangeUserPassword(GizWifiErrorCode result) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String resetFailed = (String) getText(R.string.reset_failed);
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);// resetFailed + "\n" + errorMessage;
		handler.sendMessage(msg);
	} else {
		msg.what = handler_key.TOAST.ordinal();
		String resetSuccessful = (String) getText(R.string.reset_successful);
		msg.obj = resetSuccessful;
		handler.sendMessage(msg);
	}
}
 
Example 8
/** 重置密码回调 */
@Override
public void didChangeUserPassword(GizWifiErrorCode result) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String resetFailed = (String) getText(R.string.reset_failed);
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);// resetFailed + "\n" + errorMessage;
		handler.sendMessage(msg);
	} else {
		msg.what = handler_key.TOAST.ordinal();
		String resetSuccessful = (String) getText(R.string.reset_successful);
		msg.obj = resetSuccessful;
		handler.sendMessage(msg);
	}
}
 
Example 9
/** 手机验证码回调 */
@Override
protected void didRequestSendPhoneSMSCode(GizWifiErrorCode result, String token) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String sendFailed = (String) getText(R.string.send_failed);
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);// sendFailed + "\n" +
										// errorMessage;toastError(errorCode)
		handler.sendMessage(msg);
	} else {
		handler.sendEmptyMessage(handler_key.SENDSUCCESSFUL.ordinal());
		msg.what = handler_key.TOAST.ordinal();
		String sendSuccessful = (String) getText(R.string.send_successful);
		msg.obj = sendSuccessful;
		handler.sendMessage(msg);
	}
}
 
Example 10
protected void didUserLogin(GizWifiErrorCode result, java.lang.String uid, java.lang.String token) {

		if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
			loginStatus = 2;
			this.uid = uid;
			this.token = token;
			spf.edit().putString("Uid", this.uid).commit();
			spf.edit().putString("Token", this.token).commit();
			handler.sendEmptyMessage(GETLIST);
			// TODO 绑定推送
			GosPushManager.pushBindService(token);
		} else {
			loginStatus = 0;
			tryUserLoginAnonymous();
		}
	}
 
Example 11
Source Project: gokit-android   File: GosDeviceListActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 推送绑定回调
 * 
 * @param result
 */
@Override
protected void didChannelIDBind(GizWifiErrorCode result) {
	Log.i("Apptest", result.toString());
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Toast.makeText(this, toastError(result), 2000).show();
	}
}
 
Example 12
/**
 * 设备绑定回调
 * 
 * @param result
 * @param did
 */
protected void didBindDevice(GizWifiErrorCode result, java.lang.String did) {
	progressDialog.cancel();
	if (result != GizWifiErrorCode.GIZ_SDK_SUCCESS) {
		Toast.makeText(this, toastError(result), 2000).show();
	} else {

		Toast.makeText(this, R.string.add_successful, 2000).show();
	}
}
 
Example 13
Source Project: gokit-android   File: GosUserLoginActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 设置云端服务回调
 */
protected void didGetCurrentCloudService(GizWifiErrorCode result,
		java.util.concurrent.ConcurrentHashMap<String, String> cloudServiceInfo) {
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Toast.makeText(this, toastError(result), toastTime).show();
	}
}
 
Example 14
/**
 * 设置云端服务回调
 */
protected void didGetCurrentCloudService(GizWifiErrorCode result,
		java.util.concurrent.ConcurrentHashMap<String, String> cloudServiceInfo) {
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Toast.makeText(this, toastError(result), toastTime).show();
	}
}
 
Example 15
/**
 * 用户登录回调
 */
@Override
protected void didUserLogin(GizWifiErrorCode result, String uid, String token) {

	progressDialog.cancel();
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "User");
	if (GosDeviceListActivity.loginStatus == 4 || GosDeviceListActivity.loginStatus == 3) {
		return;
	}
	Log.i("Apptest", GosDeviceListActivity.loginStatus + "\t" + "UserLogin");

	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {// 登录失败
		Toast.makeText(GosUserLoginActivity.this, toastError(result), toastTime).show();

	} else {// 登录成功

		GosDeviceListActivity.loginStatus = 1;
		Toast.makeText(GosUserLoginActivity.this, R.string.toast_login_successful, toastTime).show();

		// TODO 绑定推送
		GosPushManager.pushBindService(token);

		if (!TextUtils.isEmpty(etName.getText().toString()) && !TextUtils.isEmpty(etPsw.getText().toString())
				&& TextUtils.isEmpty(spf.getString("thirdUid", ""))) {
			spf.edit().putString("UserName", etName.getText().toString()).commit();
			spf.edit().putString("PassWord", etPsw.getText().toString()).commit();
		}
		spf.edit().putString("Uid", uid).commit();
		spf.edit().putString("Token", token).commit();

		intent = new Intent(GosUserLoginActivity.this, GosMainActivity.class);
		intent.putExtra("ThredLogin", true);
		startActivity(intent);

	}
}
 
Example 16
/**
 * 解绑推送回调
 * 
 * @param result
 */
protected void didChannelIDUnBind(GizWifiErrorCode result) {
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Toast.makeText(this, toastError(result), toastTime).show();
	}

	Log.i("Apptest", "UnBind:" + result.toString());
}
 
Example 17
Source Project: gokit-android   File: GosDeviceListActivity.java    License: MIT License 5 votes vote down vote up
protected void didUnbindDevice(GizWifiErrorCode result, java.lang.String did) {
	progressDialog.cancel();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		// String unBoundFailed = (String) getText(R.string.unbound_failed);
		Toast.makeText(this, toastError(result), 2000).show();
	}
}
 
Example 18
@Override
protected void didReceiveData(GizWifiErrorCode result, GizWifiDevice device,
		ConcurrentHashMap<String, Object> dataMap, int sn) {
	super.didReceiveData(result, device, dataMap, sn);
	if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
		deviceDataMap = dataMap;
		getDataFromDateMap();
	}
}
 
Example 19
Source Project: gokit-android   File: GosUserLoginActivity.java    License: MIT License 5 votes vote down vote up
/**
 * 解绑推送回调
 * 
 * @param result
 */
protected void didChannelIDUnBind(GizWifiErrorCode result) {
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Toast.makeText(this, toastError(result), toastTime).show();
	}

	Log.i("Apptest", "UnBind:" + result.toString());
}
 
Example 20
public void didGetCurrentCloudService(GizWifiErrorCode result,
		java.util.concurrent.ConcurrentHashMap<String, String> cloudServiceInfo) {

	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		Log.e("Apptest", "CloudService Error: " + result.toString());
	}
}