sameplace

Crates.iosameplace
lib.rssameplace
version0.2.0
created_at2025-05-25 21:20:25.758829+00
updated_at2025-09-07 03:43:16.082113+00
descriptionA SAME/EAS Message Parser
homepagehttps://github.com/cbs228/sameold
repositoryhttps://github.com/cbs228/sameold.git
max_upload_size
id1688703
size108,713
Colin S. (cbs228)

documentation

README

sameplace: A SAME/EAS Message Parser

This crate provides a text parser for Specific Area Message Encoding (SAME). It provides machine- and human-friendly representations of these messages, with event codes and significance levels.

For a complete CLI binary, see samedec.

Anatomy of a SAME message

SAME/EAS messages contain:

  1. A digital header which provides machine-readable information
  2. An audio voice message, for human consumption
  3. A digital trailer which denotes the end of message.

The actual "message" part of a SAME message is the audio itself, which describes the event and provides instructions to the listener. The digital headers do not contain all the information as the voice message.

  • For analog→digital decoding, see our companion library sameold.

  • For a complete program, which can also handle the voice message, see our companion binary crate samedec.

Interpreting Messages

The MessageHeader type decodes a SAME header, like:

ZCZC-WXR-RWT-012345-567890-888990+0015-0321115-KLOX/NWS-
use sameplace::{MessageHeader, Originator, Phenomenon, SignificanceLevel};

// decode the header string
let hdr = MessageHeader::new(
    "ZCZC-WXR-RWT-012345-567890-888990+0015-0321115-KLOX/NWS-"
).expect("fail to parse");

// what organization originated the message?
assert_eq!(Originator::NationalWeatherService, hdr.originator());

// parse SAME event code `RWT`
let evt = hdr.event();

//   the Phenomenon describes what is occurring
assert_eq!(Phenomenon::RequiredWeeklyTest, evt.phenomenon());

//   the SignificanceLevel indicates the overall severity and/or
//   how intrusive or noisy the alert should be
assert_eq!(SignificanceLevel::Test, evt.significance());
assert!(SignificanceLevel::Test < SignificanceLevel::Warning);

//   Display to the user
assert_eq!("Required Weekly Test", &format!("{}", evt));

// location codes are accessed by iterator
let first_location = hdr.location_str_iter().next();
assert_eq!(Some("012345"), first_location);

Crate features

  • chrono: Use chrono to calculate message issuance times and other fields as true UTC timestamps. If enabled, chrono becomes part of this crate's public API.

MSRV Policy

A minimum supported rust version (MSRV) increase will be treated as a minor version bump.

Contributing

Please read our contributing guidelines before opening any issues or PRs.

License: MIT OR Apache-2.0

Commit count: 227

cargo fmt