2

I've searched google and only found the MultipeerConnectivity framework in iOS but I don't know how I could make it work for my specific case.

The flow of what I want to do is like this:

  1. Enable personal hotspot in iOS
  2. Connect to hotspot from a raspberry pie
  3. Once client is connected, send a message string from the iOS app.

Assuming that the raspberry pie connection is already sorted out (We're using a static SSID and Password for the hotspot)

The questions that come up are:

  • Which framework should I use (assuming there is one already)?
  • do I need to explicitly advertise the iOS device from the app?
  • How do I get notified when the raspberry connects to the phone?
  • How do I send a message to the connected client?
Marcy
  • 4,611
  • 2
  • 34
  • 52
HardCodeStuds
  • 407
  • 2
  • 11
  • 29

2 Answers2

1

Although I never developed anything for Pi, I developed net service browsing for iOS devices, so can give an answer. When you connect to iPhone hotspot, it's a usual WiFi connection, so here you can use Bonjour protocol (mDNS) to discover devices one another.

Run Avahi mDNS service on Pi, and discover it on iPhone.

Here is how to run Avahi on Pi.

Here is how to discover mDNS net service on iPhone.

After net service is discovered with NSNetServiceBrowser, you'll have IP address and port of your Pi available on your iPhone, so you can connect to it.

Community
  • 1
  • 1
Eugene Dudnyk
  • 5,553
  • 1
  • 23
  • 48
0

If you are trying to setup a IoT system, it may be useful to look into various cloud offerings to facilitate messaging between devices. Personally I have used AWS IoT core services in the past, and it is relatively easy to setup messaging between devices.

I am not sure what your exact use case is for this setup, but using a cloud based service to setup messaging between devices will remove the requirement to connect directly between devices via hotspot (the pi still needs some internet connection), and could make it easier to enable multiple devices and app clients in the system.