2018-02-09 18:55:53 +00:00
|
|
|
# Copyright 2018 Stuart Buchanan
|
|
|
|
# This file is part of FlightGear.
|
|
|
|
#
|
2018-05-28 19:15:57 +00:00
|
|
|
# FlightGear is free software: you can redistribute it and/or modify
|
2018-02-09 18:55:53 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# FlightGear is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with FlightGear. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
2018-02-09 15:01:33 +00:00
|
|
|
# Generic Interface controller.
|
|
|
|
|
|
|
|
var nasal_dir = getprop("/sim/fg-root") ~ "/Aircraft/Instruments-3d/FG1000/Nasal/";
|
2018-03-16 16:38:22 +00:00
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/NavDataInterface.nas', "fg1000");
|
2018-02-09 15:01:33 +00:00
|
|
|
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");
|
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericFMSPublisher.nas', "fg1000");
|
2018-03-04 20:02:16 +00:00
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericFMSUpdater.nas', "fg1000");
|
2018-02-09 15:01:33 +00:00
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericADCPublisher.nas', "fg1000");
|
2019-01-11 20:19:09 +00:00
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericFuelInterface.nas', "fg1000");
|
|
|
|
io.load_nasal(nasal_dir ~ 'Interfaces/GenericFuelPublisher.nas', "fg1000");
|
2018-02-09 15:01:33 +00:00
|
|
|
|
|
|
|
var GenericInterfaceController = {
|
|
|
|
|
2018-02-09 17:26:57 +00:00
|
|
|
_instance : nil,
|
|
|
|
|
|
|
|
# Factory method
|
2018-02-18 21:41:17 +00:00
|
|
|
getOrCreateInstance : func() {
|
2018-02-09 17:26:57 +00:00
|
|
|
if (GenericInterfaceController._instance == nil) {
|
|
|
|
GenericInterfaceController._instance = GenericInterfaceController.new();
|
|
|
|
}
|
|
|
|
|
|
|
|
return GenericInterfaceController._instance;
|
|
|
|
},
|
|
|
|
|
2018-02-09 15:01:33 +00:00
|
|
|
new : func() {
|
|
|
|
var obj = {
|
|
|
|
parents : [GenericInterfaceController],
|
|
|
|
running : 0,
|
|
|
|
};
|
|
|
|
|
|
|
|
obj.eisPublisher = fg1000.GenericEISPublisher.new();
|
|
|
|
obj.navcomPublisher = fg1000.GenericNavComPublisher.new();
|
|
|
|
obj.navcomUpdater = fg1000.GenericNavComUpdater.new();
|
|
|
|
obj.navdataInterface = fg1000.NavDataInterface.new();
|
|
|
|
obj.gpsPublisher = fg1000.GenericFMSPublisher.new();
|
2018-03-04 20:02:16 +00:00
|
|
|
obj.gpsUpdater = fg1000.GenericFMSUpdater.new();
|
2018-02-09 15:01:33 +00:00
|
|
|
obj.adcPublisher = fg1000.GenericADCPublisher.new();
|
2019-01-11 20:19:09 +00:00
|
|
|
obj.fuelPublisher = fg1000.GenericFuelPublisher.new();
|
|
|
|
obj.fuelInterface = fg1000.GenericFuelInterface.new();
|
2018-04-06 18:52:18 +00:00
|
|
|
|
2018-02-09 15:01:33 +00:00
|
|
|
return obj;
|
|
|
|
},
|
|
|
|
|
|
|
|
start : func() {
|
|
|
|
if (me.running) return;
|
|
|
|
me.eisPublisher.start();
|
|
|
|
me.navcomPublisher.start();
|
|
|
|
me.navcomUpdater.start();
|
|
|
|
me.navdataInterface.start();
|
|
|
|
me.gpsPublisher.start();
|
2018-03-04 20:02:16 +00:00
|
|
|
me.gpsUpdater.start();
|
2018-02-09 15:01:33 +00:00
|
|
|
me.adcPublisher.start();
|
2019-01-11 20:19:09 +00:00
|
|
|
me.fuelPublisher.start();
|
|
|
|
me.fuelInterface.start();
|
2018-02-09 15:01:33 +00:00
|
|
|
},
|
|
|
|
|
|
|
|
stop : func() {
|
|
|
|
if (me.running == 0) return;
|
|
|
|
me.eisPublisher.stop();
|
|
|
|
me.navcomPublisher.stop();
|
|
|
|
me.navcomUpdater.stop();
|
|
|
|
me.navdataInterface.stop();
|
|
|
|
me.gpsPublisher.stop();
|
2018-03-04 20:02:16 +00:00
|
|
|
me.gpsUpdater.stop();
|
2018-02-09 15:01:33 +00:00
|
|
|
me.adcPublisher.stop();
|
2019-01-11 20:19:09 +00:00
|
|
|
me.fuelPublisher.stop();
|
|
|
|
me.fuelInterface.stop();
|
2018-02-09 15:01:33 +00:00
|
|
|
},
|
|
|
|
};
|