This is probably asked several times before, but my websearch skills can't really direct me to an adequate answer.
I have a thingy, that takes commands from a mobile application with a request-response protocol.
Also from time to time it sends notifications to the mobile app.
Until now, I used RFCOMM, but iOS doesn't really seem to support it. So I had to switch the underlying implementation. So far I found that the GATT profile might be what I need, but I'm not sure if it is the right direction. Or if it is achievable at all.
So what profile/setup should I dig into to implement this communication pattern?
-
please provide a link to the answers you found ... state the reason why the answer was not adequate– jsotolaCommented May 9, 2021 at 21:31
2 Answers
The exact setup depends on what you want or need to do, but the basic scheme is that:
- you define a service with your own custom UUID
- you define a characteristic on that service (or several), with read/write/notify flags depending on your needs
- you start advertising
This is a scheme that will work with all BLE devices with an appropriate app running on them.
Sometimes you can just advertise and not bother with the service and characteristics. Sometimes you use pre-defined services and characteristics. And there are probably other combinations.
Since you are focusing on iOS in your question, I can recommend looking at
- Apple's Bluetooth Developer Web Site.
- Take a closer look at Bluetooth profiles that iOS and iPadOS support
- And Chapter 15 of Accessory Design Guidelines
From personal experience, I would recommend using an Espressif ESP32 as a development standin for your thingy, as you can learn a great deal about Bluetooth development. Notably, developing with BLE for iOS interactivity is more flexible than classic Bluetooth, and, if I may share an experienced opinion, Espressif has many examples with good documentation.
-
Thanks a lot. I've already checked the first two of your suggested literature, but the third one is new to me, I hope it will help, I'll have some time in the weekend to try some stuff. And btw, we'll switch to esp32 from our current raspberry based thingy :)– zellerCommented May 14, 2021 at 17:57
-
Cool. I appreciate the feedback. If you want to say I answered your question, I'd appreciate it.– JimWCommented May 17, 2021 at 17:25
-
unfortunately I still don't know if a custom profile over GATT is the way to go, or something else. Maybe I missed something (and I also admit I haven't checked the Accessory Design Guidelines in depth yet).– zellerCommented May 20, 2021 at 14:07