Commit graph

1601 commits

Author SHA1 Message Date
lly 7db10be193 ble_mesh: Rename mesh_kernel.* to mesh_timer.* 2020-05-21 15:19:51 +08:00
lly fde075aec2 ble_mesh: Add and use transport macro definitions [Zephyr] 2020-05-21 15:19:51 +08:00
lly cbd2bcfbd2 ble_mesh: Friend SeqAuth cleanup [Zephyr]
The Friend queue uses the message SeqAuth to determine whether the
message is already in the queue. To facilitate this, the SeqAuth is
passed around as a pointer throughout the transport modules. In the
bt_mesh_ctl_send functions, this parameter is also exposed in the API,
but the internal usage is inconsistent and buggy. Also, no one actually
uses this parameter.

- Removes seq_auth param from bt_mesh_ctl_send, instead passing NULL
  directly to the friend module, to enforce its addition to the queue.
- Makes the seq_auth pointer const throughout the friend module.
2020-05-21 15:19:50 +08:00
lly 5c5621790a ble_mesh: Rework msg_cache [Zephyr]
Changes the behavior of the message cache to optimize for cache
capacity. Previously, the message cache's primary function was to avoid
decrypting messages multiple times, although the cache's main function
in the spec is to avoid message rebroadcasting. Optimizing for minimal
decryption causes us to fill the network cache faster, which in turn
causes more cache misses, potentially outweighing the advantage.

Now stores src + seq in message cache instead of field hash value. This
cuts cache size in two, while including more of the sequence number than
before.

Adds messages to the cache only after the packet is successfully
decrypted. This reduces noise in the cache, and ensures that no
invalid deobfuscations are added.

Additionally, this fixes a bug where multiple calls to net_decrypt with
the same packet failed, as the message cache found its own entry from
the previous call.
2020-05-21 15:19:49 +08:00
lly fbdb7ff665 ble_mesh: Segmented TX to groups [Zephyr]
Implements several changes to the transport layer segmented tx to
improve group message performance:
- Moves retransmit counter to tx context instead of per packet. As every
  unacked packet is sent every retransmit, the retransmit counters would
  be the same in each segment. This makes it easier to control progress.
- Delays the scheduling of the retransmit until the completion of the
  last segment by adding a seg_pending counter. This is essentially the
  same as the old behavior, except that the old behavior might retrigger
  the sending before all segments are finished if the advertising is
  slow.
- Allows the group transmits to stop as soon as all retransmits have
  been exhausted, instead of timing out waiting for acks that won't
  come. This allows group tx to finish without error.
- Fixes a bug where a failed TX would block IV update.
- Cancels any pending transmissions of acked segments.
- Reduces log level for several common group tx scenarios that aren't
  erronous.
2020-05-21 15:19:49 +08:00
lly bbfaaa2044 ble_mesh: Add comment explaining use of byte order [Zephyr]
Add comment that explains why a different byte order is used for the
3-byte opcode on the CID part of the opcode.
2020-05-21 15:19:48 +08:00
lly ad14507e3f 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-21 15:19:47 +08:00
lly c9d1255ce4 ble_mesh: Optimize net_buf_simple routines [Zephyr]
Use sys_put_xyz() helpers instead of memcpy() whenever possible. This
brings in straight-line inline code for pushes and adds of known,
small sizes.
2020-05-21 15:19:46 +08:00
lly 25569cd9de ble_mesh: Add PRIu64 & PRIx64 in mesh_types.h 2020-05-21 15:19:46 +08:00
lly 416e8958fa ble_mesh: Add push functions for supported bit-variants [Zephyr]
Add push functions for bit-widths supported by add and pull functions.
2020-05-21 15:19:45 +08:00
lly cde1592bf3 ble_mesh: Add support for 64 bit data type [Zephyr]
This enables pulling and pushing values in 64 bit format.
2020-05-21 15:19:44 +08:00
lly 0af05fdee1 ble_mesh: Add support for 48 bit data type [Zephyr]
This enables pulling and pushing values in 48 bit format.
2020-05-21 15:19:44 +08:00
lly 4536a485be ble_mesh: Add 48 bit variants [Zephyr]
This adds sys_*_*48 functions that operation on a 48 bits values.
2020-05-21 15:19:43 +08:00
lly e7d37f2d1a ble_mesh: Add support for 24 bit data type [Zephyr]
This enables pulling and pushing values in 24 bit format.
2020-05-21 15:19:42 +08:00
lly fd17ff2f0b ble_mesh: Add 24 bit variants [Zephyr]
This adds sys_*_*24 functions that operation on a 24 bits values.
2020-05-21 15:19:41 +08:00
lly e322c5950b 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-21 15:19:41 +08:00
lly 1f96a6f35d 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-21 15:19:40 +08:00
lly 4fddf1156b 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-21 15:19:39 +08:00
lly 833483bb22 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-21 15:19:39 +08:00
lly 3d4948664b ble_mesh: Check device uuid when init provisioning 2020-05-21 15:19:38 +08:00
lly 203f871420 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-21 15:19:37 +08:00
lly 2c6a3f9e5b 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-21 15:19:36 +08:00
lly 2b6131b5f4 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-21 15:19:36 +08:00
Island 793d2b11f1 Merge branch 'bugfix/ble_mesh_not_ignore_msg_in_fast_prov_v4.0' into 'release/v4.0'
ble_mesh: Not ignore msg when fast prov is enabled (v4.0)

See merge request espressif/esp-idf!8711
2020-05-21 15:16:08 +08:00
Island 471171cb32 Merge branch 'feat/ble_mesh_sensor_model_example_v4.0' into 'release/v4.0'
ble_mesh: Add ble mesh sensor model examples (v4.0)

See merge request espressif/esp-idf!8508
2020-05-21 15:14:22 +08:00
Island 3b4ff12246 Merge branch 'bugfix/ble_mesh_compile_error_o2_v4.0' into 'release/v4.0'
ble_mesh: Fix compile error when -O2 (performance) is chosen (v4.0)

See merge request espressif/esp-idf!8617
2020-05-21 15:13:56 +08:00
Island 351dba9272 Merge branch 'bugfix/ble_mesh_provisioner_check_key_v4.0' into 'release/v4.0'
ble_mesh: Check if appkey exist before deleting it (v4.0)

See merge request espressif/esp-idf!8620
2020-05-21 15:13:31 +08:00
Island 7b6236c2d9 Merge branch 'bugfix/ble_mesh_node_reset_erase_v4.0' into 'release/v4.0'
ble_mesh: Fix node not erase info completely (v4.0)

See merge request espressif/esp-idf!8623
2020-05-21 15:12:21 +08:00
lly 9a654ec590 ble_mesh: Add some common macros for sensor model 2020-05-20 10:51:55 +00:00
lly 193828f121 ble_mesh: Allow empty sensor series column value 2020-05-20 10:51:55 +00:00
lly fab2dcb790 ble_mesh: Check if same sensor (settings) property id exists 2020-05-20 10:51:55 +00:00
lly d3619d0b45 ble_mesh: Allow empty sensor settings exist 2020-05-20 10:51:55 +00:00
Prasad Alatkar 5af06f49f5 NimBLE: Include upstream fixes and use macros for log level filtering (backport v4.0)
Change list:
- Reduces the size of the compiled binary, PR: https://github.com/espressif/esp-nimble/pull/6
- Null pointer check, PR: https://github.com/apache/mynewt-nimble/pull/701
- Pairing procedure abort on unexpected req: https://github.com/apache/mynewt-nimble/pull/710
- Fix conn flags after pairing: https://github.com/apache/mynewt-nimble/pull/730
- Remove notification for update process timeout (Vol 6, Part B, section 5.2 ):
  https://github.com/apache/mynewt-nimble/pull/782
- CCCD fix : https://github.com/apache/mynewt-nimble/pull/790 and
  https://github.com/apache/mynewt-nimble/pull/804
- Host based Privacy (RPA) fix: https://github.com/espressif/esp-nimble/pull/7

 Closes https://github.com/espressif/esp-nimble/issues/10

 Closes https://github.com/espressif/esp-idf/issues/4413
2020-05-20 16:19:55 +05:30
Jiang Jiang Jian 4695eeddee Merge branch 'bufix/fix_v4.0_bluedroid_bugs_mr' into 'release/v4.0'
component/bt: fix notify malloc failed , fix no BLE_AUTH_CMPL_EVT and fix bluedroid btc deinit crash(backport 4.0)

See merge request espressif/esp-idf!8755
2020-05-16 19:53:15 +08:00
zhiweijian 6ee978c6aa add congest direct callback and fix malloc failed when multi_connection notify performance test 2020-05-15 16:18:31 +08:00
wangcheng d231b25bc4 fix bta_dm_deinit_cb crash 2020-05-15 16:16:26 +08:00
wangcheng 456c8bdbdf master missing BLE_AUTH_CMPL_EVT after restart 2020-05-15 16:16:26 +08:00
Hrishikesh Dhayagude 02c47360f1 Add NimBLE config options in sdkconfig.rename 2020-05-14 11:31:53 +10:00
lly b47111c708 ble_mesh: Not ignore msg when fast prov is enabled
When fast provisioning is enabled, Provisioner shall not
ignore messages from the nodes whose addresses are not in
the provisioning database. Because other nodes which are
not provisioned by the Primary Provisioner will send node
address messages to the Primary Provisioner.
2020-05-13 10:09:50 +08:00
lly 814108f9ac ble_mesh: Add length check for some mesh operations 2020-05-07 09:18:15 +00:00
lly baf0fb3576 ble_mesh: Fix compile error when -O2 (performance) is chosen 2020-05-07 09:18:15 +00:00
lly a895bb157f 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-07 09:16:51 +00:00
lly 30c645d9c2 ble_mesh: Check if appkey exist before deleting it 2020-05-06 11:39:02 +08:00
Island 5f71ec3640 Merge branch 'bugfix/ble_mesh_rpl_list_size_v4.0' into 'release/v4.0'
ble_mesh: Associate replay protection list size with nodes count (v4.0)

See merge request espressif/esp-idf!8495
2020-05-06 11:14:21 +08:00
Island a44f473d4a Merge branch 'doc/ble_mesh_fixes_v4.0' into 'release/v4.0'
doc: Fix some ble mesh description (v4.0)

See merge request espressif/esp-idf!8503
2020-05-06 11:12:57 +08:00
Island beb64a1af4 Merge branch 'bugfix/ble_mesh_add_missing_cpp_v4.0' into 'release/v4.0'
ble_mesh: Add missing #ifdef __cplusplus (v4.0)

See merge request espressif/esp-idf!8506
2020-05-06 11:12:25 +08:00
lly b97d4c617b ble_mesh: Fix time scene wrong macro name 2020-04-27 16:26:23 +08:00
lly 765bd76ba3 ble_mesh: Add missing #ifdef __cplusplus 2020-04-27 15:34:14 +08:00
lly 9370264cac doc: Fix some ble mesh description 2020-04-27 15:25:46 +08:00
lly 8bfa01cc28 ble_mesh: Fix client local parameters not initialized 2020-04-27 14:39:40 +08:00
lly 90a9444696 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-27 14:39:40 +08:00
lly b9fd2673a7 ble_mesh: Remove some redundant functions 2020-04-27 14:39:39 +08:00
lly 7595116353 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-27 14:39:38 +08:00
lly 9aae0f2dee 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-27 14:39:38 +08:00
lly f137546a4b ble_mesh: Update next alloc address when node info is added 2020-04-27 14:39:37 +08:00
lly 388043c203 ble_mesh: Fix Provisioner provisioning deadlock 2020-04-27 14:39:37 +08:00
lly c496fa79de 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-27 14:39:36 +08:00
lly 2af16b92e5 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-27 14:39:35 +08:00
Jiang Jiang Jian 44d653adff Merge branch 'bugfix/btdm_backports_v4.0_0328' into 'release/v4.0'
Bugfix/btdm backports v4.0 0328

See merge request espressif/esp-idf!8151
2020-04-16 22:01:39 +08:00
Jiang Jiang Jian fe67bedee2 Merge branch 'nimble/fix_ble_hs_reset_v4.0' into 'release/v4.0'
NimBLE: Reset master and slave states on host reset and fix build failure (backport v4.0)

See merge request espressif/esp-idf!8218
2020-04-15 13:26:18 +08:00
lly 3b5eb3caf5 ble_mesh: Support BLE advertising simultaneously 2020-04-10 17:36:44 +08:00
Island 967e66bdf6 Merge branch 'bugfix/ble_mesh_add_test_function_v4.0' into 'release/v4.0'
ble_mesh: Add ble mesh white list test function (v4.0)

See merge request espressif/esp-idf!8159
2020-04-10 17:29:07 +08:00
Prasad Alatkar 0fc72b58e1 NimBLE: Reset master and slave states on host reset and fix build failure (backport v4.0) 2020-04-07 10:41:35 +05:30
Island 50073a7e61 Merge branch 'nimble/misc_host_flow_ctrl_changes_v4.0' into 'release/v4.0'
NimBLE: Misc fixes in NimBLE host (backport v4.0)

See merge request espressif/esp-idf!7949
2020-04-02 19:43:52 +08:00
Jiang Jiang Jian f69f96edab Merge branch 'bugfix/btdm_dont_dequeue_the_command_queue_v4.0' into 'release/v4.0'
component/bt: fix don't dequeue the command queue after process the read_by_type_req(backport v4.0)

See merge request espressif/esp-idf!8182
2020-04-01 17:56:05 +08:00
xiewenxiang 50e83cf374 component/bt: fix don't dequeue the command queue after process the read_by_type_req 2020-03-31 16:29:07 +08:00
lly 1d55af4bb2 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-30 11:03:00 +08:00
baohongde b2a3a9041d components/coex: Fix wakeup delay with DFS 2020-03-28 20:49:15 +08:00
baohongde 286d249239 components/bt: Fix assert when create conntion cancel 2020-03-28 20:44:43 +08:00
lly 28a9cb5be1 ble_mesh: Fix ble mesh nimble host deinit 2020-03-17 16:22:26 +08:00
Jiang Jiang Jian a8364af83d Merge branch 'bugfix/ble_mesh_miscellaneous_fix_v4.0' into 'release/v4.0'
Bugfix/ble mesh miscellaneous fix (v4.0)

See merge request espressif/esp-idf!7970
2020-03-17 15:35:12 +08:00
Jiang Jiang Jian 75f6bc2de1 Merge branch 'bugfix/compiler_err_when_performance_optimization_enabled_v4.0' into 'release/v4.0'
Bugfix/compiler err when performance optimization enabled v4.0

See merge request espressif/esp-idf!7978
2020-03-17 13:53:54 +08:00
Prasad Alatkar 5f7436006f NimBLE: Add Host based privacy (RPA) feature support (v4.0)
- This feature removes dependency on controller to use privacy (RPA)
2020-03-16 07:33:07 +00:00
Prasad Alatkar 6ee1947822 NimBLE: Fix check for static random address & add MSYS_1 in menuconfig (v4.0)
Closes BT-290 & BT-440
2020-03-16 07:33:07 +00:00
Hrishikesh Dhayagude 3aaf6a06dd NimBLE: Use dynamic buffers instead of static memory (v4.0)
The NimBLE host buffers that consume a significant amount of memory are
now allocated dynamically.
The advantage is that, the memory can be reclaimed in cases where BLE
is turned off and not required for the current boot cycle
2020-03-16 07:33:07 +00:00
Prasad Alatkar 3ee6dfa4d6 NimBLE: Misc changes in host flow control, ble_gap_unpair, ble_hs_hci_rx_evt & example (v4.0)
- Add menuconfig option for NimBLE host flow control
- Include changes in `blecent` example from upstream PR!702
- add ble_hs_lock in ble_gap_unpair Upstream PR!584
- ble_hs_hci_rx_evt, upstream PR!738

Closes https://github.com/espressif/esp-idf/issues/4243
2020-03-16 07:33:07 +00:00
weitianhua b6415d9a91 Remove (x2) variable in BCM_STRNCPY_S and BCM_STRCPY_S when performance optimization enabled 2020-03-14 14:45:57 +08:00
weitianhua ce55956a8f Fix mem_start uninitialized error when compiler optimization performance enabled 2020-03-14 14:45:04 +08:00
weitianhua 7c2f1287ec Bugfix for HFP and some Github issue.
1. Bugfix for AG audio crash (change the return position)
2. Fix the error macro name and error return in hfp_hf demo
3. Fix the annotation error using UTF-8 ' (from Github)
4. Change or remove the log in SCO related code region.
5. Correct error of introduction of a function.
2020-03-14 14:19:54 +08:00
lly eee8bd4612 ble_mesh: Move dev_role to the end of model_pub 2020-03-13 19:27:55 +08:00
lly 4dde86e45d ble_mesh: Use the right netkey during iv update 2020-03-13 19:27:54 +08:00
lly e6b4eb60ef ble_mesh: Use the right net_idx & app_idx for publish 2020-03-13 19:27:54 +08:00
lly c5b2f693b8 ble_mesh: Check buf->ref before unref the buffer 2020-03-13 19:27:54 +08:00
lly 7cf29e0f3f ble_mesh: Fix mesh memory use-after-free issue 2020-03-13 19:27:54 +08:00
lly cb31c71877 ble_mesh: Add ble mesh deinit in btc task 2020-03-13 19:27:54 +08:00
lly 50040e8e99 ble_mesh: Free beacon timer when deinit mesh 2020-03-13 19:27:53 +08:00
lly a364541193 ble_mesh: Use lock for mesh timer operations 2020-03-13 19:27:53 +08:00
Mahavir Jain 0cc802e6ab ipc: prevent code getting pulled in for unicore configuration 2020-03-11 14:04:45 +05:30
Chinmay Chhajed abab19ad4d This MR is intended to fix Bluetooth event scheduling when WiFi is also
enabled. The global interrupts will be disabled before taking current
    time for scheduling further bluetooth events. Earlier disabling
    interrupts was taking some time because of which WiFi events were
    interrupting in current bluetooth scheduling.

    Also fixes ble crash issue triggered by ble event irq miss(0x20000) (819979b9)
2020-03-04 20:30:37 +05:30
Jiang Jiang Jian e6a59ac038 Merge branch 'feat/ble_mesh_update_4.0' into 'release/v4.0'
Feat/ble mesh update 4.0

See merge request espressif/esp-idf!7799
2020-03-02 15:33:14 +08:00
June ea3d70382b backport esp325p0 new features to release/v4.0 2020-02-29 09:11:30 +00:00
lly 6eaeda9cf4 ble_mesh: Calc incomplete timeout based on msg info 2020-02-27 14:42:25 +08:00
lly f2e5ee5d25 ble_mesh: Start the timer when starting to send the client message 2020-02-27 14:42:25 +08:00
lly 4a3b06dde3 ble_mesh: No timeout for client message to non-unicast address 2020-02-27 14:42:25 +08:00
lly ef7461ae1d ble_mesh: Unify client application and lower transport layer timeout 2020-02-27 14:42:25 +08:00
lly bfed4fc90c ble_mesh: Allow maximum 377 octets payload 2020-02-27 14:42:25 +08:00
lly 6d61f6667a ble_mesh: Reset transport info when node is removed 2020-02-27 14:42:25 +08:00
lly 41cef4b1bb ble_mesh: Provisioner ignores msg from removed node 2020-02-27 14:42:25 +08:00
lly e24641cc89 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-27 14:42:25 +08:00
wangmengyang 2236449f47 component/bt: set non-zero initial value for bt sleep clock cycle to avoid div-by-zero error in function "btdm_us_2_lpcycles" when BT modem sleep is not enabled 2020-02-26 16:19:43 +08:00
Jiang Jiang Jian d292907fb7 Merge branch 'bugfix/btdm_check_EXT_CRYS_state_for_sleep_clk_for_v4.0' into 'release/v4.0'
bugfix/btdm_check_EXT_CRYS_state_for_sleep_clk(backport v4.0)

See merge request espressif/esp-idf!7747
2020-02-25 17:55:59 +08:00
Jiang Jiang Jian 25dfb08435 Merge branch 'bugfix/btdm_role_switch_v4.0' into 'release/v4.0'
Fix bugs about role switch

See merge request espressif/esp-idf!6924
2020-02-25 14:13:58 +08:00
wangmengyang 636195fb29 component/bt: fall back to main XTAL as Bluetooth sleep clock when EXT 32K CRYS is configured but not detected 2020-02-24 12:14:25 +08:00
June 9d15ffb573 backport mr !6031 - fix security info restore bug 2020-02-21 20:00:25 +08:00
baohongde 06ff1ceae3 Fix bugs about role switch
Jitter in FHS
Jitter in first PULL
Receive EDR packet fail after role switch
2020-02-20 15:21:28 +08:00
Jiang Jiang Jian b04e643bd0 Merge branch 'bugfix/coex_schm_v4.0' into 'release/v4.0'
Bugfix/coex schm v4.0

See merge request espressif/esp-idf!7636
2020-02-20 14:49:32 +08:00
baohongde 53e355b355 components/coex: Fix misspell in Kconfig 2020-02-19 11:48:45 +08:00
baohongde d07b9e97d7 components/coex: Fix a2dp stuck after creating anther connection 2020-02-19 11:48:33 +08:00
Jiang Jiang Jian 615dc00e86 Merge branch 'bugfix/some_host_and_example_bugfix_Backport_to_4v0' into 'release/v4.0'
Bugfix/some host and example bugfix backport to v4.0

See merge request espressif/esp-idf!7360
2020-02-18 21:02:34 +08:00
Jiang Jiang Jian 3b954fb6d6 Merge branch 'bugfix/ble_mesh_fix_compile_error_with_cpp_4.0' into 'release/v4.0'
ble_mesh: Fix compile error with c++ files (v4.0)

See merge request espressif/esp-idf!7584
2020-02-18 20:44:41 +08:00
baohongde 78ecc043d5 Improve coexistence performance according to specific WiFi/BT/BLE scienario
1. Improve WiFi performance in some Classic BT scienario(idle, inquire scan,
       connecting, connected, sniff, a2dp pause, etc).

    2. Support WiFi + Classic BT + BLE mesh coexistence scienario.

    3. Improve WiFi scan and connect performance in coexistence scienario.
2020-02-18 12:40:48 +08:00
baohongde c48a94d4a8 components/mesh: Fix some bugs about mesh
fix send acl pkt after ble have sent terminate ind
modify min adv interval to 10ms
2020-02-18 11:07:16 +08:00
Jiang Jiang Jian f92534f95d Merge branch 'bugfix/btdm_error_type_in_config_eir_evt_v4.0' into 'release/v4.0'
components/bt: Fix error EIR type in config eir event

See merge request espressif/esp-idf!7407
2020-02-14 16:41:58 +08:00
Jiang Jiang Jian b6bec84c6e Merge branch 'bugfix/ble_mesh_utf_8_comma_4_0' into 'release/v4.0'
ble_mesh: Kconfig included a UTF-8 comma (v4.0)

See merge request espressif/esp-idf!7576
2020-02-13 11:13:02 +08:00
Jiang Jiang Jian fb924ece79 Merge branch 'bugfix/btdm_fix_multi_open_evt_and_clear_blufi_prepare_write_len' into 'release/v4.0'
component/bt: fix multi open evt and clear blufi prepare write len(backport v4.0)

See merge request espressif/esp-idf!7324
2020-02-13 11:08:41 +08:00
Jiang Jiang Jian e07a64925b Merge branch 'bugfix/coex_bt_ble_stuck_v4.0' into 'release/v4.0'
components/bt: Fix A2DP stuck when BLE's interval is too small

See merge request espressif/esp-idf!7220
2020-02-13 11:08:20 +08:00
Jiang Jiang Jian e07ecea868 Merge branch 'hfp_a2dp_iphone_4.1' into 'release/v4.0'
components bt/: Disable sniff mode during (e)SCO connection for HFP. [backport 4.0]

See merge request espressif/esp-idf!7249
2020-02-13 11:08:10 +08:00
Jiang Jiang Jian d5bd2256f4 Merge branch 'bugfix/fix_ble_mesh_memory_leak_v4.0' into 'release/v4.0'
ble_mesh: Fix memory leak when node is reset (v4.0)

See merge request espressif/esp-idf!7278
2020-02-13 10:58:09 +08:00
Jiang Jiang Jian c235640bf4 Merge branch 'bugfix/ble_mesh_update_lightness_last_v4.0' into 'release/v4.0'
ble_mesh: Update lightness last state when actual state is changed (v4.0)

See merge request espressif/esp-idf!7281
2020-02-13 10:58:06 +08:00
lly 3bf1b9b8ab ble_mesh: Fix compile error with c++ files 2020-02-13 09:52:10 +08:00
lly 04fc15a4f3 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.
2020-02-12 12:03:31 +00:00
lly e95b59c089 ble_mesh: Kconfig included a UTF-8 comma 2020-02-12 18:28:06 +08:00
baohongde e38c080f79 components/bt: Fix error EIR type in config eir event 2020-01-20 21:50:01 +08:00
gengyuchao 443ea78e78 bugfix:Fix length check for snprintf in osi config. And remove the error code when there is no file in the nvs in config.c 2020-01-16 16:20:43 +08:00
gengyuchao ed6805625c ble:set a esp api to get size of controller send packets buffer. 2020-01-16 16:09:34 +08:00
gengyuchao 74a89774fd bugfix:Fixed throughput wasting memory and packet loss issues. 2020-01-16 16:09:17 +08:00
gengyuchao 7dc5c2af59 ble Fix typo and add some comment 2020-01-16 16:05:44 +08:00
Brian Friedkin e5bd8b1982 add missing gatt descriptors 2020-01-16 16:05:29 +08:00
Geng Yu Chao 5445c80a8e 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-16 15:26:37 +08:00
Geng Yu Chao 69d341f7f0 Fix some typo in idf 2020-01-16 15:26:37 +08:00
gengyuchao 4900ead609 bugfix:btmd fix the problem that fixed_queue_enqueue may give the wrong semaphore if list_append fail to calloc a new node 2020-01-16 11:32:40 +08:00
zhiweijian 93409bd57e component/bt: fix blufi prepare write buf len invalid 2020-01-14 17:25:54 +08:00
zhiweijian 32ba52760f Component/bt: Fix GATTC trigger open event multiple times 2020-01-14 17:24:36 +08:00
lly 14a408c478 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-13 10:40:25 +08:00
lly 92d0d7ad49 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-13 10:40:20 +08:00
lly 19c9ae400b 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-13 10:40:13 +08:00
lly 566fb11a73 ble_mesh: Fix compile error when using release optimization level 2020-01-13 10:40:05 +08:00
lly 928480ada9 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-13 10:39:57 +08:00
lly da0205b166 ble_mesh: Fixes Provisioner not support friend feature 2020-01-13 10:39:52 +08:00
lly 610fc8124a 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-13 10:39:42 +08:00
lly 21dbee1291 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-13 10:39:37 +08:00
lly e5431e55a9 ble_mesh: fix virtual addr wrong return value
Fixes missing return value on `va_del`
Fixes wrong return value on `va_add`
2020-01-13 10:39:28 +08:00
lly 4405560483 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-13 10:39:22 +08:00
lly 51616eacee 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-13 10:39:15 +08:00
lly 4aa7f31f02 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-13 10:39:10 +08:00
lly 318f83e33a 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-13 10:39:03 +08:00
lly 4bf2ceee4e 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-13 10:38:59 +08:00
lly a9c5092baf 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-13 10:38:54 +08:00
lly 9e47e04897 ble_mesh: Expose app key get function 2020-01-13 10:38:48 +08:00
lly ca0bfb84d0 ble_mesh: Expose header parsing outside net 2020-01-13 10:38:38 +08:00