EDN Admin
Well-known member
hi, I have to use some functions from c++ dll handling communication with finger print reader devices. our application is written ic c# so I need to make some encapsulations of c++ function calls.<br/>i have this c++ structure
<pre><span style="font-family:Courier New;font-size:xx-small <span style="font-family:Courier New;font-size:xx-small <p align=left>typedef struct <br/>{ <p align=left> unsigned long id; //Template Id number <p align=left> unsigned long employee_id; //Optional Employee Id <p align=left> unsigned long password; //Optional administration pass <p align=left> unsigned char sensor_version; //specifies sensor type/version (Do not alter) <p align=left> unsigned char template_version; //Specifies template version (Do not alter) <p align=left> char name[16]; //optional name <p align=left> unsigned char finger; //finger enrolled (0-9 is left pinky to right pinky) <p align=left> unsigned char admin_level; //Administration Privileges <p align=left> unsigned char schedule; //Optional template use schedule <p align=left> unsigned char security_thresh; //Template specific security level <p align=left> unsigned char noise_level[18]; //Noise Level (Do not alter) <p align=left> unsigned char corramb[NUM_CORE]; //Core Stats (Do not alter) <p align=left> unsigned char reference_x; //Finger Placement Core X coordinate <p align=left> unsigned char reference_y; //Finger Placement Core Y coordinate <p align=left> unsigned char ihcore[NUM_CORE]; //Horizontal core locations (Do not alter <p align=left> unsigned char ivcore[NUM_CORE]; //Vertical core locations (Do not alter) <p align=left> unsigned char temp_xoffset; // (Do not alter) <p align=left> unsigned char temp_yoffset; // (Do not alter) <p align=left> unsigned char index; //Template Index (refers to a specific instance of an ID) <p align=left> unsigned char inphase[PACKED_ARRAY_SIZE];//Fingerprint data (Do not alter) } BII_Template; [/code]
i need to rewrite it to c# so that it can be used like in rewritten c# code
<pre>int BII_Finish_FPREnroll_Transfer_MT
(
HUNIT pUnitHandle,
BII_Template *the_template,
int *quality,
int *content
)[/code]
I have imported dll function like this
<div style="background-color:white;color:black
<pre>[DllImport(<span style="color:#a31515 @"C
rogram FilesBioscryptSecureSDKDLLVSeries.dll")]
<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:blue int BII_Finish_FPREnroll_Transfer_MT(<span style="color:blue uint handle, <span style="color:blue ref BII_Template template, <span style="color:blue ref <span style="color:blue int quality, <span style="color:blue ref <span style="color:blue int content);<br/>[/code]
but I was not able to master the BII_Template to receive correct data in array fields.
View the full article
<pre><span style="font-family:Courier New;font-size:xx-small <span style="font-family:Courier New;font-size:xx-small <p align=left>typedef struct <br/>{ <p align=left> unsigned long id; //Template Id number <p align=left> unsigned long employee_id; //Optional Employee Id <p align=left> unsigned long password; //Optional administration pass <p align=left> unsigned char sensor_version; //specifies sensor type/version (Do not alter) <p align=left> unsigned char template_version; //Specifies template version (Do not alter) <p align=left> char name[16]; //optional name <p align=left> unsigned char finger; //finger enrolled (0-9 is left pinky to right pinky) <p align=left> unsigned char admin_level; //Administration Privileges <p align=left> unsigned char schedule; //Optional template use schedule <p align=left> unsigned char security_thresh; //Template specific security level <p align=left> unsigned char noise_level[18]; //Noise Level (Do not alter) <p align=left> unsigned char corramb[NUM_CORE]; //Core Stats (Do not alter) <p align=left> unsigned char reference_x; //Finger Placement Core X coordinate <p align=left> unsigned char reference_y; //Finger Placement Core Y coordinate <p align=left> unsigned char ihcore[NUM_CORE]; //Horizontal core locations (Do not alter <p align=left> unsigned char ivcore[NUM_CORE]; //Vertical core locations (Do not alter) <p align=left> unsigned char temp_xoffset; // (Do not alter) <p align=left> unsigned char temp_yoffset; // (Do not alter) <p align=left> unsigned char index; //Template Index (refers to a specific instance of an ID) <p align=left> unsigned char inphase[PACKED_ARRAY_SIZE];//Fingerprint data (Do not alter) } BII_Template; [/code]
i need to rewrite it to c# so that it can be used like in rewritten c# code
<pre>int BII_Finish_FPREnroll_Transfer_MT
(
HUNIT pUnitHandle,
BII_Template *the_template,
int *quality,
int *content
)[/code]
I have imported dll function like this
<div style="background-color:white;color:black
<pre>[DllImport(<span style="color:#a31515 @"C

<span style="color:blue private <span style="color:blue static <span style="color:blue extern <span style="color:blue int BII_Finish_FPREnroll_Transfer_MT(<span style="color:blue uint handle, <span style="color:blue ref BII_Template template, <span style="color:blue ref <span style="color:blue int quality, <span style="color:blue ref <span style="color:blue int content);<br/>[/code]
but I was not able to master the BII_Template to receive correct data in array fields.
View the full article