1
0
Fork 0

CPDLC: add some initial work. Once it's merged to -next, I can then proceed to implement it better

This commit is contained in:
legoboyvdlp R 2020-11-29 21:41:52 +00:00
parent d6d654afbf
commit acc4b5c381
2 changed files with 35 additions and 17 deletions

View file

@ -11,18 +11,18 @@ var CPDLCmessage = {
},
};
makeNewDictionaryItem(CPDLCmessage.new("CONNECT",0), "CONNECT");
var CPDLCnewMsgFlag = props.globals.getNode("/network/cpdlc/rx/new-message");
setlistener("/network/cpdlc/rx/new-message", func() {
if (CPDLCnewMsgflag.getBoolValue()) {
# add to DCDU message buffer
# make alert on DCDU
# add DCDU prompts (wilco, etc)
CPDLCnewMsgFlag.setBoolValue(0);
}
}, 0, 0);
makeNewDictionaryItem(CPDLCmessage.new("WILCO",0), "WILCO");
makeNewDictionaryItem(CPDLCmessage.new("UNABLE",0), "UNABLE");
makeNewDictionaryItem(CPDLCmessage.new("STANDBY",0), "STANDBY");
makeNewDictionaryItem(CPDLCmessage.new("ROGER",0), "ROGER");
makeNewDictionaryItem(CPDLCmessage.new("AFFIRM",0), "AFFIRM");
makeNewDictionaryItem(CPDLCmessage.new("NEGATIVE",0), "NEGATIVE");
makeNewDictionaryItem(CPDLCmessage.new("REQUEST ALTITUDE",0), "REQUEST ALTITUDE");
# issue fgcommand with cpdlc message to send
var freeText = {
new: func(index) {
@ -32,6 +32,23 @@ var freeText = {
},
selection: 9,
changed: 0,
getText: func() {
if (me.selection == 0) {
return "DUE TO A/C PERFORMANCE";
} elsif (me.selection == 1) {
return "DUE TO WEATHER";
} elsif (me.selection == 2) {
return "DUE TO TURBULENCE";
} elsif (me.selection == 3) {
return "DUE TO MEDICAL";
} elsif (me.selection == 4) {
return "DUE TO TECHNICAL";
} elsif (me.selection == 5) {
return "AT PILOTS DISCRETION";
} else {
return nil;
}
}
};
var freeTexts = [freeText.new(0), freeText.new(1)];

View file

@ -20,16 +20,17 @@ var notificationSystem = {
notifyAirport: nil,
hasNotified: 0,
inputAirport: func(airport) {
if (!fmgc.FMGCInternal.flightNumSet or size(airport) != 4) { return 1; }
var airportList = findAirportsByICAO(airport);
if (size(airportList) == 0) { return 2; }
#if (!fmgc.FMGCInternal.flightNumSet or size(airport) != 4) { return 1; }
#var airportList = findAirportsByICAO(airport);
#if (size(airportList) == 0) { return 2; }
if (me.hasNotified) { me.hasNotified = 0; }
me.notifyAirport = airportList[0].id;
me.notifyAirport = airport;
return 0;
},
notify: func() {
if (me.notifyAirport != nil) {
me.hasNotified = 1;
fgcommand("cpdlc-connect", props.Node.new( {atc: me.notifyAirport} ));
# todo - send notification to ATC
return 0;
} else {
@ -37,9 +38,9 @@ var notificationSystem = {
}
},
automaticTransfer: func(station) {
var airportList = findAirportsByICAO(station);
if (size(airportList) == 0) { return 2; }
me.notifyAirport = airportList[0].id;
#var airportList = findAirportsByICAO(station);
#if (size(airportList) == 0) { return 2; }
me.notifyAirport = station;
return 0;
},
};