Hi all, I need help using the SDK version 2.52.
I’m trying to send a facial template using this piece of code (adapted from the SDK to suit my necessities):
public int SendPhoto(DevClock connectedClock, AnvizPhoto photo, AnvizUser user)
{
int ret = 0;
if ((connectedClock.DevTypeFlag & (int)AnvizLib.MODE_FP_Type.DEV_TYPE_FLAG_FACEPASS_PICTURE) != 0)
{
if (photo.DataLength > 0)
{
AnvizLib.CCHEX_DEL_PERSON_INFO_STRU Data;
Data.EmployeeId = new byte[5];
Conversions.string_to_byte(user.UserID, Data.EmployeeId, 5);
Data.operation = 11;
byte[] photoArray = new byte[photo.DataLength];
Array.Copy(photo.BinaryData, 0, photoArray, 0, photo.DataLength);
ret = AnvizLib.CChex_UploadFacePictureModule(anviz_handle, connectedClock.DevIdx, ref Data, photo.BinaryData, photo.DataLength);
}
}
return ret;
}
This code works fine, but when I get the CChex_Update message type in return it gives me an error (Result -1).
case (int)AnvizLib.MsgType.CCHEX_RET_UPLOAD_FACE_PICTURE_MODULE_TYPE:
{
AnvizLib.CCHEX_UPLOAD_FACE_PICTURE_MODULE result;
result = (AnvizLib.CCHEX_UPLOAD_FACE_PICTURE_MODULE)Marshal.PtrToStructure(pBuff, typeof(AnvizLib.CCHEX_UPLOAD_FACE_PICTURE_MODULE));
DevClock clock = GetConnectedClock(dev_idx[0]);
if (result.Result == 0)
{
SWLogger.DebugFmt("Photo succesfully uploaded. Result {0} [User {1} - Device {2} ({3})]",
result.Result, Conversions.Employee_array_to_srring(result.EmployeeId),
clock.Clock.Name, clock.Clock.Ip);
}
else
{
SWLogger.DebugFmt("Photo failed to upload. Result {0} [User {1} - Device {2} ({3})]",
result.Result, Conversions.Employee_array_to_srring(result.EmployeeId),
clock.Clock.Name, clock.Clock.Ip);
}
}
break;
The picture was downloaded using the CChex_DownloadFacePictureModule SDK method, getting the result from the CChex_Update with a message type of CCHEX_RET_DOWNLOAD_FACE_PICTURE_MODULE_TYPE and saved into a SQL Server instance using a VarBinary field to store the data from the picture.
Am I doing something wrong?
I appreciate any help you can provide.
Thanks in advance.