Commit graph

190 commits

Author SHA1 Message Date
lly 77bb7806a0 ble_mesh: Fix client local parameters not initialized 2020-04-26 06:25:08 +00:00
lly 713581ae87 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-26 06:25:08 +00:00
lly 73804ef4d3 ble_mesh: Remove some redundant functions 2020-04-26 06:25:08 +00:00
lly f37bc1a515 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-26 06:25:08 +00:00
lly 88b0cd918a 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-26 06:25:08 +00:00
lly 7486616382 ble_mesh: Update next alloc address when node info is added 2020-04-26 06:25:08 +00:00
lly a4d9259912 ble_mesh: Fix Provisioner provisioning deadlock 2020-04-26 06:25:08 +00:00
lly 8d57ebf57d 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-26 06:25:08 +00:00
lly ec2324edbe ble_mesh: Associate replay protection list size with nodes count
The replay protection list of Provisioner should be at least equal
to the number of nodes with the precondition that each node contains
only one element.
The help information of replay protection list is updated, and the
maximum number of nodes for Provisioner is adjusted based on the
replay protection list size.
2020-04-26 06:25:08 +00:00
lly 2f6a4140fa doc: Fix some ble mesh description 2020-04-26 06:22:33 +00:00
lly e8c5f5dc03 ble_mesh: Add some common macros for sensor model 2020-04-26 06:08:44 +00:00
lly 361dd8b29c ble_mesh: Allow empty sensor series column value 2020-04-26 06:08:44 +00:00
lly 561191d50f ble_mesh: Check if same sensor (settings) property id exists 2020-04-26 06:08:44 +00:00
lly 3862f0e784 ble_mesh: Allow empty sensor settings exist 2020-04-26 06:08:44 +00:00
lly a919e20c1a ble_mesh: Support BLE advertising simultaneously 2020-04-02 01:03:25 +00:00
lly 45d43f005a 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-03-25 11:30:08 +08:00
lly ac2ef797fe ble_mesh: Fix ble mesh nimble host deinit 2020-03-16 12:45:58 +08:00
lly 2ed1724fc2 ble_mesh: Move dev_role to the end of model_pub 2020-03-12 17:48:09 +08:00
lly 5a90ea3048 ble_mesh: Use the right netkey during iv update 2020-03-12 17:43:19 +08:00
lly 37466d957d ble_mesh: Use the right net_idx & app_idx for publish 2020-03-12 17:43:19 +08:00
lly 1795107533 ble_mesh: Check buf->ref before unref the buffer 2020-03-12 17:43:19 +08:00
lly 2b80649a79 ble_mesh: Fix mesh memory use-after-free issue 2020-03-12 17:43:19 +08:00
lly 08080edb1b ble_mesh: Add ble mesh deinit in btc task 2020-03-12 17:43:19 +08:00
lly 9d3ad04667 ble_mesh: Free beacon timer when deinit mesh 2020-03-12 17:43:19 +08:00
lly 13ab2f4015 ble_mesh: Use lock for mesh timer operations 2020-03-12 17:43:19 +08:00
lly 134f57b8e0 ble_mesh: Calc incomplete timeout based on msg info 2020-02-26 17:42:04 +08:00
lly 087bafe5b9 ble_mesh: Start the timer when starting to send the client message 2020-02-26 17:41:46 +08:00
lly 90f8a54a71 ble_mesh: No timeout for client message to non-unicast address 2020-02-26 17:41:30 +08:00
lly 97eca35805 ble_mesh: Unify client application and lower transport layer timeout 2020-02-26 17:41:11 +08:00
lly e24645c791 ble_mesh: Allow maximum 377 octets payload 2020-02-26 17:40:46 +08:00
lly 828bfeac88 ble_mesh: Reset transport info when node is removed 2020-02-26 17:40:23 +08:00
lly 48343a8a8f ble_mesh: Provisioner ignores msg from removed node 2020-02-26 17:39:55 +08:00
lly 7cd08b5824 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-02-26 17:37:44 +08:00
Jiang Jiang Jian 6d03758ac4 Merge branch 'bugfix/ble_mesh_fix_compile_error_with_cpp' into 'master'
ble_mesh: Fix compile error with c++ files

Closes BMCI-52

See merge request espressif/esp-idf!7579
2020-02-18 20:43:55 +08:00
lly 326ccfca88 ble_mesh: Fix compile error with c++ files 2020-02-12 21:24:32 +08:00
lly bfb27addda ble_mesh: Kconfig included a UTF-8 comma 2020-02-12 18:21:09 +08:00
Angus Gratton 11fac8637a docs: Resolve doxygen & Sphinx warnings 2020-02-07 16:37:45 +11:00
Tian Hao f351effdb2 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 17:43:36 +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 8cf4d02720 Merge branch 'bugfix/ble_mesh_update_lightness_last' into 'master'
ble_mesh: Update lightness last state when actual state is changed

See merge request espressif/esp-idf!7206
2020-01-10 14:47:29 +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
lly 131a4e7c22 ble_mesh: fix provisioner failed to send msg to 0xFFFF
According to Mesh Spec 3.4.5.3, a node shall implement a local
network interface. And here we limit the situation just based
on the spec, and Provisioner directly sending the msg without
passing through the local network interface.
2020-01-06 16:17:36 +08:00
lly 197e54053e ble_mesh: fix virtual addr wrong return value
Fixes missing return value on `va_del`
Fixes wrong return value on `va_add`
2020-01-06 16:17:36 +08:00
lly e8440ac2f9 ble_mesh: Persistent storage of Virtual Address
The 16-bit format group addresses will be stored,
but we don't store (or restore) the virtual label UUIDs,
i.e. after a power cycle the 16-bit group addresses
would be meaningless.
2020-01-06 16:17:36 +08:00
lly 74d0bd3134 ble_mesh: Proxy forwards ALL_NODES addr
Unless explicitly blacklisted, the Proxy node will forward all messages
for the ALL_NODES address to the GATT proxy client.
2020-01-06 16:17:36 +08:00
lly 1338fc4ff1 ble_mesh: Model message macros
Creates macros for determining model message lengths based on opcode,
payload length and MIC size. Also adds macro wrapping
NET_BUF_SIMPLE_DEFINE to serve the most common use case.
2020-01-06 16:17:36 +08:00
lly f3b9b099cd ble_mesh: Use net_buf_simple_clone
Uses net_buf_simple_clone to access the sdu of an unsegmented app packet
for re-encryption.
2020-01-06 16:17:36 +08:00
lly aec696a3a4 ble_mesh: Skip local messages in rx
Local messages are already enqueued for the LPN in the tx path, and
don't have to be added again in the rx path.
2020-01-06 16:17:36 +08:00
lly 6516ab71ea ble_mesh: Ensure seqnum match in app/net
Re-encrypts single-segment application messages when the network seqnum
has changed, to avoid encrypting messages with different seqnums in
network and transport. This operation is only required for unsegmented
messages, as segmented messages don't need to use the same seqnum in
network.

Reinstates the special adv data for friend messages to store the app key
index.
2020-01-06 16:17:36 +08:00
lly b88dbf6348 ble_mesh: Expose app key get function 2020-01-06 16:17:36 +08:00
lly 906fb9d6e3 ble_mesh: Expose header parsing outside net 2020-01-06 16:17:36 +08:00
lly 865434e6de ble_mesh: Remove unused macro FRIEND_BUF_SIZE 2020-01-06 16:17:36 +08:00
lly 67cb3062a6 ble_mesh: Make RSSI value available to mesh applications 2020-01-06 16:17:36 +08:00
lly 89a681fd4a ble_mesh: Encrypt friend packets on send
Stores friend queue packets unencrypted, removing any out-of-order
issues caused by seqnum allocation. Also moves as much of the metadata
storage as possible into the packet, allowing us to free up some bytes
of net_buf user data for friend packets.
2020-01-06 16:17:36 +08:00
lly 99a63ce81d ble_mesh: Expose SeqZero mask
Makes a define for the seqzero 13-bit mask in transport, and exposes it
in the header for use in the friend module.
2020-01-06 16:17:36 +08:00
lly 9f6dd19033 ble_mesh: Update lightness last state when actual state is changed 2020-01-04 14:57:08 +08:00
lly 3b9fe36494 ble_mesh: Fix memory leak when node is reset
When node is being reset, the init functions of each sig-defined
models will be invoked again, this will cause memory leak because
some model internal data will be allocated again.
Hence before trying to allocate memory for them, we add some check
to make sure no memory has been allocated previously.
And for client model, when the init functions are invoked again,
we will clear the list items.
2019-12-28 08:00:44 +00:00
Jiang Jiang Jian e977cc24ff Merge branch 'bugfix/fix_ble_mesh_adv_buf_unref' into 'master'
ble_mesh: Fix adv buf unref and link_id in exceptional list

See merge request espressif/esp-idf!6828
2019-12-20 17:11:08 +08:00
lly fbdaed0248 ble_mesh: Add unlock when failed to create alarm 2019-12-20 12:25:01 +08:00
lly 619e606356 ble_mesh: Rename ble mesh lock/unlock functions
Rename BLE Mesh internal lock/unlock functions, also seperate
the list, buf and atomic lock/unlock functions
2019-12-20 12:23:10 +08:00
lly 31a4738bd4 ble_mesh: Use mutex to protect client list operations 2019-12-14 17:32:47 +08:00
lly e4223df60f ble_mesh: Remove useless parameters of lock/unlock 2019-12-14 16:28:22 +08:00
lly d2bc597e9f ble_mesh: Client model check timer remaining time
Before handling status message, client models need check if the
corresponding timer has expired. And if timeout happens, the
status message will be treated as a publish message.
2019-12-14 15:43:59 +08:00
lly 1a8199dd41 ble_mesh: Fix using wrong name for PB-GATT 2019-12-12 15:59:37 +08:00
lly c354b0993d ble_mesh: Fix adv buf unref and link_id in exceptional list 2019-12-12 15:58:43 +08:00
Geng Yu Chao 6c923cf330 Fix some typo in idf 2019-12-12 15:55:42 +08:00
lly 093cc494b9 ble_mesh: fix ble mesh device with wrong name on iOS 2019-11-14 17:03:46 +08:00
lly 2bba9d7700 ble_mesh: miscellaneous modifications
1. Clean up client_common.c
2. Clean up esp_ble_mesh directory
3. Update Kconfig.in
4. Format esp_ble_mesh files
2019-11-08 11:10:52 +08:00
lly 30aa236219 ble_mesh: adapt ble mesh with nimble host 2019-11-08 11:10:52 +08:00
lly 547081cc3c ble_mesh: add events for configuration server model 2019-11-08 11:10:52 +08:00
lly f906b7caf3 ble_mesh: add Generic/Sensor/Time and Scenes/Lighting Server models 2019-11-08 11:10:52 +08:00
lly 287f80ec01 ble_mesh: add proxy client functionality 2019-11-08 11:10:52 +08:00
lly c6286529eb ble_mesh: add ble mesh friend node event 2019-11-08 11:10:52 +08:00
lly fdfe59d369 ble_mesh: add low power node api and event 2019-11-08 11:10:52 +08:00
lly afc00fb5f5 ble_mesh: add heartbeat message recv callback 2019-11-08 11:10:52 +08:00
lly 2511024e44 ble_mesh: modify health server model callbacks 2019-11-08 11:10:52 +08:00
lly 729af38346 ble_mesh: add separate advertising buffers for relay packets 2019-11-08 11:10:52 +08:00
Krzysztof Budzynski 2c3548b65e Provide BLE Mesh documentation 2019-10-30 17:01:18 +08:00
Jiang Jiang Jian 758db1e008 Merge branch 'bugfix/fix_mesh_proxy_adv_with_wrong_dev_name' into 'master'
ble_mesh: using bt device name in mesh proxy adv

Closes BLEMESH-51

See merge request espressif/esp-idf!6438
2019-10-26 20:45:10 +08:00
Hrishikesh Dhayagude a26dfe70aa nimble: Miscellaneous changes
1. Update NimBLE submodule as per changes in adv interval and stop port
2. Make changes in ESP BLE Mesh NimBLE host code for the same
2019-10-24 14:38:01 +08:00
lly 2350b15451 ble_mesh: using bt device name in mesh proxy adv 2019-10-22 15:04:19 +08:00
Hrishikesh Dhayagude f58d7d14c7 components/bt: Add support of NimBLE host in ESP BLE Mesh 2019-10-21 20:18:21 +08:00
lly 35353de137 ble_mesh: fix not callback net_key when device is provisioned 2019-10-11 09:51:02 +08:00
lly 673f58fe03 ble_mesh: fix not restoring ble mesh cfg value 2019-10-08 16:34:05 +08:00
lly 7a450222f5 ble_mesh: fix client model invalid address access 2019-09-26 20:11:22 +08:00
lly 0792a2fde8 ble_mesh: check ble mesh queue and task init status 2019-09-25 11:09:40 +08:00
lly 9ee5e3d8ed ble_mesh: fix duplicate memory free during receiving status message 2019-09-16 17:34:08 +08:00
lly e1b04df763 ble_mesh: make unicast elem lookup O(1) 2019-09-16 14:55:41 +08:00
lly 5d1f84f69c ble_mesh: fix ble mesh get timer remaining time 2019-09-10 16:58:41 +08:00
lly 1a8f37b383 ble_mesh: update ble mesh examples sdkconfig.defaults 2019-09-09 17:15:16 +08:00
lly d48c89b56a ble_mesh: fix ble mesh btc may caused memory leak 2019-09-09 17:15:16 +08:00
lly 8a41132507 ble_mesh: fix publication period timestamp initialization 2019-09-09 17:15:16 +08:00