mercredi 6 mai 2015

Best practices: What's the best way to treat byte protocol

I have a serial communication with a device that has its own protocol, in other words, it has some byte arrays (frames) with some meaning. So, I have been treating it with a lot of default frames in a map to send data to the device and a kind of state machine, a big switch-case block to receive data from the device.

I know this question is subjective but I really would like to receive best practices to implement this relationship. Maybe there are design patterns to do the same.

Aucun commentaire:

Enregistrer un commentaire