Commit graph

1720 commits

Author SHA1 Message Date
Jiang Jiang Jian 6938c615d8 Merge branch 'bugfix/connect_param_check_and_channel_map_bugs_v4.2' into 'release/v4.2'
components/bt:Fix channel map instant reverse and add ble connect paramter check.(backport 4.2)

See merge request espressif/esp-idf!9236
2020-06-30 15:11:56 +08:00
lly 6f715c4472 ble_mesh: Check if subnet exists before updating beacon_sent
- Before updating the "beacon_sent" of a subnet, we need to check
  if the subnet still exists, especially for a Provisioner.
- Fix a bug which will cause Provisioner failed to send Secure
  Network Beacon if no device is provisioned
2020-06-30 09:22:21 +08:00
lly 3fa5daf0ba ble_mesh: stack: Copy recv_rssi for other received messages
Follow the commit: 2b80cb6883,
copy the recv_rssi for other mesh messages.
2020-06-30 09:05:23 +08:00
mbroek 4b3bb6c8fd When a generic mesh model message is received "bt_mesh_generic_server_cb_evt_to_btc" copies the
ctx values to cb_params for the mesh stack.

recv_rssi was not copied.

This means the rssi could not be read when receiving generic server messages using ble_mesh.
2020-06-30 09:05:23 +08:00
liminyang 5bf8bb6d3a docs:fix event typo
1.In the description of the ESP_API header file, it should be the event that the application layer needs to handle, not the BTA layer.
2.Fix name typo of BTA_GATTS_CREATE_SRVC_EVT event

Closes https://github.com/espressif/esp-idf/issues/5446
2020-06-29 20:48:48 +08:00
Island 00148cd0c6 Merge branch 'bugfix/ble_mesh_get_node_with_name_v4.2' into 'release/v4.2'
ble_mesh: Get node info with pre-configured node name (v4.2)

See merge request espressif/esp-idf!9302
2020-06-28 20:25:32 +08:00
Island 3c92395170 Merge branch 'bugfix/ble_mesh_bt_hex_v4.2' into 'release/v4.2'
ble_mesh: Fix wrong log output with bt_hex (v4.2)

See merge request espressif/esp-idf!9309
2020-06-28 20:24:31 +08:00
Island 257384ea75 Merge branch 'bugfix/ble_mesh_not_define_bool_v4.2' into 'release/v4.2'
Bugfix/ble mesh not define bool (v4.2)

See merge request espressif/esp-idf!9316
2020-06-28 20:23:21 +08:00
lly 698fe7dd99 ble_mesh: stack: Check model status with variable length 2020-06-24 14:12:53 +08:00
lly bd5ef62253 ble_mesh: Remove boolean type definitions 2020-06-24 14:05:58 +08:00
Nikolaos Strikos 5bacf6b23d ble_mesh: Do not #define bool when compiling in C++ 2020-06-24 14:05:58 +08:00
lly 55f48877a4 ble_mesh: Fix wrong log output with bt_hex
- This issue was introduced in the commit: a788e7cd3d
  which updated the bt_hex() function incorrectly.
- And in bt_hex(), we use 2 for the two-dimensional array, because currently
  at most two bt_hex() will be used at the same time. Also this will save
  some DRAM compared with using 4.
2020-06-24 12:29:33 +08:00
lly b4b2cd19f7 ble_mesh: Get node info with pre-configured node name
Also add a function to get the entry of the nodes table.

Closes https://github.com/espressif/esp-idf/issues/5397
2020-06-24 10:58:36 +08:00
Island aaeb2ba733 Merge branch 'bugfix/att_buffer_count_fixed_v4.2' into 'release/v4.2'
Bugfix/att buffer count fixed v4.2

See merge request espressif/esp-idf!9161
2020-06-22 11:44:54 +08:00
wangcheng 12d39f9faa components/bt:Fix instant reverse and add ble connect paramter check. 2020-06-18 15:54:53 +08:00
Island 710249c86a Merge branch 'bugfix/blufi_buffer_overflow_report_v4.2' into 'release/v4.2'
blufi: When the format of the received data packet is wrong, reply with an error response(backport 4.2)

See merge request espressif/esp-idf!9201
2020-06-18 13:44:52 +08:00
baohongde 783cd1bb08 components/bt: Fix ble disconnect due to instant of channel map update is too small 2020-06-17 07:15:46 +00:00
baohongde d4b232590a Set AFH in time(075dd35)
Send LMP_channelClassification immediately
Fix first LMP_set_AFH not using host value
2020-06-17 07:15:46 +00:00
baohongde ef92a22b0c components/coex: Fix ble connecting fail in coexist 2020-06-17 07:15:46 +00:00
Wang Cheng 21ff2f84ce components/bt: Add a detailed description for the user to distinguish the function of the query buffer api. 2020-06-17 12:52:28 +08:00
Geng Yu Chao 02cd178115 Update the limited of function esp_ble_get_sendable_packets_num. 2020-06-17 12:52:18 +08:00
wangcheng 17609cbb02 blufi: When the format of the received data packet is wrong, reply with an error response 2020-06-17 12:19:00 +08:00
liqigan 4dd29dac94 components/bt: Adjust the description of esp_bt_gap_start_discovery and esp_bt_gap_cancel_discovery.
Add some comments to explain why `ESP_BT_GAP_DISC_STATE_CHANGED_EVT` is not reported.
2020-06-16 22:18:21 +08:00
wangcheng 7f299d9d60 components/bt: Consider link_xmit_data_q in congest events to prevent excessive memory usage 2020-06-13 15:10:30 +08:00
wangcheng d53a2719b9 components/bt: Fixed the problem of incomplete data packets caused by disordered acl data packets 2020-06-13 15:09:45 +08:00
wangcheng f9b0cd1847 components/bt: Add api to query the number of available buffers for the current connection 2020-06-13 15:09:36 +08:00
Island a8f40b7095 Merge branch 'bugfix/ble_mesh_remove_relay_dependency_v4.2' into 'release/v4.2'
ble_mesh: Remove relay option dependency (v4.2)

See merge request espressif/esp-idf!9025
2020-06-03 15:20:35 +08:00
Island 9bdaa64d80 Merge branch 'bugfix/ble_mesh_example_nvs_store_v4.2' into 'release/v4.2'
Bugfix/ble mesh example nvs store (v4.2)

See merge request espressif/esp-idf!9015
2020-06-03 15:11:54 +08:00
Island 55cd09578f Merge branch 'bugfix/ble_mesh_model_recv_fix_v4.2' into 'release/v4.2'
Bugfix/ble mesh model recv fix (v4.2)

See merge request espressif/esp-idf!9006
2020-06-03 15:11:15 +08:00
Island 118b69ce0d Merge branch 'bugfix/ble_mesh_rework_prov_pdu_len_check_v4.2' into 'release/v4.2'
ble_mesh: Rework prov pdu length check (v4.2)

See merge request espressif/esp-idf!9002
2020-06-03 15:10:33 +08:00
lly eeb44e7dd6 ble_mesh: Remove relay option dependency
When the relay functionality of a node is not enabled, this
issue will cause the node failing to send messages to fixed
group.
2020-06-02 19:18:18 +08:00
lly adf785a1b0 ble_mesh: Config and health client btc fixes
Fix an issue which may cause no error code is returned
when sending config client or health client messages
with invalid parameters.
2020-06-02 14:02:54 +08:00
lly b25cffd4d5 ble_mesh: Add more checks of net_idx & app_idx 2020-06-02 14:02:54 +08:00
lly 4919d17ad1 ble_mesh: Optimize some send & recv logs 2020-06-02 14:02:53 +08:00
lly 1a3c315d2f ble_mesh: correct the return type [Zephyr] 2020-06-02 10:31:08 +08:00
lly 8271ae4a1e ble_mesh: Add net_buf_simple_init_with_data [Zephyr] 2020-06-02 10:31:08 +08:00
lly d6a247f7e4 ble_mesh: Optimize model recv operations [Zephyr]
Previously the model recv operation is a littl fuzzy.
With the changes, the model recv operation is splitted into:
- find op
- check app_idx
- check dst
- check length
- update info & handle message
2020-06-02 10:31:07 +08:00
lly 4fbc29616c ble_mesh: Rework prov pdu length check 2020-06-02 10:13:21 +08:00
lly 067d94e88f ble_mesh: Local model (un)subscribes group address 2020-06-01 09:10:17 +08:00
lly 6bc4f5802d ble_mesh: Define a macro for invalid company id 2020-06-01 09:10:17 +08:00
Jiang Jiang Jian 8f2d1e7f92 Merge branch 'bugfix/collection_of_confirmed_fixes_from_baidu_project' into 'master'
Bugfix/collection of confirmed fixes from baidu project

Closes BT-826, BT-542, BCI-31, BCI-34, BT-840, and AUD-1857

See merge request espressif/esp-idf!8675
2020-05-28 12:23:58 +08:00
lly 6768c2b7a1 ble_mesh: Check the result of creating timer 2020-05-27 09:30:34 +00:00
Island 3b85d4ef24 Merge branch 'bugfix/ble_mesh_sync_zephyr_fixes' into 'master'
Bugfix/ble mesh sync zephyr fixes

Closes BLEMESH-215

See merge request espressif/esp-idf!8912
2020-05-27 17:26:00 +08:00
Island d82f3372a0 Merge branch 'bugfix/ble_mesh_not_use_same_private_key' into 'master'
ble_mesh: Not using pre-initialized private key

Closes BLEMESH-214

See merge request espressif/esp-idf!8905
2020-05-27 17:25:39 +08:00
Island 02376b97d4 Merge branch 'bugfix/ble_mesh_uses_deprecated_config' into 'master'
ble_mesh: Fix using old config for duplicate scan

Closes BLEMESH-213

See merge request espressif/esp-idf!8898
2020-05-27 17:23:55 +08:00
Island 7b12d96169 Merge branch 'bugfix/ble_mesh_comp_data_store_restore' into 'master'
ble_mesh: Same func for storing/restoring comp data

See merge request espressif/esp-idf!8882
2020-05-27 17:23:21 +08:00
lly 0cfb6c138b ble_mesh: Transport tx fields overflow [Zephyr]
The transport segmented TX nack and seg_pending fields must be at least
6 bits to avoid overflow for 32 segment messages. This change rearranges
the seg_tx fields to gather all state flag fields in one byte, while
making the counter fields whole bytes.
2020-05-26 11:42:31 +08:00
lly f863a1b328 ble_mesh: Friend with unknown appkey [Zephyr]
Ensures that friend messages are enqueued, even if the packet is
received with an appkey is unknown to the friend. Previously, sdu_recv
would return EINVAL if the appkey was unknown, which would prevent the
lower transport layer from adding the packet to the friend queue. This
is irrelevant for the logic in lower transport, and should not be
returned as an error.
2020-05-26 11:16:01 +08:00
lly 05c287e05c ble_mesh: Not using pre-initialized private key 2020-05-26 10:46:22 +08:00
lly 3c1487be0e ble_mesh: Fix using old config for duplicate scan 2020-05-25 16:48:15 +08:00
Angus Gratton 084e170a8f Merge branch 'refactor/esp_ipc' into 'master'
Split esp_ipc to a seaparate component

Closes IDF-1295

See merge request espressif/esp-idf!8520
2020-05-25 15:03:04 +08:00
lly bbbdbb8699 ble_mesh: Same func for storing/restoring comp data 2020-05-25 13:27:08 +08:00
lly af37aee5bf ble_mesh: Fix Provisioner failed to publish 2020-05-22 15:32:12 +08:00
lly b1f3843ed6 ble_mesh: Clear two more vars during proxy server deinit 2020-05-20 11:35:26 +00:00
lly d5b126667a ble_mesh: Add missing sdkconfig.h 2020-05-20 11:35:26 +00:00
lly 4e60919a66 ble_mesh: Init device name during proxy server init
Device name will be reset when deinit mesh stack. If not
initializing device name during the next mesh stack init,
it will fail to set the device name when using bluedroid.
2020-05-20 11:35:26 +00:00
lly a0ce8c64b0 ble_mesh: Add init flag for friend init/deinit
Since bt_mesh_friend_init() will only be invoked when
a device is provisioned or Provisioner is enabled, so
we add a flag to indicate if the friend functionality
is initialized in case deinit before initialization.
2020-05-20 11:35:26 +00:00
Jiang Jiang Jian 05f4668ad0 Merge branch 'nimble/update_nimble_submodule' into 'master'
NimBLE: Include upstream fixes and use macros for log level filtering

See merge request espressif/esp-idf!8448
2020-05-20 11:23:46 +08:00
Darian Leung 11d96b39d0 esp_ipc: Move to new component
This commit moves esp_ipc into a separate component.
2020-05-18 16:51:45 +08:00
weitianhua 8fc05d0665 Fix ASSERT for RXDESC and save the log for debug 2020-05-18 06:51:51 +00:00
weitianhua 8d1032ccac Fix ASSERT in ld_acl at line 302 forclkoff1 and localval 2020-05-18 06:51:51 +00:00
weitianhua 77cc105c72 Fix ld_acl schedule bug to parity shift 2020-05-18 06:51:51 +00:00
weitianhua 55877684a0 Fix ASSERT(64,0) in rwble.c 2020-05-18 06:51:51 +00:00
weitianhua 0811851378 Fix ASSERT in ld_pscan.c at line 1032 2020-05-18 06:51:51 +00:00
weitianhua b20f254483 Free lmp tx buf in EM in the procedure of handling LMP_detach_Req when not received the last acknowledge from peer device and seperate them by ACL State 2020-05-18 06:51:51 +00:00
weitianhua 190ff3ae37 Fix that when slave initiate unsniff procedure and meet transaction collision, no mode change event is repoerted 2020-05-18 06:51:51 +00:00
weitianhua 70fa5b4ac5 Fix int_wdt due to disable interrupt too long time 2020-05-18 06:51:51 +00:00
weitianhua c18ed5cbee Fix Connection fail in loop 2020-05-18 06:51:51 +00:00
weitianhua 7aeb3d329a Set AFH in BTDM Task when WiFi changes channel 2020-05-18 06:51:51 +00:00
weitianhua e0e1154b62 Fix ASSERT(25,0) in lc_task.c 2020-05-18 06:51:51 +00:00
weitianhua 899e49b90e Disable frequent warning log in ld_acl 2020-05-18 06:51:51 +00:00
weitianhua b45f2d3913 Move default log level to WARNING instead ERROR in BT Controller 2020-05-18 06:51:51 +00:00
Jiang Jiang Jian bef57a8ddc Merge branch 'bugfix/V3.1.7_ble_bug_mr' into 'master'
component/bt: fix notify malloc failed , fix no BLE_AUTH_CMPL_EVT and fix bluedroid btc deinit crash

See merge request espressif/esp-idf!8729
2020-05-16 19:52:34 +08:00
zhiweijian ec6c7558ef add congest direct callback and fix malloc failed when multi_connection notify performance test 2020-05-15 15:35:39 +08:00
lly 25a6ea9600 ble_mesh: Remove patch for the bug of an App 2020-05-14 10:24:15 +08:00
Angus Gratton 6ccd7dbc59 Merge branch 'nimble/config_option_sdkconfig_rename' into 'master'
Add NimBLE config options in sdkconfig.rename

Closes IDF-1650

See merge request espressif/esp-idf!8653
2020-05-14 09:30:16 +08:00
wangcheng 418b32e71b master missing BLE_AUTH_CMPL_EVT after restart 2020-05-13 20:33:24 +08:00
wangcheng a5ac789725 fix bta_dm_deinit_cb crash 2020-05-13 20:18:27 +08:00
Island c946ca8b45 Merge branch 'bugfix/ble_mesh_node_old_version_to_new' into 'master'
ble_mesh: Fix mesh node device role restore

Closes BLEMESH-188

See merge request espressif/esp-idf!8314
2020-05-12 20:36:55 +08:00
Island 1d22f17da3 Merge branch 'bugfix/ble_mesh_not_ignore_msg_in_fast_prov' into 'master'
ble_mesh: Not ignore msg when fast prov is enabled

Closes BLEMESH-196

See merge request espressif/esp-idf!8698
2020-05-12 20:36:41 +08:00
lly f7ef701856 ble_mesh: Fix mesh node device role restore
Old version of BLE Mesh has no device role storage, because
previously we only support storing mesh node info.
If the binary of the node is upgraded from old version to a
new version (support storing provisioner info), the mesh info
of the node will not be restored because mesh role does not
exist in the flash.
2020-05-12 19:25:57 +08:00
lly 6b9c0dda08 ble_mesh: Fix typos 2020-05-12 16:23:13 +08:00
lly d937b415e3 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-12 11:22:07 +08:00
Prasad Alatkar 2ef489005b NimBLE: Include upstream fixes and use macros for log level filtering
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-11 05:36:50 +00:00
lly c2fd80b8f4 ble_mesh: Fix not update prov addr in fast prov
When using fast provisioning, the Provisioner functionality
will be enabled. Unicast addresses within the pre-allocated
range will be used for provisioning nodes. And during the
address assignment, the allocated unicast address will be
checked that if it's duplicated with other nodes addresses
and the Provisioner's own addresses.
So before starting using fast provisioning, we need to update
the Provisioner address.
2020-05-11 02:29:18 +00:00
lly 97f11600e3 ble_mesh: net_key_status only pull one key idx [Zephyr]
Fixes bug where the config client's net_key_status handler would attempt
to pull two key indexes from a message which only holds one.
2020-05-11 02:29:18 +00:00
lly 9d7adc3e1b ble_mesh: Update client message timeout calculation
Since the behavior of sending segmented messages has been
changed properly, the calculation of timeout value which
will be used when sending an acknowledged message by a
client model also needs to be updated.
2020-05-11 02:29:18 +00:00
lly 5e59233cc0 ble_mesh: Add lock for segmented msg operations
Add mutex to protect some variables of the mesh segmented
messages.
Currently the timeout handler of mesh will be executed in
the btc task, while the received mesh messages will be
handled in the btu task. In case some variables are set to
NULL when handled in the btu task, meanwhile these variables
are also accessed in the timeout handler, so we add mutex to
protect these variables and related operations.
2020-05-11 02:29:18 +00:00
lly 9e5fec73f8 ble_mesh: Fix dereferencing pointer before checking for NULL [Zephyr]
The publication context is checked for NULL in bt_mesh_model_publish()
however it was dereferenced before that. Move the assignment to
ctx.send_rel to the same place where other ctx members are set.
2020-05-11 02:29:18 +00:00
lly d7a671ab7a ble_mesh: Optimize some mesh log output 2020-05-11 02:29:18 +00:00
lly 52493a1644 ble_mesh: Fix restore when revoke keys [Zephyr]
Store keys (NetKey and AppKey) again after revoking.
2020-05-11 02:29:18 +00:00
lly 8ea6714a96 ble_mesh: Spit mesh_util.h into different header files
Split mesh_util.h into mesh_byteorder.h, mesh_compiler.h,
mesh_ffs.h and mesh_util.h based on the classification of
Zephyr, which will make further porting more clear.
2020-05-11 02:29:18 +00:00
lly 52a30c8f4a ble_mesh: Split mesh os related into a separate file 2020-05-11 02:29:18 +00:00
lly 01a8a6c150 ble_mesh: Split mesh mutex into a separate file 2020-05-11 02:29:18 +00:00
lly c493be489f ble_mesh: Rename mesh_kernel.* to mesh_timer.* 2020-05-11 02:29:18 +00:00
lly 25dfee4bdd ble_mesh: Add and use transport macro definitions [Zephyr] 2020-05-11 02:29:18 +00:00
lly df525bf0b3 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-11 02:29:18 +00:00
lly cd58874a9b 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-11 02:29:18 +00:00
lly ef8206cdc6 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-11 02:29:18 +00:00
lly fd9a16805a 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-11 02:29:18 +00:00