Weather uplink
This commit is contained in:
parent
a2088e58d9
commit
86f265b791
9 changed files with 637 additions and 503 deletions
|
@ -4251,6 +4251,7 @@
|
|||
<file>Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/HOLD.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
<file>Aircraft/A320-family/Nasal/MCDU/F-PLN.nas</file> <!-- dynamic page - init before MCDU -->
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -2986,4 +2986,34 @@
|
|||
d="m 974.36752,294.79468 20.17349,-20.1735"
|
||||
style="fill:none;stroke:#ffffff;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(1.0807111,0,0,1.0807111,-76.462145,331.52578)"
|
||||
inkscape:label="#g4324"
|
||||
id="WEATHERREQSEND"
|
||||
style="stroke:#179ab7;stroke-opacity:1">
|
||||
<path
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 998.71909,284.70793 H 970.18944"
|
||||
id="path1181"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path1183"
|
||||
d="m 994.54102,294.79468 -20.17351,-20.1735"
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 984.45427,298.97275 -10e-6,-28.52964"
|
||||
id="path1185"
|
||||
inkscape:connector-curvature="0"
|
||||
sodipodi:nodetypes="cc" />
|
||||
<path
|
||||
sodipodi:nodetypes="cc"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path1187"
|
||||
d="m 974.36752,294.79468 20.17349,-20.1735"
|
||||
style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</svg>
|
||||
|
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 157 KiB |
|
@ -2426,6 +2426,7 @@ var messages_right_memo = func {
|
|||
} else {
|
||||
vhf3_voice.active = 0;
|
||||
}
|
||||
|
||||
if (getprop("controls/autobrake/mode") == 1 and (phaseVarMemo3 == 7 or phaseVarMemo3 == 8)) {
|
||||
auto_brk_lo.active = 1;
|
||||
} else {
|
||||
|
|
|
@ -171,6 +171,7 @@ var MessageController = {
|
|||
TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"),
|
||||
TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"),
|
||||
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"),
|
||||
]),
|
||||
typeIIMessages: std.Vector.new([
|
||||
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),
|
||||
|
|
|
@ -244,6 +244,7 @@ var systemsLoop = maketimer(0.1, func {
|
|||
dmc.DMController.loop();
|
||||
systems.APUController.loop();
|
||||
systems.HFLoop();
|
||||
atsu.ATSU.loop();
|
||||
|
||||
groundspeed = pts.Velocities.groundspeed.getValue();
|
||||
if ((groundAir.getBoolValue() or groundCart.getBoolValue()) and ((groundspeed > 2) or (!pts.Controls.Gear.parkingBrake.getBoolValue() and !chocks.getBoolValue()))) {
|
||||
|
|
|
@ -273,6 +273,11 @@ var lskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERTYPE");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") {
|
||||
atsu.AOC.selectedType = "HOURLY WX";
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -550,10 +555,12 @@ var lskbutton = func(btn, i) {
|
|||
canvas_mcdu.myDirTo[i].fieldL6();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "CLOSESTAIRPORT") {
|
||||
canvas_mcdu.myClosestAirport[i].freeze();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU" or getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "NOTIFICATION" or getprop("/MCDU[" ~ i ~ "]/page") == "CONNECTSTATUS") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ" or getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATSUDLINK");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMINIT" or getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY" or getprop("/MCDU[" ~ i ~ "]/page") == "DATAMODE" or getprop("/MCDU[" ~ i ~ "]/page") == "COMMSTATUS" or getprop("/MCDU[" ~ i ~ "]/page") == "COMPANYCALL") {
|
||||
|
@ -620,6 +627,20 @@ var rskbutton = func(btn, i) {
|
|||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATSUDLINK") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "AOCMENU");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i);
|
||||
if (result == 1) {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} elsif (result == 2) {
|
||||
mcdu_message(i, "NOT IN DATA BASE");
|
||||
} else {
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERTYPE") {
|
||||
atsu.AOC.selectedType = "TERM FCST";
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -647,6 +668,8 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "COMMMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "COMPANYCALL");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "WEATHERREQ");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -677,6 +700,13 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") {
|
||||
canvas_mcdu.myFpln[i].pushButtonRight(3);
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "AOCMENU") {
|
||||
if (canvas_mcdu.myReceivedMessages[i] != nil) {
|
||||
canvas_mcdu.myReceivedMessages[i].del();
|
||||
}
|
||||
canvas_mcdu.myReceivedMessages[i] = nil;
|
||||
canvas_mcdu.myReceivedMessages[i] = receivedMessagesPage.new(i);
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "RECEIVEDMSGS");
|
||||
} else {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
}
|
||||
|
@ -814,6 +844,13 @@ var rskbutton = func(btn, i) {
|
|||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "CONNECTSTATUS");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WEATHERREQ") {
|
||||
var result = atsu.AOC.sendReq(i);
|
||||
if (result == 1) {
|
||||
mcdu_message(i, "NOT ALLOWED");
|
||||
} else {
|
||||
mcdu_scratchpad.scratchpads[i].empty();
|
||||
}
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "VOICEDIRECTORY") {
|
||||
for (var i = 0; i < 3; i = i + 1) {
|
||||
if (getprop("/systems/radio/rmp[" ~ i ~ "]/sel_chan") == "vhf3") {
|
||||
|
@ -902,6 +939,8 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myArrival[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") {
|
||||
canvas_mcdu.myPilotWP[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollLeft();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
@ -930,6 +969,8 @@ var arrowbutton = func(btn, i) {
|
|||
canvas_mcdu.myArrival[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "PILOTWP") {
|
||||
canvas_mcdu.myPilotWP[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "RECEIVEDMSGS") {
|
||||
canvas_mcdu.myReceivedMessages[i].scrollRight();
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU") {
|
||||
setprop("/MCDU[" ~ i ~ "]/page", "ATCMENU2");
|
||||
} else if (getprop("/MCDU[" ~ i ~ "]/page") == "ATCMENU2") {
|
||||
|
@ -1006,7 +1047,7 @@ var pagebutton = func(btn, i) {
|
|||
setprop("/MCDU[" ~ i ~ "]/page", "DATA");
|
||||
} else if (btn == "mcdu") {
|
||||
var page = getprop("/MCDU[" ~ i ~ "]/page");
|
||||
if (page != "ATSUDLINK" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
|
||||
if (page != "ATSUDLINK" and page != "AOCMENU" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "ATCMENU" and page != "ATCMENU2" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT") {
|
||||
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", getprop("/MCDU[" ~ i ~ "]/page"));
|
||||
} else {
|
||||
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", getprop("/MCDU[" ~ i ~ "]/page"));
|
||||
|
|
157
Nasal/MCDU/RECEIVEDMESSAGES.nas
Normal file
157
Nasal/MCDU/RECEIVEDMESSAGES.nas
Normal file
|
@ -0,0 +1,157 @@
|
|||
var receivedMessages = {
|
||||
title: nil,
|
||||
fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]],
|
||||
arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]],
|
||||
L1: [nil, nil, "ack"], # content, title, colour
|
||||
L2: [nil, nil, "ack"],
|
||||
L3: [nil, nil, "ack"],
|
||||
L4: [nil, nil, "ack"],
|
||||
L5: [nil, nil, "ack"],
|
||||
L6: [nil, nil, "ack"],
|
||||
R1: [nil, nil, "ack"],
|
||||
R2: [nil, nil, "ack"],
|
||||
R3: [nil, nil, "ack"],
|
||||
R4: [nil, nil, "ack"],
|
||||
R5: [nil, nil, "ack"],
|
||||
R6: [nil, nil, "ack"],
|
||||
computer: nil,
|
||||
size: 0,
|
||||
getPageNumStr: func() {
|
||||
return me.curPage ~ "/" ~ receivedMessagesDatabase.getCountPages();
|
||||
},
|
||||
new: func(computer) {
|
||||
var ap = {parents:[receivedMessagesPage]};
|
||||
ap.computer = computer;
|
||||
ap.curPage = 1;
|
||||
ap._setupPageWithData();
|
||||
ap.update();
|
||||
return ap;
|
||||
},
|
||||
del: func() {
|
||||
return nil;
|
||||
},
|
||||
scrollLeft: func() {
|
||||
me.curPage -= 1;
|
||||
if (me.curPage < 1) {
|
||||
me.curPage = receivedMessagesDatabase.getCountPages();
|
||||
}
|
||||
},
|
||||
scrollRight: func() {
|
||||
me.curPage += 1;
|
||||
if (me.curPage > receivedMessagesDatabase.getCountPages()) {
|
||||
me.curPage = 1;
|
||||
}
|
||||
},
|
||||
_clearPage: func() {
|
||||
me.L1 = [nil, nil, "ack"];
|
||||
me.L2 = [nil, nil, "ack"];
|
||||
me.L3 = [nil, nil, "ack"];
|
||||
me.L4 = [nil, nil, "ack"];
|
||||
me.L5 = [nil, nil, "ack"];
|
||||
me.R1 = [nil, nil, "ack"];
|
||||
me.R2 = [nil, nil, "ack"];
|
||||
me.R3 = [nil, nil, "ack"];
|
||||
me.R4 = [nil, nil, "ack"];
|
||||
me.R5 = [nil, nil, "ack"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
},
|
||||
_setupPageWithData: func() {
|
||||
me.title = "RECEIVED MESSAGES";
|
||||
me.L6 = [" RETURN", nil, "wht"];
|
||||
me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]];
|
||||
me.arrowsColour = [["wht", "wht", "wht", "wht", "wht", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]];
|
||||
me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]];
|
||||
canvas_mcdu.pageSwitch[me.computer].setBoolValue(0);
|
||||
},
|
||||
update: func() {
|
||||
me._clearPage();
|
||||
me.size = ReceivedMessagesDatabase.getSize();
|
||||
var message = nil;
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -4) {
|
||||
message = ReceivedMessagesDatabase.database[-5 + (me.curPage * 5)];
|
||||
me.L1[0] = left(message.body, 16);
|
||||
me.L1[2] = "wht";
|
||||
if (!message.viewed) {
|
||||
me.L1[1] = message.time ~ " NEW";
|
||||
} else {
|
||||
me.L1[1] = message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][0] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -3) {
|
||||
message = ReceivedMessagesDatabase.database[-4 + (me.curPage * 5)];
|
||||
me.L2[0] = left(message.body, 16);
|
||||
me.L2[2] = "wht";
|
||||
if (!message.viewed) {
|
||||
me.L2[1] = message.time ~ " NEW";
|
||||
} else {
|
||||
me.L2[1] = message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][1] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -2) {
|
||||
message = ReceivedMessagesDatabase.database[-3 + (me.curPage * 5)];
|
||||
me.L3[0] = left(message.body, 16);
|
||||
me.L3[2] = "wht";
|
||||
if (!message.viewed) {
|
||||
me.L3[1] = message.time ~ " NEW";
|
||||
} else {
|
||||
me.L3[1] = message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][2] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + -1) {
|
||||
message = ReceivedMessagesDatabase.database[-2 + (me.curPage * 5)];
|
||||
me.L4[0] = left(message.body, 16);
|
||||
me.L4[2] = "wht";
|
||||
if (!message.viewed) {
|
||||
me.L4[1] = message.time ~ " NEW";
|
||||
} else {
|
||||
me.L4[1] = message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][3] = 1;
|
||||
}
|
||||
|
||||
if (me.size >= (me.curPage * 5) + 0) {
|
||||
message = ReceivedMessagesDatabase.database[-1 + (me.curPage * 5)];
|
||||
me.L5[0] = left(message.body, 16);
|
||||
me.L5[2] = "wht";
|
||||
if (!message.viewed) {
|
||||
me.L5[1] = message.time ~ " NEW";
|
||||
} else {
|
||||
me.L5[1] = message.time ~ " VIEWED";
|
||||
}
|
||||
me.arrowsMatrix[0][4] = 1;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var ACARSMessage = {
|
||||
new: func(time, body) {
|
||||
var message = {parents:[ACARSMessage]};
|
||||
message.time = time;
|
||||
message.body = body;
|
||||
message.viewed = 0;
|
||||
},
|
||||
};
|
||||
|
||||
var ReceivedMessagesDatabase = {
|
||||
database: std.Vector.new(),
|
||||
addMessage: func(message) {
|
||||
me.database.insert(message);
|
||||
},
|
||||
getCountPages: func() {
|
||||
return math.ceil(me.database.size() / 4);
|
||||
},
|
||||
getSize: func() {
|
||||
return me.database.size();
|
||||
},
|
||||
clearDatabase: func() {
|
||||
me.database.clear();
|
||||
},
|
||||
};
|
|
@ -2,6 +2,17 @@
|
|||
# Jonathan Redpath
|
||||
|
||||
# Copyright (c) 2020 Josh Davidson (Octal450)
|
||||
var ATSU = {
|
||||
working: 0,
|
||||
loop: func() {
|
||||
if (systems.ELEC.Bus.ac1.getValue() >= 110 or systems.ELEC.Bus.dc1.getValue() >= 25) {
|
||||
me.working = 1;
|
||||
} else {
|
||||
me.working = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var notificationSystem = {
|
||||
notifyAirport: nil,
|
||||
hasNotified: 0,
|
||||
|
@ -78,4 +89,90 @@ var CompanyCall = {
|
|||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var AOC = {
|
||||
station: nil,
|
||||
selectedType: "HOURLY WX", # 0 = METAR 1 = TAF
|
||||
lastMETAR: nil,
|
||||
lastTAF: nil,
|
||||
sent: 0,
|
||||
sentTime: nil,
|
||||
received: 0,
|
||||
newStation: func(airport) {
|
||||
if (size(airport) == 3 or size(airport) == 4) {
|
||||
if (size(findAirportsByICAO(airport)) == 0) {
|
||||
return 2;
|
||||
} else {
|
||||
me.station = airport;
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
sendReq: func(i) {
|
||||
if (me.station == nil or (me.sent and !me.received)) {
|
||||
return 1;
|
||||
}
|
||||
me.sent = 1;
|
||||
me.received = 0;
|
||||
var sentTime = left(getprop("/sim/time/gmt-string"), 5);
|
||||
me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z";
|
||||
if (me.selectedType == "HOURLY WX") {
|
||||
me.fetchMETAR(atsu.AOC.station, i);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (me.selectedType == "TERM FCST") {
|
||||
me.fetchTAF(atsu.AOC.station, i);
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
fetchMETAR: func(airport, i) {
|
||||
if (ecam.vhf3_voice.active) {
|
||||
mcdu.mcdu_message(i, "VHF3 VOICE MSG NOT GEN");
|
||||
return;
|
||||
}
|
||||
if (!ATSU.working) {
|
||||
mcdu.mcdu_message(i, "NO COMM MSG NOT GEN");
|
||||
return;
|
||||
}
|
||||
http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport)
|
||||
.fail(func print("Download failed!"))
|
||||
.done(func(r) me.processMETAR(r, i));
|
||||
},
|
||||
fetchTAF: func(airport, i) {
|
||||
if (ecam.vhf3_voice.active) {
|
||||
mcdu_message(i, "VHF3 VOICE MSG NOT GEN");
|
||||
return;
|
||||
}
|
||||
if (!ATSU.working) {
|
||||
mcdu_message(i, "NO COMM MSG NOT GEN");
|
||||
return;
|
||||
}
|
||||
http.load("https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=tafs&requestType=retrieve&format=xml&timeType=issue&mostRecent=true&hoursBeforeNow=12&stationString=" ~ airport)
|
||||
.fail(func print("Download failed!"))
|
||||
.done(func(r) me.processTAF(r, i));
|
||||
},
|
||||
processMETAR: func(r, i) {
|
||||
var raw = r.response;
|
||||
raw = split("<raw_text>", raw)[1];
|
||||
raw = split("</raw_text>", raw)[0];
|
||||
me.lastMETAR = raw;
|
||||
settimer(func() {
|
||||
me.received = 1;
|
||||
mcdu.mcdu_message(i, "WX UPLINK");
|
||||
}, math.max(rand()*6, 2.25));
|
||||
},
|
||||
processTAF: func(r, i) {
|
||||
var raw = r.response;
|
||||
raw = split("<raw_text>", raw)[1];
|
||||
raw = split("</raw_text>", raw)[0];
|
||||
me.lastTAF = raw;
|
||||
settimer(func() {
|
||||
me.received = 1;
|
||||
mcdu.mcdu_message(i, "WX UPLINK");
|
||||
}, math.max(rand()*6, 2.25));
|
||||
},
|
||||
};
|
Loading…
Add table
Reference in a new issue