1
0
Fork 0

Set a default DTO target on AirportInfo page.

This commit is contained in:
Stuart Buchanan 2018-01-30 20:59:16 +00:00
parent 626cdd042a
commit 11d811e93d
3 changed files with 24 additions and 5 deletions

View file

@ -72,6 +72,9 @@ var AirportInfoController =
if (apt != nil) {
me.airport = id;
# Set up the default ID if the user presses DTO.
me.setDefaultDTOWayPoint(id);
me.info = apt;
}

View file

@ -13,7 +13,7 @@ new : func (device)
obj._transmitter = emesary.GlobalTransmitter;
obj._registered = 0;
obj._device = device;
obj._currentDTO = "";
obj._defaultDTO = "";
# List of recently use waypoints
obj._recentWaypoints = std.Vector.new();
@ -173,13 +173,13 @@ setDirectTo : func(param)
# Return the current DTO location to use
getCurrentDTO : func()
{
return me._currentDTO;
return me._defaultDTO;
},
# Set the current DTO location to use
setCurrentDTO : func(id)
setDefaultDTO : func(id)
{
me._currentDTO = id;
me._defaultDTO = id;
},
RegisterWithEmesary : func()
@ -237,6 +237,10 @@ RegisterWithEmesary : func()
controller.setDirectTo(notification.EventParameter.Value);
return emesary.Transmitter.ReceiptStatus_Finished;
}
if (id == "SetDefaultDTO") {
controller.setDefaultDTO(notification.EventParameter.Value);
return emesary.Transmitter.ReceiptStatus_Finished;
}
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;

View file

@ -15,7 +15,6 @@ new : func (page)
obj._transmitter = emesary.GlobalTransmitter;
obj._registered = 0;
return obj;
},
@ -175,6 +174,19 @@ DeRegisterWithEmesary : func()
me._registered = 0;
},
# Set up the default waypoint to use if the DirectTo button is pressed
setDefaultDTOWayPoint : func(id)
{
# Use Emesary to set the default DTO waypoint
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
notifications.PFDEventNotification.NavData,
{Id: "SetDefaultDTO", Value: id});
var response = me._transmitter.NotifyAll(notification);
if (me._transmitter.IsFailed(response)) print("Failed to set Default DTO waypoint");
},
};