This Whitepaper (with accompanying source code) gives a very good example of applying a State Machine design:
visualgps.net/WhitePapers/NM … arser.html
The specific problem addressed is the decoding of GPS NMEA Sentences.
In particular, note that this also illustrates how to accept data in arbitrary “chunks” that do not necessarily correspond to complete “messages” (NMEA Sentences, in this case) - which is exactly what happens when receiving data via FCM.
See: viewtopic.php?f=7&t=3766&p=23393#p23393
And: viewtopic.php?f=7&t=3766&p=23393#p23261