Commit Graph

2304 Commits

Author SHA1 Message Date
Andrzej Kaczmarek 210d62470c nimble: Make this proper external repository 2018-03-12 14:34:23 +01:00
Łukasz Rymanowski 448954c40b Merge pull request #866 from rymanluk/dtm_impr
nimble/dtm: Allow RX being late 

X-Original-Commit: 3d41bd30587911376a748fdd5cd12260edb95fc6
2018-03-12 08:49:22 +01:00
Łukasz Rymanowski 07a5d6965f nimble/mesh: Use OS_TASK_STACK_DEFINE for stacks in mesh
X-Original-Commit: 5a97968cdfa5914ad14318051dcb7d6fbef928ea
2018-03-08 22:08:08 +01:00
Łukasz Rymanowski 7925ccfb83 nimble/ll: Use OS_TASK_STACK_DEFINE to init ble_ll stack
This will assure correct aligment

X-Original-Commit: f217015c76f8e2e26a68cc0126f8f9994c96d10f
2018-03-08 22:08:08 +01:00
Łukasz Rymanowski b35de4c81e nimble/dtm: Allow for being late on RX start timer
So far we assert when being late or starting RX timer. Now we allow to
be late as it is not important for dtm code. RX is still on after it.

X-Original-Commit: dc600a051f11e3c9f31e93fdd45e63c659c3c8c4
2018-03-07 12:08:47 +01:00
Andrzej Kaczmarek 1ca40fe580 Merge pull request #837 from andrzej-kaczmarek/nimble-numpktcmp-fix
nimble/ll: Fix sending HCI Number of Completed Packets event

X-Original-Commit: 356528ca3c7307d38ceb6b44ab452e9c6d74f2a9
2018-03-07 11:10:26 +01:00
Michał Narajowski 6014f938cd Merge pull request #871 from michal-narajowski/ll-legacy-adv-fix
nimble/ll: Allow setting scan rsp data before configuring advertising

X-Original-Commit: 8f0a8d53bd57cc17644758dc31f0d0439327f752
2018-03-07 11:10:06 +01:00
Michał Narajowski 8acb7a83ef nimble/ll: Allow setting scan rsp data before configuring advertising
When using legacy advertising commands

X-Original-Commit: 7c9ebd15755af50377418f4fb7b19fd9f22fcfc8
2018-03-06 15:48:04 +01:00
Andrzej Kaczmarek c33701ae80 nimble/phy: Fix receiver configuration on late RX
If we are late when scheduling RX, receiver is enabled anyway since we
may just want to scan for "anything". However, current code only enables
receiver but does not configure it so the results seem unpredictable.

This patch fixes this by ensuring that radio is properly configured for
RX in both cases.

X-Original-Commit: 068c09a8da97bc62eddd5084fa1e40f910abf7e8
2018-03-06 10:24:59 +01:00
Michał Narajowski 8feb3cade1 Merge pull request #841 from michal-narajowski/mesh-zephyr-ports
Mesh zephyr ports

X-Original-Commit: 6192e73f2685d55fa950013e2040621a5d619f77
2018-02-27 12:06:19 +01:00
Michał Narajowski e99920f59e mesh: Use a single transmission from Friend to LPN
As per TSE 10009 the TS will enforce that a Friend ever only uses a
single transmission when sending packets to an LPN. Make sure that our
implementation follows this.

https://www.bluetooth.org/tse/errata_view.cfm?errata_id=10009

X-Original-Commit: 564a956d1a3b291234dc1351f422830b781689f1
2018-02-27 09:56:07 +01:00
Michał Narajowski 7ed968551e mesh: Ignore segments of cancelled message
This fixes the issue when after incomplete timer expiration
host sent ACK.
The host failed in two cases:
1. Sending ACK right after the incomplete timer expiration;
2. Sending ACK from new RX context. Now, seq_auth of cancelled
message is not cleaned on RX reset, so segments of cancelled message
will be discarded when resend.

According to the Mesh Profile v1.0
"When the incomplete timer expires, the lower transport layer
shall consider that the message being received has failed and
cancel the acknowledgment timer. Any segment of a canceled
message shall be ignored."

X-Original-Commit: 50e7d632932c4188849aee89e0d23e2207352601
2018-02-27 09:56:07 +01:00
Michał Narajowski d7fc4a5a11 mesh: Fix sending Provisioning Failed for PB-GATT
In the case of an unexpected PDU we need to send the right response.
This was already taken care of for PB-ADV, but not for PB-GATT.

X-Original-Commit: 65b2467d6192e9bd943a3f898132775984d6b871
2018-02-27 09:56:07 +01:00
Michał Narajowski 63b487ad59 mesh: Resend Link Acknowledgment when necessary
The Provisioner might have missed our earlier Link Acknowledgement, so
if we receive another one with matching Link ID and link.expect state,
simply send another acknowledgement.

X-Original-Commit: b6d823cb5131e8750d7ec1152b4d48ea60ac85c3
2018-02-27 09:56:07 +01:00
Michał Narajowski 35bcfc25b7 mesh: Fix handling of failed transmissions
When sending a segmented message, the state could get stuck if the
advertising bearer fails in transmitting and we don't detect that it
happened. Add a send_start callback for all packets so we can always
know if sending fails.

X-Original-Commit: c2f6fa5baf8eab609a705347e1c1b881e48bd710
2018-02-27 09:56:07 +01:00
Michał Narajowski 6e2c7d1902 mesh: Account for scan window delaying adv events
New advertising started while scanning is already enabled
would delay the first advertisement event until the end of
the current overlapping scan window in the Zephyr native BLE
controller implementation. Hence, consider this scan window
duration when calculating the advertising stop.

X-Original-Commit: 9b8e353c059d260134310e0255bce8b40b00d394
2018-02-27 09:56:07 +01:00
Michał Narajowski 703c021133 mesh: Fix coverity warning with unchecked error return
This fixes Zephyr's Coverity CID 182769.

X-Original-Commit: 584c807f5e25a9c325d90ad6643628198785128d
2018-02-27 09:56:07 +01:00
Michał Narajowski 417418eaac mesh: Add support for OOB info and URI in provisioning data
Until now the OOB info and URI fields in unprovisioned beacons were
generally ignored by the implementation. Add fields for these to
bt_mesh_prov and make sure to take them into account when encoding
advertising data, both for PB-ADV and PB-GATT. For PB-ADV the URI goes
out in a separate beacon, whereas for PB-GATT it is placed in the scan
response data.

X-Original-Commit: e6b7f42e2688c2d4102dea83bf962d2fbc74ac5e
2018-02-27 09:56:07 +01:00
Vipul Rahane aaf569e8bc nimble: Adding missing inttypes.h include
- This was causing a build failure

X-Original-Commit: 13566431878bc3e4ac84cd0e9a36eb1d2cd5c870
2018-02-26 15:27:23 -08:00
Andrzej Kaczmarek 1e7940c858 nimble/ll: Update handling of HCI Number of Completed Packets event
The calculations for sending this HCI event periodically are a bit
mysterious at first glance - let's make them more obvious.

X-Original-Commit: 29d5d03fc888c414fb21ac22d6df4b970847f92f
2018-02-26 11:26:56 +01:00
Andrzej Kaczmarek 78617e1644 nimble/gap: Make max device length configurable
X-Original-Commit: a1122f0c7a942baf6e0c963fcae9b8df9484a27b
2018-02-23 23:07:06 +01:00
Andrzej Kaczmarek 48ec4798d5 nimble/gap: Make appearance optionally writable
As it turns out, spec allows appearance characteristic to be writable
so let us allow configure it this way. Also we need API to set this
from app so it can read new appearance value, store it and then restore
after reboot.

X-Original-Commit: b1b1c785b6f7968588aec68cad897711539552d5
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek 5f5b248e34 nimble/gap: Make device name optionally writable
GAP service takes care of updating characteristic value. Application
can register callback to be notified of value change and can then read
this value and store somewhere (and restore on next boot).

X-Original-Commit: 46e768f451bc4c7a0222348fee384b4d1c87aff1
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek 0fa1d0e1a8 nimble/gap: Make PPCP configurable
Allow to configure value of "Peripherap Preferred Connection Parameters"
characteristic. Since this characteristic is optional and right now we
do not set any meaningful value there, we simply disable it by default.

X-Original-Commit: ce7276d7ea9e46e2912980d010b98ef5beadc6ee
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek ac3727c406 nimble/gap: Fix characteristics in non-peripheral role
"Peripheral Preferred Connection Parameters" is only optional in
peripheral role and excluded otherwise - so make it register only
if we're configured for peripheral role.

X-Original-Commit: 3b1e9855a8dcf0450a21f1bc18102601701d3f60
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek 095bbc8f88 nimble/gap: Store appearance as simple uint16
X-Original-Commit: a57cfcafecae8b880acb6a3214708f945d9e98b8
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek 0256df284f nimble/gap: Make device name configurable via syscfg
This can still be overriden by app, as previously - it's just not
hardcoded.

X-Original-Commit: d8101a357beb0b541597f46e5f049af799063aff
2018-02-23 23:05:05 +01:00
Andrzej Kaczmarek e77d5460c6 nimble/gap: Add "Central Address Resolution" characteristic
This characteristics is mandatory for LE Central role if LL Privacy is
supported.

We could be smarter in registering it by checking controller features,
but this is quite complex to implement due to the way everything is set
up so let's leave proper configuration for user :)

X-Original-Commit: 4934ddf4afc889c0aaa932734d5bf361eb4dc042
2018-02-23 23:05:02 +01:00
Andrzej Kaczmarek 724dea122c nimble/gap: Remove deprecated characteristics
"Peripheal Privacy Flag" and "Reconnection Address" are not included in
GAP spec since 4.1, so let's remove them. And they were not properly
configured anyway...

X-Original-Commit: 3e2a7295ab2a6be2e46319677ba0d19f4d36224b
2018-02-23 23:02:53 +01:00
Andrzej Kaczmarek 49c1941f89 nimble/gap: Remove redundant formward declaration
X-Original-Commit: b83cc69fbbb59e1bb2c80914d2a9b31698f13b76
2018-02-23 23:02:53 +01:00
Andrzej Kaczmarek da72102f44 nimble/gap: Fix whitespaces
X-Original-Commit: 7e4dae9ad578d711c4cba0243b1edbfcb0262be6
2018-02-23 23:02:52 +01:00
Michał Narajowski ad3ff34e98 mesh: Fix passing CID to model publication messages
The vendor variants of the model publication client messages were not
passing onward the CID, rather passing CID_NVAL which is clearly not
right.

X-Original-Commit: 398fd57f82a407a343ff04e445aed6de9e990e8e
2018-02-23 12:09:23 +01:00
Andrzej Kaczmarek c1272bd6dd nimble/ll: Fix BLE_LL_CONN_INIT_MIN_WIN_OFFSET
The code which calculates earliest connection event start does not take
BLE_LL_CONN_INIT_MIN_WIN_OFFSET into account, but we still update tx
windows offset in state machine with its value. As a result when this
setting is set to non-zero value we schedule first connection event
earlier than what slave calculates from CONNECT_IND PDU so connection
cannot be established.

X-Original-Commit: cf8ca1b0a6fab4e5d1c579fe37ee2adc4e3a1e07
2018-02-21 09:49:17 +01:00
ccollins476ad ea51f6d421 Merge pull request #792 from ccollins476ad/task-prio
Use `task_priority` type for task priority syscfg. 

X-Original-Commit: e17911e30947a29488b6ddfa7f469567971f5f01
2018-02-20 14:40:53 -08:00
Michał Narajowski ab815f79aa mesh: shell: Fix build when shell is disabled
X-Original-Commit: 5ed429bff2e761adb6d330610ef6e1a6c468872a
2018-02-20 15:08:07 +01:00
Michał Narajowski cb1760eb74 Merge pull request #815 from michal-narajowski/mesh-blemesh-shell
New mesh app with shell support for testing

X-Original-Commit: 2cf52d5bf0b83bf200d2ff5124270aa387ffcdb1
2018-02-20 10:21:24 +01:00
Maciej Jurczak b0e6640b4d Changes after PR review.
CSC profile specific ATT error added.
Custom endianness handling functions replaced with system functions.
Device appearance moved to syscfg.

X-Original-Commit: 6cb978b99b2014a9589b1d59ea40e17a9e531dfd
2018-02-19 23:18:24 +01:00
Maciej Jurczak ceab2b4609 Reverted accidentaly removed function prototype.
X-Original-Commit: a7d82f957630171bf48972cd2b3915ccd37b434c
2018-02-18 14:20:49 +01:00
Maciej Jurczak 150cbde507 Added device appearance setter and getter to GAP service.
X-Original-Commit: e4221d89612eda349dad1e6ba7a8e9390d841dc9
2018-02-18 13:11:31 +01:00
Michał Narajowski 554fd64645 mesh: shell: Use random addr when public is unassigned
X-Original-Commit: 8d0155cfbc024386a09106cba8f584a0a897144f
2018-02-16 14:26:02 +01:00
Michał Narajowski 1b202fa925 mesh: glue: Add sanity check in k_delayed_work_submit
X-Original-Commit: a14eec88975af4679cd523a5aced6a5510dcfceb
2018-02-16 14:26:02 +01:00
Michał Narajowski 3dc586db13 mesh: glue: Fix calculating remaining time of delayed work
os_cputime_get32() returns value from totally different range, than
os_time_get() and os_callout_reset() uses os_time_get(), so it should be
also used here. os_cputime_ticks_to_usecs() doesn't work well with
os_time_get(), so OS_TICKS_PER_SEC macro is used.

X-Original-Commit: 1eb0d588b403935a8451ff8d87a9b5c993282e3c
2018-02-16 14:26:02 +01:00
Michał Narajowski 9b080e3657 mesh: cfg_cli: Set default message timeout to 5 seconds
To be able to process long messages like composition data get.

X-Original-Commit: cb2a7cb98ac55ece8d007dab1f70b7bf4bc2bc50
2018-02-16 14:26:02 +01:00
Michał Narajowski 5d427da0df mesh: shell: Use Runtime's company ID
X-Original-Commit: 44d9a1ed1767c936068875c70d2ba994515e39da
2018-02-16 14:26:02 +01:00
Michał Narajowski a17113e8d0 mesh: shell: Use separate task to avoid deadlocks
This is added to avoid deadlocks when node is used as Configuration Client.

X-Original-Commit: c147a42a7d6554c3cd9313effbe6e39924a0e1ea
2018-02-16 14:26:02 +01:00
Michał Narajowski eccf2e838a mesh: Fix Friend os_mempool_size calculation
X-Original-Commit: a0b45a5f3d7d81641cca8fc6f4461296199a4db0
2018-02-16 14:26:02 +01:00
Michał Narajowski 65cdb84628 mesh: glue: Fix k_sem_take() semaphore port
os_sem_pend expects time in ticks and timeout is in ms.

X-Original-Commit: 7999ae27b8269561b22711a580001f6210b63485
2018-02-16 14:26:02 +01:00
Michał Narajowski 6bc91e9e82 mesh: shell: Add command for printing mesh composition data
For testing purposes.

X-Original-Commit: bc8f9b16f1c9141c7466bb7a55b2a863622db203
2018-02-16 14:26:02 +01:00
Michał Narajowski 31d1880960 mesh: shell: Add command for printing mesh credentials
For testing purposes.

X-Original-Commit: 77b78775f138c5aaffa9d8c8e0c17fb7e9604820
2018-02-16 14:26:02 +01:00
Michał Narajowski bc4923805f mesh: shell: Add LPN subscription commands to mesh shell
X-Original-Commit: 1409b61d162858308030c2f9c3dbd18fd0d89b73
2018-02-16 14:26:02 +01:00