com.gizwits.gizwifisdk.enumration.GizWifiErrorCode Java Examples

The following examples show how to use com.gizwits.gizwifisdk.enumration.GizWifiErrorCode. 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 File: GosRegisterUserActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
/** 手机验证码回调 */
@Override
protected void didRequestSendPhoneSMSCode(GizWifiErrorCode result,
		String token) {
	progressDialog.cancel();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		msg.what = handler_key.TOAST.ordinal();
		msg.obj = toastError(result);
		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 #2
Source File: GosForgetPasswordActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
/** 重置密码回调 */
@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 #3
Source File: GosForgetPasswordActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
/** 手机验证码回调 */
@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 #4
Source File: GosForgetPasswordActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
/** 手机验证码回调 */
@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 #5
Source File: GosDeviceListActivity.java    From GOpenSource_AppKit_Android_AS with 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
Source File: userSharedActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
@Override
protected void onResume() {
	super.onResume();

	GizDeviceSharing.setListener(new GizDeviceSharingListener() {

		@Override
		public void didSharingDevice(GizWifiErrorCode result, String deviceID, int sharingID,
				Bitmap QRCodeImage) {
			super.didSharingDevice(result, deviceID, sharingID, QRCodeImage);

			if (result.ordinal() == 0) {
				Toast.makeText(userSharedActivity.this, getResources().getString(R.string.alawyssend), 1).show();
				finish();
			} else {
				Toast.makeText(userSharedActivity.this, getResources().getString(R.string.send_failed1), 2).show();

			}

		}

	});
}
 
Example #7
Source File: GosForgetPasswordActivity.java    From gokit-android with MIT License 6 votes vote down vote up
/** 重置密码回调 */
@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
Source File: GosConfigCountdownActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 6 votes vote down vote up
/**
 * 设备配置回调
 * 
 * @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);
	}
	handler.sendMessage(message);
}
 
Example #9
Source File: GosDeviceListActivity.java    From gokit-android with 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 #10
Source File: GosAirlinkConfigCountdownActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
/**
 * 设备配置回调
 * 
 * @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 #11
Source File: GosRegisterUserActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
/** 手机验证码回调 */
@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;
		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 #12
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with 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;
			tryUserLoginAnonymous();
		}
	}
 
Example #13
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
@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 #14
Source File: GosUserLoginActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
/**
 * 用户登录回调
 */
@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), 2000).show();

	} else {// 登录成功

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

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

		if (!TextUtils.isEmpty(etName.getText().toString()) && !TextUtils.isEmpty(etPsw.getText().toString())) {
			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, GosDeviceListActivity.class);
		intent.putExtra("ThredLogin", true);
		startActivity(intent);
	}
}
 
Example #15
Source File: GosDeviceListActivity.java    From gokit-android with 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 #16
Source File: GosDeviceListActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
protected void didDiscovered(GizWifiErrorCode result, java.util.List<GizWifiDevice> deviceList) {
	GosDeviceModuleBaseActivity.deviceslist.clear();
	for (GizWifiDevice gizWifiDevice : deviceList) {
		GosDeviceModuleBaseActivity.deviceslist.add(gizWifiDevice);
	}
	handler.sendEmptyMessage(UPDATALIST);

}
 
Example #17
Source File: messageCenterActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@Override
public void onResume() {
	super.onResume();
	String token = spf.getString("Token", "");
	GizDeviceSharing.queryMessageList(token, GizMessageType.GizMessageSharing);
	//GizDeviceSharing.queryMessageList(token, GizMessageType.GizMessageSystem);

	GizDeviceSharing.setListener(new GizDeviceSharingListener() {

		@Override
		public void didQueryMessageList(GizWifiErrorCode result, List<GizMessage> messageList) {
			super.didQueryMessageList(result, messageList);

			if (messageList.size() > 0) {
				isShowRedPoint(messageList);
			}else{
				redpoint.setVisibility(View.GONE);
			}
			
			if (result.ordinal() != 0) {
				Toast.makeText(messageCenterActivity.this, toastError(result), 2).show();
			}

		}

	});
}
 
Example #18
Source File: GosDeviceListActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
/**
 * 设备绑定回调
 * 
 * @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 #19
Source File: GosApplication.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
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());
	}
}
 
Example #20
Source File: GosUserLoginActivity.java    From Gizwits-SmartBuld_Android with 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), 2000).show();
	}

	Log.i("Apptest", "UnBind:" + result.toString());
}
 
Example #21
Source File: GosUserLoginActivity.java    From GOpenSource_AppKit_Android_AS with 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 #22
Source File: GosUserLoginActivity.java    From GOpenSource_AppKit_Android_AS with MIT License 5 votes vote down vote up
@Override
protected void didNotifyEvent(GizEventType eventType, Object eventSource, GizWifiErrorCode eventID,
		String eventMessage) {
	super.didNotifyEvent(eventType, eventSource, eventID, eventMessage);

	if (eventID != null && eventID.getResult() != 8316) {
		String toastError = toastError(eventID);

		TipsDialog dia = new TipsDialog(this, toastError);
		dia.show();
	}

}
 
Example #23
Source File: GosDeviceMoreActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
@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();
		updateUI();
	}
}
 
Example #24
Source File: GosEditDeviceAliasActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
@Override
protected void didSetCustomInfo(GizWifiErrorCode result, GizWifiDevice device2) {
	super.didSetCustomInfo(result, device2);
	if (result == GizWifiErrorCode.GIZ_SDK_SUCCESS) {
		myToast(R.string.modify_succeed);
		progressDialog.cancel();
		backToDeviceList();
	} else {
		progressDialog.cancel();
		// 修改失败
		myToast(R.string.updata_fail);
	}
}
 
Example #25
Source File: GosDeviceControlActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
@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;
		handler.sendEmptyMessage(handler_key.RECEIVED.ordinal());
	}
}
 
Example #26
Source File: GosDeviceControlActivity.java    From gokit-android with MIT License 5 votes vote down vote up
protected void didSetCustomInfo(GizWifiErrorCode result, GizWifiDevice device) {
	progressDialog.cancel();
	Message msg = new Message();
	msg.what = TOAST;
	String toastText;
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS == result) {
		toastText = (String) getText(R.string.set_info_successful);
	} else {
		toastText = toastError(result);
	}
	msg.obj = toastText;
	handler.sendMessage(msg);
}
 
Example #27
Source File: GosDeviceControlActivity.java    From gokit-android with MIT License 5 votes vote down vote up
protected void didGetHardwareInfo(GizWifiErrorCode result, GizWifiDevice device,
		java.util.concurrent.ConcurrentHashMap<String, String> hardwareInfo) {
	Log.i("Apptest", hardwareInfo.toString());
	StringBuffer sb = new StringBuffer();
	Message msg = new Message();
	if (GizWifiErrorCode.GIZ_SDK_SUCCESS != result) {
		msg.what = TOAST;
		msg.obj = toastError(result);
	} else {
		sb.append("Wifi Hardware Version:" + hardwareInfo.get(wifiHardVerKey) + "\r\n");
		sb.append("Wifi Software Version:" + hardwareInfo.get(wifiSoftVerKey) + "\r\n");
		sb.append("MCU Hardware Version:" + hardwareInfo.get(mcuHardVerKey) + "\r\n");
		sb.append("MCU Software Version:" + hardwareInfo.get(mcuSoftVerKey) + "\r\n");
		sb.append("Wifi Firmware Id:" + hardwareInfo.get(FirmwareIdKey) + "\r\n");
		sb.append("Wifi Firmware Version:" + hardwareInfo.get(FirmwareVerKey) + "\r\n");
		sb.append("Product Key:" + "\r\n" + hardwareInfo.get(productKey) + "\r\n");

		// 设备属性
		sb.append("Device ID:" + "\r\n" + mDevice.getDid() + "\r\n");
		sb.append("Device IP:" + mDevice.getIPAddress() + "\r\n");
		sb.append("Device MAC:" + mDevice.getMacAddress() + "\r\n");

		msg.what = HARDWARE;
		msg.obj = sb.toString();
	}

	handler.sendMessage(msg);
}
 
Example #28
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
/**
 * 设备绑定回调
 * 
 * @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 #29
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with MIT License 5 votes vote down vote up
protected void didDiscovered(GizWifiErrorCode result, java.util.List<GizWifiDevice> deviceList) {
	GosDeviceModuleBaseActivity.deviceslist.clear();
	for (GizWifiDevice gizWifiDevice : deviceList) {
		GosDeviceModuleBaseActivity.deviceslist.add(gizWifiDevice);
	}
	handler.sendEmptyMessage(UPDATALIST);

}
 
Example #30
Source File: GosDeviceListActivity.java    From Gizwits-SmartBuld_Android with 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();
	}
}