How to get data from serial?

Hi guys, I am a beginner for PX4.
I want to set up a serial communication between my PX4 flight controller and other device by SERIAL4/5.
The serial will receive a 16-byte data packet continuously. So how to save these data?

Any example code or tutorial?

Thanks a lot, for your help!

Maybe this documentation helps?