mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
Merge branch 'nimble/add_throughput_example' into 'master'
NimBLE throughput example: Changed write api to write without response See merge request espressif/esp-idf!16138
This commit is contained in:
committed by
isha pardikar
parent
279e135c8f
commit
8fec43eecb
@ -9,8 +9,8 @@ sample numbers of different throughput test runs for 60 seconds (MTU = 512, conn
|
|||||||
|
|
||||||
|GATT method | Measurement time | Application Throughput|
|
|GATT method | Measurement time | Application Throughput|
|
||||||
|--- | --- | ---|
|
|--- | --- | ---|
|
||||||
|NOTIFY | 60 seconds | ~530Kbps|
|
|NOTIFY | 60 seconds | ~340Kbps|
|
||||||
|READ | 60 seconds | ~180kbps|
|
|READ | 60 seconds | ~200kbps|
|
||||||
|WRITE | 60 seconds | ~180kbps|
|
|WRITE | 60 seconds | ~500kbps|
|
||||||
|
|
||||||
The notify output is seen on `bleprph_throughput` console and read/write throughput are seen on `blecent_throughput` console.
|
The notify output is seen on `bleprph_throughput` console and read/write throughput are seen on `blecent_throughput` console.
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
/* Console example — various system commands
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
Unless required by applicable law or agreed to in writing, this
|
|
||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
/* Console example — various system commands
|
/*
|
||||||
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
Unless required by applicable law or agreed to in writing, this
|
|
||||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
||||||
CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -37,7 +37,7 @@ menu "Example Configuration"
|
|||||||
Set the minimum connection event length in 0.625msec units.
|
Set the minimum connection event length in 0.625msec units.
|
||||||
|
|
||||||
config EXAMPLE_CONN_CE_LEN_MAX
|
config EXAMPLE_CONN_CE_LEN_MAX
|
||||||
int "Minimum connection itvl"
|
int "Maximum connection event length"
|
||||||
default 12
|
default 12
|
||||||
help
|
help
|
||||||
Set the maximum connection event length in 0.625msec units.
|
Set the maximum connection event length in 0.625msec units.
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* // Modifications Copyright 2020-2021 Espressif Systems (Shanghai) CO., LTD.
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef H_BLECENT_
|
#ifndef H_BLECENT_
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
@ -117,26 +102,8 @@ err:
|
|||||||
return ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM);
|
return ble_gap_terminate(peer->conn_handle, BLE_ERR_REM_USER_CONN_TERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
blecent_repeat_write(uint16_t conn_handle,
|
|
||||||
const struct ble_gatt_error *error,
|
|
||||||
struct ble_gatt_attr *attr,
|
|
||||||
void *arg)
|
|
||||||
{
|
|
||||||
if (error->status == 0) {
|
|
||||||
xSemaphoreGive(xSemaphore);
|
|
||||||
ESP_LOGD(tag, " attr_handle=%d value=", attr->handle);
|
|
||||||
MODLOG_DFLT(INFO, "\n");
|
|
||||||
} else {
|
|
||||||
failure_count++;
|
|
||||||
xSemaphoreGive(xSemaphore);
|
|
||||||
ESP_LOGE(tag, " Error writing error code = %d", error->status);
|
|
||||||
}
|
|
||||||
return error->status;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int blecent_write(uint16_t conn_handle, uint16_t val_handle,
|
static int blecent_write(uint16_t conn_handle, uint16_t val_handle,
|
||||||
ble_gatt_attr_fn *cb, struct peer *peer, int test_time)
|
struct peer *peer, int test_time)
|
||||||
{
|
{
|
||||||
int64_t start_time, end_time, write_time = 0;
|
int64_t start_time, end_time, write_time = 0;
|
||||||
int write_count = 0;
|
int write_count = 0;
|
||||||
@ -150,13 +117,16 @@ static int blecent_write(uint16_t conn_handle, uint16_t val_handle,
|
|||||||
while (write_time < test_time * 1000) {
|
while (write_time < test_time * 1000) {
|
||||||
/* Wait till the previous write is complete. For first time Semaphore
|
/* Wait till the previous write is complete. For first time Semaphore
|
||||||
* is already available */
|
* is already available */
|
||||||
xSemaphoreTake(xSemaphore, portMAX_DELAY);
|
label:
|
||||||
rc = ble_gattc_write_flat(conn_handle, val_handle,
|
rc = ble_gattc_write_no_rsp_flat(conn_handle, val_handle, &value, sizeof value);
|
||||||
&value, sizeof value, blecent_repeat_write, NULL);
|
|
||||||
if (rc != 0) {
|
if(rc == BLE_HS_ENOMEM) {
|
||||||
ESP_LOGE(tag, "Error: Failed to write characteristic; rc=%d\n",
|
vTaskDelay(2); /* Wait for buffers to free up and try again */
|
||||||
rc);
|
goto label;
|
||||||
goto err;
|
}
|
||||||
|
else if (rc != 0) {
|
||||||
|
ESP_LOGE(tag, "Error: Failed to write characteristic; rc=%d\n",rc);
|
||||||
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
end_time = esp_timer_get_time();
|
end_time = esp_timer_get_time();
|
||||||
@ -311,8 +281,7 @@ static void throughput_task(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (test_data[1] > 0) {
|
if (test_data[1] > 0) {
|
||||||
rc = blecent_write(peer->conn_handle, chr->chr.val_handle,
|
rc = blecent_write(peer->conn_handle, chr->chr.val_handle, (void *) peer, test_data[1]);
|
||||||
blecent_repeat_write, (void *) peer, test_data[1]);
|
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
ESP_LOGE(tag, "Error while writing data; rc = %d", rc);
|
ESP_LOGE(tag, "Error while writing data; rc = %d", rc);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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
|
* SPDX-License-Identifier: Apache-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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -1,20 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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
|
* SPDX-License-Identifier: Apache-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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-2021 Espressif Systems (Shanghai) PTE LTD
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020-21 Espressif Systems (Shanghai) PTE LTD
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef H_GATTS_SENS_
|
#ifndef H_GATTS_SENS_
|
||||||
|
@ -1,22 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2020 Espressif Systems (Shanghai) PTE LTD
|
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
|
||||||
*
|
*
|
||||||
* Licensed to the Apache Software Foundation (ASF) under one
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
* or more contributor license agreements. See the NOTICE file
|
|
||||||
* distributed with this work for additional information
|
|
||||||
* regarding copyright ownership. The ASF licenses this file
|
|
||||||
* to you 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.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
Reference in New Issue
Block a user