1
0
Fork 0

NAV/COM Radio support

Add NAV/COM 8.33MHz radio support and integration
with the property trees for radios.

Also general cleanup.
This commit is contained in:
Stuart Buchanan 2018-01-13 18:53:06 +00:00
parent b45ae04c15
commit cbb281759c
87 changed files with 962 additions and 2587 deletions

View file

@ -10,37 +10,7 @@ var ActiveFlightPlanNarrow =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.ActiveFlightPlanNarrowController.new(obj, svg);
@ -63,4 +33,11 @@ var ActiveFlightPlanNarrow =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var ActiveFlightPlanNarrowController =
new : func (page, svg)
{
var obj = {
parents : [ ActiveFlightPlanNarrowController ],
parents : [ ActiveFlightPlanNarrowController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var ActiveFlightPlanNarrowController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var ActiveFlightPlanNarrowController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var ActiveFlightPlanNarrowController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var ActiveFlightPlanWide =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.ActiveFlightPlanWideController.new(obj, svg);
@ -63,4 +33,11 @@ var ActiveFlightPlanWide =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var ActiveFlightPlanWideController =
new : func (page, svg)
{
var obj = {
parents : [ ActiveFlightPlanWideController ],
parents : [ ActiveFlightPlanWideController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var ActiveFlightPlanWideController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var ActiveFlightPlanWideController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var ActiveFlightPlanWideController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var AirportApproach =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.AirportApproachController.new(obj, svg);
@ -63,4 +33,11 @@ var AirportApproach =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var AirportApproachController =
new : func (page, svg)
{
var obj = {
parents : [ AirportApproachController ],
parents : [ AirportApproachController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var AirportApproachController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var AirportApproachController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var AirportApproachController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var AirportArrival =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.AirportArrivalController.new(obj, svg);
@ -63,4 +33,11 @@ var AirportArrival =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var AirportArrivalController =
new : func (page, svg)
{
var obj = {
parents : [ AirportArrivalController ],
parents : [ AirportArrivalController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var AirportArrivalController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var AirportArrivalController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var AirportArrivalController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var AirportDeparture =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.AirportDepartureController.new(obj, svg);
@ -63,4 +33,11 @@ var AirportDeparture =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var AirportDepartureController =
new : func (page, svg)
{
var obj = {
parents : [ AirportDepartureController ],
parents : [ AirportDepartureController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var AirportDepartureController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var AirportDepartureController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var AirportDepartureController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var AirportDirectory =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.AirportDirectoryController.new(obj, svg);
@ -63,4 +33,11 @@ var AirportDirectory =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var AirportDirectoryController =
new : func (page, svg)
{
var obj = {
parents : [ AirportDirectoryController ],
parents : [ AirportDirectoryController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var AirportDirectoryController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var AirportDirectoryController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var AirportDirectoryController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -99,38 +99,7 @@ var AirportInfo =
obj.controller = fg1000.AirportInfoController.new(obj, svg);
# Softkey menus
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
return obj;
},
@ -285,4 +254,10 @@ var AirportInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
# Softkey menus
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -33,9 +33,6 @@ var AirportInfoController =
obj.crsrToggle = 0;
obj.current_zoom = 7;
# Emesary
obj._recipient = nil;
# Initial airport is our current location.
var current_apt = airportinfo("airport");
obj.setAirport(current_apt.id);
@ -103,7 +100,7 @@ var AirportInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd._pageGroupController.handleFMSInner(value);
return me.page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -111,7 +108,7 @@ var AirportInfoController =
me.page.moveCRSR(value);
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd._pageGroupController.handleFMSOuter(value);
return me.page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {

View file

@ -10,37 +10,7 @@ var AirportWeather =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.AirportWeatherController.new(obj, svg);
@ -63,4 +33,11 @@ var AirportWeather =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var AirportWeatherController =
new : func (page, svg)
{
var obj = {
parents : [ AirportWeatherController ],
parents : [ AirportWeatherController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var AirportWeatherController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var AirportWeatherController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var AirportWeatherController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Checklist1 =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.Checklist1Controller.new(obj, svg);
@ -63,4 +33,11 @@ var Checklist1 =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var Checklist1Controller =
new : func (page, svg)
{
var obj = {
parents : [ Checklist1Controller ],
parents : [ Checklist1Controller, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var Checklist1Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var Checklist1Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var Checklist1Controller =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Checklist2 =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.Checklist2Controller.new(obj, svg);
@ -63,4 +33,11 @@ var Checklist2 =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var Checklist2Controller =
new : func (page, svg)
{
var obj = {
parents : [ Checklist2Controller ],
parents : [ Checklist2Controller, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var Checklist2Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var Checklist2Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var Checklist2Controller =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Checklist3 =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.Checklist3Controller.new(obj, svg);
@ -63,4 +33,11 @@ var Checklist3 =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var Checklist3Controller =
new : func (page, svg)
{
var obj = {
parents : [ Checklist3Controller ],
parents : [ Checklist3Controller, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var Checklist3Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var Checklist3Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var Checklist3Controller =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Checklist4 =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.Checklist4Controller.new(obj, svg);
@ -63,4 +33,11 @@ var Checklist4 =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var Checklist4Controller =
new : func (page, svg)
{
var obj = {
parents : [ Checklist4Controller ],
parents : [ Checklist4Controller, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var Checklist4Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var Checklist4Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var Checklist4Controller =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Checklist5 =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.Checklist5Controller.new(obj, svg);
@ -63,4 +33,11 @@ var Checklist5 =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var Checklist5Controller =
new : func (page, svg)
{
var obj = {
parents : [ Checklist5Controller ],
parents : [ Checklist5Controller, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var Checklist5Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var Checklist5Controller =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var Checklist5Controller =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var FlightPlanCatalog =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.FlightPlanCatalogController.new(obj, svg);
@ -63,4 +33,11 @@ var FlightPlanCatalog =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var FlightPlanCatalogController =
new : func (page, svg)
{
var obj = {
parents : [ FlightPlanCatalogController ],
parents : [ FlightPlanCatalogController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var FlightPlanCatalogController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var FlightPlanCatalogController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var FlightPlanCatalogController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var GPSStatus =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.GPSStatusController.new(obj, svg);
@ -63,4 +33,11 @@ var GPSStatus =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var GPSStatusController =
new : func (page, svg)
{
var obj = {
parents : [ GPSStatusController ],
parents : [ GPSStatusController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var GPSStatusController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var GPSStatusController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var GPSStatusController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -1,4 +1,9 @@
# NavCom Interface using Emesary for a simple dual Nav/Com system using standard properties
#
# This maps properties to Emesary Messages that will be publishes using the
#
# notifications.PFDEventNotification.NavComData
#
var GenericNavComPublisher =
{
new : func () {
@ -9,7 +14,7 @@ var GenericNavComPublisher =
],
};
# Hack to handle cases where there is no selected COMM or NAV frequency
# Hack to handle cases where there is no selected Com or NAV frequency
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
@ -34,12 +39,16 @@ var GenericNavComPublisher =
obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/serviceable");
obj.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume");
obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable");
obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id");
obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/serviceable");
obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume");
obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
obj.addPropMap("NavSelected", "/instrumentation/nav-selected");

View file

@ -0,0 +1,59 @@
# NavCom Interface using Emesary for a simple dual Nav/Com system using standard properties
# This updates the properties from Emesary messages.
var GenericNavComUpdater =
{
new : func (device) {
var obj = {
parents : [
GenericNavComUpdater,
PropertyUpdater.new(
device,
notifications.PFDEventNotification.DefaultType,
notifications.PFDEventNotification.NavComData
)
],
};
# Hack to handle cases where there is no selected COMM or NAV frequency
if (getprop("/instrumentation/com-selected") == nil) setprop("/instrumentation/com-selected", 1);
if (getprop("/instrumentation/nav-selected") == nil) setprop("/instrumentation/nav-selected", 1);
obj.addPropMap("Comm1SelectedFreq", "/instrumentation/comm/frequencies/selected-mhz");
obj.addPropMap("Comm1StandbyFreq", "/instrumentation/comm/frequencies/standby-mhz");
obj.addPropMap("Comm1AirportID", "/instrumentation/comm/airport-id");
obj.addPropMap("Comm1StationName", "/instrumentation/comm/station-name");
obj.addPropMap("Comm1StationType", "/instrumentation/comm/station-type");
obj.addPropMap("Comm1Volume", "/instrumentation/comm/volume");
obj.addPropMap("Comm1Serviceable", "/instrumentation/comm/serviceable");
obj.addPropMap("Comm2SelectedFreq", "/instrumentation/comm[1]/frequencies/selected-mhz");
obj.addPropMap("Comm2StandbyFreq", "/instrumentation/comm[1]/frequencies/standby-mhz");
obj.addPropMap("Comm2AirportID", "/instrumentation/comm[1]/airport-id");
obj.addPropMap("Comm2StationName", "/instrumentation/comm[1]/station-name");
obj.addPropMap("Comm2StationType", "/instrumentation/comm[1]/station-type");
obj.addPropMap("Comm2Volume", "/instrumentation/comm[1]/volume");
obj.addPropMap("Comm2Serviceable", "/instrumentation/comm[1]/serviceable");
obj.addPropMap("CommSelected", "/instrumentation/com-selected");
obj.addPropMap("Nav1SelectedFreq", "/instrumentation/nav/frequencies/selected-mhz");
obj.addPropMap("Nav1StandbyFreq", "/instrumentation/nav/frequencies/standby-mhz");
obj.addPropMap("Nav1ID", "/instrumentation/nav/nav-id");
obj.addPropMap("Nav1Volume", "/instrumentation/nav/nav-volume");
obj.addPropMap("Nav1AudioID", "/instrumentation/nav/audio-btn");
obj.addPropMap("Nav1Serviceable", "/instrumentation/nav/operable");
obj.addPropMap("Nav2SelectedFreq", "/instrumentation/nav[1]/frequencies/selected-mhz");
obj.addPropMap("Nav2StandbyFreq", "/instrumentation/nav[1]/frequencies/standby-mhz");
obj.addPropMap("Nav2ID", "/instrumentation/nav[1]/nav-id");
obj.addPropMap("Nav2Volume", "/instrumentation/nav[1]/nav-volume");
obj.addPropMap("Nav2AudioID", "/instrumentation/nav[1]/audio-btn");
obj.addPropMap("Nav2Serviceable", "/instrumentation/nav[1]/operable");
obj.addPropMap("NavSelected", "/instrumentation/nav-selected");
return obj;
},
};

View file

@ -8,7 +8,6 @@
var PropertyUpdater =
{
PropMap : {
new : func(name, property)
{
@ -20,33 +19,42 @@ var PropertyUpdater =
getName : func() { return me._name; },
getValue : func() { return me._prop.getValue(); },
setValue : func(val) { me._prop.setValue(val); },
},
new : func (device, notificationType, eventID, transmitter = nil) {
new : func (device, notificationType, eventID) {
var obj = {
parents : [ Interface ],
parents : [ PropertyUpdater ],
_device : device,
_notificationType : notificationType,
_transmitter : transmitter,
_recipient : recipient,
_eventID : eventID,
_recipient : nil,
_transmitter : nil,
_registered : 0,
_propmaps : {},
};
if (obj._transmitter == nil) obj._transmitter = emesary.GlobalTransmitter;
obj._transmitter = emesary.GlobalTransmitter;
return obj;
},
addPropMap : func(name, prop) {
me._propmaps[name] = PropertyPublisher.PropMap.new(name, prop);
me._propmaps[name] = PropertyUpdater.PropMap.new(name, prop);
},
handleNotificationEvent : func(eventParameter) {
handleNotificationEvent : func(eventParameters) {
var retval = emesary.Transmitter.ReceiptStatus_NotProcessed;
foreach(var name; keys(eventParameters)) {
var value = eventParameters[name];
if (me._propmaps[name] != nil) {
me._propmaps[name].setValue(eventParameters[name])
if (me._propmaps[name].getValue() != value) {
# Only update on a true change. Otherwise if there is a Publisher
# on this property, we risk creating a never ending loop between
# the Publisher and this Updater
me._propmaps[name].setValue(value);
}
retval = emesary.Transmitter.ReceiptStatus_OK;
}
}
@ -57,30 +65,30 @@ var PropertyUpdater =
RegisterWithEmesary : func(){
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("PropertyUpdater_" ~ me._page.device.designation);
me._recipient = emesary.Recipient.new("PropertyUpdater");
var pfd_obj = me._device;
var notificationtype = me._notificationType;
var eventID = me._eventID;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == me._notificationType) {
if (notification.Event_Id == me._eventID
and notification.NotificationType == notificationtype) {
if (notification.Event_Id == eventID
and notification.EventParameter != nil)
{
return me.handleNotificationEvent(notification.EventParameter);
return controller.handleNotificationEvent(notification.EventParameter);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
me._transmitter.Register(me._recipient);
me._registered = 1;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
if (me._registered == 1) me._transmitter.DeRegister(me._recipient);
me._registered = 0;
},
start : func() {

View file

@ -10,37 +10,7 @@ var IntersectionInfo =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.IntersectionInfoController.new(obj, svg);
@ -63,4 +33,11 @@ var IntersectionInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var IntersectionInfoController =
new : func (page, svg)
{
var obj = {
parents : [ IntersectionInfoController ],
parents : [ IntersectionInfoController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var IntersectionInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var IntersectionInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var IntersectionInfoController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -18,7 +18,7 @@ var MFDPages = [
"TrafficMap",
"Stormscope",
"WeatherDataLink",
"TAWS",
"TAWSB",
"AirportInfo",
"AirportDirectory",
"AirportDeparture",
@ -103,7 +103,7 @@ var MFD =
# Controller for the header and display on the bottom left which allows selection
# of page groups and individual pages using the FMS controller.
obj.Surround = fg1000.Surround.new(obj, myCanvas, obj._MFDDevice, obj._svg);
obj._pageGroupController = obj.Surround.controller;
obj.SurroundController = obj.Surround.controller;
# Engine Information System. A special case as it's always displayed on the MFD.
obj.EIS = obj.Surround.addPage("EIS", fg1000.EIS.new(obj, myCanvas, obj._MFDDevice, obj._svg));
@ -139,11 +139,14 @@ var MFD =
return obj;
},
getDevice : func () {
return me._MFDDevice;
},
del: func()
{
me._MFDDevice.current_page.offdisplay();
me._MFDDevice.DeRegisterWithEmesary();
me._pageGroupController.del();
me.SurroundController.del();
},
setPageTitle: func(title)

View file

@ -22,12 +22,13 @@ new : func (page)
# Default handlers for all the Fascia hardkeys. These should be over-ridden
# as required by specific page function.
handleNavVol : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleNavVolToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleNavFreqTransfer : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleNavOuter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleNavInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
#
handleNavVol : func (value) { return me.page.mfd.SurroundController.handleNavVol(value); },
handleNavVolToggle : func (value) { return me.page.mfd.SurroundController.handleNavVolToggle(value); },
handleNavFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleNavFreqTransfer(value); },
handleNavOuter : func (value) { return me.page.mfd.SurroundController.handleNavOuter(value); },
handleNavInner : func (value) { return me.page.mfd.SurroundController.handleNavInner(value); },
handleNavToggle : func (value) { return me.page.mfd.SurroundController.handleNavToggle(value); },
handleHeading : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleHeadingPress : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
@ -41,15 +42,15 @@ handleBaro : func (value) { return emesary.Transmitter.ReceiptStatus_NotPro
handleCRS : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleCRSCenter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleComOuter : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleComInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleComToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleComOuter : func (value) { return me.page.mfd.SurroundController.handleComOuter(value); },
handleComInner : func (value) { return me.page.mfd.SurroundController.handleComInner(value); },
handleComToggle : func (value) { return me.page.mfd.SurroundController.handleComToggle(value); },
handleFreqTransfer : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleFreqTransferHold : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; }, # Auto-tunes to 121.2 when pressed for 2 seconds
handleComFreqTransfer : func (value) { return me.page.mfd.SurroundController.handleComFreqTransfer(value); },
handleComFreqTransferHold : func (value) { return me.page.mfd.SurroundController.handleComFreqTransferHold(value); }, # Auto-tunes to 121.2 when pressed for 2 seconds
handleComVol : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleComVolToggle : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },,
handleComVol : func (value) { return me.page.mfd.SurroundController.handleComVol(value); },
handleComVolToggle : func (value) { return me.page.mfd.SurroundController.handleComVolToggle(value); },
handleDTO : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleFPL : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
@ -57,8 +58,8 @@ handleClear : func (value) { return emesary.Transmitter.ReceiptStatus_NotPro
handleClearHold : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
# By default, the FMS knobs will select a new page.
handleFMSOuter : func (value) { return me.page.mfd._pageGroupController.handleFMSOuter(value); },
handleFMSOuter : func (value) { return me.page.mfd._pageGroupController.handleFMSInner(value); },
handleFMSOuter : func (value) { return me.page.mfd.SurroundController.handleFMSOuter(value); },
handleFMSInner : func (value) { return me.page.mfd.SurroundController.handleFMSInner(value); },
handleCRSR : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
handleMenu : func (value) { return emesary.Transmitter.ReceiptStatus_NotProcessed; },
@ -71,8 +72,8 @@ handleAltInner : func (value) { return emesary.Transmitter.ReceiptStatus_NotProc
RegisterWithEmesary : func()
{
if (me._recipient == nil){
me._recipient = emesary.Recipient.new(me.page.pageName ~ "Controller_" ~ me.page.device.designation);
var pfd_obj = me.page.device;
me._recipient = emesary.Recipient.new(me._page.pageName ~ "Controller_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
@ -91,7 +92,7 @@ RegisterWithEmesary : func()
if (id == fg1000.FASCIA.NAV_FREQ_TRANSFER) return controller.handleNavFreqTransfer(value);
if (id == fg1000.FASCIA.NAV_OUTER) return controller.handleNavOuter(value);
if (id == fg1000.FASCIA.NAV_INNER) return controller.handleNavInner(value);
if (id == fg1000.FASCIA.NAV_TOGGLE) return controller.handleToggle(value);
if (id == fg1000.FASCIA.NAV_TOGGLE) return controller.handleNavToggle(value);
if (id == fg1000.FASCIA.HEADING) return controller.handleHeading(value);
if (id == fg1000.FASCIA.HEADING_PRESS) return controller.handleHeadingPress(value);
@ -109,8 +110,8 @@ RegisterWithEmesary : func()
if (id == fg1000.FASCIA.COM_INNER) return controller.handleComInner(value);
if (id == fg1000.FASCIA.COM_TOGGLE) return controller.handleComToggle(value);
if (id == fg1000.FASCIA.COM_FREQ_TRANSFER) return controller.handleFreqTransfer(value);
if (id == fg1000.FASCIA.COM_FREQ_TRANSFER_HOLD) return controller.handleFreqTransferHold(value); # Auto-tunes to 121.2 when pressed for 2 seconds
if (id == fg1000.FASCIA.COM_FREQ_TRANSFER) return controller.handleComFreqTransfer(value);
if (id == fg1000.FASCIA.COM_FREQ_TRANSFER_HOLD) return controller.handleComFreqTransferHold(value); # Auto-tunes to 121.2 when pressed for 2 seconds
if (id == fg1000.FASCIA.COM_VOL) return controller.handleComVol(value);
if (id == fg1000.FASCIA.COM_VOL_TOGGLE) return controller.handleComVolToggle(value);

View file

@ -10,37 +10,7 @@ var NDBInfo =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NDBInfoController.new(obj, svg);
@ -63,4 +33,11 @@ var NDBInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NDBInfoController =
new : func (page, svg)
{
var obj = {
parents : [ NDBInfoController ],
parents : [ NDBInfoController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NDBInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NDBInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NDBInfoController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -165,18 +165,6 @@ var NavigationMapController =
me.updateVisibility();
},
handleFMSInner : func(value) {
# This page has no use for the FMS knob, so we pass all such
# events to the pageGroupController which displays the page menu in the
# bottom right of the screen
return me.page.mfd._pageGroupController.handleFMSInner(value);
},
handleFMSOuter : func(value) {
# This page has no use for the FMS knob, so we pass all such
# events to the pageGroupController which displays the page menu in the
# bottom right of the screen
return me.page.mfd._pageGroupController.handleFMSOuter(value);
},
handleRange : func(val)
{
var incr_or_decr = (val > 0) ? 1 : -1;

View file

@ -124,7 +124,7 @@ var NearestAirportsController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd._pageGroupController.handleFMSInner(value);
return me.page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -144,7 +144,7 @@ var NearestAirportsController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return me.page.mfd._pageGroupController.handleFMSOuter(value);
return me.page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {

View file

@ -10,37 +10,7 @@ var NearestAirspaces =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestAirspacesController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestAirspaces =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestAirspacesController =
new : func (page, svg)
{
var obj = {
parents : [ NearestAirspacesController ],
parents : [ NearestAirspacesController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestAirspacesController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestAirspacesController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestAirspacesController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var NearestFrequencies =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestFrequenciesController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestFrequencies =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestFrequenciesController =
new : func (page, svg)
{
var obj = {
parents : [ NearestFrequenciesController ],
parents : [ NearestFrequenciesController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestFrequenciesController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestFrequenciesController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestFrequenciesController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var NearestIntersections =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestIntersectionsController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestIntersections =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestIntersectionsController =
new : func (page, svg)
{
var obj = {
parents : [ NearestIntersectionsController ],
parents : [ NearestIntersectionsController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestIntersectionsController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestIntersectionsController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestIntersectionsController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var NearestNDB =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestNDBController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestNDB =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestNDBController =
new : func (page, svg)
{
var obj = {
parents : [ NearestNDBController ],
parents : [ NearestNDBController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestNDBController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestNDBController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestNDBController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var NearestUserWPT =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestUserWPTController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestUserWPT =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestUserWPTController =
new : func (page, svg)
{
var obj = {
parents : [ NearestUserWPTController ],
parents : [ NearestUserWPTController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestUserWPTController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestUserWPTController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestUserWPTController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var NearestVOR =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.NearestVORController.new(obj, svg);
@ -63,4 +33,11 @@ var NearestVOR =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var NearestVORController =
new : func (page, svg)
{
var obj = {
parents : [ NearestVORController ],
parents : [ NearestVORController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var NearestVORController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var NearestVORController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var NearestVORController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var StoredFlightPlan =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.StoredFlightPlanController.new(obj, svg);
@ -63,4 +33,11 @@ var StoredFlightPlan =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var StoredFlightPlanController =
new : func (page, svg)
{
var obj = {
parents : [ StoredFlightPlanController ],
parents : [ StoredFlightPlanController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var StoredFlightPlanController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var StoredFlightPlanController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var StoredFlightPlanController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Stormscope =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.StormscopeController.new(obj, svg);
@ -63,4 +33,11 @@ var Stormscope =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var StormscopeController =
new : func (page, svg)
{
var obj = {
parents : [ StormscopeController ],
parents : [ StormscopeController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var StormscopeController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var StormscopeController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var StormscopeController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -174,6 +174,10 @@ var Surround =
if (name == "Nav1ID") me.setTextElement("Nav1ID", val);
if (name == "Nav2ID") me.setTextElement("Nav2ID", val);
# TODO - COM Volume - display the current volume for 2 seconds in place of the
# standby frequency.
}
},

View file

@ -7,8 +7,20 @@ var SurroundController =
parents : [ SurroundController ],
_recipient : nil,
_page : page,
_comselected : 1,
_navselected : 1,
_com1active : 0.0,
_com1standby : 0.0,
_com2active : 0.0,
_com2standby : 0.0,
_nav1active : 0.0,
_nav1standby : 0.0,
_nav2active : 0.0,
_nav2standby : 0.0,
};
obj.RegisterWithEmesary();
return obj;
},
@ -17,12 +29,297 @@ var SurroundController =
me.DeRegisterWithEmesary();
},
handleNavComData : func(values) {
# pass straight through the to page - we have nothing to do.
me._page.handleNavComData(values);
# Helper function to notify the Emesary bridge of a NavComData update.
sendNavComDataNotification : func(data) {
var notification = notifications.PFDEventNotification.new(
"MFD",
1,
notifications.PFDEventNotification.NavComData,
data);
me.transmitter.NotifyAll(notification);
},
handleNavComData : func(data) {
# Store off particularly important data for control.
if (data["CommSelected"] != nil) me._comselected = data["CommSelected"];
if (data["NavSelected"] != nil) me._navselected = data["NavSelected"];
if (data["Comm1SelectedFreq"] != nil) me._com1active = data["Comm1SelectedFreq"];
if (data["Comm1StandbyFreq"] != nil) me._com1standby = data["Comm1StandbyFreq"];
if (data["Comm2SelectedFreq"] != nil) me._com2active = data["Comm2SelectedFreq"];
if (data["Comm2StandbyFreq"] != nil) me._com2standby = data["Comm2StandbyFreq"];
if (data["Nav1SelectedFreq"] != nil) me._nav1active = data["Nav1SelectedFreq"];
if (data["Nav1StandbyFreq"] != nil) me._nav1standby = data["Nav1StandbyFreq"];
if (data["Nav2SelectedFreq"] != nil) me._nav2active = data["Nav2SelectedFreq"];
if (data["Nav2StandbyFreq"] != nil) me._nav2standby = data["Nav2StandbyFreq"];
# pass through to the page
me._page.handleNavComData(data);
return emesary.Transmitter.ReceiptStatus_OK;
},
#
# Handle the various COM and NAV controls at the top left and top right of the Fascia
#
handleNavVol : func (value) {
var data={};
if (me._navselected == 1) {
data["Nav1Volume"] = value;
} else {
data["Nav2Volume"] = value;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleNavVolToggle : func (value) {
var data={};
if (me._navselected == 1) {
data["Nav1AudioID"] = value;
} else {
data["Nav1AudioID"] = value;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Swap active and standby Nav frequencies. Note that we don't update internal state here - we
# instead pass updated NavComData notification data which will be picked up by the underlying
# updaters to map to properties, and this controller itself.
handleNavFreqTransfer : func (value)
{
var data={};
if (me._navselected == 1) {
data["Nav1SelectedFreq"] = me._nav1standby;
data["Nav1StandbyFreq"] = me._nav1active;
} else {
data["Nav2SelectedFreq"] = me._nav2standby;
data["Nav2StandbyFreq"] = me._nav2active;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Outer Nav dial updates the integer portion of the selected standby
# NAV frequency only, and wrap on limits - leaving the fractional part unchanged.
handleNavOuter : func (value) {
var incr_or_decr = (value > 0) ? 1000.0 : -1000.0;
var data={};
# Determine the new value, wrapping within the limits.
var datakey = "";
var freq = 0;
var old_freq = 0;
if (me._navselected == 1) {
datakey = "Nav1StandbyFreq";
old_freq = me._nav1standby;
} else {
datakey = "Nav2StandbyFreq";
old_freq = me._nav2standby;
}
old_freq = math.round(old_freq * 1000);
freq = old_freq + incr_or_decr;
# Wrap if out of bounds
if (freq > (fg1000.MAX_NAV_FREQ * 1000)) freq = freq - (fg1000.MAX_NAV_FREQ - fg1000.MIN_NAV_FREQ) * 1000;
if (freq < (fg1000.MIN_NAV_FREQ * 1000)) freq = freq + (fg1000.MAX_NAV_FREQ - fg1000.MIN_NAV_FREQ) * 1000;
# Convert back to a frequency to 3 decimal places.
data[datakey] = sprintf("%.3f", freq/1000.0);
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Inner Nav dial updates the fractional portion of the selected standby
# NAV frequency only - leaving the integer part unchanged. Even if it
# increments past 0.975.
handleNavInner : func (value) {
var incr_or_decr = (value > 0) ? 25 : -25;
var data={};
# Determine the new value, wrapping within the limits.
var datakey = "";
var freq = 0;
var old_freq = 0;
if (me._navselected == 1) {
datakey = "Nav1StandbyFreq";
old_freq = me._nav1standby;
} else {
datakey = "Nav2StandbyFreq";
old_freq = me._nav2standby;
}
old_freq = math.round(old_freq * 1000);
freq = old_freq + incr_or_decr;
# Wrap on decimal by handling case where the integer part has changed
if (int(old_freq/1000) < int(freq/1000)) freq = freq - 1000;
if (int(old_freq/1000) > int(freq/1000)) freq = freq + 1000;
data[datakey] = sprintf("%.3f", freq/1000.0);
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Switch between Nav1 and Nav2.
handleNavToggle : func (value)
{
var data={};
if (me._navselected == 1) {
data["NavSelected"] = 2;
} else {
data["NavSelected"] = 1;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Outer COM dial changes the integer value of the standby selected COM
# frequency, wrapping on limits. Leaves the fractional part unchanged
handleComOuter : func (value) {
var incr_or_decr = (value > 0) ? 1000.0 : -1000.0;
var data={};
# Determine the new value, wrapping within the limits.
var datakey = "";
var freq = 0;
var old_freq = 0;
if (me._comselected == 1) {
datakey = "Comm1StandbyFreq";
old_freq = me._com1standby;
} else {
datakey = "Comm2StandbyFreq";
old_freq = me._com2standby;
}
old_freq = math.round(old_freq * 1000);
freq = old_freq + incr_or_decr;
# Wrap if out of bounds
if (freq > (fg1000.MAX_COM_FREQ * 1000)) freq = freq - (fg1000.MAX_COM_FREQ - fg1000.MIN_COM_FREQ) * 1000;
if (freq < (fg1000.MIN_COM_FREQ * 1000)) freq = freq + (fg1000.MAX_COM_FREQ - fg1000.MIN_COM_FREQ) * 1000;
# Convert back to a frequency to 3 decimal places.
data[datakey] = sprintf("%.3f", freq/1000.0);
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Inner COM dial changes the fractional part of the standby selected COM frequency,
# wrapping on limits and leaving the integer part unchanged.
handleComInner : func (value) {
var incr_or_decr = (value > 0) ? 1 : -1;
var data={};
var datakey = "";
var freq = 0;
var old_freq = 0;
if (me._comselected == 1) {
datakey = "Comm1StandbyFreq";
old_freq = me._com1standby;
} else {
datakey = "Comm2StandbyFreq";
old_freq = me._com2standby;
}
old_freq = math.round(old_freq * 1000);
var integer_part = int(old_freq / 1000) * 1000;
var fractional_part = old_freq - integer_part;
# 8.33kHz frequencies are complicated - we need to do a lookup to find
# the current and next frequencies
var idx = 0;
for (var i=0; i < size(fg1000.COM_833_SPACING); i = i + 1) {
if (math.round(fg1000.COM_833_SPACING[i] * 1000) == fractional_part) {
idx = i;
break;
}
}
idx = math.mod(idx + incr_or_decr, size(fg1000.COM_833_SPACING));
freq = integer_part + fg1000.COM_833_SPACING[idx] * 1000;
data[datakey] = sprintf("%.3f", freq/1000.0);
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Switch between COM1 and COM2
handleComToggle : func (value) {
var data={};
if (me._comselected == 1) {
data["CommSelected"] = 2;
} else {
data["CommSelected"] = 1;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Swap active and standby Com frequencies. Note that we don't update internal state here - we
# instead pass updated NavComData notification data which will be picked up by the underlying
# updaters to map to properties, and this controller itself.
handleComFreqTransfer : func (value) {
var data={};
if (me._comselected == 1) {
data["Comm1SelectedFreq"] = me._com1standby;
data["Comm1StandbyFreq"] = me._com1active;
} else {
data["Comm2SelectedFreq"] = me._com2standby;
data["Comm2StandbyFreq"] = me._com2active;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
# Auto-tunes the ACTIVE COM channel to 121.2 when pressed for 2 seconds
handleComFreqTransferHold : func (value) {
var data={};
if (me._comselected == 1) {
data["Comm1SelectedFreq"] = 121.00;
} else {
data["Comm2SelectedFreq"] = 121.00;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleComVol : func (value) {
var data={};
if (me._comselected == 1) {
data["Comm1Volume"] = value;
} else {
data["Comm2Volume"] = value;
}
me.sendNavComDataNotification(data);
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleComVolToggle : func (value) {
},
# These methods are slightly unusual in that they are called by other
# controllers when the CRSR is not active. Hence they aren't referenced
# in the RegisterWithEmesary call below.

View file

@ -10,37 +10,7 @@ var SystemStatus =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.SystemStatusController.new(obj, svg);
@ -63,4 +33,11 @@ var SystemStatus =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var SystemStatusController =
new : func (page, svg)
{
var obj = {
parents : [ SystemStatusController ],
parents : [ SystemStatusController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var SystemStatusController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var SystemStatusController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var SystemStatusController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -1,66 +0,0 @@
# TAWS
var TAWS =
{
new : func (mfd, myCanvas, device, svg)
{
var obj = {
parents : [
TAWS,
MFDPage.new(mfd, myCanvas, device, svg, "TAWS", "MAP - TAWS")
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.controller = fg1000.TAWSController.new(obj, svg);
return obj;
},
offdisplay : func() {
me._group.setVisible(0);
# Reset the menu colours. Shouldn't have to do this here, but
# there's not currently an obvious other location to do so.
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
me.device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
me.controller.offdisplay();
},
ondisplay : func() {
me._group.setVisible(1);
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
};

View file

@ -1,95 +0,0 @@
# TAWS Controller
var TAWSController =
{
new : func (page, svg)
{
var obj = {
parents : [ TAWSController ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
};
return obj;
},
# Input Handling
handleCRSR : func() {
me._crsrToggle = (! me._crsrToggle);
if (me._crsrToggle) {
} else {
me._page.hideCRSR();
}
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleFMSInner : func(value) {
if (me._crsrToggle == 1) {
# Scroll through whatever is the current list
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
if (me._crsrToggle == 1) {
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
if (me._crsrToggle == 1) {
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {
me.RegisterWithEmesary();
},
offdisplay : func() {
me.DeRegisterWithEmesary();
},
};

View file

@ -0,0 +1,43 @@
# TAWSB
var TAWSB =
{
new : func (mfd, myCanvas, device, svg)
{
var obj = {
parents : [
TAWSB,
MFDPage.new(mfd, myCanvas, device, svg, "TAWSB", "MAP - TAWS")
],
};
obj.topMenu(device, obj, nil);
obj.controller = fg1000.TAWSBController.new(obj, svg);
return obj;
},
offdisplay : func() {
me._group.setVisible(0);
# Reset the menu colours. Shouldn't have to do this here, but
# there's not currently an obvious other location to do so.
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
me.device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
me.device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
me.controller.offdisplay();
},
ondisplay : func() {
me._group.setVisible(1);
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -0,0 +1,59 @@
# TAWSB Controller
var TAWSBController =
{
new : func (page, svg)
{
var obj = {
parents : [ TAWSBController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
};
return obj;
},
# Input Handling
handleCRSR : func() {
me._crsrToggle = (! me._crsrToggle);
if (me._crsrToggle) {
} else {
me._page.hideCRSR();
}
return emesary.Transmitter.ReceiptStatus_Finished;
},
handleFMSInner : func(value) {
if (me._crsrToggle == 1) {
# Scroll through whatever is the current list
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
if (me._crsrToggle == 1) {
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
if (me._crsrToggle == 1) {
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {
me.RegisterWithEmesary();
},
offdisplay : func() {
me.DeRegisterWithEmesary();
},
};

View file

@ -1,8 +1,8 @@
# TAWS Options
var TAWSOptions =
# TAWSB Options
var TAWSBOptions =
{
new : func() {
var obj = { parents : [TAWSOptions] };
var obj = { parents : [TAWSBOptions] };
obj.Options= {};
obj.loadOptions();
return obj;

View file

@ -1,8 +1,8 @@
# TAWS Styles
var TAWSStyles =
# TAWSB Styles
var TAWSBStyles =
{
new : func() {
var obj = { parents : [ TAWSStyles ]};
var obj = { parents : [ TAWSBStyles ]};
obj.Styles = {};
obj.loadStyles();
return obj;

View file

@ -4,7 +4,7 @@ var TemplateController =
new : func (page, svg)
{
var obj = {
parents : [ TemplateController ],
parents : [ TemplateController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var TemplateController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var TemplateController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var TemplateController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Template =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.TemplateController.new(obj, svg);
@ -63,4 +33,11 @@ var Template =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -10,37 +10,7 @@ var TripPlanning =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.TripPlanningController.new(obj, svg);
@ -63,4 +33,11 @@ var TripPlanning =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var TripPlanningController =
new : func (page, svg)
{
var obj = {
parents : [ TripPlanningController ],
parents : [ TripPlanningController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var TripPlanningController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var TripPlanningController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var TripPlanningController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var UserWPTInfo =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.UserWPTInfoController.new(obj, svg);
@ -63,4 +33,11 @@ var UserWPTInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var UserWPTInfoController =
new : func (page, svg)
{
var obj = {
parents : [ UserWPTInfoController ],
parents : [ UserWPTInfoController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var UserWPTInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var UserWPTInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var UserWPTInfoController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var Utility =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.UtilityController.new(obj, svg);
@ -63,4 +33,11 @@ var Utility =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var UtilityController =
new : func (page, svg)
{
var obj = {
parents : [ UtilityController ],
parents : [ UtilityController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var UtilityController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var UtilityController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var UtilityController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var VORInfo =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.VORInfoController.new(obj, svg);
@ -63,4 +33,11 @@ var VORInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var VORInfoController =
new : func (page, svg)
{
var obj = {
parents : [ VORInfoController ],
parents : [ VORInfoController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var VORInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var VORInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var VORInfoController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var WeatherDataLink =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.WeatherDataLinkController.new(obj, svg);
@ -63,4 +33,11 @@ var WeatherDataLink =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var WeatherDataLinkController =
new : func (page, svg)
{
var obj = {
parents : [ WeatherDataLinkController ],
parents : [ WeatherDataLinkController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var WeatherDataLinkController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var WeatherDataLinkController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var WeatherDataLinkController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var XMInfo =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.XMInfoController.new(obj, svg);
@ -63,4 +33,11 @@ var XMInfo =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var XMInfoController =
new : func (page, svg)
{
var obj = {
parents : [ XMInfoController ],
parents : [ XMInfoController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var XMInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var XMInfoController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var XMInfoController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -10,37 +10,7 @@ var XMRadio =
],
};
var topMenu = func(device, pg, menuitem) {
pg.clearMenu();
resetMenuColors(device);
device.updateMenus();
};
# Display map toggle softkeys which change color depending
# on whether a particular layer is enabled or not.
var display_toggle = func(device, svg, mi, layer) {
var bg_name = sprintf("SoftKey%d-bg",mi.menu_id);
if (obj.controller.isEnabled(layer)) {
device.svg.getElementById(bg_name).setColorFill(0.5,0.5,0.5);
svg.setColor(0.0,0.0,0.0);
} else {
device.svg.getElementById(bg_name).setColorFill(0.0,0.0,0.0);
svg.setColor(1.0,1.0,1.0);
}
svg.setText(mi.title);
svg.setVisible(1); # display function
};
# Function to undo any colors set by display_toggle when loading a new menu
var resetMenuColors = func(device) {
for(var i = 0; i < 12; i +=1) {
var name = sprintf("SoftKey%d",i);
device.svg.getElementById(name ~ "-bg").setColorFill(0.0,0.0,0.0);
device.svg.getElementById(name).setColor(1.0,1.0,1.0);
}
}
topMenu(device, obj, nil);
obj.topMenu(device, obj, nil);
obj.controller = fg1000.XMRadioController.new(obj, svg);
@ -63,4 +33,11 @@ var XMRadio =
me.mfd.setPageTitle(me.title);
me.controller.ondisplay();
},
topMenu : func(device, pg, menuitem) {
pg.clearMenu();
pg.resetMenuColors();
device.updateMenus();
},
};

View file

@ -4,7 +4,7 @@ var XMRadioController =
new : func (page, svg)
{
var obj = {
parents : [ XMRadioController ],
parents : [ XMRadioController, MFDPageController.new(page) ],
_crsrToggle : 0,
_recipient : nil,
_page : page,
@ -29,7 +29,7 @@ var XMRadioController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSInner(value);
return me._page.mfd.SurroundController.handleFMSInner(value);
}
},
handleFMSOuter : func(value) {
@ -37,7 +37,7 @@ var XMRadioController =
return emesary.Transmitter.ReceiptStatus_Finished;
} else {
# Pass to the page group controller to display and scroll through the page group menu
return me._page.mfd._pageGroupController.handleFMSOuter(value);
return me._page.mfd.SurroundController.handleFMSOuter(value);
}
},
handleEnter : func(value) {
@ -47,42 +47,6 @@ var XMRadioController =
return emesary.Transmitter.ReceiptStatus_NotProcessed;
}
},
RegisterWithEmesary : func(transmitter = nil){
if (transmitter == nil)
transmitter = emesary.GlobalTransmitter;
if (me._recipient == nil){
me._recipient = emesary.Recipient.new("AirportInfoController_" ~ me._page.device.designation);
var pfd_obj = me._page.device;
var controller = me;
me._recipient.Receive = func(notification)
{
if (notification.Device_Id == pfd_obj.device_id
and notification.NotificationType == notifications.PFDEventNotification.DefaultType) {
if (notification.Event_Id == notifications.PFDEventNotification.HardKeyPushed
and notification.EventParameter != nil)
{
var id = notification.EventParameter.Id;
var value = notification.EventParameter.Value;
#printf("Button pressed " ~ id ~ " " ~ value);
if (id == fg1000.FASCIA.FMS_CRSR) return controller.handleCRSR();
if (id == fg1000.FASCIA.FMS_OUTER) return controller.handleFMSOuter(value);
if (id == fg1000.FASCIA.FMS_INNER) return controller.handleFMSInner(value);
if (id == fg1000.FASCIA.ENT) return controller.handleEnter(value);
}
}
return emesary.Transmitter.ReceiptStatus_NotProcessed;
};
}
transmitter.Register(me._recipient);
me.transmitter = transmitter;
},
DeRegisterWithEmesary : func(transmitter = nil){
# remove registration from transmitter; but keep the recipient once it is created.
if (me.transmitter != nil)
me.transmitter.DeRegister(me._recipient);
me.transmitter = nil;
},
# Reset controller if required when the page is displayed or hidden
ondisplay : func() {

View file

@ -36,10 +36,43 @@ var MAP_PARTIAL = {
Y : ((DISPLAY.HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT) / 2 + HEADER_HEIGHT), },
};
# Frequency limits. We're assuming we're on 8.33kHz
var MIN_COM_FREQ = 118.000;
var MAX_COM_FREQ = 137.000;
var COM_833_SPACING = [
0.000, 0.005, 0.010, 0.015, 0.025, 0.030, 0.035, 0.040, 0.050, 0.055, 0.060, 0.065, 0.075, 0.080, 0.085, 0.090,
0.100, 0.105, 0.110, 0.115, 0.125, 0.130, 0.135, 0.140, 0.150, 0.155, 0.160, 0.165, 0.175, 0.180, 0.185, 0.190,
0.200, 0.205, 0.210, 0.215, 0.225, 0.230, 0.235, 0.240, 0.250, 0.255, 0.260, 0.265, 0.275, 0.280, 0.285, 0.290,
0.300, 0.305, 0.310, 0.315, 0.325, 0.330, 0.335, 0.340, 0.350, 0.355, 0.360, 0.365, 0.375, 0.380, 0.385, 0.390,
0.400, 0.405, 0.410, 0.415, 0.425, 0.430, 0.435, 0.440, 0.450, 0.455, 0.460, 0.465, 0.475, 0.480, 0.485, 0.490,
0.500, 0.505, 0.510, 0.515, 0.525, 0.530, 0.535, 0.540, 0.550, 0.555, 0.560, 0.565, 0.575, 0.580, 0.585, 0.590,
0.600, 0.605, 0.610, 0.615, 0.625, 0.630, 0.635, 0.640, 0.650, 0.655, 0.660, 0.665, 0.675, 0.680, 0.685, 0.690,
0.700, 0.705, 0.710, 0.715, 0.725, 0.730, 0.735, 0.740, 0.750, 0.755, 0.760, 0.765, 0.775, 0.780, 0.785, 0.790,
0.800, 0.805, 0.810, 0.815, 0.825, 0.830, 0.835, 0.840, 0.850, 0.855, 0.860, 0.865, 0.875, 0.880, 0.885, 0.890,
0.900, 0.905, 0.910, 0.915, 0.925, 0.930, 0.935, 0.940, 0.950, 0.955, 0.960, 0.965, 0.975, 0.980, 0.985, 0.990,
];
var NAV_SPACING = [
0.000, 0.025, 0.050, 0.075,
0.100, 0.125, 0.150, 0.175,
0.200, 0.225, 0.250, 0.275,
0.300, 0.325, 0.350, 0.375,
0.400, 0.425, 0.450, 0.475,
0.500, 0.525, 0.550, 0.575,
0.600, 0.625, 0.650, 0.675,
0.700, 0.725, 0.750, 0.775,
0.800, 0.825, 0.850, 0.875,
0.900, 0.925, 0.950, 0.975,
];
var MIN_NAV_FREQ = 108.000;
var MAX_NAV_FREQ = 118.000;
# When the CRSR is selecting fields, this is the period for changing the
# cursor color between normal and highlight (defined below)
# Constants for the hard-buttons on the fascia
FASCIA = {
var FASCIA = {
NAV_VOL : 0,
NAV_VOL_TOGGLE : 1,
NAV_FREQ_TRANSFER :2,

View file

@ -4,7 +4,7 @@ use warnings;
my %pages = ("Stormscope" => "MAP - STORMSCOPE",
"WeatherDataLink" => "MAP - WEATHER DATA LINK",
"TAWS" => "MAP - TAWS",
"TAWSB" => "MAP - TAWS",
#"AirportInfo" => "WPT - AIRPORT INFORMATION",
"AirportDirectory" => "WPT - AIRPORT DIRECTORY",
"AirportDeparture" => "WPT - AIRPORT DEPARTURE INFORMATION",

View file

@ -22,7 +22,7 @@ var new = func(layer) {
setsize(m.active_vors, size(m.navNs));
foreach (var navN; m.navNs) {
append(m.listeners, setlistener(
navN.getNode("frequencies/selected-mhz"),
navN.getNode("frequencies/selected-mhz", 1),
func m.changed_freq()
));
}
@ -53,4 +53,3 @@ var changed_freq = func(update=1) {
};
var searchCmd = NavaidSymbolLayer.make('vor');

View file

@ -17,6 +17,7 @@
var mfd = nil;
var eisPublisher = nil;
var navcomPublisher = nil;
var navcomUpdater = nil;
]]></open>
<close><![CDATA[
@ -26,10 +27,12 @@
mfd.del();
eisPublisher.stop();
eisPublisher = nil;
navcomPublisher.stop();
navcomPublisher = nil;
navcomUpdater.stop();
navcomUpdater = nil;
]]></close>
</nasal>
@ -91,7 +94,7 @@
</dial>
<button>
<name>toggle-nav</name>
<name>toggle-nav-freq</name>
<legend>&lt;-&gt;</legend>
<pref-width>30</pref-width>
<pref-height>30</pref-height>
@ -103,7 +106,7 @@
"MFD",
1,
notifications.PFDEventNotification.HardKeyPushed,
{ Id: fg1000.FASCIA.NAV_VOL_TOGGLE, Value: 1 }
{ Id: fg1000.FASCIA.NAV_FREQ_TRANSFER, Value: 1 }
);
emesary.GlobalTransmitter.NotifyAll(notification);
</script>
@ -490,8 +493,10 @@
var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/";
io.load_nasal(nasal_dir ~ 'MFD.nas', "fg1000");
io.load_nasal(nasal_dir ~ 'Interfaces/PropertyPublisher.nas', "fg1000");
io.load_nasal(nasal_dir ~ 'Interfaces/PropertyUpdater.nas', "fg1000");
io.load_nasal(nasal_dir ~ 'Interfaces/GenericEISPublisher.nas', "fg1000");
io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComPublisher.nas', "fg1000");
io.load_nasal(nasal_dir ~ 'Interfaces/GenericNavComUpdater.nas', "fg1000");
mfd = fg1000.MFD.new(myCanvas);
eisPublisher = fg1000.GenericEISPublisher.new();
@ -500,6 +505,9 @@
navcomPublisher = fg1000.GenericNavComPublisher.new();
navcomPublisher.start();
navcomUpdater = fg1000.GenericNavComUpdater.new(mfd.getDevice());
navcomUpdater.start();
softkeypushed = 0;
# Connect the buttons - using the provided model index to get the right ones from the model binding
var softkey_listener = setlistener("/sim/gui/dialogs/fg1000/softkey-pressed", func(v)
@ -713,7 +721,7 @@
"MFD",
1,
notifications.PFDEventNotification.HardKeyPushed,
{ Id: fg1000.FASCIA.COM_VOL_TOGGLE, Value: 1.0 }
{ Id: fg1000.FASCIA.COM_FREQ_TRANSFER, Value: 1.0 }
);
emesary.GlobalTransmitter.NotifyAll(notification);
</script>
@ -802,7 +810,7 @@
</group>
<button>
<name>toggle-nav</name>
<name>toggle-com</name>
<legend>1-2</legend>
<pref-width>50</pref-width>
<pref-height>25</pref-height>