Skip to content

Commit

Permalink
fix doc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Jan 20, 2024
1 parent f4d3cff commit fc59cfb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
20 changes: 7 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,16 @@
//! ```
//! use sdre_rust_adsb_parser::DecodeMessage;
//!
//! let json_message = r#"{
//! "messageType": "Aircraft",
//! "icao": "ABC123",
//! "altitude": 35000,
//! "latitude": 37.7749,
//! "longitude": -122.4194
//! }"#;
//! let message = "8EADC035002D7000000000B02845";
//!
//! let decoded_message = json_message.decode_message().unwrap();
//! let decoded_message = message.decode_message().unwrap();
//!
//! match decoded_message {
//! sdre_rust_adsb_parser::ADSBMessage::AircraftJSON(aircraft) => {
//! println!("ICAO: {}", aircraft.icao);
//! println!("Altitude: {} feet", aircraft.altitude);
//! println!("Latitude: {}", aircraft.latitude);
//! println!("Longitude: {}", aircraft.longitude);
//! sdre_rust_adsb_parser::ADSBMessage::JSONMessage(aircraft) => {
//! println!("ICAO: {}", aircraft.transponder_hex);
//! println!("Altitude: {:?} feet", aircraft.barometric_altitude);
//! println!("Latitude: {:?}", aircraft.latitude);
//! println!("Longitude: {:?}", aircraft.longitude);
//! }
//! _ => {
//! println!("Invalid message type");
Expand Down
26 changes: 16 additions & 10 deletions src/state_machine/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,27 @@
///
/// ```
/// use sdre_rust_adsb_parser::state_machine::state::StateMachine;
/// use sdre_rust_adsb_parser::state_machine::state::ProcessMessageType;
///
/// // Create a new state machine with a timeout of 10 seconds for ADS-B messages
/// let state_machine = StateMachine::new(10, 0, 37.7749, -122.4194);
/// async fn process_message() {
/// // Create a raw ADS-B message. Generally input will be from a receiver.
/// let raw_message = "8D4840D6202CC371C32CE0576098".to_string();
/// // Create a new state machine with a timeout of 10 seconds for ADS-B messages
/// let mut state_machine = StateMachine::new(10, 0, 37.7749, -122.4194);
///
/// // Get the sender channel to send messages to the state machine
/// let sender_channel = state_machine.get_sender_channel();
///
/// // Send a raw ADS-B message to the state machine
/// sender_channel.send(ProcessMessageType::Raw(raw_message)).await;
/// // Get the sender channel to send messages to the state machine
/// let sender_channel = state_machine.get_sender_channel();
///
/// // Process the incoming messages in the state machine
/// state_machine.process_adsb_message().await;
/// // Send a raw ADS-B message to the state machine
/// sender_channel.send(ProcessMessageType::AsString(raw_message)).await;
///
/// // Print the airplanes in the state machine
/// state_machine.print_airplanes().await;
/// // Process the incoming messages in the state machine
/// state_machine.process_adsb_message().await;
///
/// // Print the airplanes in the state machine
/// state_machine.print_airplanes().await;
/// }
/// ```
///
/// The state machine processes different types of messages, such as raw ADS-B data, JSON messages,
Expand Down

0 comments on commit fc59cfb

Please sign in to comment.