Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New EventCode API #32

Merged
merged 5 commits into from
Feb 23, 2024
Merged

New EventCode API #32

merged 5 commits into from
Feb 23, 2024

Commits on Feb 8, 2024

  1. sameold: reorg message

    Move `sameold::message::event` → `sameold::message::phenomenon`
    
    Move SignificanceLevel and errors to
    `sameold::message::significance`
    
    These moves do not impact the external API.
    cbs228 committed Feb 8, 2024
    Configuration menu
    Copy the full SHA
    bc3da1e View commit details
    Browse the repository at this point in the history

Commits on Feb 22, 2024

  1. sameold: overhaul Originator API

    * Drop enum variant `WeatherService`, which was previously emitted
      if sameold could not determine if the originator was the NWS or
      Environment Canda. It's actually easy to tell: in Canada, SAME
      is only ever transmitted on Weatherradio stations. This means
      the station callsign will be an `EC/…` station.
    
    * Rename `Originator::as_str()` to `Originator::as_code_str()` for
      clarity
    
    * Support the "alternate" format code.
    
    * Originator is no longer `From<&str>`. Instead, it should be
      constructed via `Originator::from_org_and_call()`.
    
    * Originator now implements Default
    
    This is API-BREAKING for sameold. The samedec executable only
    reports the Display value, which is largely unchanged, but a
    `$SAMEDEC_ORIGINATOR` of "National Weather Service" will now be
    emitted instead of "Weather Service."
    cbs228 committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    d48c218 View commit details
    Browse the repository at this point in the history
  2. sameold: message: infallible conversion to significance

    * `SignificanceLevel::from()` constructs directly from
      significance code str. The conversion is infallible.
      A new `SignificanceLevel::Unknown` variant is returned
      when a significance level cannot be determined. It sorts
      higher than `Warning`.
    
    * The conversion from `str` to `SignificanceLevel` is now
      infallible. A new `SignificanceLevel::Unknown` variant,
      which is the new Default, represents cases when the
      significance level cannot be determined.
    
    * The UnknownSignificanceLevel is no longer required and
      is removed.
    
    * Renamed `SignificanceLevel::as_str()` →
      `SignificanceLevel::as_code_str()`. This method returns a
      one-character significance code.
    
    * The Unknown variant is the new Default.
    
    This is an API-BREAKING change.
    cbs228 committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    79eb1f9 View commit details
    Browse the repository at this point in the history

Commits on Feb 23, 2024

  1. sameold: message: EventCode API for more informative decodes

    * The `EventCode` is now a struct which represents the combination
      of a `Phenomenon` and a `SignificanceLevel`.
    
      * The enum of all the SAME events is renamed to `Phenomenon`.
    
      * Phenomenon previously de-normalized into significance levels,
        like `TornadoWatch` and `TornadoWarning`, are represented as
        a single enum entry like `Tornado`.
    
      * Phenomenon from the 2022 revision of NWSI 10-1712 and more
        Canadian codes are added:
    
        * EAN: Renamed to National Emergency Message
        * NAT: National Audible Test
        * NST: National Silent Test
        * FSW: Flash Freeze Warning
        * FZW: Freeze Warning
        * HLS: Hurricane Local Statement
        * SQW: Snow Squall Warning
    
      * The alternate formatter for `EventCode` now displays only the
        phenomenon, like `Tornado`, without the significance level
    
    * The conversion of `EventCode` from str is now infallible.
      Drop the `UnrecognizedEventCode` error.
    
    * The `EventCodeIter` is not required and is dropped from the
      public API.
    
    * Fix bad code entry for ADR (Administrative Message)
    
    * Add dependency on `phf`
    
    This is an API-BREAKING change.
    cbs228 committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    03ff745 View commit details
    Browse the repository at this point in the history
  2. samedec: update for breaking EventCode API

    The new API is simpler and doesn't require matches for errors.
    
    The integration tests are also updated.
    cbs228 committed Feb 23, 2024
    Configuration menu
    Copy the full SHA
    ec9f691 View commit details
    Browse the repository at this point in the history