|
|
@@ -1,16 +1,9 @@
|
|
|
-// Copyright 2017-2019 Espressif Systems (Shanghai) PTE LTD
|
|
|
-//
|
|
|
-// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
-// you may not use this file except in compliance with the License.
|
|
|
-// You may obtain a copy of the License at
|
|
|
-
|
|
|
-// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
-//
|
|
|
-// Unless required by applicable law or agreed to in writing, software
|
|
|
-// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
-// See the License for the specific language governing permissions and
|
|
|
-// limitations under the License.
|
|
|
+/*
|
|
|
+ * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
+ *
|
|
|
+ * SPDX-License-Identifier: Apache-2.0
|
|
|
+ */
|
|
|
+
|
|
|
#include "esp_ble_mesh_networking_api.h"
|
|
|
#include "ble_mesh_adapter.h"
|
|
|
|
|
|
@@ -116,9 +109,10 @@ int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t
|
|
|
xSemaphoreTake(ble_mesh_node_sema, portMAX_DELAY);
|
|
|
|
|
|
for (i = 0; i < ble_mesh_node_statistics.total_package_num; i++) {
|
|
|
+ /* Filter out repeated packages during retransmission */
|
|
|
if (ble_mesh_node_statistics.package_index[i] == sequence_num) {
|
|
|
xSemaphoreGive(ble_mesh_node_sema);
|
|
|
- return 1;
|
|
|
+ return 0;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -129,6 +123,7 @@ int ble_mesh_node_statistics_accumulate(uint8_t *data, uint32_t value, uint16_t
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < ble_mesh_node_statistics.total_package_num; i++) {
|
|
|
+ /* Judge whether the package is received for the first time */
|
|
|
if (ble_mesh_node_statistics.package_index[i] == 0) {
|
|
|
ble_mesh_node_statistics.package_index[i] = sequence_num;
|
|
|
ble_mesh_node_statistics.package_num += 1;
|