* Add optimised constexpr default constructor. Default construction
was previously by a heavyweight defaulted `nsapi_addr_t` parameter.
* Remove deprecated resolving constructor.
* Take `nsapi_addr_t` inputs by constant reference rather than value.
* Inline the trivial getters and setters.
* Use `unique_ptr` to manage the text buffer.
* Make `operator bool` explicit.
* Optimise some methods.
* Update to C++11 style (default initialisers, nullptr etc)
* Optimise clearing by adding `nullptr` overload. This overload means
`Callback(NULL)` or `Callback(0)` will no longer work; users must
use `Callback(nullptr)` or `Callback()`.
* Optimise clearing by not clearing storage - increases code size of
comparison, but that is extremely rare.
* Reduce ROM used by trivial functors - share copy/destroy code.
* Config option to force trivial functors - major ROM saving by
eliminating the "operations" table.
* Config option to eliminate comparison altogether - minor ROM saving by
eliminating zero padding.
* Conform more to `std::function` API.
Use tag dispatch to better handle both NetworkInterface and NetworkStack
pointers.
The previous design was intended to avoid ambiguities when presented
with a scenario like
class MyDevice : public NetworkInterface, public NetworkStack {
};
TCPSocket(&MyDevice);
// Need NetworkStack *: use NetworkInterface::get_stack or
// cast to NetworkStack?
But the previous solution didn't actually work as intended. The overload
pair
nsapi_create_stack(NetworkStack *);
// versus
template <class IF>
nsapi_create_stack(IF *);
would only select the first form if passed an exact match -
`NetworkStack *`. If passed a derived class pointer, like `MyDevice *`,
it would select the template.
This meant that an ambiguity for MyDevice was at least avoided, but
in the wrong direction, potentially increasing code size.
But in other cases, the system just didn't work at all - you couldn't
pass a `MyStack *` pointer, unless you cast it to `NetworkStack *`.
Quite a few bits of test code do this.
Add a small bit of tag dispatch to prioritise the cast whenever the
supplied pointer is convertible to `NetworkStack *`.
- PHY default configuration can be changed
- AutoNegotiation
- Speed
- DuplexMode
- PHY register offset can be updated depending on chosen PHY
All unused parameters are cleaned.
Previous change that removed string-based APIs missed
`NetworkStackWrapper::get_ip_address`. Remove string-based method (which
is not overriding anything in `NetworkStack`) and add missing binary
form to implement `NetworkStack::get_ip_address`.