1
0
Fork 0

Bugfix: fix the ATIS API references

This commit is contained in:
legoboyvdlp R 2021-01-20 14:51:36 +00:00
parent 1c4b046875
commit 8c2e0d6600
2 changed files with 21 additions and 5 deletions

View file

@ -180,7 +180,7 @@ var MessageController = {
TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"),
TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"),
TypeIMessage.new("SIMBRIEF DOWNLOAD FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"),
TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"),
TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("NO METAR AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"),
TypeIMessage.new("WIND DATA UPLINK"),TypeIMessage.new("CHECK ALT WIND"),TypeIMessage.new("INVALID WIND UPLINK"),TypeIMessage.new("WIND UPLINK EXISTS"), #p.533
TypeIMessage.new("FM DATALINK UNAVAIL"),TypeIMessage.new("NOT XMITTED TO ACARS"), #p.559
TypeIMessage.new("PRINTER NOT AVAILABLE"),

View file

@ -168,12 +168,12 @@ var AOC = {
var serverString = "";
if (me.server.getValue() == "vatsim") {
serverString = "https://api.flybywiresim.com/metar?source=vatsim&icao=";
serverString = "https://api.flybywiresim.com/metar/" ~ airport ~ "?source=vatsim";
} else {
serverString = defaultServer;
serverString = defaultServer ~ airport;
}
http.load(serverString ~ airport)
http.load(serverString)
.fail(func(r) me.downloadFail(i, r))
.done(func(r) {
var errs = [];
@ -212,7 +212,23 @@ var AOC = {
},
processMETAR: func(r, i) {
var raw = r.response;
if (find('"statusCode":404',raw) != -1) {
me.received = 0;
me.sent = 0;
mcdu.mcdu_message(i, "NO METAR AVAILABLE");
return;
}
if (me.server.getValue() == "vatsim") {
if (find("metar", raw) != -1) {
raw = split('"metar":"', raw)[1];
raw = split('","source":"Vatsim"}', raw)[0];
} else {
me.received = 0;
me.sent = 0;
mcdu.mcdu_message(i, "BAD SERVER RESPONSE");
return;
}
me.lastMETAR = raw;
} else if (find("<raw_text>", raw) != -1) {
raw = split("<raw_text>", raw)[1];
@ -330,7 +346,7 @@ var ATIS = {
},
processATIS: func(r, i) {
var raw = r.response;
if (r.response == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",r.response) != -1 or find('"statusCode":404',r.response) != -1) {
if (raw == "FBW_ERROR: D-ATIS not available at this airport" or find("atis not avail",raw) != -1 or find('"statusCode":404',raw) != -1) {
me.received = 0;
me.sent = 0;
mcdu.mcdu_message(i,"NO D-ATIS AVAILABLE");