APRS Message Format
You may want to build an APRS message.
I don't mean encoding a GPS location.
I mean building a low-level bit-by-bit sendable packet that will be identified properly by low-level tech like gates and repeaters, etc.
I've provided a source code implementation of the below on another page (here).
Here are the lower levels of the OSI stack that correspond to all terminology relating to APRS.
The design behind APRS predated formalized OSI standardization and so not all of the layering is strictly intact in all places.
Documentation and resources tend to go into a lot of detail about things you don't need to care much about, like all the detail around HDLC and AX.25.
Below I'm going to outline the message structure as you need to care about it in a practical sense.
This does not cover the actual transmission of this data here (but I do elsewhere), because that's complex, and unrelated to the task of actually successfully building a message in the first place.
I will start from the bottom to the top of the OSI stack and move upwards, showing what the specs identify as message format structure.
I will link together those structures so you can see them in context.
This is a depiction of the Layer 1 frame structure for HDLC/Bell202.
I only mention it because you'll see this diagram around and I want to be clear about what I'm talking about.
We will care about the Frame Payload here.
This is a depiction of the Layer2 AX.25 frame structure.
This is what goes into the Frame Payload identified above.
The formatting of the Address fields is the most complex part here.
The Destination, Source, and the 0-or-more "Routing Path" Address fields are formatted using identical methodology.
Below is a description of how to format any of the Address fields.
The Control and PID (Protocol ID) fields are constants in practice.
Control = 0x03
PID = 0xF0
The "Information Field" is where APRS-specific formatted data goes (things like GPS locations, etc).
I don't cover that here since there are many resources out there dedicated to it.
Back to Layer 1 - Worrying about the Checksum (FCS)
The checksum should be calculated after all other fields in the Layer 2 message have been filled out.
There is an extra complication that the specs dictate that, unlike the rest of the fields, when transmitted in Layer 1 (physical) that the bits should be sent most-significant-bit first as opposed to all other fields.
The specifics of what is meant by the spec are ambiguous as written, but in my source code implementation the details get worked out and you, as the developer, just need to worry about streaming out the bits.