diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index fc11fa51..a6fd7623 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -231,7 +231,7 @@ var canvas_MCDU_base = { "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star","NOTIFY","NOTIFY_FLTNBR","NOTIFY_AIRPORT","WEATHERREQSEND", - "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE"]; + "WIND","WIND_CANCEL","WIND_INSERT_star","WIND_UPDOWN","MODEVHF3","PRINTPAGE","COMM-ADS","COCALL","COCALLTUNE","ATISSend1","ATISSend2","ATISSend3","ATISSend4"]; }, update: func() { if (systems.ELEC.Bus.ac1.getValue() >= 110 and mcdu1_lgt.getValue() > 0.01) { @@ -362,6 +362,12 @@ var canvas_MCDU_base = { me["PRINTPAGE"].setColor(WHITE); } } + if (page != "ATIS") { + me["ATISSend1"].hide(); + me["ATISSend2"].hide(); + me["ATISSend3"].hide(); + me["ATISSend4"].hide(); + } if (page == "F-PLNA" or page == "F-PLNB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -974,8 +980,8 @@ var canvas_MCDU_base = { pageSwitch[i].setBoolValue(1); } - if (fmgc.FMGCInternal.depApt != "") { - me["Simple_L1"].setText(" " ~ fmgc.FMGCInternal.depApt ~ "/DEP"); + if (atsu.ATISInstances[0].station != nil) { + me["Simple_L1"].setText(" " ~ atsu.ATISInstances[0].station ~ "/" ~ (atsu.ATISInstances[0].type == 0 ? "ARR" : "DEP")); me["Simple_L1"].setFont(default); me["Simple_L1"].setColor(WHITE); me["Simple_L1_Arrow"].show(); @@ -986,29 +992,65 @@ var canvas_MCDU_base = { me["Simple_L1_Arrow"].hide(); } - if (fmgc.FMGCInternal.arrApt != "") { - me["Simple_L2"].setText(" " ~ fmgc.FMGCInternal.arrApt ~ "/ARR"); + if (atsu.ATISInstances[1].station != nil) { + me["Simple_L2"].setText(" " ~ atsu.ATISInstances[1].station ~ "/" ~ (atsu.ATISInstances[1].type == 0 ? "ARR" : "DEP")); me["Simple_L2"].setFont(default); - me["Simple_L1"].setColor(WHITE); + me["Simple_L2"].setColor(WHITE); me["Simple_L2_Arrow"].show(); } else { me["Simple_L2"].setText(" [ ]/[ ]"); me["Simple_L2"].setFont(symbol); - me["Simple_L1"].setColor(BLUE); + me["Simple_L2"].setColor(BLUE); me["Simple_L2_Arrow"].hide(); } - if (fmgc.FMGCInternal.altAirportSet == 1) { - me["Simple_L3"].setText(" " ~ fmgc.FMGCInternal.altAirport ~ "/ARR"); + if (atsu.ATISInstances[2].station != nil) { + me["Simple_L3"].setText(" " ~ atsu.ATISInstances[2].station ~ "/" ~ (atsu.ATISInstances[2].type == 0 ? "ARR" : "DEP")); me["Simple_L3"].setFont(default); - me["Simple_L1"].setColor(WHITE); + me["Simple_L3"].setColor(WHITE); me["Simple_L3_Arrow"].show(); } else { me["Simple_L3"].setText(" [ ]/[ ]"); me["Simple_L3"].setFont(symbol); - me["Simple_L1"].setColor(BLUE); + me["Simple_L3"].setColor(BLUE); me["Simple_L3_Arrow"].hide(); } + + if (atsu.ATISInstances[3].station != nil) { + me["Simple_L4"].setText(" " ~ atsu.ATISInstances[3].station ~ "/" ~ (atsu.ATISInstances[3].type == 0 ? "ARR" : "DEP")); + me["Simple_L4"].setFont(default); + me["Simple_L4"].setColor(WHITE); + me["Simple_L4_Arrow"].show(); + } else { + me["Simple_L4"].setText(" [ ]/[ ]"); + me["Simple_L4"].setFont(symbol); + me["Simple_L4"].setColor(BLUE); + me["Simple_L4_Arrow"].hide(); + } + + if (atsu.ATISInstances[0].sent) { + me["ATISSend1"].hide(); + } else { + me["ATISSend1"].show(); + } + + if (atsu.ATISInstances[1].sent) { + me["ATISSend2"].hide(); + } else { + me["ATISSend2"].show(); + } + + if (atsu.ATISInstances[2].sent) { + me["ATISSend3"].hide(); + } else { + me["ATISSend3"].show(); + } + + if (atsu.ATISInstances[3].sent) { + me["ATISSend4"].hide(); + } else { + me["ATISSend4"].show(); + } } else if (page == "NOTIFICATION") { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 365d0760..89be56b3 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 864" version="1.1" id="svg2" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + inkscape:version="0.92.4 (5da689c313, 2019-01-14)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1440" - inkscape:window-height="819" + inkscape:window-width="1366" + inkscape:window-height="705" id="namedview371" showgrid="true" - inkscape:zoom="0.78947164" - inkscape:cx="929.63178" - inkscape:cy="751.57487" - inkscape:window-x="481" - inkscape:window-y="23" - inkscape:window-maximized="0" - inkscape:current-layer="WIND" + inkscape:zoom="17.863704" + inkscape:cx="1222.2874" + inkscape:cy="575.96236" + inkscape:window-x="-8" + inkscape:window-y="-8" + inkscape:window-maximized="1" + inkscape:current-layer="PERFAPPR" showguides="false" inkscape:snap-global="false" units="px" @@ -1016,7 +1016,7 @@ inkscape:label="#g4241" id="g4241"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1103,7 +1103,7 @@ x="177.72771" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" xml:space="preserve"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1235,7 +1235,7 @@ inkscape:label="arrow5L" id="arrow5L"> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -2617,7 +2617,7 @@ id="tspan1088" x="478.87796" y="171.04486" - style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= = + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> = @@ -2833,7 +2833,7 @@ sodipodi:nodetypes="cc" inkscape:connector-curvature="0" id="path1243" - d="m 998.71909,284.70793 -28.52965,0" + d="M 998.71909,284.70793 H 970.18944" style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 33fa5c7e..3e5c8f9a 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -173,7 +173,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 ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE") ]), 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"), diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 0d060c4e..fc32ee21 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -286,6 +286,63 @@ var lskbutton = func(btn, i) { pageNode[i].setValue("WEATHERREQ"); } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(1); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.depApt != "") { + atsu.ATISInstances[0].newStation(fmgc.FMGCInternal.depApt); + } else { + atsu.ATISInstances[0].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[0].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[0].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[0].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[0].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + if (str[1] == "DEP") { + atsu.ATISInstances[0].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[0].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[0].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -358,6 +415,63 @@ var lskbutton = func(btn, i) { canvas_mcdu.myReceivedMessages[i].leftKey(2); } else if (page == "DATAMODE") { atsu.ATIS.server = 0; + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.arrApt != "") { + atsu.ATISInstances[1].newStation(fmgc.FMGCInternal.arrApt); + } else { + atsu.ATISInstances[1].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[1].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[1].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[1].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[1].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + if (str[1] == "DEP") { + atsu.ATISInstances[1].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[1].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[0].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -413,6 +527,63 @@ var lskbutton = func(btn, i) { canvas_mcdu.myReceivedMessages[i].leftKey(3); } else if (page == "DATAMODE") { atsu.ATIS.server = 1; + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + if (fmgc.FMGCInternal.altAirportSet) { + atsu.ATISInstances[2].newStation(fmgc.FMGCInternal.altAirport); + } else { + atsu.ATISInstances[2].station = nil; + } + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[2].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[2].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[2].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[2].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + if (str[1] == "DEP") { + atsu.ATISInstances[2].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[2].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[2].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -461,6 +632,59 @@ var lskbutton = func(btn, i) { } } else if (page == "RECEIVEDMSGS") { canvas_mcdu.myReceivedMessages[i].leftKey(4); + } else if (page == "ATIS") { + var scratchpad = mcdu_scratchpad.scratchpads[i].scratchpad; + if (scratchpad == "CLR") { + atsu.ATISInstances[3].station = nil; + mcdu_scratchpad.scratchpads[i].empty(); + } elsif (find("/", scratchpad) != -1) { + var str = split("/", scratchpad); + if (size(str[0]) > 0 and size(str[1]) == 0) { + var result = atsu.ATISInstances[3].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } elsif (size(str[0]) == 0 and size(str[1]) > 0) { + if (str[1] == "DEP") { + atsu.ATISInstances[3].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[3].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } elsif (size(str[0]) > 0 and size(str[1]) > 0) { + var result = atsu.ATISInstances[3].newStation(str[0]); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + if (str[1] == "DEP") { + atsu.ATISInstances[3].type = 1; + } elsif (str[1] == "ARR") { + atsu.ATISInstances[3].type = 0; + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } + } else { + var result = atsu.ATISInstances[3].newStation(scratchpad); + if (result == 2) { + mcdu_message(i, "NOT IN DATA BASE"); + } elsif (result == 1) { + mcdu_message(i, "NOT ALLOWED"); + } elsif (result == 0) { + mcdu_scratchpad.scratchpads[i].empty(); + } + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -671,6 +895,12 @@ var rskbutton = func(btn, i) { pageNode[i].setValue("WEATHERREQ"); } else if (page == "ATCMENU2") { pageNode[i].setValue("ATIS"); + } else if (page == "ATIS") { + if (atsu.ATISInstances[0].station != nil and atsu.ATISInstances[0].sent != 1) { + atsu.ATISInstances[0].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -704,6 +934,12 @@ var rskbutton = func(btn, i) { pageNode[i].setValue("WEATHERREQ"); } else if (page == "DATAMODE") { atsu.AOC.server = 0; + } else if (page == "ATIS") { + if (atsu.ATISInstances[1].station != nil and atsu.ATISInstances[1].sent != 1) { + atsu.ATISInstances[1].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -743,6 +979,12 @@ var rskbutton = func(btn, i) { pageNode[i].setValue("RECEIVEDMSGS"); } else if (page == "DATAMODE") { atsu.AOC.server = 1; + } else if (page == "ATIS") { + if (atsu.ATISInstances[2].station != nil and atsu.ATISInstances[2].sent != 1) { + atsu.ATISInstances[2].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } @@ -803,6 +1045,12 @@ var rskbutton = func(btn, i) { canvas_mcdu.myArrival[i].arrPushbuttonRight(4); } else if (page == "F-PLNA" or page == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonRight(4); + } else if (page == "ATIS") { + if (atsu.ATISInstances[3].station != nil and atsu.ATISInstances[3].sent != 1) { + atsu.ATISInstances[3].sendReq(i); + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else { mcdu_message(i, "NOT ALLOWED"); } diff --git a/Nasal/Systems/Comm/Notification.nas b/Nasal/Systems/Comm/Notification.nas index ca555e71..49d091da 100644 --- a/Nasal/Systems/Comm/Notification.nas +++ b/Nasal/Systems/Comm/Notification.nas @@ -234,11 +234,11 @@ var ATIS = { ATIS.station = nil; ATIS.lastATIS = nil; ATIS.sent = 0; - ATIS.sentTime = nil; ATIS.received = 0; ATIS.receivedTime = nil; ATIS.receivedCode = nil; ATIS.server = 0; + ATIS.type = 0; # 0 = arr, 1 = dep return ATIS; }, newStation: func(airport) { @@ -259,10 +259,8 @@ var ATIS = { } me.sent = 1; me.received = 0; - var sentTime = left(getprop("/sim/time/gmt-string"), 5); - me.sentTime = split(":", sentTime)[0] ~ "." ~ split(":", sentTime)[1] ~ "Z"; - result = me.fetchATIS(atsu.ATIS.station, i); + result = me.fetchATIS(me.station, i); if (result == 0) { return 0; } elsif (result == 1) { @@ -298,22 +296,58 @@ var ATIS = { }, processATIS: func(r, i) { var raw = r.response; - if (find("combined", raw)) { + if (r.response == "FBW_ERROR: D-ATIS not available at this airport") { + me.received = 0; + me.sent = 0; + mcdu.mcdu_message(i,"NO D-ATIS AVAILABLE"); + return; + } + if (find("combined", raw) != -1) { raw = split('{"combined":"', raw)[1]; raw = split('"}', raw)[0]; } else { - raw = split('{"arr":"', raw)[1]; - raw = split('","dep":', raw)[0]; + if (me.type == 0) { + raw = split('{"arr":"', raw)[1]; + raw = split('","dep":', raw)[0]; + } else { + raw = split('","dep":"', raw)[1]; + raw = split('"}', raw)[0]; + } + } + var code = nil; + if (find("INFO ", raw) != -1) { + code = split("INFO ", raw)[1]; + code = split(" ", code)[0]; + me.receivedCode = code; + } else if (find("information ", raw) != -1) { + code = split("information ", raw)[1]; + code = split(" ", code)[0]; + me.receivedCode = code; + } + var time = nil; + if (find("Time ", raw) != -1) { + time = split("Time ", raw)[1]; + time = split(" ", time)[0]; + } else if (find("TIME ", raw) != -1) { + time = split("TIME ", raw)[1]; + time = split(" ", time)[0]; + } else if (find("Z.", raw) != -1) { + time = split("Z.", raw)[0]; + time = right(time, 4); + } else if (find("Z SPECIAL", raw) != -1) { + time = split("Z SPECIAL", raw)[0]; + time = right(time, 4); + } + if (size(time) == 3) { + time ~= " "; } - me.lastATIS = raw; settimer(func() { + me.sent = 0; me.received = 1; - mcdu.mcdu_message(i, "WX UPLINK"); - - var receivedTime = left(getprop("/sim/time/gmt-string"), 5); - me.receivedTime = split(":", receivedTime)[0] ~ "." ~ split(":", receivedTime)[1] ~ "Z"; - var message = mcdu.ACARSMessage.new(me.receivedTime, me.lastATIS); - mcdu.ReceivedMessagesDatabase.addMessage(message); - }, math.max(rand()*10, 2.25)); + me.receivedTime = time ~ "Z"; + me.lastATIS = raw; + }, math.max(rand()*10, 4.5)); }, -}; \ No newline at end of file +}; + +var ATISInstances = [ATIS.new(), ATIS.new(), ATIS.new(), ATIS.new()]; \ No newline at end of file