feat: Add FPL message parsing functionality

This commit adds functionality to parse FPL messages in the `aftn_parser.go` file. The `Parse` method now correctly parses the FPL message type and extracts the relevant data fields. The `FPL` struct is introduced in the `domain` package to represent FPL messages. The parsing logic is implemented to populate the `FPL` struct with the parsed data. This change enables the application to handle FPL messages and process them accordingly.
This commit is contained in:
windyboy
2024-07-20 00:46:31 +08:00
parent 969bb57902
commit afd4643696
3 changed files with 54 additions and 0 deletions
+16
View File
@@ -41,6 +41,22 @@ func (p AFTNParser) Parse(text string) (interface{}, error) {
DepartureTime: data["departure_time"],
Destination: data["arrival"],
}, nil
case "FPL":
return &domain.FPL{
Category: data["type"],
FlightNumber: data["number"],
FlightRulesAndType: data["indicator"],
AircraftID: data["aircraft"],
SSRModeAndCode: data["surve"],
DepartureAirport: data["departure"],
DepartureTime: data["departure_time"],
CruisingSpeedAndLevel: data["speed"] + data["level"],
Route: data["route"],
DestinationAndTotalTime: data["destination"] + data["estt"],
AlternateAirport: data["alter"],
OtherInfo: data["pbn"] + " " + data["nav"] + " " + "REG/" + data["reg"] + " " + "EET/" + data["eet"] + " " + "SEL/" + data["sel"] + " " + "PER/" + data["performance"] + " " + "RIF/" + data["rif"],
SupplementaryInfo: "RMK/" + data["remark"],
}, nil
default:
return nil, fmt.Errorf("invalid message type")
}