fn add_altitude(&mut self, icao: ICAO, altitude: &Altitude, lat_long: (f64, f64)) {
        let state = self.0.entry(icao).or_insert_with(AirplaneState::default);
        info!(
            "[{icao}] with altitude: {}, cpr lat: {}, cpr long: {}",
            altitude.alt, altitude.lat_cpr, altitude.lon_cpr
        );
        let mut temp_coords = match altitude.odd_flag {
            CPRFormat::Odd => AirplaneCoor {
                altitudes: [state.coords.altitudes[0], Some(*altitude)],
                ..state.coords
            },
            CPRFormat::Even => AirplaneCoor {
                altitudes: [Some(*altitude), state.coords.altitudes[1]],
                ..state.coords
            },
        };
        // update the position from the new even/odd message if it's a good new position
        if temp_coords.update_position(lat_long) {
            state.coords = temp_coords;
        } else {
            // clear record
            state.coords = AirplaneCoor::default();
        }
    }
/// Add `Altitude` from adsb frame
Add `Altitude` from adsb frame
Add ` Altitude ` from adsb frame
fn add_altitude(&mut self, icao: ICAO, altitude: &Altitude, lat_long: (f64, f64)) {
        let state = self.0.entry(icao).or_insert_with(AirplaneState::default);
        info!(
            "[{icao}] with altitude: {}, cpr lat: {}, cpr long: {}",
            altitude.alt, altitude.lat_cpr, altitude.lon_cpr
        );
        let mut temp_coords = match altitude.odd_flag {
            CPRFormat::Odd => AirplaneCoor {
                altitudes: [state.coords.altitudes[0], Some(*altitude)],
                ..state.coords
            },
            CPRFormat::Even => AirplaneCoor {
                altitudes: [Some(*altitude), state.coords.altitudes[1]],
                ..state.coords
            },
        };
        // update the position from the new even/odd message if it's a good new position
        if temp_coords.update_position(lat_long) {
            state.coords = temp_coords;
        } else {
            // clear record
            state.coords = AirplaneCoor::default();
        }
    }
fn add_altitude ( & mut self , icao : ICAO , altitude : & Altitude , lat_long : ( f64 , f64 ) ) { let state = self . 0 . entry ( icao ) . or_insert_with ( AirplaneState :: default ) ; info ! ( " " altitude alt altitude lat_cpr altitude lon_cpr ) ; let mut temp_coords = match altitude . odd_flag { CPRFormat :: Odd => AirplaneCoor { altitudes : [ state . coords . altitudes [ 0 ] , Some ( * altitude ) ] , .. state . coords } , CPRFormat :: Even => AirplaneCoor { altitudes : [ Some ( * altitude ) , state . coords . altitudes [ 1 ] ] , .. state . coords } , } ; // update the position from the new even/odd message if it's a good new position if temp_coords . update_position ( lat_long ) { state . coords = temp_coords ; } else { // clear record state . coords = AirplaneCoor :: default ( ) ; } }
Add `Altitude` from adsb frame
Add ` Altitude ` from adsb frame
&mut self
icao
ICAO
altitude
&Altitude
lat_long
(f64, f64)
&mut self
icao
ICAO
altitude
&Altitude
lat_long
(f64, f64)