pub fn encode_packet( packet_type: u8, packet_flags: u8, data_flags: Option<u16>, payload: &[u8], width: PacketLengthWidth, ) -> Result<Vec<u8>>