(Classic) Bluetooth LAN - IP address

Dears, I'm struggling with something that I wasn't able to find on the internet.

Here is my scenario:


I have a (classic) bluetooth device (non iOS) running Linux (I don't have any access to source code or whatever) and its need an IP address/port to communicate (send/receive data).

If I connect it to a WiFi network, I can use CFStreamCreatePairWithSocketToHost or NWEndpoint to create in/out socket streams to the device (the device can act either as Client or Server, that's why I can choose which network method to use).

If I enable Bluetooth and Personal hotspot, I can connect (pair) to the device and send/receive data the same way as WiFi.

But, on this case, I lost WiFi as iOS only supports Personal hotspot over Cellular network (3G/4G).

That limits my (hardware) options as my App will only runs on iPhones or iPads with mobile data. I would like to use it also on WiFi iPads and iPods.


My question is: is there any way my App can act as DHCP server (or similar) to provide an IP address to the device over Bluetooth ? So I can keep my WiFi on at the same time the device is connected to the phone/tablet using Bluetooth?


thanks, Cassio

I will come at this from the Wi-Fi aspect, leaving Bluetooth out of the equation for a moment. For communication with your iOS device over Wi-Fi you could use NWListener and provide an IP to your Linux device to communicate with iOS on. This can work. However, this approach is not recommended as there are several pitfalls. The largest pitfall being that the IP can change at any point rendering your connection with iOS unusable. You could however use Bonjour service-discovery. On your Linux device if you are able to get on the Wi-Fi network and browse for a Bonjour service, you could use NWListener on iOS to advertise a service that Linux could connect to.


My recommendation here would be one of two things; either flip your solution so that iOS is the client connecting to the Linux device via NEHotspotConfiguration, or if you are able to use Bonjour take a look at service discovery over the Wi-Fi network.


As for the Bluetooth side of things, you could ask for more information in the CoreOS Bluetooth specific space.



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

Thanks Matt.


On the WiFi side I was able to connect and send/receive data, but I really need to use Bluetooth.

I'll repost this question on the other channel, but as far as I understand, that channel is for BLE, not Classic Bluetooth, right?

The CoreOS Bluetooth channel is not limited to BLE. I wouldn't hesitate to ask a Classic Bluetooth question there, or anything else related to Bluetooth on Apple Platforms.


Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

(Classic) Bluetooth LAN - IP address
 
 
Q