I am making an app that sends data to an arduino. An example of the data is incoming text messages. I can now send the contact name or phone number. But I would like to send the message itself with it.
I was thinking of using a differentiator but I found some problems with it. The main problem is that the delimiter could be in the name of the contact or the message, and so mess up everything.
How could I best send 2 or more strings through bluetooth?
Thanks in advance!
Could you use non-printing characters or even non-ascii byte values as delimiters?
Use of ascii characters below 0x20 as a separator might work.
A simple approach could be to send a sequence where a delimiter does not occur in the first fields. E.g. a phone number does not have commas, a name possibly also does not have commas. So possibly number,contactname,message could work; read up to two commas and the remainder is the message.
Use an approach as used in CSV files where you embed fields in double quotes and escape double quotes inside a field with another double quote. E.g. "0123456789","sterretje","Hi ""Robbeserry"", how are you?". I'm not sure if there is a csv parser library available for the Arduino eco-system.