BluetoothLE extension 20190701 released

Hello everybody. I am impressed from th power of the BLE extension, really great job! I would like to use the new ScanForService api, but I’m afraid I didn’t understand how. Is it a replacement of the StartAìScanning api? Is it an integration fo it? And in case, should I declare the ScanForService intent before calling StartScanning?
Thanks in advance for any clarification on this subject and best regards

Stefano (istvan54)

You can use BluetoothLE1.ScanForService method in place of the BluetoothLE1.StartScanning. The latter scans for and returns all devices whereas the former will only detect devices that advertise the specified UUID. You can use ScanForService to find only those devices that will work with your app (assuming it needs a specific service to work). We introduced this as part of a pilot of an improved IOT offering (yet to be published).

1 Like

If updating from an old Extension Version:
1)Clear the Backpack
2)Copy all Blocks to the Backpack
3)Delete the old BLE Extension
4)Import the new BLE Extension
5)Recover the Blocks from the Backpack

Thank you for the clarification, in fact that’s how I had tried to use it. But, though I used the right UUID for the specific service, I could not find the particular source that was issuing that service. However, I will try again and again.

Thanks again and best regards

Stefano

Hi Evan,

I was wondering in the BluetoothLE extension when you perform the connectGatt?

an example would be:
mBluetoothGatt=device.connectGatt(this,autoconnect, mGattCallback,BluetoothDevice.TRANSPORT_LE);

And if you do use the connectGatt, do you set autoconnect to true or false? And call the connect separately.

Thanks
Dave Carlson
Valencia, Ca.

Note that these steps are only required if upgrading from Version <= 2 to a newer version. If someone is going from a dated version, e.g., 20191118 to another dated version, the upgrade should proceed cleanly. The earlier versions had a different package name and different block names.

@dcarl661

There are 4 places where connectGatt is called in the BluetoothLE extension. I’m going to discuss its use in the Connect method since that seems the most relevant. The specific call is invoked on line 1573 of BluetoothLEint. We pass whatever the value of the AutoConnect property is at the time the Connect call is made.

1 Like

Thanks Evan,
Very nice code.

Btw last year I shared some of my work with Amna Greaves at MIT. I coded a sensor server for incident management that handles live and historic instrument readings. Amna’s team is compiling information on how different organizations share information. Our system shares data different ways with different organizations such as the EPA.

I’ve coded 70 instrument interfaces an I’m always researching and learning. I have one instrument where the timing of the BLE communication is strict, but the timing was different on some of the instruments. In my research I came across this site, and found it interesting.

Thanks again!
Dave Carlson
Valencia, Ca.

I have been quietly using this extension for awhile now and the filter scanning option is such a welcomed improvement.

I have also been working with other BLE modules where they are designated as central devices. One feature I have found to be extremely useful, which is not found here with the MIT BLE extention is the:

canRead / canNotify / canWrite checks you can make on the Characteristics discovered (once connected). Usually you do this check and if true you can then set up your Register or Read or Write Bytes/Strings etc.

Has this been considered at all? What would it take to include?

Look forward to the feedback.

Wow, I love it Thanks a lot @ewpatton for your News. im very happy :+1: :smiley: :+1:

This has been requested in the past (possibly by you?) a few times. I don’t think that it would be hard to add, but it’s mainly an issue of my time availability to implement it.

Thanks for the reply. Yes, I’ve requested a few times as it continues to be the one thing sorely missed.

I consider it best practice to avoid assumption…

So, it would be really really nice to see if you could find some time to add in this feature (and avoid these persistent requests :grin:).

Thanks.

Hi, it is really nice that there is a new extension. I am starting a new little micro:bit project, but I really got tripped up by the name of the new extension: 20190701. ??? That is almost a year ago! It took me quite some time and searching until I found that it is really the latest one.
I am looking forward now to using it!
Cheers, Ghica.

Here’s a version that should do what you want. Let me know:

1 Like

The version number is based on the last change that I made to the code base. Given testing and my work schedule, it can be months between coding a solution and actually releasing it as a production version.

Thanks Evan,
BLE is very important these IOT days.

I tried to play with BLE advertising (without connect).
I'm able to find the devices around me, and I can get their services UUID.
But, I'm not able to get the advertising data itself.
Using "call BluetoothLE1 AdvertisementData" block, always return null.
More details are here BLE Advertising Data
I tried the official 20190701 and the aix you post here few days ago.

THX

2 posts were split to a new topic: Connecting to a specific BLE device

Hello, i want to report that when i try to use method ConnectToDeviceWithServiceAndName to ESP32 arduino, i failed. So now i am using method ConnectWithAddress. And method WriteStrings and WriteStringWithResponse, they can't send more than 23bytes even after RequestMTU and event MTUChanged is success to change the MTU for both devices. But the good is method ReadStrings is able to receive more than 23bytes. Thank you

1 Like

I tried and fixed my problems on android 10 on my samsung mobile phone. :slight_smile:

A post was merged into an existing topic: No devices found during BLE scan on android 10