You can use Skinner's technique which is easy enough or consider this.
If your command sequence is terminated with a known value like CR or CRLF which is the norm in most cases, your job becomes easier. What you have to do is just collect the data and buffer it till you hit the CR. Then, check the packet for ID and process accordingly. This is how I do it in my products
ID xxxx CR
If the packet is not yours and not a broadcast, discard it.
Bookmarks