So far my best understanding is that I'll have to implement a custom GATT profile/service.
But both BLE and iOS development is new to me. Could anyone give extra directions?
It depends, but a flexible approach might look like this. I'll focus on your protocol here—the rest is in the Core Bluetooth docs.
These writes and notifications have a small binary data payload of your choice. Typically iOS devices will let you do ~185 bytes at a time so if your requests and responses are short you can insert them directly. If they're bigger you'll have a bit more work to split them up.
Possible simplifications if your app allows it:
Thanks a lot thombles! I was thinking about something like this. What caught my attention is that you say we have to split messages that are too "large". With my old RFCOMM implementation the average packet size was 340 bytes, so I'm a bit disappointed. Is this something unavoidable? And if yes, am I going to need something like this:
loop until the whole message is sent:
central sends several bytes of the message to a characteristic
peripheral reads it and writes a checksum to another characteristic
if crc failure:
restart transmission