-read() now works, reading right from the stream (look ma, no buffer!) -you can use all of the stream functions (readBytes, readBytesUntil) TODO -make read() also respond to wrapJSONForMe() - omit le json
-Added printMessage() so I could temporarily move away from SwarmMessage - which is leaking memory, and i'd like to deprecate -Finished swarm.println() solution, added wrapJSONForMe() so user can choose whether to print JSON or just strings, dammit
Instead of doing all the parsing and loading in available(), we get the message and load it into a SwarmMessage object. This all happens in fetchMessage(), so that available() is free'd up Next: -abstract the free() and destroy() from the user code - make a parseForMe() function to handle that stuff -Add a new constructor to SwarmMessage that can use the stream directly - using a char * is super inefficient...
produce() and consume() now *work*. produce is pretty straightforward, and doesn't do anything fancy (make sure your messages are in the right format!) Consume() right now is a bit of a hack - it only returns a reference to the buffer location of the message. You will need to copy that memory out before doing anything else, or it will be overwritten.
swarm.available() will essentially fetch the next packet and parse it. This should probably be renamed... swarm.consume() and swarm.getSender() return data right out of the swarm_buff - saving them bytes! added printBuffer() as a valuable debug swarm.available() and swarm.consume() AAALMOST work except for: -a nasty race condition causing something in swarm.available() to block indefinately - printf-ing causes this to go away -poor payload end detection logic - right now just a placeholder Next more thought into informing user of presence / more options for producing (would you like JSON with that?)