gphoto2
gphoto2 copied to clipboard
gphoto2-webapi server
A new approach for the gphoto2 webapi server, integrated into the build system as a separate binary gphoto2-webapi
.
I think there is a remaining point of discussion: Do we want to subject our users to the hassle of dealing with git submodule
?
I can see two alternatives:
-
Use
git submodule
.- proper history tracking of the
mongoose.[ch]
files used - using
git submodule
is a big hassle even for people very familiar with git, but thegphoto2
repo is used by many people not very familiar with git - We could mitigate that problem by making the build work by skipping the webapi build in the absence of a properly checked out git submodule. So the CLI would build by default, but the webapi would only build for people who have properly initialized and updated the git submodule.
- proper history tracking of the
-
Avoid git submodule, and copy over
mongoose.[ch]
from agit clone
of mongoose and check them into thegphoto2
repository, possibly with the help of scripts.- Builds on every git clone.
- Loses the direct history connection of
mongoose.[ch]
. - Requires a bit of additional work to update and track the versions of
mongoose.[ch]
, parts of which could be assisted by scripts, git hooks, etc.
In both cases, gphoto2 repo maintainers must regularly update mongoose.[ch]
, either with the proper git submodule commands, or by copying mongoose.[ch]
from an updated mongoose repo and pushing them into the gphoto2 repo.
More comments/review/additional commits to follow.
I'm honest to you, i'm dealing with github now over 10 years and this was the very first time i used git submodule
and in my opinion it is not very handy. I see also an advantage in coping the mongoose sources into the gphoto2 repository, because in case of a major release upgrade with api incompatibilities one get time to migrate to the new release.
Hmm, is there no commonly used http server c library we could use? libhttp? libmicrohttpd?
But libhttp and libmicrohttpd are huge vs. mongoose - it's like to take a sledgehammer to crack a nut. mongoose is a well developed product.
https://github.com/cesanta/mongoose
from README.md:
- Mongoose is used by hundreds of businesses, from Fortune500 giants like Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, Qualcomm, Caterpillar to the small businesses
- Used to solve a wide range of business needs, like implementing Web UI interface on devices, RESTful API services, telemetry data exchange, remote control for a product, remote software updates, remote monitoring, and others
you are right. do not mind me then ;)
@thorsten-l Which editor are you using? I am wondering if we can add a few magic lines to the source files to tell your editor to use the indentation the rest of the code in that file is already using.
Anyway, I will fix the indentation in the existing code by a rebase before merging it into master
, but it would be nice we could tell your editor to not introduce more mixed code indentation in code yet to be written.
@thorsten-l Which editor are you using? I am wondering if we can add a few magic lines to the source files to tell your editor to use the indentation the rest of the code in that file is already using.
Anyway, I will fix the indentation in the existing code by a rebase before merging it into
master
, but it would be nice we could tell your editor to not introduce more mixed code indentation in code yet to be written.
I'm using Visual-Studio-Code on Lubuntu 22.04
I think now i've implemented all features that are of interest.
Two Questions:
- What is the best way to reinitialize the Camera/Port? At this time i run the server in an endless script loop and do /api/server/shutdown for a reinit.
- How do i 'close' the Mirror after /api/show-preview or /api/capture-movie?
I just startet to implement a little sample Web Application.
https://github.com/thorsten-l/gphoto2-webapp
It is a sample WebApp to demonstrate the usage of the gphoto-webapi
only.