artyom-beilis / OpenLiveStacker

Live Stacker Project - C++ backend and frontend
GNU General Public License v3.0
34 stars 4 forks source link

Just a question #70

Closed laheller closed 1 year ago

laheller commented 1 year ago

Hi @artyom-beilis

Just a question: In the Android application if you want to call ZWO API from C++, how do you pass the USB device file descriptor to the native API ? I am developing my own application and currently I am stuck with this issue.

Best Regards,

Ladislav

artyom-beilis commented 1 year ago

You can't.

I open the camera in Java API first and than assume it is open in C++ API - using same device id. (Since Java uses same library under the hood it works)

Java

https://github.com/artyom-beilis/android_live_stacker/blob/web_ols/app/src/main/java/org/openlivestacker/LiveStackerMain.java#L262

And I pass extracted CamID (actually same 0) to C++ code

Here I assume it is open: https://github.com/artyom-beilis/OpenLiveStacker/blob/main/src/asi_camera.cpp#L543

laheller commented 1 year ago

@artyom-beilis

Hm, that's weird. I mean that we cannot pass the FD. In the meantime I decompiled their zwocamera.jar Java library using the Jadx Gui tool and there is something about the FD in the Java Source: image

Basically they provide the ASIUSBManager.getUSB( ) static method, but I was not able to found any reference to this method, so it is really a big question to me, what they do with the FD and how the pass it to the native API. But obviously they must somewhere/somehow pass it, otherwise the native API cannot access the USB device...

artyom-beilis commented 1 year ago

1st of all take the SDK they gave me at the forum: https://bbs.astronomy-imaging-camera.com/d/16533-general-error-on-attept-to-open-asi120-camera-on-some-devices/2

Official one is broken.

2nd there is no way to pass FD - just open camera from app directly and than use opened camera from C++

laheller commented 1 year ago

@artyom-beilis Thank you!