implement function to decode a complete frame of transimission