🐸 Ribbit Header Codec

Compact message header encoding/decoding system for amateur radio data transmission.
Watch data flow from human-readable → binary → bytes → binary → human-readable

Header Structure (128+ bits):
📤 Step 1: Encoding

Encode Human-Readable Data → Binary

Callsign

Callsign (48 bits):
000000000000000000000000000000000000000000000000

Timestamp (UTC)

Year+Month (10 bits): 0000000000
Day (5 bits): 00000
Hour (5 bits): 00000
Minute (6 bits): 000000
Second (5 bits): 00000
Timestamp Combined (31 bits):
0000000000000000000000000000000

Emergency Flag

Emergency (1 bit): 0
Message ID Complete (80 bits):
Callsign (48) + Timestamp (31) + Emergency (1) = Unique Message Identifier

Gridsquare

Gridsquare (28 bits):
0000000000000000000000000000

Meta Flags

NTP (1 bit): 0
GPS (1 bit): 0

Lengths and Type

First Name Length (4 bits): 0000
Last Name Length (4 bits): 0000
Combined Name Length (8 bits):
00000000
Message Length (8 bits): 00000000
Message Type (2 bits): 01

Name

First Name (0-75 bits):
Last Name (0-75 bits):

Message

Message (0-1920 bits):

✅ Complete Encoded Bitstream

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001

Total bits: 128 bits | Message ID: 80 bits

⬇ TRANSMISSION ⬇
📡 Step 2: Byte Conversion

Prepare for Transmission (Variable Length)

The header bitstream is padded to the nearest byte boundary for transmission. Minimum: 16 bytes (128 bits, no padding needed).

Byte Array:
[0b00000000]

Byte count: 16 bytes

⬇ RECEPTION ⬇
📥 Step 3: Decoding

Decode Binary → Human-Readable Data

Recompose Bitstream from Bytes

Extract Fragments

Callsign (48 bits): 000000000000000000000000000000000000000000000000
Timestamp (31 bits): 0000000000000000000000000000000
Emergency (1 bit): 0
Message ID Complete (80 bits)
Gridsquare (28 bits): 0000000000000000000000000000
NTP (1 bit): 0
GPS (1 bit): 0
Name Length (8 bits): 00000000
Message Length (8 bits): 00000000
Message Type (2 bits): 01
First Name (variable):
Last Name (variable):
Message (variable):

✅ Decoded Values

Callsign: --------

Timestamp: 2026-01-01 00:00:00

Emergency: false

Message ID (80 bits): Callsign + Timestamp + Emergency

Gridsquare: ------

NTP: false

GPS: false

First Name Length: 0

Last Name Length: 0

Message Length: 0

Message Type: 1 - Chat

First Name:

Last Name:

Message: