var CommandType;
|
(function (CommandType) {
|
CommandType[CommandType["OpenDevice_Type"] = 1] = "OpenDevice_Type";
|
CommandType[CommandType["CloseDevice_Type"] = 2] = "CloseDevice_Type";
|
CommandType[CommandType["GetDeviceCount_Type"] = 3] = "GetDeviceCount_Type";
|
CommandType[CommandType["GetDeviceDescription_Type"] = 4] = "GetDeviceDescription_Type";
|
CommandType[CommandType["CaptureFingerData_Type"] = 5] = "CaptureFingerData_Type";
|
CommandType[CommandType["StartCapture_Type"] = 6] = "StartCapture_Type";
|
CommandType[CommandType["StopCapture_Type"] = 7] = "StopCapture_Type";
|
CommandType[CommandType["GeneralizeTemplate_Type"] = 8] = "GeneralizeTemplate_Type";
|
CommandType[CommandType["Verify_Type"] = 9] = "Verify_Type";
|
CommandType[CommandType["SetOption_Type"] = 10] = "SetOption_Type";
|
CommandType[CommandType["BmpToRaw_Type"] = 11] = "BmpToRaw_Type";
|
CommandType[CommandType["BmpToWSQ_Type"] = 12] = "BmpToWSQ_Type";
|
CommandType[CommandType["BmpToISO_Type"] = 13] = "BmpToISO_Type";
|
CommandType[CommandType["BmpToANSI_Type"] = 14] = "BmpToANSI_Type";
|
CommandType[CommandType["CID_Init_Type"] = 15] = "CID_Init_Type";
|
CommandType[CommandType["CID_Close_Type"] = 16] = "CID_Close_Type";
|
CommandType[CommandType["CID_GetChannelCount_Type"] = 17] = "CID_GetChannelCount_Type";
|
CommandType[CommandType["CID_BeginCapture_Type"] = 18] = "CID_BeginCapture_Type";
|
CommandType[CommandType["CID_GetFPRawData_Type"] = 19] = "CID_GetFPRawData_Type";
|
CommandType[CommandType["CID_GetFPBmpData_Type"] = 20] = "CID_GetFPBmpData_Type";
|
CommandType[CommandType["CID_EndCapture_Type"] = 21] = "CID_EndCapture_Type";
|
CommandType[CommandType["CID_GetVersion_Type"] = 22] = "CID_GetVersion_Type";
|
CommandType[CommandType["CID_GetDesc_Type"] = 23] = "CID_GetDesc_Type";
|
CommandType[CommandType["CID_Alg_GetVersion_Type"] = 25] = "CID_Alg_GetVersion_Type";
|
CommandType[CommandType["CID_Alg_Begin_Type"] = 26] = "CID_Alg_Begin_Type";
|
CommandType[CommandType["CID_Alg_FeatureExtract_Type"] = 27] = "CID_Alg_FeatureExtract_Type";
|
CommandType[CommandType["CID_Alg_FeatureMatch_Type"] = 28] = "CID_Alg_FeatureMatch_Type";
|
CommandType[CommandType["CID_Alg_ImageMatch_Type"] = 29] = "CID_Alg_ImageMatch_Type";
|
CommandType[CommandType["CID_Alg_GetQualityScore_Type"] = 32] = "CID_Alg_GetQualityScore_Type";
|
CommandType[CommandType["CID_Alg_End_Type"] = 35] = "CID_Alg_End_Type";
|
CommandType[CommandType["TrustLink_GetDeviceInfo_Type"] = 49] = "TrustLink_GetDeviceInfo_Type";
|
CommandType[CommandType["ARA_ReadIDCard_Type"] = 50] = "ARA_ReadIDCard_Type";
|
CommandType[CommandType["ARA_FeaConv_Type"] = 51] = "ARA_FeaConv_Type";
|
CommandType[CommandType["ARA_GetCurrentDeviceList_Type"] = 53] = "ARA_GetCurrentDeviceList_Type";
|
CommandType[CommandType["FRO900_OpenDevice_Type"] = 64] = "FRO900_OpenDevice_Type";
|
CommandType[CommandType["FRO900_CloseDevice_Type"] = 65] = "FRO900_CloseDevice_Type";
|
CommandType[CommandType["FRO900_GetDeviceCount_Type"] = 66] = "FRO900_GetDeviceCount_Type";
|
CommandType[CommandType["FRO900_CaptureFingerPrintData_Type"] = 67] = "FRO900_CaptureFingerPrintData_Type";
|
CommandType[CommandType["FRO900_GeneralizeTemplate_Type"] = 68] = "FRO900_GeneralizeTemplate_Type";
|
CommandType[CommandType["FRO900_Verify_Type"] = 69] = "FRO900_Verify_Type";
|
CommandType[CommandType["Iris_InitDevice_Type"] = 80] = "Iris_InitDevice_Type";
|
CommandType[CommandType["Iris_ReleaseDevice_type"] = 81] = "Iris_ReleaseDevice_type";
|
CommandType[CommandType["Iris_StartCapture_Type"] = 82] = "Iris_StartCapture_Type";
|
CommandType[CommandType["Iris_StartCapture2_Type"] = 83] = "Iris_StartCapture2_Type";
|
CommandType[CommandType["Iris_StopCapture_Type"] = 84] = "Iris_StopCapture_Type";
|
CommandType[CommandType["Iris_SetOptions_Type"] = 86] = "Iris_SetOptions_Type";
|
CommandType[CommandType["Iris_StartVerify_Type"] = 87] = "Iris_StartVerify_Type";
|
CommandType[CommandType["Iris_StartVerify2_Type"] = 88] = "Iris_StartVerify2_Type";
|
CommandType[CommandType["Iris_StopVerify_Type"] = 89] = "Iris_StopVerify_Type";
|
CommandType[CommandType["Iris_StartFastCapture_Type"] = 90] = "Iris_StartFastCapture_Type";
|
CommandType[CommandType["Iris_StartFastCapture2_Type"] = 91] = "Iris_StartFastCapture2_Type";
|
CommandType[CommandType["FingerKey_OpenDevice_Type"] = 96] = "FingerKey_OpenDevice_Type";
|
CommandType[CommandType["FingerKey_CloseDevice_Type"] = 97] = "FingerKey_CloseDevice_Type";
|
CommandType[CommandType["FingerKey_GetDeviceInformation_Type"] = 99] = "FingerKey_GetDeviceInformation_Type";
|
CommandType[CommandType["FingerKey_CaptureFingerData_Type"] = 100] = "FingerKey_CaptureFingerData_Type";
|
CommandType[CommandType["FingerKey_ImportFingerPrint_Type"] = 101] = "FingerKey_ImportFingerPrint_Type";
|
CommandType[CommandType["Camera_InitDevice_Type"] = 112] = "Camera_InitDevice_Type";
|
CommandType[CommandType["Camera_ReleaseDevice_Type"] = 113] = "Camera_ReleaseDevice_Type";
|
CommandType[CommandType["Camera_StartCapture_Type"] = 114] = "Camera_StartCapture_Type";
|
CommandType[CommandType["Camera_StopCapture_Type"] = 115] = "Camera_StopCapture_Type";
|
CommandType[CommandType["Camera_SetOption_Type"] = 116] = "Camera_SetOption_Type";
|
})(CommandType || (CommandType = {}));
|
var FingerPosition;
|
(function (FingerPosition) {
|
FingerPosition[FingerPosition["UNKNOWN"] = 0] = "UNKNOWN";
|
FingerPosition[FingerPosition["RIGHT_THUMB"] = 1] = "RIGHT_THUMB";
|
FingerPosition[FingerPosition["RIGHT_INDEX"] = 2] = "RIGHT_INDEX";
|
FingerPosition[FingerPosition["RIGHT_MIDDLE"] = 3] = "RIGHT_MIDDLE";
|
FingerPosition[FingerPosition["RIGHT_RING"] = 4] = "RIGHT_RING";
|
FingerPosition[FingerPosition["RIGHT_LITTLE"] = 5] = "RIGHT_LITTLE";
|
FingerPosition[FingerPosition["LEFT_THUMB"] = 6] = "LEFT_THUMB";
|
FingerPosition[FingerPosition["LEFT_INDEX"] = 7] = "LEFT_INDEX";
|
FingerPosition[FingerPosition["LEFT_MIDDLE"] = 8] = "LEFT_MIDDLE";
|
FingerPosition[FingerPosition["LEFT_RING"] = 9] = "LEFT_RING";
|
FingerPosition[FingerPosition["LEFT_LITTLE"] = 10] = "LEFT_LITTLE";
|
FingerPosition[FingerPosition["THUMB_TWO"] = 21] = "THUMB_TWO";
|
FingerPosition[FingerPosition["LEFT_FOUR"] = 22] = "LEFT_FOUR";
|
FingerPosition[FingerPosition["RIGHT_FOUR"] = 23] = "RIGHT_FOUR";
|
})(FingerPosition || (FingerPosition = {}));
|
var FRO900_MissFinger;
|
(function (FRO900_MissFinger) {
|
FRO900_MissFinger[FRO900_MissFinger["NO_FINGER_MISS"] = 0] = "NO_FINGER_MISS";
|
FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_INDEX"] = 1] = "MISS_FINGER_INDEX";
|
FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_MIDDLE"] = 2] = "MISS_FINGER_MIDDLE";
|
FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_RING"] = 4] = "MISS_FINGER_RING";
|
FRO900_MissFinger[FRO900_MissFinger["MISS_FINGER_LITTLE"] = 8] = "MISS_FINGER_LITTLE";
|
})(FRO900_MissFinger || (FRO900_MissFinger = {}));
|
var ID_FingerPosition;
|
(function (ID_FingerPosition) {
|
ID_FingerPosition[ID_FingerPosition["UNKNOWN"] = 99] = "UNKNOWN";
|
ID_FingerPosition[ID_FingerPosition["RIGHT_THUMB"] = 11] = "RIGHT_THUMB";
|
ID_FingerPosition[ID_FingerPosition["RIGHT_INDEX"] = 12] = "RIGHT_INDEX";
|
ID_FingerPosition[ID_FingerPosition["RIGHT_MIDDLE"] = 13] = "RIGHT_MIDDLE";
|
ID_FingerPosition[ID_FingerPosition["RIGHT_RING"] = 14] = "RIGHT_RING";
|
ID_FingerPosition[ID_FingerPosition["RIGHT_LITTLE"] = 15] = "RIGHT_LITTLE";
|
ID_FingerPosition[ID_FingerPosition["LEFT_THUMB"] = 16] = "LEFT_THUMB";
|
ID_FingerPosition[ID_FingerPosition["LEFT_INDEX"] = 17] = "LEFT_INDEX";
|
ID_FingerPosition[ID_FingerPosition["LEFT_MIDDLE"] = 18] = "LEFT_MIDDLE";
|
ID_FingerPosition[ID_FingerPosition["LEFT_RING"] = 19] = "LEFT_RING";
|
ID_FingerPosition[ID_FingerPosition["LEFT_LITTLE"] = 20] = "LEFT_LITTLE";
|
})(ID_FingerPosition || (ID_FingerPosition = {}));
|
var CompressionType;
|
(function (CompressionType) {
|
CompressionType[CompressionType["UnCompressed"] = 0] = "UnCompressed";
|
CompressionType[CompressionType["BitPacked"] = 1] = "BitPacked";
|
CompressionType[CompressionType["WSQ"] = 2] = "WSQ";
|
CompressionType[CompressionType["JPEG"] = 3] = "JPEG";
|
CompressionType[CompressionType["JPEG2000"] = 4] = "JPEG2000";
|
CompressionType[CompressionType["PNG"] = 5] = "PNG";
|
})(CompressionType || (CompressionType = {}));
|
var SecurityLevel;
|
(function (SecurityLevel) {
|
SecurityLevel[SecurityLevel["Level_1"] = 1] = "Level_1";
|
SecurityLevel[SecurityLevel["Level_2"] = 2] = "Level_2";
|
SecurityLevel[SecurityLevel["Level_3"] = 3] = "Level_3";
|
SecurityLevel[SecurityLevel["Level_4"] = 4] = "Level_4";
|
SecurityLevel[SecurityLevel["Level_5"] = 5] = "Level_5";
|
})(SecurityLevel || (SecurityLevel = {}));
|
var ImageFormatType;
|
(function (ImageFormatType) {
|
ImageFormatType[ImageFormatType["IRaw"] = 1] = "IRaw";
|
ImageFormatType[ImageFormatType["IBmp"] = 2] = "IBmp";
|
ImageFormatType[ImageFormatType["IISO"] = 3] = "IISO";
|
ImageFormatType[ImageFormatType["IANSI"] = 4] = "IANSI";
|
})(ImageFormatType || (ImageFormatType = {}));
|
var FeatureFormatType;
|
(function (FeatureFormatType) {
|
FeatureFormatType[FeatureFormatType["FBione"] = 1] = "FBione";
|
FeatureFormatType[FeatureFormatType["FISO"] = 2] = "FISO";
|
FeatureFormatType[FeatureFormatType["FANSI"] = 3] = "FANSI";
|
FeatureFormatType[FeatureFormatType["FIDCard"] = 4] = "FIDCard";
|
})(FeatureFormatType || (FeatureFormatType = {}));
|
var CIDDeviceType;
|
(function (CIDDeviceType) {
|
CIDDeviceType[CIDDeviceType["CID3000TC"] = 0] = "CID3000TC";
|
CIDDeviceType[CIDDeviceType["CID4000"] = 1] = "CID4000";
|
CIDDeviceType[CIDDeviceType["CID5000"] = 2] = "CID5000";
|
CIDDeviceType[CIDDeviceType["CID7000"] = 3] = "CID7000";
|
CIDDeviceType[CIDDeviceType["CID3000"] = 4] = "CID3000";
|
CIDDeviceType[CIDDeviceType["CID7000R"] = 5] = "CID7000R";
|
})(CIDDeviceType || (CIDDeviceType = {}));
|
var IrisDeviceType;
|
(function (IrisDeviceType) {
|
IrisDeviceType[IrisDeviceType["IR100"] = 1] = "IR100";
|
IrisDeviceType[IrisDeviceType["IR200"] = 2] = "IR200";
|
})(IrisDeviceType || (IrisDeviceType = {}));
|
var IrisCaptureMode;
|
(function (IrisCaptureMode) {
|
IrisCaptureMode[IrisCaptureMode["Two_Eyes"] = 1] = "Two_Eyes";
|
IrisCaptureMode[IrisCaptureMode["Left_Eye"] = 2] = "Left_Eye";
|
IrisCaptureMode[IrisCaptureMode["Right_Eye"] = 3] = "Right_Eye";
|
})(IrisCaptureMode || (IrisCaptureMode = {}));
|
var IDCardType;
|
(function (IDCardType) {
|
IDCardType[IDCardType["IDCard_People"] = 1] = "IDCard_People";
|
IDCardType[IDCardType["IDCard_GAT"] = 2] = "IDCard_GAT";
|
IDCardType[IDCardType["IDCard_Foreign"] = 3] = "IDCard_Foreign";
|
})(IDCardType || (IDCardType = {}));
|
var Camera_Device_List;
|
(function (Camera_Device_List) {
|
Camera_Device_List[Camera_Device_List["FC200V"] = 1] = "FC200V";
|
Camera_Device_List[Camera_Device_List["FC200H"] = 2] = "FC200H";
|
Camera_Device_List[Camera_Device_List["FC205"] = 3] = "FC205";
|
Camera_Device_List[Camera_Device_List["CID7000"] = 11] = "CID7000";
|
})(Camera_Device_List || (Camera_Device_List = {}));
|
;
|
var NOT_CONNECT = -1;
|
var Client = (function () {
|
function Client() {
|
this.url = 'ws://127.0.0.1:4397/aratek';
|
this.ws = null;
|
this.isConnect = false;
|
}
|
Client.prototype.CIDDeviceType = CIDDeviceType;
|
Client.prototype.SendMessage = function (msg) {
|
// console.log(this.isConnect)
|
if (this.isConnect) {
|
this.ws.send(msg);
|
}
|
};
|
Client.prototype.OpenDevice = function (index) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.OpenDevice_Type,
|
"Index": index
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CloseDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CloseDevice_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.GetDeviceCount = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.GetDeviceCount_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.GetDeviceDescription = function (index) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.GetDeviceDescription_Type,
|
"Index": index
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CaptureFingerData = function (image_format, feature_format, timeout, fingerposition, compression_type, device_id, factor) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CaptureFingerData_Type,
|
"Image_Format": image_format,
|
"Feature_Format": feature_format,
|
"TimeOut": timeout,
|
"Finger_Position": fingerposition,
|
"Compression_Type": compression_type,
|
"Device_ID": device_id,
|
"Factor": factor
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.StartCapture = function (feature_format, fingerposition) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.StartCapture_Type,
|
"Feature_Format": feature_format,
|
"Finger_Position": fingerposition
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.StopCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.StopCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.GeneralizeTemplate = function (fea1, fea2, fea3) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.GeneralizeTemplate_Type,
|
"Feature_1": fea1,
|
"Feature_2": fea2,
|
"Feature_3": fea3
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Verify = function (fea1, fea2, security_level) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Verify_Type,
|
"Feature_1": fea1,
|
"Feature_2": fea2,
|
"Security_Level": security_level
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.SetOption = function (LED_index, LED_status) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.SetOption_Type,
|
"LED_Index": LED_index,
|
"LED_Status": LED_status
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.BmpToRaw = function (bmp_imagedata, image_width, image_height) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.BmpToRaw_Type,
|
"Bmp_ImageData": bmp_imagedata,
|
"Image_Width": image_width,
|
"Image_Height": image_height
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.BmpToWSQ = function (bmp_imagedata, image_width, image_height, dpi, bitrate) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.BmpToWSQ_Type,
|
"Bmp_ImageData": bmp_imagedata,
|
"Image_Width": image_width,
|
"Image_Height": image_height,
|
"DPI": dpi,
|
"Bitrate": bitrate
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.BmpToISO = function (bmp_imagedata, image_width, image_height, fingerposition, compression_type, deviceid) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.BmpToISO_Type,
|
"Bmp_ImageData": bmp_imagedata,
|
"Image_Width": image_width,
|
"Image_Height": image_height,
|
"Finger_Position": fingerposition,
|
"Compression_Type": compression_type,
|
"Device_ID": deviceid
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.BmpToANSI = function (bmp_imagedata, image_width, image_height, fingerposition, compression_type, deviceid) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.BmpToANSI_Type,
|
"Bmp_ImageData": bmp_imagedata,
|
"Image_Width": image_width,
|
"Image_Height": image_height,
|
"Finger_Position": fingerposition,
|
"Compression_Type": compression_type,
|
"Device_ID": deviceid
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Init = function (devicetype, that) {//that改变this指向Client实例
|
if (that.isConnect == false) {
|
// console.log("Unconnected service");
|
console.log("非连接服务");
|
return -1;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Init_Type,
|
"DeviceType": devicetype
|
};
|
that.SendMessage(JSON.stringify(cmd_json));
|
// console.log("连接设备成功");
|
};
|
Client.prototype.CID_Close = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Close_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_GetChannelCount = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_GetChannelCount_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_BeginCapture = function (nChannel) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_BeginCapture_Type,
|
"nChannel": nChannel
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_GetFPRawData = function (nChannel) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_GetFPRawData_Type,
|
"nChannel": nChannel
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_GetFPBmpData = function (nChannel) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_GetFPBmpData_Type,
|
"nChannel": nChannel
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_EndCapture = function (nChannel) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_EndCapture_Type,
|
"nChannel": nChannel
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_GetVersion = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_GetVersion_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_GetDesc = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_GetDesc_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_GetVersion = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_GetVersion_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_Begin = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_Begin_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_FeatureExtract = function (fingerposition, image_rawdata) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_FeatureExtract_Type,
|
"FingerPosition": fingerposition,
|
"Image_RawData": image_rawdata
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_FeatureMatch = function (featuredata1, featuredata2) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_FeatureMatch_Type,
|
"FeatureData1": featuredata1,
|
"FeatureData2": featuredata2
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_ImageMatch = function (image_rawdata, featuredata) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_ImageMatch_Type,
|
"RawImageData": image_rawdata,
|
"FeatureData": featuredata
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
// Client.prototype.CID_Alg_GetQualityScore = function (image_rawdata) {
|
// if (this.isConnect == false) {
|
// console.log("Unconnected service");
|
// return NOT_CONNECT;
|
// }
|
// var cmd_json = {
|
// "RequestType": CommandType.CID_Alg_GetQualityScore_Type,
|
// "RawImageData": image_rawdata
|
// };
|
// // console.log(cmd_json)
|
// // return;
|
// this.SendMessage(JSON.stringify(cmd_json));
|
// };
|
Client.prototype.CID_Alg_GetQualityScore = function (image_rawdata) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_GetQualityScore_Type,
|
"RawImageData": image_rawdata
|
};
|
// console.log(cmd_json)
|
// return
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.CID_Alg_End = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.CID_Alg_End_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.ARA_ReadIDCard = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.ARA_ReadIDCard_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.TrustLink_GetDeviceInfo = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.TrustLink_GetDeviceInfo_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.ARA_FeaConv = function (feasrc, feasrc_fm, feadst_fm) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.ARA_FeaConv_Type,
|
"Fea_Src_Data": feasrc,
|
"Fea_Src_Format": feasrc_fm,
|
"Fea_Dst_Format": feadst_fm
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.ARA_GetCurrentDeviceList = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.ARA_GetCurrentDeviceList_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_OpenDevice = function (index) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_OpenDevice_Type,
|
"Index": index
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_GetDeviceCount = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_GetDeviceCount_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_CaptureFingerPrintData = function (fingerposition, imageformat, featureformat, compressiontype, factor, missfinger) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_CaptureFingerPrintData_Type,
|
"Finger_Position": fingerposition,
|
"Image_Format": imageformat,
|
"Feature_Format": featureformat,
|
"Compression_Type": compressiontype,
|
"Factor": factor,
|
"Miss_Finger_Position": missfinger
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_CloseDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_CloseDevice_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_GeneralizeTemplate = function (fea1, fea2, fea3) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_GeneralizeTemplate_Type,
|
"Feature_1": fea1,
|
"Feature_2": fea2,
|
"Feature_3": fea3
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FRO900_Verify = function (fea1, fea2, security_level) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FRO900_Verify_Type,
|
"Feature_1": fea1,
|
"Feature_2": fea2,
|
"Security_Level": security_level
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_InitDevice = function (devicetype) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_InitDevice_Type,
|
"DeviceType": devicetype
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_StartCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_StartCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_StartFastCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_StartFastCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_StopCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_StopCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_StartVerify = function (timeout, leftdata, rightdata) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_StartVerify_Type,
|
"Timeout": timeout,
|
"LeftEye_FeaData": leftdata,
|
"RightEye_FeaData": rightdata
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_StopVerify = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_StopVerify_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_ReleaseDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_ReleaseDevice_type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Iris_SetOptions = function (enrothresh) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Iris_SetOptions_Type,
|
"EnrollThresh": enrothresh
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FingerKey_OpenDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FingerKey_OpenDevice_Type,
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FingerKey_CloseDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FingerKey_CloseDevice_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FingerKey_GetDeviceInformation = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FingerKey_GetDeviceInformation_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FingerKey_CaptureFingerData = function (fingerposition, imageformat, featureformat, timeout) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FingerKey_CaptureFingerData_Type,
|
"Image_Format": imageformat,
|
"Feature_Format": featureformat,
|
"TimeOut": timeout,
|
"Finger_Position": fingerposition
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.FingerKey_ImportFingerPrint = function (fingerposition, allfeature) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.FingerKey_ImportFingerPrint_Type,
|
"Finger_Position": fingerposition,
|
"AllFeatureData": allfeature
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Camera_InitDevice = function (devicetype) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Camera_InitDevice_Type,
|
"DeviceType": devicetype
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Camera_ReleaseDevice = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Camera_ReleaseDevice_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Camera_StartCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Camera_StartCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Camera_StopCapture = function () {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Camera_StopCapture_Type
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.Camera_SetOption = function (livedetectvalue) {
|
if (this.isConnect == false) {
|
console.log("Unconnected service");
|
return NOT_CONNECT;
|
}
|
var cmd_json = {
|
"RequestType": CommandType.Camera_SetOption_Type,
|
"LiveDetectSetting": livedetectvalue
|
};
|
this.SendMessage(JSON.stringify(cmd_json));
|
};
|
Client.prototype.beginFn; // 添加异步设备初始化,因为websocket需要时间来启动
|
Client.prototype.Connect_Server = function () {
|
var thisws = this;
|
this.ws = new WebSocket(this.url);
|
this.ws.onopen = function () {
|
console.log("指纹助手连接成功");
|
// alert("Connect Success");
|
thisws.isConnect = true;
|
// console.log(thisws.beginFn, 1)
|
// ;
|
let data = thisws.beginFn, my = thisws;//循环连接设备
|
let openequipment = function (beginFn, that) {
|
if (beginFn.fn(beginFn.CID5000, that) == -1) {
|
setTimeout(() => {
|
openequipment(data, my);
|
}, 2000);
|
}
|
}
|
openequipment(data, my);
|
};
|
// console.log(thisws.isConnect, 3)
|
this.ws.onmessage = function (ev) {
|
var data = JSON.parse(ev.data);
|
var responsetype = data.ResponseType;
|
// console.log(responsetype, data, '指纹机器返回code值');
|
if (responsetype == 15) {//自定义返回参数 初始化
|
if (thisws.OnCID_Alg_Begin) {
|
thisws.OnCID_Alg_Begin(data.ErrorCode, data.ErrorMessage);
|
}
|
return;
|
}
|
if (responsetype == 18) {//自定义返回参数 图片预览
|
if (thisws.OnCID_BeginCapture) {
|
thisws.OnCID_BeginCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
return;
|
}
|
if (responsetype == 32) {//自定义返回参数 图片预览
|
if (thisws.OnCID_Alg_GetQualityScore) {
|
thisws.OnCID_Alg_GetQualityScore(data.ErrorCode, data.ErrorMessage, data.Score);
|
}
|
return;
|
}
|
//
|
//
|
switch (responsetype) {
|
case CommandType.OpenDevice_Type:
|
if (thisws.OnOpenDevice) {
|
thisws.OnOpenDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CloseDevice_Type:
|
if (thisws.OnCloseDevice) {
|
thisws.OnCloseDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.GetDeviceCount_Type:
|
if (thisws.OnGetDeviceCount) {
|
thisws.OnGetDeviceCount(data.ErrorCode, data.ErrorMessage, data.Count);
|
}
|
break;
|
case CommandType.GetDeviceDescription_Type:
|
var deviceinfo = {
|
sn: data.SN,
|
manufacturer: data.Manufacturer,
|
productname: data.ProductName,
|
productmodel: data.ProductModel,
|
fw_version: data.FW_Version,
|
hw_version: data.HW_Version,
|
image_width: data.Image_Width,
|
iamge_height: data.Image_Height,
|
dpi: data.DPI,
|
device_id: data.Device_ID
|
};
|
if (thisws.OnGetDeviceDescription) {
|
thisws.OnGetDeviceDescription(data.ErrorCode, data.ErrorMessage, deviceinfo);
|
}
|
break;
|
case CommandType.CaptureFingerData_Type:
|
var capimage = {
|
image_format: data.Image_Format,
|
image_data: data.Image_Data,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data,
|
quality: data.Image_Quality,
|
NFIQ: data.Image_NFIQ
|
};
|
if (thisws.OnCaptureFingerData) {
|
thisws.OnCaptureFingerData(data.ErrorCode, data.ErrorMessage, capimage);
|
}
|
break;
|
case CommandType.StartCapture_Type:
|
var startimage = {
|
image_format: ImageFormatType.IBmp,
|
image_data: data.Image_Data,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data,
|
quality: data.Image_Quality,
|
NFIQ: data.Image_NFIQ
|
};
|
if (thisws.OnStartCapture) {
|
thisws.OnStartCapture(data.ErrorCode, data.ErrorMessage, startimage);
|
}
|
break;
|
case CommandType.StopCapture_Type:
|
if (thisws.OnStopCapture) {
|
thisws.OnStopCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.GeneralizeTemplate_Type:
|
if (thisws.OnGeneralizeTemplate) {
|
thisws.OnGeneralizeTemplate(data.ErrorCode, data.ErrorMessage, data.Template_Data);
|
}
|
break;
|
case CommandType.Verify_Type:
|
if (thisws.OnVerify) {
|
thisws.OnVerify(data.ErrorCode, data.ErrorMessage, data.Verify_Score, data.Verify_Result);
|
}
|
break;
|
case CommandType.SetOption_Type:
|
if (thisws.OnSetOption) {
|
thisws.OnSetOption(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.BmpToRaw_Type:
|
if (thisws.OnBmpToRaw) {
|
thisws.OnBmpToRaw(data.ErrorCode, data.ErrorMessage, data.Raw_ImageData);
|
}
|
break;
|
case CommandType.BmpToWSQ_Type:
|
if (thisws.OnBmpToWSQ) {
|
thisws.OnBmpToWSQ(data.ErrorCode, data.ErrorMessage, data.WSQ_ImageData);
|
}
|
break;
|
case CommandType.BmpToISO_Type:
|
if (thisws.OnBmpToISO) {
|
thisws.OnBmpToISO(data.ErrorCode, data.ErrorMessage, data.ISO_ImageData);
|
}
|
break;
|
case CommandType.BmpToANSI_Type:
|
if (thisws.OnBmpToANSI) {
|
thisws.OnBmpToANSI(data.ErrorCode, data.ErrorMessage, data.ANSI_ImageData);
|
}
|
break;
|
case CommandType.CID_Init_Type:
|
if (thisws.OnCID_Init) {
|
thisws.OnCID_Init(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CID_Close_Type:
|
if (thisws.OnCID_Close) {
|
thisws.OnCID_Close(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CID_GetChannelCount_Type:
|
if (thisws.OnCID_GetCount) {
|
thisws.OnCID_GetCount(data.ErrorCode, data.ErrorMessage, data.Count);
|
}
|
break;
|
case CommandType.CID_BeginCapture_Type:
|
if (thisws.OnCID_BeginCapture) {
|
thisws.OnCID_BeginCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CID_GetFPRawData_Type:
|
if (thisws.OnCID_GetRawData) {
|
thisws.OnCID_GetRawData(data.ErrorCode, data.ErrorMessage, data.RawData, data.FeaData);
|
}
|
break;
|
case CommandType.CID_GetFPBmpData_Type:
|
if (thisws.OnCID_GetBmpData) {
|
thisws.OnCID_GetBmpData(data.ErrorCode, data.ErrorMessage, data.BmpData, data.FeaData);
|
}
|
break;
|
case CommandType.CID_EndCapture_Type:
|
if (thisws.OnCID_EndCapture) {
|
thisws.OnCID_EndCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CID_GetVersion_Type:
|
if (thisws.OnCID_GetVersion) {
|
thisws.OnCID_GetVersion(data.ErrorCode, data.ErrorMessage, data.Version);
|
}
|
break;
|
case CommandType.CID_GetDesc_Type:
|
if (thisws.OnCID_GetDesc) {
|
thisws.OnCID_GetDesc(data.ErrorCode, data.ErrorMessage, data.Description);
|
}
|
break;
|
case CommandType.CID_Alg_GetVersion_Type:
|
if (thisws.OnCID_Alg_GetVersion) {
|
thisws.OnCID_Alg_GetVersion(data.ErrorCode, data.ErrorMessage, data.Version);
|
}
|
break;
|
case CommandType.CID_Alg_Begin_Type:
|
console.log(11111)
|
if (thisws.OnCID_Alg_Begin) {
|
console.log(2222)
|
thisws.OnCID_Alg_Begin(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.CID_Alg_FeatureExtract_Type:
|
if (thisws.OnCID_Alg_FeatureExtract) {
|
thisws.OnCID_Alg_FeatureExtract(data.ErrorCode, data.ErrorMessage, data.FeatureData);
|
}
|
break;
|
case CommandType.CID_Alg_FeatureMatch_Type:
|
if (thisws.OnCID_Alg_FeatureMatch) {
|
thisws.OnCID_Alg_FeatureMatch(data.ErrorCode, data.ErrorMessage, data.Similarity);
|
}
|
break;
|
case CommandType.CID_Alg_ImageMatch_Type:
|
if (thisws.OnCID_Alg_ImageMatch) {
|
thisws.OnCID_Alg_ImageMatch(data.ErrorCode, data.ErrorMessage, data.Similarity);
|
}
|
break;
|
case CommandType.CID_Alg_GetQualityScore_Type:
|
if (thisws.OnCID_Alg_GetQualityScore) {
|
thisws.OnCID_Alg_GetQualityScore(data.ErrorCode, data.ErrorMessage, data.Score);
|
}
|
break;
|
case CommandType.CID_Alg_End_Type:
|
if (thisws.OnCID_Alg_End) {
|
thisws.OnCID_Alg_End(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.TrustLink_GetDeviceInfo_Type:
|
if (thisws.OnTrustLink_GetDeviceInfo) {
|
thisws.OnTrustLink_GetDeviceInfo(data.ErrorCode, data.ErrorMessage, data.MACAdress, data.IPAdress, data.HostName);
|
}
|
break;
|
case CommandType.ARA_FeaConv_Type:
|
if (thisws.OnARA_FeaConv) {
|
thisws.OnARA_FeaConv(data.ErrorCode, data.ErrorMessage, data.Fea_Dst_Data);
|
}
|
break;
|
case CommandType.ARA_GetCurrentDeviceList_Type:
|
if (thisws.OnARA_GetCurrentDeviceList) {
|
thisws.OnARA_GetCurrentDeviceList(data.ErrorCode, data.ErrorMessage, data.List);
|
}
|
break;
|
case CommandType.FRO900_OpenDevice_Type:
|
if (thisws.OnFRO900_OpenDevice) {
|
thisws.OnFRO900_OpenDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.FRO900_GetDeviceCount_Type:
|
if (thisws.OnFRO900_GetDeviceCount) {
|
thisws.OnFRO900_GetDeviceCount(data.ErrorCode, data.ErrorMessage, data.Count);
|
}
|
break;
|
case CommandType.FRO900_CaptureFingerPrintData_Type:
|
if (data.PreviewImg != null) {
|
if (thisws.OnFRO900_CaptureFingerPrintData) {
|
thisws.OnFRO900_CaptureFingerPrintData(data.ErrorCode, data.ErrorMessage, null, null, null, null, data.PreviewImg);
|
}
|
}
|
else {
|
var FRO900_Capture_image_1 = {
|
image_format: data.Image_Format,
|
image_data: data.Image_Data_1,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data_1,
|
quality: data.Image_Quality_1,
|
NFIQ: data.Image_NFIQ_1
|
};
|
var FRO900_Capture_image_2 = {
|
image_format: data.Image_Format,
|
image_data: data.Image_Data_2,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data_2,
|
quality: data.Image_Quality_2,
|
NFIQ: data.Image_NFIQ_2
|
};
|
var FRO900_Capture_image_3 = {
|
image_format: data.Image_Format,
|
image_data: data.Image_Data_3,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data_3,
|
quality: data.Image_Quality_3,
|
NFIQ: data.Image_NFIQ_3
|
};
|
var FRO900_Capture_image_4 = {
|
image_format: data.Image_Format,
|
image_data: data.Image_Data_4,
|
feature_format: data.Feature_Format,
|
feature_data: data.Feature_Data_4,
|
quality: data.Image_Quality_4,
|
NFIQ: data.Image_NFIQ_4
|
};
|
if (thisws.OnFRO900_CaptureFingerPrintData) {
|
thisws.OnFRO900_CaptureFingerPrintData(data.ErrorCode, data.ErrorMessage, FRO900_Capture_image_1, FRO900_Capture_image_2, FRO900_Capture_image_3, FRO900_Capture_image_4, null);
|
}
|
}
|
break;
|
case CommandType.FRO900_CloseDevice_Type:
|
if (thisws.OnFRO900_OpenDevice) {
|
thisws.OnFRO900_OpenDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.FRO900_GeneralizeTemplate_Type:
|
if (thisws.OnGeneralizeTemplate) {
|
thisws.OnFRO900_GeneralizeTemplate(data.ErrorCode, data.ErrorMessage, data.Template_Data);
|
}
|
break;
|
case CommandType.FRO900_Verify_Type:
|
if (thisws.OnVerify) {
|
thisws.OnFRO900_Verify(data.ErrorCode, data.ErrorMessage, data.Verify_Score, data.Verify_Result);
|
}
|
break;
|
case CommandType.Iris_InitDevice_Type:
|
if (thisws.OnIris_InitDevice) {
|
thisws.OnIris_InitDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Iris_StartCapture_Type:
|
if (thisws.OnIris_StartCapture) {
|
thisws.OnIris_StartCapture(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance);
|
}
|
break;
|
case CommandType.Iris_StartCapture2_Type:
|
if (thisws.OnIris_StartCapture2) {
|
thisws.OnIris_StartCapture2(data.ErrorCode, data.ErrorMessage, data.Left_Eye_Image, data.Left_Eye_Data, data.Right_Eye_Image, data.Right_Eye_Data);
|
}
|
break;
|
case CommandType.Iris_StartFastCapture_Type:
|
if (thisws.OnIris_StartCapture) {
|
thisws.OnIris_StartCapture(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance);
|
}
|
break;
|
case CommandType.Iris_StartFastCapture2_Type:
|
if (thisws.OnIris_StartCapture2) {
|
thisws.OnIris_StartCapture2(data.ErrorCode, data.ErrorMessage, data.Left_Eye_Image, data.Left_Eye_Data, data.Right_Eye_Image, data.Right_Eye_Data);
|
}
|
break;
|
case CommandType.Iris_StopCapture_Type:
|
if (thisws.OnIris_StopCapture) {
|
thisws.OnIris_StopCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Iris_StartVerify_Type:
|
if (thisws.OnIris_StartVerify) {
|
thisws.OnIris_StartVerify(data.ErrorCode, data.ErrorMessage, data.Face_Image, data.Distance);
|
}
|
break;
|
case CommandType.Iris_StartVerify2_Type:
|
if (thisws.OnIris_StartVerify2) {
|
thisws.OnIris_StartVerify2(data.ErrorCode, data.ErrorMessage, data.Verify_Result);
|
}
|
break;
|
case CommandType.Iris_StopVerify_Type:
|
if (thisws.OnIris_StopVerify) {
|
thisws.OnIris_StopVerify(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Iris_ReleaseDevice_type:
|
if (thisws.OnIris_ReleaseDevice) {
|
thisws.OnIris_ReleaseDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Iris_SetOptions_Type:
|
if (thisws.OnIris_SetOptions) {
|
thisws.OnIris_SetOptions(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.ARA_ReadIDCard_Type:
|
var infodata = {
|
chinese_name: data.CNName,
|
sex: data.Sex,
|
birth: data.Birth,
|
idnum: data.IDNum,
|
expdatebegin: data.ExpDateBegin,
|
expdateend: data.ExpDateEnd,
|
authority: data.Authority,
|
english_name: data.ENName,
|
country: data.Country,
|
version: data.Version,
|
address: data.Address,
|
passnum: data.PassNum,
|
issuecount: data.IssueCount,
|
nation: data.Nation,
|
newaddress: data.NewAddress,
|
feature1: data.Feature1,
|
feature2: data.Feature2,
|
photodata: data.PhotoData,
|
};
|
if (thisws.OnARA_ReadIDCard) {
|
thisws.OnARA_ReadIDCard(data.ErrorCode, data.ErrorMessage, data.CardType, infodata);
|
}
|
break;
|
case CommandType.FingerKey_OpenDevice_Type:
|
if (thisws.OnFingerKey_OpenDevice) {
|
thisws.OnFingerKey_OpenDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.FingerKey_CloseDevice_Type:
|
if (thisws.OnFingerKey_CloseDevice) {
|
thisws.OnFingerKey_CloseDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.FingerKey_GetDeviceInformation_Type:
|
var keyinfo = {
|
manufacturer: data.Manufacturer,
|
issuer: data.Issuer,
|
label: data.Label,
|
sn: data.SN,
|
hwver: data.HWVer,
|
fwver: data.FWVer,
|
};
|
if (thisws.OnFingerKey_GetDeviceInformation) {
|
thisws.OnFingerKey_GetDeviceInformation(data.ErrorCode, data.ErrorMessage, keyinfo);
|
}
|
break;
|
case CommandType.FingerKey_CaptureFingerData_Type:
|
if (thisws.OnFingerKey_CaptureFingerData) {
|
thisws.OnFingerKey_CaptureFingerData(data.ErrorCode, data.ErrorMessage, data.Image_Data, data.Feature_Data, data.Image_Quality);
|
}
|
break;
|
case CommandType.FingerKey_ImportFingerPrint_Type:
|
if (thisws.OnFingerKey_ImportFingerPrint) {
|
thisws.OnFingerKey_ImportFingerPrint(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Camera_InitDevice_Type:
|
if (thisws.OnCamera_InitDevice) {
|
thisws.OnCamera_InitDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Camera_ReleaseDevice_Type:
|
if (thisws.OnCamera_ReleaseDevice) {
|
thisws.OnCamera_ReleaseDevice(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Camera_StartCapture_Type:
|
if (thisws.OnCamera_StartCapture) {
|
thisws.OnCamera_StartCapture(data.ErrorCode, data.ErrorMessage, data.ImageData, data.LiveDetect, data.FaceDetect, data.FaceQuality);
|
}
|
break;
|
case CommandType.Camera_StopCapture_Type:
|
if (thisws.OnCamera_StopCapture) {
|
thisws.OnCamera_StopCapture(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
case CommandType.Camera_SetOption_Type:
|
if (thisws.OnCamera_SetOption) {
|
thisws.OnCamera_SetOption(data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
default:
|
if (thisws.OnOtherError) {
|
thisws.OnOtherError(data.ResponseType, data.ErrorCode, data.ErrorMessage);
|
}
|
break;
|
}
|
};
|
this.ws.onclose = function () {
|
thisws.isConnect = false;
|
console.log("ws.onclose:Disconnect");
|
};
|
};
|
Client.prototype.Disconnect_Server = function () {
|
var thisws = this;
|
this.ws.close();
|
};
|
return Client;
|
}());
|
|
export default Client
|