📄 trustlinkgeneralcontroller.java
字号:
// 2. Add user ID again.
// 404: The user requires to cancel and leave.
// Suggestion item:
// 1. Please enroll fingers again.
//******************************************************************************
/// <summary>
/// Register User and Register Fingerprint
/// </summary>
/// <param name="aUserID">the user will be register</param>
/// <returns>0=success,else=error coce</returns>
public String NewEnroll(String aUserID)
{
String strHtml = "";
try
{
this.BK_Connectservers(); //Connect TrustLink Server
this.BK_AddUser(aUserID); //Register User
strHtml = this.BK_FPEnroll(aUserID); //Register Fingerprint
}
catch (Exception ex)
{
strHtml = "";
}
return strHtml;
}
//#region UpdateEnroll
//******************************************************************************
//Function Name:
// UpdateEnroll.
//Functional description:
// The UpdateEnroll function consists of five blocks below:
// 1. BK_Connectservers: Connected to the Server.
// i. Call InitAgent function of DLL to initial XAgent action.
// ii. Call ConnectServer functiono f DLL to test TrustLink XServer connect situation.
// 2. BK_GetEnrolledFingers(aUserID): Query enrolled fingers of the user.
// i. Call GetEnrolledFingers function.
// 3. BK_FPUpdateEnroll(aUserID, aEnrolledFingers): Manage (update/delete) user fingerprints.
// i. Call EnrollByPwd function.
// 4. self.NewEnroll(aUserID)
// 5. Exception
//
//Function Declaration:
// UpdateEnroll(aUserID: string): integer;
//Parameter description:
// aUserID: Authenticatee ID.
//Result value:
// 0: NewEnroll successfully.
// 60: No connection copyright of Client product.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 202: TrustLink Xserver connection error.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 215: System parameter lack error.
// Suggestion item:
// 1. Delete existed user ID.
// 2. Add user ID again.
// 404: The user requires to cancel and leave.
// Suggestion item:
// 1. Please enroll fingers again.
//******************************************************************************
public String UpdateEnroll(String aUserID)
{
String strHtml = "";
try
{
this.BK_Connectservers();
String strFK = this.BK_GetEnrolledFingers(aUserID,false);
int intResult = this._ResultCode;
this._ResultCode = SUCCESSED;
switch (intResult)
{
case SUCCESSED:
strHtml = this.BK_FPUpdateEnroll(aUserID, strFK);
break;
case USER_NOT_EXIST: //UserNoExist
strHtml = this.NewEnroll(aUserID);
break;
case NOT_REGISTER_AUTHENTIFICATION: //NOT_REGISTER_AUTHENTIFICATION
strHtml = this.BK_FPUpdateEnroll(aUserID, EMPTY_ENROLLED_FINGERS);
break;
}
}
catch (Exception ex)
{
strHtml = "";
}
return strHtml;
}
//#region FPUserVerify
//******************************************************************************
//Function Name:
// FPUserVerify.
//Functional description:
// The FPUserVerify function consists of five blocks below:
// 1. BK_Connectservers: Connected to the Server.
// i. Call InitAgent function of DLL to initial XAgent action.
// ii. Call ConnectServer functiono f DLL to test TrustLink XServer connect situation.
// 2. BK_GetEnrolledFingers(aUserID): Query enrolled fingers of the user.
// i. Call GetEnrolledFingers function
// 3. BK_FPAuthen(aUserID, aEnrolledFingers): Fingerprint authentication.
// i. Call FPAuthenDlg function of DLL to verify user account and fingerprint.
// 4. Exception
//
//Function Declaration:
// FPUserVerify(aUserID: string): integer;
//Parameter description:
// aUserID: Authenticatee ID.
//Result value:
// 0: Verified successfully.
// 12: User ID not input
// Suggestion item:
// 1. Check user has registration user ID.
// 2. Check user has registration enroll fingers.
// 14: Fingers of the authenticatee have not been enrolled.
// 33: Incorrect verification.
// Suggestion item:
// 1. Please identify again with valid finger.
// 60: No connection copyright of Client product.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 62: The User ID does not exist.
// Suggestion item:
// 1. Check user has registration user ID.
// 2. Check user has registration enroll fingers.
// 202: TrustLink Xserver connection error.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 215: System parameter lack error.
// Suggestion item:
// 1. Delete existed user ID.
// 2. Add user ID again.
// 404: The user requires to cancel and leave.
// Suggestion item:
// 1. Please enroll fingers again.
//******************************************************************************
/// <summary>
/// Verify Fingerpfint
/// </summary>
/// <param name="aUserID">the user will be verify</param>
/// <returns>0=success,else=error code</returns>
public String FPUserVerify(String aUserID)
{
String strHtml = "";
try
{
this.BK_Connectservers(); //Connect TrustLink Server
String strFK = this.BK_GetEnrolledFingers(aUserID,true);
strHtml = this.BK_FPAuthen(aUserID, strFK); //Authen finterprint
}
catch (Exception ex)
{
strHtml = "";
}
return strHtml;
}
//#region FPUserIdentify
//******************************************************************************
//Function Name:
// FPUserIdentify.
//Functional description:
// The FPUserIdentify function consists of five blocks below:
// 1. BK_Connectservers: Connected to the Server.
// i. Call InitAgent function of DLL to initial XAgent action.
// ii. Call ConnectServer functiono f DLL to test TrustLink XServer connect situation.
// 2. BK_FPIdentify(): Fingerprint authentication.
// i. Call FPAuthenDlg function of DLL to verify user account and fingerprint.
// 3. Exception
//
//Function Declaration:
// FPUserIdentify(): integer;
//Result value:
// 0: Identified successfully.
// 39Cannot be identified.
// Suggestion item:
// 1. Check user has registration user ID.
// 2. Check user has registration enroll fingers.
// 60: No connection copyright of Client product.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 202: TrustLink Xserver connection error.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 215: System parameter lack error.
// Suggestion item:
// 1. Delete existed user ID.
// 2. Add user ID again.
// 404: The user requires to cancel and leave.
// Suggestion item:
// 1. Please enroll fingers again.
//******************************************************************************
/// <summary>
/// Vindicate fingerprint
/// </summary>
/// <returns>0=success,else=error code</returns>
public String FPUserIdentify()
{
String strHtml = "";
try
{
this.BK_Connectservers(); //Connect TrustLink Server
strHtml = this.BK_FPIdentify(); //Vindicate fingerprint
}
catch (Exception ex)
{
strHtml = "";
}
return strHtml;
}
//#region DeleteUser
//******************************************************************************
//Function Name:
// DeleteUser.
//Functional description:
// The DeleteUser function consists of five blocks below:
// 1. BK_Connectservers: Connected to the Server.
// i. Call InitAgent function of DLL to initial XAgent action.
// ii. Call ConnectServer functiono f DLL to test TrustLink XServer connect situation.
// 2. BK_DeleteUserFun(aUserID): Delete the user from the Server.
// i. Call DeleteUserByPwd function
// 3. Exception
//
//Function Declaration:
// DeleteUser(aUserID: string): integer;
//Parameter description:
// aUserID: Authenticatee ID.
//Result value:
// 0: Delete successfully.
// 12: User ID not input
// Suggestion item:
// 1. Check user has registration user ID.
// 2. Check user has registration enroll fingers.
// 28Authentication information not input.
// 33: Incorrect verification.
// Suggestion item:
// 1. 1. Please identify again with valid finger.
// 60: No connection copyright of Client product.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 62: The User ID does not exist.
// Suggestion item:
// 1. Check user has registration user ID.
// 2. Check user has registration enroll fingers.
// 202: TrustLink Xserver connection error.
// Suggestion item:
// 1. Inspects whether stopped using TrustLink XServer
// 2. Restart XServer.
// 3. Make sure Product ID is correct.
// 4. Make sure Port number is correct.
// 215: System parameter lack error.
// Suggestion item:
// 1. Delete existed user ID.
// 2. Add user ID again.
//******************************************************************************
/// <summary>
/// Delete User
/// </summary>
/// <param name="aUserID">the user will be delete</param>
/// <returns>0=success,else=error code</returns>
public int DeleteUser(String aUserID)
{
try
{
this.BK_Connectservers(); //Connect TrustLink Server
this.BK_DeleteUserFun(aUserID); //Delete User
}
finally
{
return this._ResultCode;
}
/*catch (Exception ex)
{
return this._ResultCode;
}*/
}
//get TrustLinkGeneralController return value
public int GetResultCodeValue()
{
return this._ResultCode;
}
//get TrustLinkGeneralController error message
public String GetErrMessage()
{
return this.lastErrMsg + this.lastReason;
}
//execute TrustLink fingerprint template data
public String ExecutePacket(String TemplateData)
{
String strResultMessage = "";
try
{
int intState = 0;
intState = TemplateData.indexOf(",");
int intAction = Integer.parseInt(TemplateData.substring(0,intState));
String strTemplateData = TemplateData.substring(intState+1);
this.BK_Connectservers();
this._ResultCode = xSocketAgent.executePacket(strTemplateData);
if (this._ResultCode == SUCCESSED)
{
//if the process type is fingerprint Identify, then Get the Identify user message
if (intAction == this.FPIdentify)
{
strResultMessage = this.BK_FPGetUser();
}
}
else
{
this.lastErrMsg = this.GetErrMsg(intAction);
this.lastReason = this.GetErrRsn(intAction);
}
}
catch(Exception ex)
{
this._ResultCode = ERR_UNKNOWN;
this.lastErrMsg = this.GetErrMsg(this.UnknowErr);
this.lastReason = this.GetErrRsn(this.UnknowErr);
}
return strResultMessage;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -