Nimble: Removed files referring to old TTFW framework

This commit is contained in:
Rahul Tank 2023-04-25 15:58:06 +05:30 committed by BOT
parent 9ee4c48f54
commit 7042eb7e64
8 changed files with 0 additions and 667 deletions

View File

@ -2347,19 +2347,6 @@
- <<: *if-dev-push
changes: *patterns-target_test-adc
.rules:test:example_test-esp32-bt:
rules:
- <<: *if-revert-branch
when: never
- <<: *if-protected
- <<: *if-label-build-only
when: never
- <<: *if-label-example_test
- <<: *if-label-example_test_esp32
- <<: *if-label-target_test
- <<: *if-dev-push
changes: *patterns-example_test-bt
.rules:test:example_test-esp32-ccs811:
rules:
- <<: *if-revert-branch

View File

@ -1132,14 +1132,6 @@ example_test_001C:
- ESP32
- Example_GENERIC
example_test_005:
extends:
- .example_test_esp32_template
- .rules:test:example_test-esp32-bt
tags:
- ESP32
- Example_WIFI_BT
example_test_C3_GENERIC:
extends: .example_test_esp32c3_template
tags:

View File

@ -31,8 +31,6 @@ This example aims at understanding BLE service discovery, connection, encryption
To test this demo, use any BLE GATT server app that advertises support for the Alert Notification service (0x1811) and includes it in the GATT database.
A Python based utility `blecent_test.py` is also provided (which will run as a BLE GATT server) and can be used to test this example.
Note :
* To install the dependency packages needed, please refer to the top level [README file](../../../README.md#running-test-python-script-ttfw).
@ -134,62 +132,6 @@ GAP procedure initiated: terminate connection; conn_handle=0 hci_reason=19
disconnect; reason=534
```
## Running Python Utility
```
python blecent_test.py
```
## Python Utility Output
This is this output seen on the python side on successful connection:
```
discovering adapter...
bluetooth adapter discovered
powering on adapter...
bluetooth adapter powered on
Advertising started
GATT Data created
GATT Application registered
Advertising data created
Advertisement registered
Read Request received
SupportedNewAlertCategoryCharacteristic
Value: [dbus.Byte(2)]
Write Request received
AlertNotificationControlPointCharacteristic
Current value: [dbus.Byte(0)]
New value: [dbus.Byte(99), dbus.Byte(100)]
Notify Started
New value on write: [dbus.Byte(1), dbus.Byte(0)]
Value on read: [dbus.Byte(1), dbus.Byte(0)]
Notify Stopped
exiting from test...
GATT Data removed
GATT Application unregistered
Advertising data removed
Advertisement unregistered
Stop Advertising status: True
disconnecting device...
device disconnected
powering off adapter...
bluetooth adapter powered off
Service discovery passed
Service Discovery Status: 0
Read passed
SupportedNewAlertCategoryCharacteristic
Read Status: 0
Write passed
AlertNotificationControlPointCharacteristic
Write Status: 0
Subscribe passed
ClientCharacteristicConfigurationDescriptor
Subscribe Status: 0
```
## Troubleshooting

View File

@ -1,140 +0,0 @@
#!/usr/bin/env python
#
# Copyright 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.
from __future__ import print_function
import os
import subprocess
import threading
import traceback
try:
import Queue
except ImportError:
import queue as Queue
import ttfw_idf
from ble import lib_ble_client
from tiny_test_fw import Utility
# When running on local machine execute the following before running this script
# > make app bootloader
# > make print_flash_cmd | tail -n 1 > build/download.config
def blecent_client_task(dut):
interface = 'hci0'
adv_host_name = 'BleCentTestApp'
adv_type = 'peripheral'
adv_uuid = '1811'
# Get BLE client module
ble_client_obj = lib_ble_client.BLE_Bluez_Client(iface=interface)
# Discover Bluetooth Adapter and power on
is_adapter_set = ble_client_obj.set_adapter()
if not is_adapter_set:
return
'''
Blecent application run:
Create GATT data
Register GATT Application
Create Advertising data
Register advertisement
Start advertising
'''
# Create Gatt Application
# Register GATT Application
ble_client_obj.register_gatt_app()
# Register Advertisement
# Check read/write/subscribe is received from device
ble_client_obj.register_adv(adv_host_name, adv_type, adv_uuid)
# Check dut responses
dut.expect('Connection established', timeout=30)
dut.expect('Service discovery complete; status=0', timeout=30)
dut.expect('GATT procedure initiated: read;', timeout=30)
dut.expect('Read complete; status=0', timeout=30)
dut.expect('GATT procedure initiated: write;', timeout=30)
dut.expect('Write complete; status=0', timeout=30)
dut.expect('GATT procedure initiated: write;', timeout=30)
dut.expect('Subscribe complete; status=0', timeout=30)
dut.expect('received notification;', timeout=30)
class BleCentThread(threading.Thread):
def __init__(self, dut, exceptions_queue):
threading.Thread.__init__(self)
self.dut = dut
self.exceptions_queue = exceptions_queue
def run(self):
try:
blecent_client_task(self.dut)
except RuntimeError:
self.exceptions_queue.put(traceback.format_exc(), block=False)
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_BT')
def test_example_app_ble_central(env, extra_data):
"""
Steps:
1. Discover Bluetooth Adapter and Power On
2. Connect BLE Device
3. Start Notifications
4. Updated value is retrieved
5. Stop Notifications
"""
# Remove cached bluetooth devices of any previous connections
subprocess.check_output(['rm', '-rf', '/var/lib/bluetooth/*'])
subprocess.check_output(['hciconfig', 'hci0', 'reset'])
# Acquire DUT
dut = env.get_dut('blecent', 'examples/bluetooth/nimble/blecent', dut_class=ttfw_idf.ESP32DUT)
# Get binary file
binary_file = os.path.join(dut.app.binary_path, 'blecent.bin')
bin_size = os.path.getsize(binary_file)
ttfw_idf.log_performance('blecent_bin_size', '{}KB'.format(bin_size // 1024))
# Upload binary and start testing
Utility.console_log('Starting blecent example test app')
dut.start_app()
dut.reset()
exceptions_queue = Queue.Queue()
# Starting a py-client in a separate thread
blehr_thread_obj = BleCentThread(dut, exceptions_queue)
blehr_thread_obj.start()
blehr_thread_obj.join()
exception_msg = None
while True:
try:
exception_msg = exceptions_queue.get(block=False)
except Queue.Empty:
break
else:
Utility.console_log('\n' + exception_msg)
if exception_msg:
raise Exception('Blecent thread did not run successfully')
if __name__ == '__main__':
test_example_app_ble_central()

View File

@ -13,8 +13,6 @@ This example aims at understanding notification subscriptions and sending notifi
To test this demo, any BLE scanner app can be used.
A Python based utility `blehr_test.py` is also provided (which will run as a BLE GATT Client) and can be used to test this example.
Note :
* To install the dependency packages needed, please refer to the top level [README file](../../../README.md#running-test-python-script-ttfw).
@ -69,54 +67,6 @@ GATT procedure initiated: notify; att_handle=3
```
## Running Python Utility
```
python blehr_test.py
```
## Python Utility Output
This is this output seen on the python side on successful connection:
```
discovering adapter...
bluetooth adapter discovered
powering on adapter...
bluetooth adapter powered on
Started Discovery
Connecting to device...
Connected to device
Services
[dbus.String(u'00001801-0000-1000-8000-00805f9b34fb', variant_level=1), dbus.String(u'0000180d-0000-1000-8000-00805f9b34fb', variant_level=1), dbus.String(u'0000180a-0000-1000-8000-00805f9b34fb', variant_level=1)]
Subscribe to notifications: On
dbus.Array([dbus.Byte(6), dbus.Byte(90)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(91)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(92)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(93)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(94)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(95)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(96)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(97)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(98)], signature=dbus.Signature('y'), variant_level=1)
dbus.Array([dbus.Byte(6), dbus.Byte(99)], signature=dbus.Signature('y'), variant_level=1)
Subscribe to notifications: Off
Success: blehr example test passed
exiting from test...
disconnecting device...
device disconnected
powering off adapter...
bluetooth adapter powered off
```
## Troubleshooting
For any technical queries, please open an [issue](https://github.com/espressif/esp-idf/issues) on GitHub. We will get back to you soon.

View File

@ -1,169 +0,0 @@
#!/usr/bin/env python
#
# Copyright 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.
from __future__ import print_function
import os
import re
import subprocess
import threading
import traceback
try:
import Queue
except ImportError:
import queue as Queue
import ttfw_idf
from ble import lib_ble_client
from tiny_test_fw import Utility
# When running on local machine execute the following before running this script
# > make app bootloader
# > make print_flash_cmd | tail -n 1 > build/download.config
def blehr_client_task(hr_obj, dut, dut_addr):
interface = 'hci0'
ble_devname = 'blehr_sensor_1.0'
hr_srv_uuid = '180d'
hr_char_uuid = '2a37'
# Get BLE client module
ble_client_obj = lib_ble_client.BLE_Bluez_Client(iface=interface)
# Discover Bluetooth Adapter and power on
is_adapter_set = ble_client_obj.set_adapter()
if not is_adapter_set:
return
# Connect BLE Device
is_connected = ble_client_obj.connect(
devname=ble_devname,
devaddr=dut_addr)
if not is_connected:
return
# Get services of the connected device
services = ble_client_obj.get_services()
if not services:
ble_client_obj.disconnect()
return
# Get characteristics of the connected device
ble_client_obj.get_chars()
'''
Blehr application run:
Start Notifications
Retrieve updated value
Stop Notifications
'''
# Get service if exists
service = ble_client_obj.get_service_if_exists(hr_srv_uuid)
if service:
# Get characteristic if exists
char = ble_client_obj.get_char_if_exists(hr_char_uuid)
if not char:
ble_client_obj.disconnect()
return
else:
ble_client_obj.disconnect()
return
# Start Notify
# Read updated value
# Stop Notify
notify = ble_client_obj.start_notify(char)
if not notify:
ble_client_obj.disconnect()
return
# Check dut responses
dut.expect('subscribe event; cur_notify=1', timeout=30)
dut.expect('subscribe event; cur_notify=0', timeout=30)
# Call disconnect to perform cleanup operations before exiting application
ble_client_obj.disconnect()
# Check dut responses
dut.expect('disconnect;', timeout=30)
class BleHRThread(threading.Thread):
def __init__(self, dut, dut_addr, exceptions_queue):
threading.Thread.__init__(self)
self.dut = dut
self.dut_addr = dut_addr
self.exceptions_queue = exceptions_queue
def run(self):
try:
blehr_client_task(self, self.dut, self.dut_addr)
except RuntimeError:
self.exceptions_queue.put(traceback.format_exc(), block=False)
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_BT')
def test_example_app_ble_hr(env, extra_data):
"""
Steps:
1. Discover Bluetooth Adapter and Power On
2. Connect BLE Device
3. Start Notifications
4. Updated value is retrieved
5. Stop Notifications
"""
# Remove cached bluetooth devices of any previous connections
subprocess.check_output(['rm', '-rf', '/var/lib/bluetooth/*'])
subprocess.check_output(['hciconfig', 'hci0', 'reset'])
# Acquire DUT
dut = env.get_dut('blehr', 'examples/bluetooth/nimble/blehr', dut_class=ttfw_idf.ESP32DUT)
# Get binary file
binary_file = os.path.join(dut.app.binary_path, 'blehr.bin')
bin_size = os.path.getsize(binary_file)
ttfw_idf.log_performance('blehr_bin_size', '{}KB'.format(bin_size // 1024))
# Upload binary and start testing
Utility.console_log('Starting blehr simple example test app')
dut.start_app()
dut.reset()
# Get device address from dut
dut_addr = dut.expect(re.compile(r'Device Address: ([a-fA-F0-9:]+)'), timeout=30)[0]
exceptions_queue = Queue.Queue()
# Starting a py-client in a separate thread
blehr_thread_obj = BleHRThread(dut, dut_addr, exceptions_queue)
blehr_thread_obj.start()
blehr_thread_obj.join()
exception_msg = None
while True:
try:
exception_msg = exceptions_queue.get(block=False)
except Queue.Empty:
break
else:
Utility.console_log('\n' + exception_msg)
if exception_msg:
raise Exception('Blehr thread did not run successfully')
if __name__ == '__main__':
test_example_app_ble_hr()

View File

@ -17,8 +17,6 @@ For RPA feature (currently Host based privacy feature is supported), use API `bl
To test this demo, any BLE scanner app can be used.
A Python based utility `bleprph_test.py` is also provided (which will run as a BLE GATT Client) and can be used to test this example.
Note :
* To install the dependency packages needed, please refer to the top level [README file](../../../README.md#running-test-python-script-ttfw).
@ -92,73 +90,6 @@ GATT procedure initiated: notify; att_handle=25
Notification sent succesfully
```
## Running Python Utility
```bash
python bleprph_test.py
```
## Python Utility Output
This is this output seen on the python side on successful connection:
```
discovering adapter...
bluetooth adapter discovered
powering on adapter...
bluetooth adapter powered on
Started Discovery
Connecting to device...
Connected to device
Services
[dbus.String(u'00001801-0000-1000-8000-00805f9b34fb', variant_level=1), dbus.String(u'59462f12-9543-9999-12c8-58b459a2712d', variant_level=1)]
Characteristics retrieved
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service000a/char000b
Characteristic UUID: 5c3a659e-897e-45e1-b016-007107c96df6
Value: dbus.Array([dbus.Byte(45), dbus.Byte(244), dbus.Byte(81), dbus.Byte(88)], signature=dbus.Signature('y'))
Properties: : dbus.Array([dbus.String(u'read')], signature=dbus.Signature('s'), variant_level=1)
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service000a/char000d
Characteristic UUID: 5c3a659e-897e-45e1-b016-007107c96df7
Value: dbus.Array([dbus.Byte(0)], signature=dbus.Signature('y'))
Properties: : dbus.Array([dbus.String(u'read'), dbus.String(u'write')], signature=dbus.Signature('s'), variant_level=1)
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service0006/char0007
Characteristic UUID: 00002a05-0000-1000-8000-00805f9b34fb
Value: None
Properties: : dbus.Array([dbus.String(u'indicate')], signature=dbus.Signature('s'), variant_level=1)
Characteristics after write operation
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service000a/char000b
Characteristic UUID: 5c3a659e-897e-45e1-b016-007107c96df6
Value: dbus.Array([dbus.Byte(45), dbus.Byte(244), dbus.Byte(81), dbus.Byte(88)], signature=dbus.Signature('y'))
Properties: : dbus.Array([dbus.String(u'read')], signature=dbus.Signature('s'), variant_level=1)
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service000a/char000d
Characteristic UUID: 5c3a659e-897e-45e1-b016-007107c96df7
Value: dbus.Array([dbus.Byte(65)], signature=dbus.Signature('y'))
Properties: : dbus.Array([dbus.String(u'read'), dbus.String(u'write')], signature=dbus.Signature('s'), variant_level=1)
Characteristic: /org/bluez/hci0/dev_xx_xx_xx_xx_xx_xx/service0006/char0007
Characteristic UUID: 00002a05-0000-1000-8000-00805f9b34fb
Value: None
Properties: : dbus.Array([dbus.String(u'indicate')], signature=dbus.Signature('s'), variant_level=1)
exiting from test...
disconnecting device...
device disconnected
powering off adapter...
bluetooth adapter powered off
```
## Note
* NVS support is not yet integrated to bonding. So, for now, bonding is not persistent across reboot.

View File

@ -1,160 +0,0 @@
#!/usr/bin/env python
#
# Copyright 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.
from __future__ import print_function
import os
import re
import subprocess
import threading
import traceback
try:
import Queue
except ImportError:
import queue as Queue
import ttfw_idf
from ble import lib_ble_client
from tiny_test_fw import Utility
# When running on local machine execute the following before running this script
# > make app bootloader
# > make print_flash_cmd | tail -n 1 > build/download.config
# > export TEST_FW_PATH=~/esp/esp-idf/tools/tiny-test-fw
def bleprph_client_task(dut, dut_addr):
interface = 'hci0'
ble_devname = 'nimble-bleprph'
srv_uuid = '2f12'
write_value = b'A'
# Get BLE client module
ble_client_obj = lib_ble_client.BLE_Bluez_Client(iface=interface)
# Discover Bluetooth Adapter and power on
is_adapter_set = ble_client_obj.set_adapter()
if not is_adapter_set:
return
# Connect BLE Device
is_connected = ble_client_obj.connect(
devname=ble_devname,
devaddr=dut_addr)
if not is_connected:
return
# Get services of the connected device
services = ble_client_obj.get_services()
if not services:
ble_client_obj.disconnect()
return
# Verify service uuid exists
service_exists = ble_client_obj.get_service_if_exists(srv_uuid)
if not service_exists:
ble_client_obj.disconnect()
return
# Get characteristics of the connected device
ble_client_obj.get_chars()
# Read properties of characteristics (uuid, value and permissions)
ble_client_obj.read_chars()
# Write new value to characteristic having read and write permission
# and display updated value
write_char = ble_client_obj.write_chars(write_value)
if not write_char:
ble_client_obj.disconnect()
return
# Disconnect device
ble_client_obj.disconnect()
# Check dut responses
dut.expect('connection established; status=0', timeout=30)
dut.expect('disconnect;', timeout=30)
class BlePrphThread(threading.Thread):
def __init__(self, dut, dut_addr, exceptions_queue):
threading.Thread.__init__(self)
self.dut = dut
self.dut_addr = dut_addr
self.exceptions_queue = exceptions_queue
def run(self):
try:
bleprph_client_task(self.dut, self.dut_addr)
except RuntimeError:
self.exceptions_queue.put(traceback.format_exc(), block=False)
@ttfw_idf.idf_example_test(env_tag='Example_WIFI_BT')
def test_example_app_ble_peripheral(env, extra_data):
"""
Steps:
1. Discover Bluetooth Adapter and Power On
2. Connect BLE Device
3. Read Services
4. Read Characteristics
5. Write Characteristics
"""
# Remove cached bluetooth devices of any previous connections
subprocess.check_output(['rm', '-rf', '/var/lib/bluetooth/*'])
subprocess.check_output(['hciconfig', 'hci0', 'reset'])
# Acquire DUT
dut = env.get_dut('bleprph', 'examples/bluetooth/nimble/bleprph', dut_class=ttfw_idf.ESP32DUT)
# Get binary file
binary_file = os.path.join(dut.app.binary_path, 'bleprph.bin')
bin_size = os.path.getsize(binary_file)
ttfw_idf.log_performance('bleprph_bin_size', '{}KB'.format(bin_size // 1024))
# Upload binary and start testing
Utility.console_log('Starting bleprph simple example test app')
dut.start_app()
dut.reset()
# Get device address from dut
dut_addr = dut.expect(re.compile(r'Device Address: ([a-fA-F0-9:]+)'), timeout=30)[0]
# Check dut responses
dut.expect('GAP procedure initiated: advertise;', timeout=30)
# Starting a py-client in a separate thread
exceptions_queue = Queue.Queue()
bleprph_thread_obj = BlePrphThread(dut, dut_addr, exceptions_queue)
bleprph_thread_obj.start()
bleprph_thread_obj.join()
exception_msg = None
while True:
try:
exception_msg = exceptions_queue.get(block=False)
except Queue.Empty:
break
else:
Utility.console_log('\n' + exception_msg)
if exception_msg:
raise Exception('BlePrph thread did not run successfully')
if __name__ == '__main__':
test_example_app_ble_peripheral()