Move avr serialization logic to Msg class, add gtest to properly exercise it.