Commit graph

129 commits

Author SHA1 Message Date
lly 0a41241e10 ble_mesh: Use 24-bit functions [Zephyr]
Use 24-bit functions for byteorder and net_buf in order to make the
byteorder used more readable.
2020-05-11 15:42:50 +08:00
lly bf4b513e83 ble_mesh: Group resends in proxy nodes [Zephyr]
Resend transport segments for groups on the advertiser interface, even
if a connected proxy node holds the group.
2020-05-11 15:42:45 +08:00
lly 91fff8c897 ble_mesh: Typo in condition in comp_add_elem of cfg_srv [Zephyr]
Vendor model IDs take up four (not two) bytes in the composition
2020-05-11 15:42:45 +08:00
lly 7ea60199a6 ble_mesh: GATT Proxy Spec 1.0.1 changes [Zephyr]
Backport of https://github.com/apache/mynewt-nimble/pull/724

Mesh spec 1.0.1 changes proxy disabling behavior to only affect the
relaying from proxy nodes. Previously, disabling proxy would shut down
all proxy and node activity.

Tweaks from the original commit:
- Removed redundant call to bt_mesh_adv_update() in gatt_proxy_set()
- Removed invalid ref to 4.2.11.1 in node_identity_set()

---

According to Mesh Profile Spec 1.0.1, Section 4.2.11:
"If the Proxy feature is disabled, a GATT client device can connect
over GATT to that node for configuration and control. Messages from
the GATT bearer are not relayed to the advertising bearer."

Moreover some notes have been removed from the spec compared to
version 1.0:

Mesh Profile Spec 1.0, Section 4.2.11:

"Upon transition from GATT Proxy state 0x01 to GATT Proxy state 0x00
the GATT Bearer Server shall disconnect all GATT Bearer Clients."

"The Configuration Client should turn off the Proxy state as the last
step in the configuration process."

Mesh Profile Spec 1.0, Section 4.2.11.1:

"When the GATT Proxy state is set to 0x00, the Node Identity state
for all subnets shall be set to 0x00 and shall not be changed."
2020-05-11 15:42:44 +08:00
lly 2b84b673bf ble_mesh: Support reliable sending when publishing [Zephyr]
Until now the choice of reliable sending (segmented messages with
acks) was implicitly dependent on the size of the payload. Add a new
member to the bt_mesh_model_pub to force using segment acks even when
the payload would fit a single unsegmented message.
2020-05-11 15:42:44 +08:00
lly c2e24e306f ble_mesh: Check device uuid when init provisioning 2020-05-11 15:42:43 +08:00
lly a85459e245 ble_mesh: Fix provisioning buffer initialization [Zephyr]
When PB-GATT support has been enabled the provisioning code "borrows"
the buffer from the proxy code. However, the way that initialization
was happening the proxy buffers were initialized only after
provisioning initialization, resulting in a corrupted buffer with
buf->data pointing to NULL. Reorder the initialization calls so that
proxy is done first and provisioning only after it.
2020-05-11 15:42:43 +08:00
lly a0434371b0 ble_mesh: Skip publish if update fails [Zephyr]
Allow models to skip a periodic publish interval by returning an error
from the publish update callback.

Previously, an error return from publish update would cancel periodic
publishing. This can't be recovered from, and as such, no valid model
implementation could return an error from this callback, and there was
no way to skip a periodic publish.
2020-05-11 15:42:42 +08:00
lly 1717c2face ble_mesh: Enable Segmented Control Messages [Zephyr]
The function bt_mesh_ctl_send() used to support maximum length of
11 bytes. The segmentation complies with the BLE Mesh Standard.
The ack is disabled in case of non unicast address.
2020-05-11 15:42:42 +08:00
Island 27ae9d3e2c Merge branch 'bugfix/ble_mesh_provisioner_check_key_v4.1' into 'release/v4.1'
ble_mesh: Check if appkey exist before deleting it (v4.1)

See merge request espressif/esp-idf!8621
2020-05-06 18:17:02 +08:00
Island 7db21de3b3 Merge branch 'bugfix/ble_mesh_compile_error_o2_v4.1' into 'release/v4.1'
ble_mesh: Fix compile error when -O2 (performance) is chosen (v4.1)

See merge request espressif/esp-idf!8616
2020-05-06 18:15:53 +08:00
lly 78b13034ef ble_mesh: Fix node not erase info completely
Previously only mesh node info is supported to be stored
in flash. So when trying to reset the node, we only need
to judge if the BLE_MESH_VALID flag is set.
Currently we support storing both node & Provisioner info
in flash, when trying to erase the node info from flash,
the BLE_MESH_NODE flag will be checked. So we need to set
bt_mesh.flags to 0 when all the erase operations are done.
2020-05-06 11:43:43 +08:00
lly 099bf88b2e ble_mesh: Check if appkey exist before deleting it 2020-05-06 11:40:20 +08:00
lly 466d450b4b ble_mesh: Add length check for some mesh operations 2020-05-06 11:26:33 +08:00
lly a742255f8e ble_mesh: Fix compile error when -O2 (performance) is chosen 2020-05-06 11:26:25 +08:00
Island dd89b2dc0d Merge branch 'bugfix/ble_mesh_rpl_list_size_v4.1' into 'release/v4.1'
ble_mesh: Associate replay protection list size with nodes count (v4.1)

See merge request espressif/esp-idf!8493
2020-05-06 11:15:21 +08:00
lly 8b2291a718 ble_mesh: Continue node info restore even if failure happens
During BLE Mesh Provisioner initialization, the stack will restore
the nodes information if settings storage is enabled.
Previously when a failure happens (e.g. found the same uuid) during
the restore procedure, the information of the following nodes will
not be restored and error will be directly returned.
But this will introduce some problem with user experience, because
some newly provisioned nodes information will not be restored and
Provisioner will not be able to control those nodes.
So we change the operation here, when a failure happens during the
restore procedure, Provisioner will only ignore the information of
the current node and continue restoring other nodes information.
2020-04-30 11:50:15 +00:00
lly fca4124f70 ble_mesh: Remove some redundant functions 2020-04-30 11:50:15 +00:00
lly d35d765395 ble_mesh: Notify unprovisioned device beacon to application layer
With this change, if a Provisioner has provisioned the maximum
number of nodes, it can still report the unprovisioned device
beacon from other nodes to the application layer. And this will
be more reasonable compared with the previous implementation.
Previously when the node array of Provisioner is full, no beacon
from unprovisioned devices will be reported, only some warning
logs will be given.
2020-04-30 11:50:15 +00:00
lly 94092a148c ble_mesh: Check if assigned node address is duplicated
Previously only check the node address when it is assigned by the
application layer. Here we also check the address when the address
is allocated internally. And this will be useful when some mesh
internal tests are performed.
2020-04-30 11:50:15 +00:00
lly 68e8a7e0ba ble_mesh: Update next alloc address when node info is added 2020-04-30 11:50:15 +00:00
lly 62ac50f9d7 ble_mesh: Fix Provisioner provisioning deadlock 2020-04-30 11:50:15 +00:00
lly fefd52f093 ble_mesh: Remove BLE_MESH_MAX_STORED_NODES option
Previously the BLE_MESH_MAX_STORED_NODES option is added for
internal mesh test, which will be a little confusing for the
users to understand.
Here we remove this option, instead the BLE_MESH_MAX_PROV_NODES
will be used for all the cases. For mesh internal test, when
the test function is called to add some nodes info, the info
will be stored in the array of provisioned nodes directly.
2020-04-30 11:50:15 +00:00
lly d51bd36142 ble_mesh: Add missing #ifdef __cplusplus 2020-04-30 08:45:55 +00:00
lly 1ac44aa202 ble_mesh: Support BLE advertising simultaneously 2020-04-10 17:34:06 +08:00
lly 89f7e62011 ble_mesh: Add ble mesh white list test function
Using the ble mesh white list test functions, a node can choose to
only receive mesh messages from a specific node and relay the
messages for it. Messages from other nodes will be ignored.
2020-04-09 06:03:59 +00:00
lly 7815cd9ff4 ble_mesh: Fix ble mesh nimble host deinit 2020-03-17 16:18:50 +08:00
lly 6431a5e185 ble_mesh: Move dev_role to the end of model_pub 2020-03-13 19:24:49 +08:00
lly 27b28c0249 ble_mesh: Use the right netkey during iv update 2020-03-13 19:24:45 +08:00
lly b29bc240a7 ble_mesh: Use the right net_idx & app_idx for publish 2020-03-13 19:24:37 +08:00
lly 940e87c0da ble_mesh: Check buf->ref before unref the buffer 2020-03-13 19:24:32 +08:00
lly 60eaca9637 ble_mesh: Fix mesh memory use-after-free issue 2020-03-13 19:24:27 +08:00
lly e01333514d ble_mesh: Add ble mesh deinit in btc task 2020-03-13 19:24:23 +08:00
lly f0519c674f ble_mesh: Free beacon timer when deinit mesh 2020-03-13 19:24:18 +08:00
lly 8e34adb94c ble_mesh: Calc incomplete timeout based on msg info 2020-03-02 02:08:13 +00:00
lly 6c207ea6d2 ble_mesh: Unify client application and lower transport layer timeout 2020-03-02 02:08:13 +00:00
lly 4b2ef7303e ble_mesh: Reset transport info when node is removed 2020-03-02 02:08:13 +00:00
lly 21af266a11 ble_mesh: Provisioner ignores msg from removed node 2020-03-02 02:08:13 +00:00
lly 711c8472fc ble_mesh: Miscellaneous modifications
1. Add an API to set Provisioner static oob value
2. Add an API to deinit BLE Mesh stack
3. Add an API to set Provisioner unicast address
4. Add an API to provision devices with fixed address
5. Add an API to store node composition data
6. Add an API to get node with device uuid
7. Add an API to get node with unicast address
8. Add an API to delete node with device uuid
9. Add an API to delete node with unicast address
10. Add an API for Provisioner to update local AppKey
11. Add an API for Provisioner to update local NetKey
12. Support Provisioner persistent functionality
13. Fix Provisioner entering IV Update procedure
14. Fix an issue which may cause client failing to send msg
15. Use bt_mesh.flags to indicate device role
16. Remove several useless macros
17. Callback RSSI of received mesh provisioning packets
18. Modify the Provisioner disable function
19. Change some log level from debug to info
20. Add parameters to Provisioner bind AppKey completion event
21. Fix node ignoring relay messages issue
22. Support using a specific partition for BLE Mesh
23. Fix compile warning when proxy related macros are disabled
24. Clean up BLE Mesh stack included header files
25. NULL can be input if client message needs no parameters
26. Fix compile warning when BT log is disabled
27. Initilize BLE Mesh stack local variables
28. Support using PSRAM for BLE Mesh mutex, queue and task
29. Add a menuconfig option to enable using memory from PSRAM
30. Clean up sdkconfig.defaults of BLE Mesh examples
2020-03-02 02:08:13 +00:00
Tian Hao f6523748fc fix Kconfig use mistake cause some config not effect
1. Fix bluedroid task pinned_to_core un-effected
2. other minor sdkconfig bugs
2020-01-20 15:24:41 +08:00
Jiang Jiang Jian 8ec233dfd0 Merge branch 'bugfix/sync_zephyr_v2.0_ble_mesh_fixes' into 'master'
ble_mesh: sync Zephyr v2.0 ble mesh fixes

Closes BLEMESH-56

See merge request espressif/esp-idf!6892
2020-01-12 20:23:57 +08:00
Jiang Jiang Jian 9ecc2c3309 Merge branch 'bugfix/fix_ble_mesh_memory_leak' into 'master'
ble_mesh: Fix memory leak when node is reset

Closes BLEMESH-122

See merge request espressif/esp-idf!7076
2020-01-10 11:43:49 +08:00
Geng Yu Chao 090843fa17 component/bt: Fix the issue with pointer type conversion in gattc. Unified count pointer type in bta and btc, change pointer type in bta from int to uint16_t. 2020-01-09 16:30:55 +08:00
lly 8116a787cd ble_mesh: Fix PreviousAddress endianess in Friend Request
The upper transport layer is using big endian ordering. The
PreviousAddress field of a Friend Request message should therefore
be converted to native endianess using sys_cpu_to_be16().
2020-01-06 16:19:03 +08:00
lly fc80d107ad ble_mesh: Fix next_period computation
If the duration to publish is roughly the same as the period, we might
end up with elapsed == period, which returns 0 and cancel the periodic
publication. Instead 1 should be returned, just like when the elapsed
time is greater than the period.
2020-01-06 16:17:36 +08:00
lly 7d7bbec5fe ble_mesh: Make model publication struct more compact
Previously the FastPeriodDivisor value was introduced to the model
publication struct. Based on the way it was grouped it seems the
intention was to fit it within the same octet as other bit fields,
but it actually makes the octet overflow by one bit. This ends up
creating another u8_t variable which in turn adds 24 bits of padding
after it.

To keep the size of the struct as compact as possible, group the flag
together with the key index, since that only requires 12 bits. Some
care is needed here, since the mesh stack does have special internal
key index values that require more than 12 bits such as
BLE_MESH_KEY_UNUSED and BLE_MESH_KEY_DEV. In this case restricting
ourselves to 12 bits is fine since the value in the model publication
struct follows 1:1 the value received in the Config Model Publication
Set message, and there the parameter is defined to be exactly 12 bits.
2020-01-06 16:17:36 +08:00
lly 82b4b89dea ble_mesh: Fix compile error when using release optimization level 2020-01-06 16:17:36 +08:00
lly b836674d8e ble_mesh: Remove useless CONFIG_BLE_MESH_NODE
For Low Power node and Proxy Server, the two features
depend on BLE_MESH_NODE in Kconfig.in, here in the
stack there is no need to judge if CONFIG_BLE_MESH_NODE
is enabled.
2020-01-06 16:17:36 +08:00
lly d83c37faed ble_mesh: Fixes Provisioner not support friend feature 2020-01-06 16:17:36 +08:00
lly 77e7d023b9 ble_mesh: Fixes wrong subnet info used for Friend Clear
When Friend node tries to send Friend Clear message to other
Friend nodes, it should use the subnet information based on
the net_idx from friendship.
2020-01-06 16:17:36 +08:00