Attendance machine is m880, need to set up in the attendance machine to save time and attendance photos.
Only functions to download attendance records in the SDK development documentation
Readgenerallogdata
Ssr_getgenerallogdata
Both mates can read the punch-card record.
The document does not have a function to download the absence photo, and you view photo in the code hint. Found the following three functions
Public virtual bool Getphotonamesbytime (int dwmachinenumber, int. Iflag, String stime, String etime, out string Allphotonam e);
Public virtual bool Getphotocount (int dwmachinenumber, out int count, int iflag);
Public virtual bool Getphotobyname (int dwmachinenumber, String photoname, out byte photodata, out int photolength);
The function can be guessed by name.
Getphotonamesbytime read the list of photos in the attendance machine, the photo naming rules are time + attendance number, multiple names separated by ' \ t '.
Getphotobyname download photos by name.
But when called in the code below, the error code-2 is returned.
byte Photodata; int 0 //////photo name needs to be added ". jpg" Axczkem1.getphotobyname (imachinenumber,"20150910063045" ". jpg"out photolength)
After the sale of the control, no one. Only on their own.
Using Wireshark analysis of computer and attendance machine communication, found that the time machine has been correctly returned to the photo data, photo data is binary data.
The parameters of the Getphotobyname function are out photodata, which should save the photo data.
The problem is that photodata is of type Byte, and the binary data of the photo should be the byte[] type. Calling a function causes the data to be written to the memory illegally.
Thought of an unconventional solution.
unsafe{byte[] Photodata =New byte[1024x768*Ten]; intPhotolength =0; Try{if(Axczkem1.getphotobyname (Imachinenumber, Arr[j]. Trim () +". jpg", outphotodata[0], outphotolength)) {if(Photolength <photodata.length) {byte[] tmp =New byte[Photolength]; Array.copy (Photodata, TMP, photolength); System.IO.File.WriteAllBytes ("d:\\photos\\20150910063045.jpg", TMP); } } } Catch(Exception ex) {}}
Finally set in the properties of the project: Allow unsafe code.
Two times in the development of the download time attendance photos