Go Down

Topic: Messenger library (Read 26 times) previous topic - next topic

tof

Messenger is a new library for Arduino. It is a "toolkit" that facilitates the processing of ASCII messages. Messenger processes characters until it receives a carriage return (CR). It then considers the message complete and available. The message is split into many elements as defined by a separator. The default separator is the space character, but can be any character other than NULL, LF or CR.

Messenger is the new SimpleMessageSystem. SimpleMessageSystem was nice, but not simple enough, so I wanted to switch to Firmata, but when I found out Firmata took at least half of my atmega168's memory, I went back to the drawing board and designed Messenger.

Please note that Messenger only provides methods for incoming messages. The internal Serial.print() functions work just fine for outgoing messages.

You can find Messenger here.
Thomas Ouellet Fredericks

Syvwlch

Hey, thanks!

Can't wait to take it out for spin...
----------
Mathieu

Xtalker

This will be very useful!  I would love to use this with my new ethernet shield to parse caller ID messages and perhaps scrape web pages but, unfortunately, it doesn't support strings yet.

I would take this on myself but efficient string handling requires more C expertise than I have!

Any hope that string support will be added to the messenger library anytime soon?

tof

The problem with strings is that they use up a big chunk of memory (1 byte per letter).

I could probably add  string support. Something like:
compareString(String) that would return a true or false.
If the result is false, it stays in the buffer, if the result is true, it would pass to the next element of the message.


p.s.: I am not sure I posted the link before, but Messenger can be found here: http://www.arduino.cc/playground/Code/Messenger
Thomas Ouellet Fredericks

Xtalker

Yes, strings are memory hogs and are not easily handled in the Arduino environment.  But something like Messenger could sure open a lot of interfacing possibilities!

I'd love to see support that allowed me to pick a string out of a sequence by position perhaps like:

readStr(index)
returns the element at the index as a string (defined by the message separator).

Thanks for all you work on this so far!

Go Up