-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
Add gv: option to select discovery network interface #979
Conversation
Hi, Thanks for your work. I don't think it is interesting to implement a generic ArvInterface API. What would this option mean to the other interfaces ? It would be better to rename Emmanuel. |
Hi, Thank you for your comment. I renamed the function name. Currently, I don't have a specific meaning for other interfaces. |
Right. |
@@ -353,8 +360,20 @@ struct _ArvGvInterfaceClass { | |||
|
|||
G_DEFINE_TYPE_WITH_CODE (ArvGvInterface, arv_gv_interface, ARV_TYPE_INTERFACE, G_ADD_PRIVATE (ArvGvInterface)) | |||
|
|||
void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make these two functions use arv_gv_interface_get_instance to find the interface instance. Use the mutex to protect private data access.
src/arvgvinterface.c
Outdated
void | ||
arv_gv_interface_set_discovery_interface_name (ArvInterface *interface, const char *discovery_interface) | ||
{ | ||
ARV_GV_INTERFACE (interface)->priv->discovery_interface = strdup (discovery_interface); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If discovery_interface was already set, a memory leak occurs. Free the content before setting the new one. Use g_strdup instead of strdup.
src/arvsystem.c
Outdated
@@ -260,6 +260,29 @@ arv_set_interface_flags(const char *interface_id, int flags) | |||
g_warning ("[Arv::enable_interface] Unknown interface '%s'", interface_id); | |||
} | |||
|
|||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed.
src/arvtool.c
Outdated
@@ -802,6 +808,9 @@ main (int argc, char **argv) | |||
if (arv_option_gv_allow_broadcast_discovery_ack) | |||
arv_set_interface_flags ("GigEVision", ARV_GV_INTERFACE_FLAGS_ALLOW_BROADCAST_DISCOVERY_ACK); | |||
|
|||
if (arv_option_gv_discovery_interface) | |||
arv_set_interface_discovery_option ("GigEVision", arv_option_gv_discovery_interface); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use arv_gv_interface_set _discovery_interface_name() here.
Thanks. I created the new commit regarding the comments. |
a647265
to
784ce8c
Compare
I have committed a slightly edited version of your work. Thanks ! |
fix #505
This pull request adds an option to specify the network interface for discovering gv cameras.
The current implementation sends camera discovery packets to all network interfaces installed on the machine.
In this PR, by adding an option “gv-discovery-interface”, it is possible to send camera discovery packets only to a specific interface.
We have several methods of implementing setter/getter and network interface matching, as follows.
Method1: arvnetwork.c
We need to implement the network interface matching for each OS.
Method2: arvgvinterface.c
We can implement the minimum in the inherited class, but we cannot use setter/getter in other inherited classes.
Method3: arvinterface.c + arvgvinterface.c
We can implement a setter/getter in the parent class and call the getter from the inherited classes.
We have implemented this PR using method3. What do you think?
@EmmanuelP