All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.facelib.faceapi.client.SdkStatus Maven / Gradle / Ivy

The newest version!
package net.facelib.faceapi.client;

/**
 * SDK初始化状态
 * @author guyadong
 *
 */
public enum SdkStatus {
	SDK_UNINITIALIZED("sdk uninitialized(未初始化)"),
	SDK_INIT_OK(0,"init ok(初始化成功)"),
	FACE_SUCESS(0),
	FACE_ERROR_INITFAILED(-1),
	FACE_ERROR_INPUTDATAERROR(-2),
	FACE_ERROR_WRONGPARM(-3),
	FACE_ERROR_OTHERERROR(-4),
	FACE_ERROR_LOADMODELFAILED(-5),
	FACE_ERROR_MAXCHANNEL(-6),
	FACE_ERROR_FEATRRELENTH(-7),
	FACE_ERROR_NOFACES(-8),
	FACE_REPEAT_INITFAILED(-9),
	FACE_ERROR_SERAIL_P(-401),
	FACE_ERROR_DECRYPT_P(-402),
	FACE_ERROR_TIMEOUT(-403),
	FACE_ERROR_LOCAL_DECRYPT_P(-404),
	FACE_ERROR_LOCAL_DECRYPT_FILE_P(-405),
	FACE_ERROR_COMPARE_DECRYPT_FILE_P(-406),
	FACE_ERROR_NO_DECRYPT_P(-407),
	LICENSE_ERROR("License error(在线授权异常)"),
	UNKNOW_ERROR("Unknown result(未知错误)"),
	OTHER_EXCEPTION("Exception");
	/** 状态描述信息 */
	final String msg;
	/** 状态码 */
	final int error;
	private SdkStatus(int error){
		this.error = error;
		this.msg = this.name();
	}
	private SdkStatus(String msg){
		this(-1, msg);
	}
	private SdkStatus(int error,String msg){
		this.error = error;
		this.msg = msg;		
	}
	/**
	 * 根据SDK jni调用返回的状态码返回{@link SdkStatus}实例
	 * @param code
	 * @return
	 */
	static SdkStatus jniCode(int code){
		switch(code){
		case 0 :
			return FACE_SUCESS;
		case -1:
			return FACE_ERROR_INITFAILED;
		case -2:
			return FACE_ERROR_INPUTDATAERROR;
		case -3:
			return FACE_ERROR_WRONGPARM;
		case -4:
			return FACE_ERROR_OTHERERROR;
		case -5:
			return FACE_ERROR_LOADMODELFAILED;
		case -6:
			return FACE_ERROR_MAXCHANNEL;
		case -7:
			return FACE_ERROR_FEATRRELENTH;
		case -8:
			return FACE_ERROR_NOFACES;
		case -9:
			return FACE_REPEAT_INITFAILED;
		case -401:
			return FACE_ERROR_SERAIL_P;
		case -402:
			return FACE_ERROR_DECRYPT_P;
		case -403:
			return FACE_ERROR_TIMEOUT;
		case -404:
			return FACE_ERROR_LOCAL_DECRYPT_P;
		case -405:
			return FACE_ERROR_LOCAL_DECRYPT_FILE_P;
		case -406:
			return FACE_ERROR_COMPARE_DECRYPT_FILE_P;
		case -407:
			return FACE_ERROR_NO_DECRYPT_P;
		default:
			return UNKNOW_ERROR;
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy