2018-02-04 21:40:37 +00:00
|
|
|
# FG Commands to support simple bindings
|
2018-02-09 15:01:33 +00:00
|
|
|
io.include("Constants.nas");
|
2018-02-04 21:40:37 +00:00
|
|
|
|
|
|
|
removecommand("FG1000HardKeyPushed");
|
|
|
|
addcommand("FG1000HardKeyPushed",
|
|
|
|
func(node) {
|
2018-02-09 15:01:33 +00:00
|
|
|
var device = int(node.getNode("device", 1).getValue());
|
|
|
|
var name = node.getNode("notification",1).getValue();
|
|
|
|
|
|
|
|
# The knob animation stores the value as an offset property
|
|
|
|
var value = node.getNode("offset", 1).getValue();
|
|
|
|
|
|
|
|
if (value == nil) {
|
|
|
|
print("FG1000HardKeyPushed: No <offset> argument passed to fgcommand");
|
|
|
|
return;
|
|
|
|
}
|
2018-02-04 21:40:37 +00:00
|
|
|
|
|
|
|
if (device == nil) {
|
|
|
|
print("FG1000HardKeyPushed: Unknown device" ~ node.getNode("device").getValue());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
# Notification may be provided as a number, or a string.
|
|
|
|
if (int(name) == nil) {
|
|
|
|
# Name is a string, to map it to the correct INT id.
|
2018-02-09 15:01:33 +00:00
|
|
|
if (FASCIA[name] != nil) {
|
|
|
|
name = FASCIA[name];
|
2018-02-04 21:40:37 +00:00
|
|
|
} else {
|
|
|
|
print("Unable to find FASCIA entry for Hard Key " ~ name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var notification = notifications.PFDEventNotification.new(
|
|
|
|
"MFD",
|
|
|
|
device,
|
|
|
|
notifications.PFDEventNotification.HardKeyPushed,
|
|
|
|
{ Id: name, Value: value }
|
|
|
|
);
|
|
|
|
emesary.GlobalTransmitter.NotifyAll(notification);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
removecommand("FG1000SoftKeyPushed");
|
|
|
|
addcommand("FG1000SoftKeyPushed",
|
|
|
|
func(node) {
|
2018-02-09 15:01:33 +00:00
|
|
|
var device = int(node.getNode("device", 1).getValue());
|
|
|
|
var value = node.getNode("offset", 1).getValue();
|
2018-02-04 21:40:37 +00:00
|
|
|
|
|
|
|
if (device == nil) {
|
|
|
|
print("FG1000SoftKeyPushed: Unknown device" ~ node.getNode("device").getValue());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (value == nil) {
|
2018-02-09 15:01:33 +00:00
|
|
|
print("FG1000SoftKeyPushed: No <offset> value for softkey number");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (int(value) == nil) {
|
2018-02-04 21:40:37 +00:00
|
|
|
print("Unable to convert softkey number to integer " ~ node.getNode("value").getValue());
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-02-09 15:01:33 +00:00
|
|
|
value = int(value);
|
|
|
|
|
2018-02-04 21:40:37 +00:00
|
|
|
var notification = notifications.PFDEventNotification.new(
|
|
|
|
"MFD",
|
|
|
|
device,
|
|
|
|
notifications.PFDEventNotification.SoftKeyPushed,
|
|
|
|
value
|
|
|
|
);
|
|
|
|
emesary.GlobalTransmitter.NotifyAll(notification);
|
|
|
|
}
|
|
|
|
);
|