Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

gabs1234
Copy link

I'm not 100% I didn't beak something here. Some unit tests would be pretty nice in this case.

Derived cameras take the names of shared lib cams you have installed in uca. e.g. mock -> netmock.
Maybe should we add some sort of minimum amount of derived net cams in the build settings ?

@MarcusZuber
Copy link
Member

Good idea, but unfortunately we do not have the plugins installed on the server running the net-instance.
Do you think there is a chance to build the subclass in runtime? Somehow the net creates its interface also at runtime when it connects to the "remote" camera

@gabs1234
Copy link
Author

Ok, so indeed having a default or minimum number of derived classes as a build parameter would be necessary. Like this you'll get derived net cams even if you don't have any shared lib camera plugins installed.

I'm not sure I follow why you'd like to build the subclasses in runtime ? Currently, the code for the derived classes is built at build time, and the remote camera properties are instantiated at runtime, just like before, but in seperate derived classes.

(I just hated the idea of having net-derived-x classes so I made a meson script that replaces the x with installed camera names)

@MarcusZuber
Copy link
Member

The plugins are usually not installed on the "client" side, so reading libuca*.so does not make sense.
I'm currently experimenting with subclassing the net-camera in the class_init and registering the remote properties only in the sub-classes, but I'm not yet satisfied. But then we would not need compile-time copies of the classes. I will proceed with this in January.

@MarcusZuber MarcusZuber self-requested a review March 19, 2025 07:41
@MarcusZuber
Copy link
Member

I'm currently too busy to proceed with a more elegant solution.

Copy link
Member

@MarcusZuber MarcusZuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm currently too busy for a more elegant solution.

Could you change this, then we can stay with this solution:

  • Remove the reading of the installed plugins. The whole point of uca-net is, that I don't have them installed on the client side. Maybe the paramter min_derived_net_cameras should be renamed num_derived_net_cameras or simmilar.
  • Add CMake builds
  • Write the number of generated netXX classes in a header-file (I have an idea to make it a bit more hidden from the user)
  • The net-camera (without a number) is now broken (not linked correctly). Make it also working for compatibility.
  • Make the default number of netXX-cameras to 10 (just checked my logs and my record so far was 5 cameras at the same time and I don't want to recompile everything the next time we try something special).

@gabs1234
Copy link
Author

Fixed:

  • min_derived_net_cameras to num_derived_net_cameras
  • Fixed CMake builds
  • Added NUM_DERIVED_NET_CAMERAS to the config files
  • Set default number of derived cameras to 10.
  • Still cannot instantiate the parent class UcaNetCamera... camera_plugin_get_type() is the culprit. The derived classes must define this function. But this creates conflicts if I also define it in the parent class (double definition).

@MarcusZuber
Copy link
Member

My gobject knowledge is a bit rusty, so here is my idea in c++ wording.

If you create a pure virtual uca net base class, from which you inherit the netX and the normal net camera it should work. Then you do not have to overwrite the method.

I cannot overwrite a method but only add new ones in gobject classes?

@MarcusZuber
Copy link
Member

This works now.
Question: Now we require python even for only a single net-camera (without suffix). Should we keep it like this, or should I generate the net once and add it to the source code?

gabs1234 and others added 12 commits May 8, 2025 08:35
Meson builds as many net cameras as there are shared libs in uca
install folder. Networking functions remain in uca net, remote
properties are handled in derived classes.
Forgot to add in previous commit
Only meson supports this for now
Fixed:
 - [x] `min_derived_net_cameras` to `num_derived_net_cameras`
 - [x] Support for CMake builds
 - [x] Added `NUM_DERIVED_NET_CAMERAS` to the config file
 - [x] Set default number of derived cameras to 10.
 - [ ] Still cannot instantiate the parent class `UcaNetCamera`...
@tfarago
Copy link
Contributor

tfarago commented May 16, 2025

Can you paste here a simple use case?

@tfarago
Copy link
Contributor

tfarago commented May 16, 2025

Also why do we just count them and not add the suffix of the actual camera behind net?

@tfarago
Copy link
Contributor

tfarago commented May 16, 2025

I mean, how am I supposed to know which camera is which?

@MarcusZuber
Copy link
Member

MarcusZuber commented May 16, 2025

Use case (in concert):

from concert.devices.camera.uca import Camera
net_dimax = await Camera("net0",params=host:port etc)
net_phantom = await Camera("net1", params=host:port, etc)

Then I don't have mixed up properties, since each remote-property is registered to a different class.

With ufo-kit/libuca#102 you can just write "net".

@MarcusZuber
Copy link
Member

Also why do we just count them and not add the suffix of the actual camera behind net?

We do not have the remote plugins installed on the client side.

@tfarago
Copy link
Contributor

tfarago commented May 30, 2025

Right. Perhaps one could somehow get them from the server but I know that's additional work. I left a comment in the sibling PR too.

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

Successfully merging this pull request may close these issues.

3 participants