-
Notifications
You must be signed in to change notification settings - Fork 3k
nsapi - Add optional API for static configuration of network interfaces #2664
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
Conversation
return NSAPI_ERROR_PARAMETER; | ||
} | ||
|
||
return connect(_ssid, _pass, _security); |
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.
User can still provide credential directly to the connect
, which is all right, but in case user calls set_credentials
first and then 'full' connect
we won't update credentials data in the object (_ssid, _pass, _security) ending up, correctly, connected to different network than we have info stored. We could call the set_credentials
in the connect to update network info.
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.
That is a good idea. Unfortunately we can't control the connect function since it is overriden by the WiFi implementation. I'm open to ideas if you think we can work around this.
It would be better if the set_credentials
was overridden by the interface (similarly to the set_network
function), but this would break existing implementations.
37fd42f
to
561a89e
Compare
@geky needs some conflicts resolved. |
Looks like dhcp defaults to false, is that right? That would be a breaking change for all existing applications unless dhcp happens when mask and gateway are null? |
You are absolutely correct, dhcp should default to true. Not sure how this was missed. |
…aces This accomplishes two things: 1. Provides a simple route for adding static IP address support to the base NetworkInterface 2. Provides a simple route for adding configurability to network interfaces and unifies the network interface to consistent connect call, allowing network interfaces to be passed around abstractly NetworkInterface - set_network - set_dhcp WiFiInterface - set_credentials CellularInterface - set_credentials
Provided through the config options added to the network interface: - EthernetInterface::set_network(ip_address, netmask, gateway) - EthernetInterface::set_dhcp(dhcp)
561a89e
to
64ac210
Compare
/morph test |
Result: SUCCESSYour command has finished executing! Here's what you wrote!
Outputmbed Build Number: 933 All builds and test passed! |
Does anyone have an example code to get a simple UDP packet transferred to a PC, with static IP addresses? |
@kristofmulier you can start with the sockets example here: https://github.com/ARMmbed/mbed-os-example-sockets |
This is a proposal to add static configuration to network interfaces.
This accomplishes two things:
Additional functions:
Let me know any concerns
related discussion #2627
should resolve #2649
cc @bulislaw, @sg-, @c1728p9