Commit Graph

3105 Commits

Author SHA1 Message Date
Szymon Janc 9180b30035 gitignore: Add missing examples binaries 2019-02-25 14:56:48 +01:00
Szymon Janc ecf352bca9 porting: Use wildcards in Makefiles
This makes port build similar to when using newt tool which always
builds all files in src/ folder.
2019-02-25 14:56:48 +01:00
Andrzej Kaczmarek 92ab01ca9b porting: Add NPL equivalent for OS_ASSERT_CRITICAL 2019-02-25 11:21:44 +01:00
Michał Narajowski 8ae6aff907 porting/examples: Fix Makefiles 2019-02-25 11:21:44 +01:00
Michał Narajowski eb90977c27 porting/examples: Add missing syscfg.h 2019-02-25 11:21:44 +01:00
Łukasz Rymanowski 137efe3bc2 nimble/ll: Improve scanner stop
With this patch aux data cleaning and scheduler clean from aux_ptrs is
done only when extended scanner was enabled.
2019-02-22 21:02:16 +01:00
Łukasz Rymanowski e7b0f49187 nimble/ll: Fix removing elements from the scheduler
This patch makes sure to start scheduler timer only for valid entry.
Also now function will return imidiatelly if scheduler list is empty.
2019-02-22 21:02:16 +01:00
Łukasz Rymanowski 9a9bac14a3 nimble/ll: Fix race condition
This patch fixes race condition when g_ble_ll_data.ll_rfclk_state
is out of sync with nrf52_clock_hfxo_refcnt in nrf52_clock.c

It could happen when HCI Reset has been done while scanning/advertising
etc.

This patch also adds OS_ASSERT_CRITICAL() in places where ll_rfclk_state
is changed.
2019-02-22 21:02:16 +01:00
Michał Narajowski e665d203e9 apps/blemesh_models_example_2: Sync with Zephyr
This patch combines all the changes made to this application in Zephyr.
It features a lot of improvements and updates.

With these changes some of the PTS Mesh Model testcases pass.
2019-02-18 10:17:37 +01:00
Michał Narajowski 65869c5571 porting: Add blemesh example app for Linux 2019-02-18 10:17:26 +01:00
Andrzej Kaczmarek 6f41813592 nimble/mesh: Do not redefine ARRAY_SIZE
os/util.h has it now, but it may still be needed for ports.
2019-02-15 11:14:33 +01:00
Reham Tarek ca2d12baed Additional Fix For Handling conn_handle=0
A conn_handle of 0 should be handled as a valid connection handle while BLE_HS_CONN_HANDLE_NONE should be the proper assignment for the cases where the connection is no longer valid. This fix includes some spotted areas where a check for a valid connection handle is not properly handled.
2019-02-12 15:30:26 +01:00
Michał Narajowski bea94a0592 nimble/mesh: Use ble_gap_event_listener instead of ble_gap_mesh_cb
Use generic listener mechanism instead of dedicated Mesh callback.
2019-02-12 11:30:18 +01:00
Michał Narajowski 7ef718c120 apps/bttester: Update L2CAP COC MTU to be lower than application MTU
Some testcases require MPS < MTU to test reassembly.
2019-02-08 16:51:52 +01:00
Michał Narajowski 27c61ea33d porting/linux: Fix semaphore and mutex pend implementations 2019-02-08 16:50:41 +01:00
Łukasz Rymanowski 44569e1c72 nimble/ll: Fix handling RX data while encryption as a Slave
Set enc_stat in the LL_ENC_REQ handler and not when sending LL_ENC_RSP.
This is in order to make sure that next incoming PDU will be
alread verified

This fix small rate of failures of LL/SEC/SLA/BI-05
2019-02-07 20:51:14 +01:00
Michał Narajowski 664bf53ae1 porting: Enable modlog printing when LOG_LEVEL set appropriately 2019-02-07 16:48:17 +01:00
Michał Narajowski 17cbeab272 porting/linux: Fix ble_npl_time_delay implementation
Previous implementation was inaccurate due to use
of sleep() function which uses seconds as a time parameter.
2019-02-07 16:11:16 +01:00
Martin Turon 680a32ce66 [linux] Stability fixes to linux port: npl mutex, queues, and task. 2019-02-07 15:40:24 +01:00
Łukasz Rymanowski 07a14c38fb nimble/ll: Fix time restrictions on PHY transition in Master role
Fix according to Bluetooth 5.0 Vol. 6 Part B 5.1.10.1

This fixes LL/CON/MAS/BV-50-C
2019-02-06 16:30:02 +01:00
Łukasz Rymanowski de4a79f345 nimble/ll: Fix enh connection complete event as a master
This patch fixes incorretly used identity address as a local rpa address
in the LE Enhanced Connection Complete Evt
2019-02-06 08:58:01 +01:00
Michał Narajowski 7cc706390e nimble/host: Fix missing newlines in some logs 2019-02-05 11:33:28 +01:00
Michał Narajowski 778d2cb9a0 nimble/host: Persist CCCD values that were set before bonding
Before:

1. Nimble is a peripheral
2. A connection is established with a peer device
3. Peer device subscribes for notifications/indications on a CCCD
4. Bonding with a peer device
5. Peer device disconnects and reconnects
6. The indication setting is not restored

After:

1. Nimble is a peripheral
2. A connection is established with a peer device
3. Peer device subscribes for notifications/indications on a CCCD
4. Bonding with a peer device
5. CCCD values are persisted
6. Peer device disconnects and reconnects
7. The indication settings are restored

Fixes issue #319
2019-02-04 11:06:46 +01:00
Michał Narajowski 2d3705b94f apps/bttester: Port app to Mynewt 2019-02-04 10:49:14 +01:00
Michał Narajowski 07df4bbae0 apps/bttester: Copy files from Zephyr 2019-02-04 10:49:14 +01:00
Łukasz Rymanowski a14826c3c6 nimble/ll: Clear connsm->inita_identity_used when connsm is created 2019-02-04 10:44:55 +01:00
Michał Narajowski 7b0995de9b apps/btshell: Add an example of included services 2019-02-01 09:44:10 +01:00
Michał Narajowski 067bebe4b5 nimble/host: Fix printing included services
Previously there was a bug when iterating over included services.
Moreover the handles for included services were not assigned, which
resulted in wrong handle for all attributes placed after the included
services in the database. This patch fixes it and improves information
displayed by this function.
2019-02-01 09:44:10 +01:00
Michał Narajowski 58ed664b99 mesh: Take advantage of net_buf_simple_pull_mem()
Use net_buf_simple_pull_mem() instead of net_buf_simple_pull() where
it makes sense.
2019-01-31 17:50:26 +01:00
Michał Narajowski 7cf84d52b9 mesh: Fix publish timer handling when sending fails
Sending a model publication message could fail e.g. if there are no
buffers available, however this doesn't mean that we should stop doing
periodic publishing indefinitely. When an error occurs, make sure to
call the publish_sent() function so that the periodic publishing timer
gets resubmitted if necessary.
2019-01-31 17:50:26 +01:00
Michał Narajowski d42c018ffb mesh: Fix publish timer handling when sending fails
Sending a model publication message could fail e.g. if there are no
buffers available, however this doesn't mean that we should stop doing
periodic publishing indefinitely. When an error occurs, make sure to
call the publish_sent() function so that the periodic publishing timer
gets resubmitted if necessary.
2019-01-31 17:50:26 +01:00
Michał Narajowski c2c5cd4e9f mesh: Clean up net validity & provisioning state handling
Tracking of the BT_MESH_VALID flag and the PB-GATT state was rather
fragile. Add proper error returns to the various GATT service enable &
disable handlers, and toggle the BT_MESH_VALID flag in a single file
(main.c). Use the newly added error returns to ensure that we don't
re-enable PB-GATT if it wasn't already enabled from before.
2019-01-31 17:50:26 +01:00
Michał Narajowski 54286e1a49 mesh: Convert bit-fields into flags
There's already a flags member in the bt_mesh context, so take
advantage of that for any boolean members that have so far been
bit-fields. This should produce more efficient code, also for the
sequence number that's now its own u32_t.
2019-01-31 17:50:26 +01:00
Michał Narajowski 7879438e99 mesh: Remove redundant stack variable
The msg->prev_addr is already stored in frnd->clear.frnd, so there's
no need to have an extra stack variable for this (in the form of
prev_addr).
2019-01-31 17:50:26 +01:00
Michał Narajowski a25ef6092c mesh: Fixes existing friend lookup in Friend Request handling
Currently, when handling a Friend Request message with `prev_addr` set,
we look up existing friend entry using `prev_addr` as the address.
However, `prev_addr` is the address of the requesting node's previous
friend, NOT the address of the requesting node itself. Therefore, we
should always look up existing friend entry using `rx->ctx.addr` as the
address.
2019-01-31 17:50:26 +01:00
Michał Narajowski 0b18846387 mesh: Fix typo leading to incorrect settings storage
This was intended to be an equality comparison and not an assignment.
2019-01-31 17:50:26 +01:00
Michał Narajowski 9b77b4cfcd mesh: Add header file support for C++
Add preprocessor directive for C++ compatibility.
2019-01-31 17:50:26 +01:00
Michał Narajowski 1630de1a67 mesh: Fix matching for all elements of an LPN
When we're acting as a Friend for an LPN, we need to consider all
elements of the LPN. The information of how many elements the LPN has
is provided in the Friend Request message, however until now the code
did not do anything with this information.

Fix the issue by tracking the number of elements for each LPN and
update the unicast address matching code to take this into account.
2019-01-31 17:50:26 +01:00
Michał Narajowski 1fef5a8e5a mesh: Increase scan window from 10ms to 30ms
Experiments have shown that the probability of missing advertising
packets is significantly lower with 30ms scan window compared to 10ms
scan window. This is especially the case with advertisers using a 20ms
advertising interval, which in turn is perhaps the most common one
since it's the smallest allowed by the Bluetooth 5.0 specification.
2019-01-31 17:50:26 +01:00
Michał Narajowski 4df2f15b06 mesh: Enforce proper compilation.
The current method relies heavily on the linker/compiler to
do the correct operation. Which is to eliminate the code that will
never get called. This posses a problem if the build even changes
by a smallest fraction.
The current patch will enforce proper inclusion of the code at the
pre-processing stage. Thereby not relying on the compiler/linker to
do the right thing.
2019-01-31 17:50:26 +01:00
Michał Narajowski 4a2884b018 mesh: Fix incorrect reference to BT_SETTINGS
The test for IS_ENABLED(BT_SETTINGS) in mod_reset()
should be IS_ENABLED(CONFIG_BT_SETTINGS).
2019-01-31 17:50:26 +01:00
Michał Narajowski 0e18a15037 mesh: Fix missing semicolon
Fix a missing semicolon at the end of a statement.
2019-01-31 17:50:26 +01:00
Michał Narajowski 2bcb0ddbf4 mesh: Fix checking for subnet when recovering App Key
The ordering of items in flash is not guaranteed, so it's possible we
get an App Key before the corresponding Net Key. Remove the check for
a Net Key, since the storing code should never store an App Key if
there is no corresponding Net Key.
2019-01-31 17:50:26 +01:00
Michał Narajowski 4f1dbf88d8 mesh: Remove commented out lines 2019-01-31 17:50:26 +01:00
Michał Narajowski 07f712cd7d mesh: Move Device UUID log to bt_mesh_prov_enable()
In some cases the application might only initialize its UUID after
calling bt_mesh_init(), e.g. in the case of deriving the UUID from the
identity address. To avoid confusing logs, only print the UUID when
actually enabling one of the provisioing bearers.
2019-01-31 17:50:26 +01:00
Michał Narajowski 8799108df8 mesh/transport: Reformat SeqAuth calculation fix 2019-01-31 17:50:26 +01:00
Michał Narajowski 3b3b92bfbd mesh: Add macros to encoded model publication periods
These macros are helpful for using the configuration client API with
periodic model publication.
2019-01-31 17:50:26 +01:00
Michał Narajowski 4e307a4984 mesh: Fix unused variable error when PB_ADV and PB_GATT disabled 2019-01-31 17:50:26 +01:00
Michał Narajowski aebc46f61f porting/linux: Fix missing MYNEWT_VAL define
Fixes a regression introduced in Nimble PR #315.
2019-01-31 17:50:12 +01:00
Andrzej Kaczmarek febac4a0db nimble/ll: Fix PHY update on symmetric PHY from slave
If slave requested symmetric PHY on PHY change we should either change
both directions to the same PHY or leave both unchanged.

This fixes LL/CON/MAS/BV-117C.
2019-01-31 17:24:40 +01:00