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

adding getHostname #57

Open
aster94 opened this issue Apr 13, 2019 · 6 comments
Open

adding getHostname #57

aster94 opened this issue Apr 13, 2019 · 6 comments
Labels
type: enhancement Proposed improvement

Comments

@aster94
Copy link

aster94 commented Apr 13, 2019

It would be useful to have the possibility to get the hostname, rigth now it is possible only to set it: https://www.arduino.cc/en/Reference/WiFiNINAsetHostname

other platform have already added it, like esp32:
https://github.com/espressif/arduino-esp32/blob/6dab3f6777b47e077fecd5b27f5f316664dd6096/libraries/WiFi/src/WiFiSTA.cpp#L570-L580

@sandeepmistry
Copy link
Contributor

Hi @aster94,

Is there a particular use case you had in mind for this? Do you want to query the hostname you set or get the default one?

@sandeepmistry sandeepmistry added the status: waiting for information More information must be provided before work can proceed label Apr 26, 2019
@aster94
Copy link
Author

aster94 commented Apr 27, 2019

hi @sandeepmistry,

In my opinion it would be useful especially to get the default one. I don't know if the arduino boards comes out from the factory with all the same hostname but anyway at some point the user could change easily it, thanks to the setHostname() but later he may forgot it and he can't check easily the new name. The user have two options set a new one or use his mobile phone/computer to see it.

Also, if someone would like to be 100% sure that the set function worked a similar approach could be made:

bool change_hostname (String name)
{
    WiFi.setHostname(name);
    if (name != WiFi.getHostname())
    {
        return false;
    }
    else
    {
        return true;
    }
}

at the end if it is not too much code/trouble i would suggest arduino staff to implement it. Since arduino boards rely on esp32 and they already implemented it it would be possible to take a look at what they did maybe

@sandeepmistry
Copy link
Contributor

The only concern with this is the default hostname depends on the firmware version loaded on the board.

We have two options:

  1. add a new command to the firmware to retrieve the hostname, and only support this feature in the new firmware versions.

  2. Make the get host name calculate the default version of the hostname based on the firmware version if one was not set by the user, otherwise store the previously set one as a variable.

I'm leaning towards options two, since it would be compatible with all versions of the firmware. Option 1 is more robust however.

@sandeepmistry
Copy link
Contributor

@facchinm any thoughts on this?

@facchinm
Copy link
Contributor

facchinm commented May 2, 2019

Option 2 looks fine for me, at least in the meantime. We can decide to switch to option 1 after some months / when the boards being produced will be flashed with the new FW

@sandeepmistry sandeepmistry added type: enhancement Proposed improvement and removed status: waiting for information More information must be provided before work can proceed labels Sep 18, 2019
@CyrilleHulin
Copy link

Hello, Some news about adding getHostname?
I will need it too. :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

4 participants