HCI Active Bluetooth LE Scan / Scanresponse for specific UUID? - bluetooth-lowenergy

I am looking for a way to do a active Bluetooth LE Scan for a specific MAC / UUID only. In other words: I want the scanresponse of a specific device only. All other (passively) scanned devices should not be asked for scanresponse (to save power).
I saw that HCI has a Whitelist and a Resolvinglist:
Would a whitelist limit scanresponse to the whitelisted devices?
What is the resolvinglist for?
If none of those options work:
If I start a passive scan, is there a way to request scanresponse for a specific device via HCI?

I'm not sure BLE works that way... Regular bluetooth sends additional requests to get details about a device, but I don't think BLE does that. There's only one type scan and I think that's passive.
As for the whitelist, that's for something else. What you can do with the whitelist is put a list of devices in there that you want to automatically connect to. You can then issue a command to initiate connections with all devices found that are in the whitelist. This saves you manually watching for ad packets and issuing separate commands for each device you want to connect to. The whitelist won't affect what you see when scanning.
I'm not sure what the "Resolving List" does, that may do what you want...
EDIT:
Okay, I did some Google searches and it seems like there's an "active" scan for BLE, but I've never used it. If there's a passive/active difference then there must also be a way to query a single device for additional information after doing a passive scan.

Related

esp32 ble only let connect a single paired device

I use the Ble library, but I want to connect/pair only the first device/phone. After this only the first device is allowed to reconnect. How do I implement this? Is there a best practice? Do I need to filter the deviceid? Or are there better ways to acchieve this?
That can be achieved using the Filter Accept List (previously known as White List), which is standard in the BLE spec. How to use it depends on the Bluetooth stack you are using, so you should check the manual for the Bluetooth stack you are using (you didn't mention).
If you want to support Random Resolvable addresses, you can use the Resolving List where you put the corresponding IRKs.
But a personal opinion is to instead always let any device connect to your device, and then secure sensitive services using MITM-secure authentication instead (pairing). That could potentially lead to a better experience for the user, because otherwise any connection attempt from "wrong" device will just lead to a unknown connection error from the user which might be hard to understand.

Simulating a BLE Pairing Mode on ESP32

I've been working on a device that includes an ESP32. I set up a secure GATT server similar to the Secure Gatt Server Example with a custom service with Man in the Middle (MITM) based encryption. Currently pairing setup is Just Works, and when a client connects to the device they are prompted to pair and thus are bonded with key exchange (although it looks like Justworks disables MITM when I did more investigation for this question).
We do not have any real IO except for one button on the device, but I would like to limit pairing to a certain window of time after the Pairing button is pressed, or to have a "pairing mode" that the device enters (I have worked on another device that may have more of a classic pairing mode that was easier to work with). I know that's not explicitly part of the IDF API, but I'm looking for some guidance on how to approach something like a "pairing mode."
Would setting the IO capability to ESP_IO_CAP_IO work for using a button for the Yes/No? I don't see anything relevant in the documentation about how to configure this. In fact the enum does not appear elsewhere in the IDF sourcecode, nor does the mentioned relevant file stack/btm_api.h help.
Is there a way to disable / enable pairing on command? Would it be some type of change to advertising?

How to make a CSD call from modem

I recently bought a modem that supports CSD (Circuit Switched Data) calls. I put SIM card in it and I am able to make calls via AT commands. But these are always VOICE calls. I have another modem and I need to connect to it via CSD.
I know it is possible because our colleagues are using it this way to access some network.
They are using windows dial-up connection, but I guess that is just something that in the background calls the AT commands.
Nevertheless the dial-up is still giving me "Error 678: Remote computer did not respond". I have tried many settings, but still the same error. I even tried different computer and still got the same error.
So I found out that when I call CSD, then on the receiving side (if AT+CRC=1) it should display +CRING: REL ASYNC. So I setup another modem and called it and it showed +CRING: VOICE.
So how do I convince my modem to call in the REL ASYNC mode?
I already tried:
AT+IPR=115200 or AT+IPR=9600
AT+FCLASS=0 (this is default though)
AT+CSNS=4
AT+CBST=7,0,0 or AT+CBST=71,0,1
AT^SXRAT=0 (this changes the network to GSM)
But still when I do ATDNUMBERIWANTTOCALL; the receiving side shows +CRING: VOICE.
Also my mobile provider ensured me, that the CSD technology is still supported in my country and that I do not need any kind of special SIM card.
You need to remove the semicolon after the phone number in the ATD command: that semicolon is what tells the modem to make a voice call rather than CSD.
Check with your teleoperator does your sim card have separate data number.
Sometimes postpaid (and/or M2M) cards have three different numbers
1. voice
2. fax
3. data
In the end the number could be called normally like it is written in the question, but it only worked in Germany, not abroad...

How do I tell if a bonjour service is wi fi or bluetooth?

I am building an app that sends information between two iPhones. The app is working great but the one problem I am having is that I have no way of telling whether bonjour is choosing wi-fi or bluetooth to make the connection. I would like to allow the user to be able to choose which they prefer. Also, is there way to programmatically tell is the device's bluetooth is on?
There is NO WAY TO TELL.
It's just one of those weird things.
And in fact there is no way to programmatically choose WiFi or Bluetooth. It's annoying but true.
Often, multidevice games will have a warning for users:
"Be sure to TURN OFF Bluetooth, to
ensure you are using your WiFi
connection."
That's the situation.
Bonjour is just a service discovery protocol - it doesn't care what kind of network you have. It will discover services across a mixture of networks (e.g. via bridges and routers), so it doesn't really make sense to try to map a service discovered via Bonjour to a single type of transport layer.

GSM Modems, PCs, SMS and Telephone Calls

What all would be the requirements for the following scenario:
A GSM modem connected to a PC running
a web based (ASP.NET) application. In
the application the user selects a
phone number from a list of phone nos.
When he clicks on a button named the
PC should call the selected phone
number. When the person on the phone
responds he should be able to have a
conversation with the PC user.
Similarly there should be a facility
to send SMS.
Now I don't want any code listings. I just need to know what would be the requirements besides asp.net, database for storing phone numbers, and GSM modem.
Any help in terms of reference websites would be highly appreciated.
I'll pick some points of your very broad question and answer them. Note that there are other points where others may be of more help...
First, a GSM modem is probably not the way you'd want to go as they usually don't allow for concurrency. So unless you just want one user at the time to use your service, you'd probably need another solution.
Also, think about cost issues - at least where I live, providing such a service would be prohibitively expensive using a normal GSM modem and a normal contract - but this is drifting into off-topicness.
The next issue will be to get voice data from the client to the server (which will relay it to the phone system - using whatever practical means). Pure browser based functionality won't be of much help, so you would absolutely need something plugin based.
Flash may work, seeing they provide access to the microphone, but please don't ask me about the details. I've never done anything like this.
Also, privacy would be a concern. While GSM data is encrypted, the path between client and server is not per default. And even if you use SSL, you'd have to convince your users trusting you that you don't record all the conversations going on, but this too is more of a political than a coding issue.
Finally, you'd have to think of bandwidth. Voice uses a lot of it and also it requires low latency. If you use a SIP trunk, you'll need the bandwidth twice per user: Once from and to your client and once from and to the SIP trunk. Calculate with 10-64 KBit/s per user and channel.
A feasible architecture would probably be to use a SIP trunk (they optimize on using VoIP as much as possible and thus can provide much lower rates than a GSM provider generally does. Also, they allow for concurrency), an Asterisk box (http://www.asterisk.org - a free PBX), some custom made flash client and a custom made SIP client on the server.
All in all, this is quite the undertaking :-)
You'll need a GSM library. There appear to be a few of these.
e.g. http://www.wirelessdevstudio.com/eng/
Have a look at the Ekiga project at http://www.Ekiga.org.
This provides audio and or video chat between users using the standard SIP (Session Initiation Protocol) over the Internet. Like most SIP clients, it can also be used to make calls to and receive calls from the telephone network, but this requires an account with a commercial service provider (there are many, and fees are quite reasonable compared to normal phone line accounts).
Ekiga uses the open source OPAL library to implement SIP communications (OPAL has support for several VoIP and video over IP standards - see www.opalvoip.org for more info).

Resources