I am up against a deadline and have one last fix to make for an application.
I am making calls to a DLL (C++) from xbaxic that interacts with an image scanner on a serial port. I a have all the communications and functions working, except for this one where I am capturing the image through pointers to arrays.
I have to send a pointer to and array, into the function. The array is of a user-defined structure which has a pointer to a C++ unsigned char array. I know I am probably just over thinking things and getting pulled into the circle, but I just can't get it to run.
I need to know how to define the pointer within the structure typedef and how to define the array and its pointer that I pass into the function.
Here is the documented DLL Function:
BII_Capture_DownSampled_Image
int BII_Capture_DownSampled_Image (BII_Raw *image)
Description:
Commands the MV1200 to take a snapshot off the sensor and send a 96 by 96 down sampled image to the PC. If the finger detect flag was set using BII_Set_User_Flags (the default is set to off), the MV1200 will wait for the placement of a finger. If the flag is not set, it will merely send the image straight to the PC. The process of sending the down-sampled image to the PC is an order of magnitude faster than sending a raw image.
Parameters:
*image A pointer to a structure of type BII_Raw (see end of chapter) whose p_image pointer points to an array with sufficient space to hold the image.In this case 9216 elements. The allocated *image pointer must have nx_pix and ny_pix set to 96 each, otherwise and error code will be returned.
Return Values:
(TRUE) 1 Image successfully captured.
Error An error specified in the error table. See end of chapter for a description.
This is the documented typedef for the BII_Raw structure:
typedef struct {
int nx_pix; //number of x pixels
int ny_pix; //number of y pixels
int bits_per_pixel; //number of bits in each pixel (currently 8)
unsigned char *p_image; //Pointer to an unsigned character array of nx_pix pixels by ny_pix pixels */
} BII_Raw;
Here is my latest try and pain points:
type BII_Raw
nx_pix as integer
ny_pix as integer
bits_per_pixel as integer
?????????????? not sure here on how to define it and as what type; as P or Byte?
End type
Dim image as {BII_Raw} ???????? should I initialize the array here?
image.nx_pix = 96
image.ny_pix = 96
image.bit_per_pixel = 8
then I would declare the DLL function
declare BII_V1100 BII_Capture_DownSampled_Image LL
and make the call
return = BII_Capture_DownSampled_Image(image) ????? not sure how to pass the pointer to the array.
If anyone can help, I'd really really appreciate it.
I am making calls to a DLL (C++) from xbaxic that interacts with an image scanner on a serial port. I a have all the communications and functions working, except for this one where I am capturing the image through pointers to arrays.
I have to send a pointer to and array, into the function. The array is of a user-defined structure which has a pointer to a C++ unsigned char array. I know I am probably just over thinking things and getting pulled into the circle, but I just can't get it to run.
I need to know how to define the pointer within the structure typedef and how to define the array and its pointer that I pass into the function.
Here is the documented DLL Function:
BII_Capture_DownSampled_Image
int BII_Capture_DownSampled_Image (BII_Raw *image)
Description:
Commands the MV1200 to take a snapshot off the sensor and send a 96 by 96 down sampled image to the PC. If the finger detect flag was set using BII_Set_User_Flags (the default is set to off), the MV1200 will wait for the placement of a finger. If the flag is not set, it will merely send the image straight to the PC. The process of sending the down-sampled image to the PC is an order of magnitude faster than sending a raw image.
Parameters:
*image A pointer to a structure of type BII_Raw (see end of chapter) whose p_image pointer points to an array with sufficient space to hold the image.In this case 9216 elements. The allocated *image pointer must have nx_pix and ny_pix set to 96 each, otherwise and error code will be returned.
Return Values:
(TRUE) 1 Image successfully captured.
Error An error specified in the error table. See end of chapter for a description.
This is the documented typedef for the BII_Raw structure:
typedef struct {
int nx_pix; //number of x pixels
int ny_pix; //number of y pixels
int bits_per_pixel; //number of bits in each pixel (currently 8)
unsigned char *p_image; //Pointer to an unsigned character array of nx_pix pixels by ny_pix pixels */
} BII_Raw;
Here is my latest try and pain points:
type BII_Raw
nx_pix as integer
ny_pix as integer
bits_per_pixel as integer
?????????????? not sure here on how to define it and as what type; as P or Byte?
End type
Dim image as {BII_Raw} ???????? should I initialize the array here?
image.nx_pix = 96
image.ny_pix = 96
image.bit_per_pixel = 8
then I would declare the DLL function
declare BII_V1100 BII_Capture_DownSampled_Image LL
and make the call
return = BII_Capture_DownSampled_Image(image) ????? not sure how to pass the pointer to the array.
If anyone can help, I'd really really appreciate it.
Comment