2017-08-16 11:24 PM
Hi,
I am using Nucleo l053r8 development board with x-nucleo-idb05a1 extension board which has SPBTLE-RF bluetooth low energy module.
I am want to make application that can scan for ble devices and reads its advertising data. I can find examples for device as peripheral mode but can't find any example about scanning. Can anyone give me some pointers where to look for example code for scanning modes or where should i start to learn more about it?Thanks
2017-08-22 07:18 AM
https://developer.mbed.org/teams/ST/code/BLE_LEDBlinker_IDB0XA1/docs/tip/main_8cpp_source.html
You can take this code to start. Instead of connect to the device you can print/save/... advertising data.
2017-08-24 04:09 AM
Hi,
In the X-CUBE-BLE1 package there is a project implementing both peripheral and central:
STM32CubeExpansion_BLE1_V3.0.0\Projects\Multi\Applications\SampleAppThT
The example is not specific about scanning, though.
If you want to learn more about the way scanning works, you may install the
application for PC.In order to use the BlueNRG GUI with X-NUCLEO-IDB05A1, you must run the Virtual_COM_Port project (included in the X-CUBE-BLE1 software package) on your STM32 Nucleo board:
STM32CubeExpansion_BLE1_V3.0.0\Projects\Multi\Applications\Virtual_COM_PortWithin the ACI Utilities tab of the GUI, in the Central Role section, there is a Scanning... button that lets you scan for BLE devices. The GUI will show all the related commands and events.
The GUI application also allows you to run many different python scripts that implement the most common functionalities for BLE. Among them, there is one that shows how to scan and connect to a specific device:
Application\scripts\SensorDemo_Central\SensorDemo_Central.py
Even if it is python, by simply getting inspiration from it, you should be able to understand the correct sequence of commands that you need to call in C code.
Hope that helps,
Antonio