How do wifi bulbs pair with the mobile - wifi

I have been working on making a commercial-equivalent smart WiFi bulb. I cannot understand how the bulb pairs with the app on smartphone and gains access to the Internet through my personal modem. The bulb cannot communicate through the personal WiFi before getting paired, as it doesn't have the credentials. I tried to experiment with my existing commercial bulb and while putting it in reset mode, noticed -
There wasn't any WiFi (that could be the bulb's AP) visible in the available networks list of my PC. Well, I don't know if it was a hidden network.
There wasn't any Bluetooth device visible in the list that could possibly be the bulb.
So I want to know how the bulb communicates with the app -
Does it act as AP (Access Point) and the app connects to it and gives it the credentials.
Else, does the bulb use any other type of communication to pair with the app.
Or, does it somehow just get to the smartphone and it all "mysteriously" works.
I would be happy if someone could explain the process to me. Also, the app scans for the available devices whenever I want to pair to a new device. Then, I can select the desired device and pair it. So, please also explain (if possible) how the scanning works.
No need to get to each technical detail, I just want to know the process. I will ask later if I need the tech details.

Related

ESP32 iPhone Bluetooth, just a general question

I'm writing some code (C++) for ESP32, to act as a BLE beacon. The problem is this: the iPhone doesn't send out its real MAC address, but does a random-generated MAC address, for security. The thing I'm confused about is how do you know if it's a device you've previously paired with?
So let's say I detect a new BLE MAC address, and looking at the manufacturer data I can determine it's an Apple device (first 2 bytes are "4C").
Now I need to know if I've previously paired with that device, so that I can allow the ESP32 to initiate an action (for simplicity let's just say turn on an LED). If that MAC address is in a list of known devices, then I can continue, and if not, I ignore it.
The problem is, if the iPhone is not giving up the real MAC address, the detected MAC address will never match anything. As this is a security situation I'm sure the algorithm for generating those MAC addresses is not known.
To be clear: this code is being written for the ESP32, not the iPhone.
It is in fact not possible to tell if a device has been previously seen, unless you pair and establish a bond with it. Once you pair with the device, long-term keys are exchanged and are used to quickly re-establish the connection.
This is by design. MAC addresses were originally unique, but this allowed tracking people and devices without their consent. You can read more about this in the following ESP-IDF guides:
GATT security server walkthrough
GATT security client walkthrough
So are you using esp32 as a beacon? This dose not involve any pairing or iOS MAC addresses. iOS will just be able to listen and the esp32 will not even know someone is "listening" to its broadcast.
Probably iOS application can store which services it is interested to hear to; may looks like pairing.. but it is a high level application managed technique and not any related to what BT standard calls pairing.

See devices connect to my wifi router using Swift and allow/block wifi acces

In short i'm trying to build an App that will grant/block wifi access to my son's wifi for his Ipad and his PS4 remotely using an App. I researched the topic and can't figure out how this can be done. Ideally i'd like to be able to grant/block wifi access independently Ie. block wifi to the Ipad and allow PS4.
How can this be done, no need for the full code ( well if you insist i'll take it ) but just point me in the right direction.
Depending on the router you're using you're going to need to write something that interacts with the router's API, if it has one. If it doesn't, you will need to replace the firmware on your router with something like ddwrt that can be scripted. From there, you might be able to create an app that talks to the router's API.
TLDR: You're probably better off simply bookmarking the management page for the router and enabling/disabling access for the devices.
Edit:
It occurred to me that some mainstream consumer router/access point manufacturers (Linksys, Asus, etc) have companion apps for managing their devices from the LAN side. You should see if such an app exists for your router, and if not, perhaps consider getting a different router that supports such an app.

Can you communicate with nearby devices using a website?

Can a website help a user communicate with nearby devices via bluetooth/WLAN without downloading software?
User requests that something be done on their device (which could be, for example a wirelessly connected printer or a bluetooth keyboard).
The site, which contains a repository of relevant actions, sends specific instructions for that device to the user's own machine.
Those instructions are then relayed to the correct device (with the user's permission) via the user's device's WLAN or existing bluetooth connection.
Part 3 is what I'm not sure of - is there a mechanism by which a website can contribute to a wireless/bluetooth connection held locally?
It is not possible. User browser can't interact with hardware for wireless networking.
You should force user to install some custom software to do this.
You would have to submit the "commands" first, then have the device make requests to the website server, i.e., check for any pending "commands" for the device, and then process them locally. A website is not "thing" that can directly interface with a hardware device.

Is wifi helps for geolocation coordinates even without connect any access points

I wonder if any device has open it's wifi without connect any access point and is it give some data info for geolocation?
Is the question about positioning with WiFi hot-spots ? Basically its described pretty well in: http://en.wikipedia.org/wiki/Wi-Fi_positioning_system
So basically in it, to be ale to determine the location, you must know the positions of the WiFi hotspots beforehand, or at least have a service which has list of hotspots and which could give you the location for the WiFi's you can see.
You don't need to make any connection to the WiFi hotspots, but you simply use the identification they are giving, and passing that information to the part which is determining the position.
In general, you would need to see whether you can find a service you could use from your selected platform, or whether the platform has APIs for using the technology.
In general positioning APIs might use the WiFi information on their cell-based positioning, and on those cases, you wouldn't really need to know anything about the WiFi things in your app.

Can an iPhone application running in the background transfer data via USB interface?

There are 2 iPhone applications. One application running in the foreground and the other running in the background. Is there any way to get the background application to send data over USB without coming into foreground? Ideally we want to keep the foreground app in the foreground, while the background app process some data. Once the data is processed it will inform the foreground app that the data has been processed.
No it cannot. It cannot even do this without the use of private frameworks, unless you're in the Made for iPhone program. If you are, then your organization will know, based on the documentation made available to you, what you can and cannot access, when and how.
Should you be in the Made for iPhone program, and are unclear as to what you have access to and when, contact the person in your organization who is the technical contact with Apple for this program, they will be able to give you the details.
If the task is started while the app is in the foreground and you call the appropriate beginBackgroundTask/endBackgroundTask methods, you should be able to have it continue running after the app is backgrounded.
Note that access to USB is restricted (see jer's answer) and that there's no officially sanctioned way to communicate between different apps on the same device. Also, you can only buy/download one app at a time in the App Store and I can't see Apple approving an app that required you to download a second app for it to work. So you may have bigger problems to solve first.
It would help significantly if you told us what you actually wanted to achieve. For example, "I want MyApp on the user's phone to communicate with MyApp on the user's computer".
The absolute easiest way is to send data between the phone and a computer is to require that they're both on the same Wi-Fi network. Several iPhone apps incorporate a web server (this was the easiest way of "file sharing" before OS 3.2), and many more iPhone apps connect to a computer running server software.
Your other options, more or less:
Reverse-engineer the Bluetooth side of GameKit and reimplement it on the computer-side. I'm not aware of anyone who's done this. Loosely, I think it's IP over Bluetooth PAN plus some sort of Bluetooth service discovery.
Audio input/output, e.g. the headphone jack or certain pins on the dock connector. I'm not entirely sure how the mic side works (the resistance was a bit high for a carbon mic when I checked), but you might get lucky and find a way to turn it into "line in" or find "line in" pins on the dock connector.
A webcam pointing at the iDevice screen (and the iDevice camera pointing at the computer screen). Ewwwww.
Join the MFi program.

Resources