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

Add current IP address to Settings Page #1415

Open
asid61 opened this issue Sep 12, 2024 · 4 comments
Open

Add current IP address to Settings Page #1415

asid61 opened this issue Sep 12, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@asid61
Copy link

asid61 commented Sep 12, 2024

Is your feature request related to a problem? Please describe.
I would like to know what the IP address of the device is, in case I am having trouble assigning a static IP address (this happens a lot)

Describe the solution you'd like
Show the current IP address in the Settings page. Should be easy.

Describe alternatives you've considered
Pinging photonvision.local works, but this is not well known.

Additional context

@asid61 asid61 added the enhancement New feature or request label Sep 12, 2024
@mcm001
Copy link
Contributor

mcm001 commented Sep 12, 2024

@tyrius02
Copy link

There is always at least two IP addresses, loopback and others. While it is possible to filter out loopback addresses, how do you deal with two or more network adapters (wired or wireless) that are all active and have an IP address?
I have Orange Pi 5 maxes that have both wired and wireless. While I intend to disable the wireless during competition there is certainly advantages to setting up the WIFI (either as a client or as an AP) when just working with the devices and PhotonVision.

@asid61
Copy link
Author

asid61 commented Sep 23, 2024 via email

@mcm001
Copy link
Contributor

mcm001 commented Sep 24, 2024

CameraServerJNI.getNetworkInterfaces (docs https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/cscore/CameraServerJNI.html#getNetworkInterfaces() ) does what you want. For example, here's the return value on my Windows computer:

String[13]@64
0 = "0.0.0.0"
1 = "172.21.0.1" // WSL adapter
2 = "0.0.0.0"
3 = "0.0.0.0"
4 = "25.55.200.156" // hamachi
5 = "0.0.0.0"
6 = "0.0.0.0"
7 = "0.0.0.0"
8 = "0.0.0.0"
9 = "0.0.0.0"
10 = "0.0.0.0"
11 = "0.0.0.0"
12 = "10.0.0.118" // my actual ethernet connection

This doesn't associate IP addresses with a particular interface, but that info is technically available... here's the wpilib implementation the JNI wraps: https://github.com/wpilibsuite/allwpilib/blob/6281ec0810a3c6c196209eb7d1f385ad05d55589/cscore/src/main/native/linux/NetworkUtil.cpp#L17

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

No branches or pull requests

3 participants