Tell the compiler we know what we are doing, and that the bytes are
correctly aligned, to avoid compiler warning:
error: cast increases required alignment of target type
- Use HCI_TRACE macro consistently.
- Use the same colour formatting.
- Add a tool to convert to .pcap for Wireshark.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
The att_flags for descriptors does not use the same bitfield as for
characteristics. This was leading to NimBLE descriptors getting the wrong
flags set.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows gatts_write(..., send_update=True) to work, which will send
notifications/indications to subscribed clients.
btstack already created the CCCD but writes to it were ignored.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
There was no event handler for central-initiated MTU exchange.
Fix truncation of notify/indicate to match NimBLE.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This replaces the previous pending operation queue (that used to also be
shared with pending server notify/indicate ops) with a single pending
operation per connection. This allows the value handle to be correctly
passed to the Python-level events.
Also re-structure GATT client event handling to simplify the packet handler
functions.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This adds a mechanism to track a pending notify/indicate operation that
is deferred due to the send buffer being full. This uses a tracked alloc
that is passed as the content arg to the callback.
This replaces the previous mechanism that did this via the global pending
op queue, shared with client read/write ops.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Makes gatts_notify and gatts_indicate work in the same way: by default they
send the DB value, but you can manually override the payload.
In other words, makes gatts_indicate work the same as gatts_notify.
Note: This removes support for queuing notifications and indications on
btstack when the ACL buffer is full. This functionality will be
reimplemented in a future commit.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This enables the use of WLAN(0).status('rssi') to get current RSSI of the
AP that the STA is connected to.
Signed-off-by: Damien George <damien@micropython.org>
The NINA socket types have the same values as modnetwork, but that may
change in the future. So check the socket types passed to socket() and
convert them (if needed) to their respective Nina socket types.
Also remove the unnecessary socket type check code from bind(), as pointed
out by @robert-hh.
When iterating over os.ilistdir(), the special directories '.' and '..'
are filtered from the results. But the code inadvertently also filtered
any file/directory which happened to match '..*'. This change fixes the
filter.
Fixes issue #11032.
Signed-off-by: Jeremy Rand <jeremy@rand-family.com>
This removes the previous WiFi driver from drivers/cyw43 (but leaves behind
the BT driver), and makes the stm32 port (i.e. PYBD and Portenta) use the
new "lib/cyw43-driver" open-source driver already in use by the rp2 port.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This allows for a port (e.g. esp8266/esp32) to use extmod/modnetwork.c
and provide the globals dict, rather than just a list of interfaces.
When this is used, the default implementation of `network.route` and the
NIC list is not enabled.
Also splits out the LWIP-specific helpers from modnetwork.c into
network_lwip.c.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
This provides a standard interface to setting the global networking config
for all interfaces and interface types.
For ports that already use either a static hostname (mimxrt, rp2) they will
now use the configured value. The default is configured by the port
(or optionally the board).
For interfaces that previously supported .config(hostname), this is still
supported but now implemented using the global network.hostname.
Similarly, pyb.country and rp2.country are now deprecated, but the methods
still exist (and forward to network.hostname).
Because ESP32/ESP8266 do not use extmod/modnetwork.c they are not affected
by this commit.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Since commit d6d8722558, modbtree.c is
included unconditionally in the build (if SRC_EXTMOD_C is used). So guard
the includes of system headers files in case a target doesn't have them.
Signed-off-by: Damien George <damien@micropython.org>
MicroPython overrides the axTLS port configuration file, but fails to
include <arpa/inet.h> (needed for htonl) and <sys/time.h> (needed for
gettimeofday). This results in build failures with compilers which do not
support implicit function declarations (which were removed from C in 1999).
This commit adds back the needed headers that were removed in this commit:
bd08017309
Signed-off-by: Damien George <damien@micropython.org>
Prior to this commit, the default security=-1 would be passed directly
through to the cyw43 driver to auto-detect the security type, but that
driver did not correctly handle the case of open security.
The cyw43 driver has now been changed to no longer support auto-detection,
rather it is up to the caller to always select the security type. The
defaults are now implemented in the Python bindings and are:
- if no key is given then it selects open security
- if a key is given then it selects WPA2_MIXED_PSK
Calling `wlan.connect(<ssid>)` will now connect to an open network, on
both rp2 and stm32 ports. The form `wlan.connect(<ssid>, <key>)` will
connect to a WPA2 network.
Fixes issue #9016.
Signed-off-by: Damien George <damien@micropython.org>