Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can anyone help this DLL wrapping with ffi? #618

Open
sctaix opened this issue Apr 3, 2021 · 0 comments
Open

Can anyone help this DLL wrapping with ffi? #618

sctaix opened this issue Apr 3, 2021 · 0 comments

Comments

@sctaix
Copy link

sctaix commented Apr 3, 2021

I have no idea with C or C++ with DLL, but I tried to learn it.

From DLL API Dcoumentation.

MVSDK_API CameraSdkStatus __stdcall CameraEnumerateDevice(tSdkCameraDevInfo * pCameraList, INT * piNums)

[Description]
Enumerate devices and establish a list of devices.

[Parameters]
[out] | pCameraList | Device list array pointer
[in,out] | piNums | The number of pointers to the device, the number of elements passed to the pCameraList array at the time of the call. When the function returns, the number of devices actually found is saved.

[Returns]
Returns CAMERA_STATUS_SUCCESS(0) successfully. Otherwise, it returns a non-zero error code. Please refer to the definition of the error code in CameraStatus.h.

[Warning]
piNums The value pointed to must be initialized and does not exceed the number of pCameraList array elements, otherwise it may cause memory overflow

[Note]
The list of returned camera information will be sorted according to acFriendlyName. For example, after changing the two cameras to the names of "Camera1" and "Camera2," the camera named "Camera1" will be in front, and the camera named "Camera2" will be behind the row.

Demo in C++

tSdkCameraDevInfo sCameraList[10]; << What this real mean? is it array?
INT iCameraNums;
CameraSdkStatus status;
CRect rect;
tSdkCameraCapbility sCameraInfo;

//Enumerate the device to get the device list
//Enumerate camera
iCameraNums = 10;//Before calling CameraEnumerateDevice, set iCameraNums = 10, which means read only up to 10 devices. If you need to enumerate more devices, change the size of the sCameraList array and the value of iCameraNums

if (CameraEnumerateDevice(sCameraList,&iCameraNums) != CAMERA_STATUS_SUCCESS || iCameraNums == 0)
{
MessageBox("No camera was found!");
return FALSE;
}

How Can I call this function with node-ffi?

Please, help me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant