NMEA HDG datagram format
The NMEA HDG datagram provides heading from a magnetic sensor. If this reading is corrected for deviation, it produces the magnetic heading. If it is offset by variation, it provides the true heading.
Format
$--HDG,x.x,z.z,a,r.r,a*hh<CR><LF>
Description
1 $—Talker identifier
2 HDGDatagram identifier
3 x.x:  (Degrees Magnetic)
4 z.z,aDeviation (Degrees Magnetic), East/West
•  E = East
•  W = West
5 r.r,a Variation (Degrees Magnetic), East/West
•  E = East
•  W = West
6 *hh: Checksum