-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #90 from hbeni/FGFS-Addon
FlightGear Addon
- Loading branch information
Showing
8 changed files
with
345 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FGCom-mumble FGFS Addon | ||
================================= | ||
This Addon is a convinient addon package to let FlightGear know about the FGCom-mumble protocol. It adds menu item and a dialog where you can conviniently adjust the parameters without the need to restart flightgear. | ||
|
||
Instead of using this addon, you can also invoke the protocol manually: | ||
|
||
- copy the `fgcom-mumble.xml` fightgear protocol file to your flightgears `Protocol` folder. | ||
- start flightgear with enabled fgcom-mumble protocol (add "`--generic=socket,out,10,127.0.0.1,16661,udp,fgcom-mumble`" to your launcher) | ||
|
||
|
||
|
||
Installation | ||
------------ | ||
After unzipping the FGCom-mumble release package, you just need to add the `fgfs` folder to your launchers *Add-ons* module list. | ||
The addon is activated automatically, so flightgear will try to connect to mumble with the default parameters. | ||
|
||
|
||
Running the Addon | ||
----------------- | ||
When added to your launcher, the addon is automatically active. | ||
No further steps are needed. | ||
|
||
The FGFS protocol file will handle old 25kHz as well as newer 8.3kHz radios. | ||
After starting flightgear, you can use your radio stack like with FGCom (default is *space* to talk on COM1 and *shift+space* for COM2). | ||
|
||
|
||
Configuration | ||
---------------------------- | ||
If you wish to adjust the parameters, you can access them via the new *Multiplayer* menu entry. This is usually not needed except you are running several mumble instances or mumble not on the same computer as FlightGear. | ||
Changes to the parameters will reinitialize the addon automatically, making them effective. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<PropertyList> | ||
<!-- init by addon-main.nas --> | ||
</PropertyList> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# | ||
# Protocol FGCom-mumble addon main nasal hook | ||
# | ||
# based on the KML addon by Slawek Mikula | ||
# | ||
# @author Benedikt Hallinger, 2021 | ||
|
||
var main = func( addon ) { | ||
var root = addon.basePath; | ||
var myAddonId = addon.id; | ||
var mySettingsRootPath = "/addons/by-id/" ~ myAddonId; | ||
var protocolInitialized = 0; | ||
|
||
# init props with defaults | ||
var enabledNode = props.globals.getNode(mySettingsRootPath ~ "/enabled", 1); | ||
enabledNode.setAttribute("userarchive", "y"); | ||
if (enabledNode.getValue() == nil) { | ||
enabledNode.setBoolValue("1"); | ||
} | ||
var refreshNode = props.globals.getNode(mySettingsRootPath ~ "/refresh-rate", 1); | ||
refreshNode.setAttribute("userarchive", "y"); | ||
if (refreshNode.getValue() == nil) { | ||
refreshNode.setIntValue("10"); | ||
} | ||
var hostNode = props.globals.getNode(mySettingsRootPath ~ "/host", 1); | ||
hostNode.setAttribute("userarchive", "y"); | ||
if (hostNode.getValue() == nil) { | ||
hostNode.setValue("localhost"); | ||
} | ||
var portNode = props.globals.getNode(mySettingsRootPath ~ "/port", 1); | ||
portNode.setAttribute("userarchive", "y"); | ||
if (portNode.getValue() == nil) { | ||
portNode.setIntValue("16661"); | ||
} | ||
|
||
# Init GUI menu entry | ||
var menuTgt = "/sim/menubar/default/menu[7]"; # 7=multiplayer | ||
var menudata = { | ||
label : "FGCom-mumble", | ||
name : "fgcom-mumble", | ||
binding : { command : "dialog-show", "dialog-name" : "fgcom-mumble-settings" } | ||
}; | ||
props.globals.getNode(menuTgt).addChild("item").setValues(menudata); | ||
fgcommand("gui-redraw"); | ||
|
||
var initProtocol = func() { | ||
if (protocolInitialized == 0) { | ||
print("Addon FGCom-mumble initializing"); | ||
var enabled = getprop(mySettingsRootPath ~ "/enabled"); | ||
var refresh = getprop(mySettingsRootPath ~ "/refresh-rate"); | ||
var host = getprop(mySettingsRootPath ~ "/host"); | ||
var port = getprop(mySettingsRootPath ~ "/port"); | ||
|
||
if (enabled == 1) { | ||
var protocolstring = "generic,socket,out," ~ refresh ~ "," ~ host ~ "," ~ port ~",udp,fgcom-mumble"; | ||
print("Addon FGCom-mumble activating protocol '"~protocolstring~"'"); | ||
fgcommand("add-io-channel", props.Node.new({ | ||
"config": protocolstring, | ||
"name":"fgcom-mumble" | ||
})); | ||
protocolInitialized = 1; | ||
} | ||
} | ||
} | ||
|
||
var shutdownProtocol = func() { | ||
if (protocolInitialized == 1) { | ||
print("Addon FGCom-mumble shutdown protocol..."); | ||
fgcommand("remove-io-channel", | ||
props.Node.new({ | ||
"name" : "fgcom-mumble" | ||
}) | ||
); | ||
protocolInitialized = 0; | ||
} | ||
} | ||
|
||
var reinitProtocol = func() { | ||
print("Addon FGCom-mumble re-initializing"); | ||
shutdownProtocol(); | ||
initProtocol(); | ||
} | ||
|
||
var init = _setlistener(mySettingsRootPath ~ "/enabled", func() { | ||
if (getprop(mySettingsRootPath ~ "/enabled") == 1) { | ||
initProtocol(); | ||
} else { | ||
shutdownProtocol(); | ||
} | ||
}); | ||
|
||
var init_fdm = setlistener("/sim/signals/fdm-initialized", func() { | ||
removelistener(init_fdm); # only call once | ||
if (getprop(mySettingsRootPath ~ "/enabled") == 1) { | ||
initProtocol(); | ||
} | ||
}); | ||
|
||
var reinit_listener = _setlistener("/sim/signals/reinit", func { | ||
removelistener(reinit_listener); # only call once | ||
if (getprop(mySettingsRootPath ~ "/enabled") == 1) { | ||
initProtocol(); | ||
} | ||
}); | ||
|
||
|
||
|
||
var reinit_hzChange = setlistener(mySettingsRootPath ~ "/refresh-rate", reinitProtocol, 0, 0); | ||
var reinit_hostChange = setlistener(mySettingsRootPath ~ "/host", reinitProtocol, 0, 0); | ||
var reinit_portChange = setlistener(mySettingsRootPath ~ "/port", reinitProtocol, 0, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<PropertyList> | ||
<meta> | ||
<file-type type="string">FlightGear add-on menu bar items</file-type> | ||
<format-version type="int">1</format-version> | ||
</meta> | ||
|
||
<!-- GUI menu adjusted in addon-main.nas --> | ||
|
||
</PropertyList> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<PropertyList> | ||
<meta> | ||
<file-type type="string">FlightGear add-on metadata</file-type> | ||
<format-version type="int">1</format-version> | ||
</meta> | ||
|
||
<addon> | ||
<identifier type="string">org.hallinger.flightgear.FGCom-mumble</identifier> | ||
<name type="string">FGCom-mumble</name> | ||
<version type="string">0.11.0</version> | ||
|
||
<authors> | ||
<author> | ||
<name type="string">Benedikt Hallinger</name> | ||
<email type="string">[email protected]</email> | ||
<url type="string">https://wiki.flightgear.org/FGCom-mumble</url> | ||
</author> | ||
</authors> | ||
|
||
<maintainers> | ||
<maintainer> | ||
<name type="string">Benedikt Hallinger</name> | ||
<email type="string">[email protected]</email> | ||
<url type="string"></url> | ||
</maintainer> | ||
</maintainers> | ||
|
||
<short-description type="string">addon to send data to mumbles FGCom-mumble plugin</short-description> | ||
<long-description type="string">Let FlightGear send it's data to the FGCom-mumble plugin data port</long-description> | ||
|
||
<localized> | ||
<de> | ||
<short-description type="string">sendet Daten an das FGCom-mumble plugin in Mumble</short-description> | ||
<long-description type="string">Lässt FlightGear die notwendigen Daten an das FGCom-mumble plugin senden</long-description> | ||
</de> | ||
</localized> | ||
|
||
<license> | ||
<designation type="string">GNU GPL version 3 or later</designation> | ||
<!--<file type="string">LICENSE</file>--> | ||
<url type="string">https://www.gnu.org/licenses/gpl-3.0</url> | ||
</license> | ||
|
||
<min-FG-version type="string">2018.3.0</min-FG-version> | ||
<max-FG-version type="string">none</max-FG-version> | ||
|
||
<urls> | ||
<download type="string">https://github.com/hbeni/fgcom-mumble/releases</download> | ||
<support type="string">https://github.com/hbeni/fgcom-mumble/issues</support> | ||
<code-repository type="string">https://github.com/hbeni/fgcom-mumble/</code-repository> | ||
</urls> | ||
|
||
<tags> | ||
<tag type="string">mumble</tag> | ||
<tag type="string">atc</tag> | ||
</tags> | ||
|
||
</addon> | ||
</PropertyList> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
<?xml version="1.0"?> | ||
|
||
<PropertyList> | ||
<name>fgcom-mumble-settings</name> | ||
<layout>vbox</layout> | ||
<width>600</width> | ||
<group> | ||
<layout>hbox</layout> | ||
|
||
<button> | ||
<legend> </legend> | ||
<pref-width>16</pref-width> | ||
<pref-height>16</pref-height> | ||
<binding> | ||
<command>dialog-close</command> | ||
</binding> | ||
</button> | ||
|
||
<empty><stretch>1</stretch></empty> | ||
|
||
<text> | ||
<label>FGCom-mumble settings</label> | ||
</text> | ||
|
||
<empty><stretch>1</stretch></empty> | ||
|
||
<button> | ||
<legend> </legend> | ||
<key>Esc</key> | ||
<pref-width>16</pref-width> | ||
<pref-height>16</pref-height> | ||
<binding> | ||
<command>dialog-close</command> | ||
</binding> | ||
</button> | ||
|
||
</group> | ||
|
||
<hrule/> | ||
|
||
<checkbox> | ||
<halign>left</halign> | ||
<label>Enable sending data</label> | ||
<property>/addons/by-id/org.hallinger.flightgear.FGCom-mumble/enabled</property> | ||
</checkbox> | ||
|
||
<group> | ||
<layout>hbox</layout> | ||
|
||
<text> | ||
<halign>left</halign> | ||
<label>Refresh rate (Hz):</label> | ||
</text> | ||
|
||
<input> | ||
<name>refresh-rate</name> | ||
<height>25</height> | ||
<halign>left</halign> | ||
<property>/addons/by-id/org.hallinger.flightgear.FGCom-mumble/refresh-rate</property> | ||
</input> | ||
</group> | ||
|
||
<group> | ||
<layout>hbox</layout> | ||
|
||
<text> | ||
<label>Host</label> | ||
<halign>left</halign> | ||
</text> | ||
|
||
<input> | ||
<height>25</height> | ||
<halign>left</halign> | ||
<property>/addons/by-id/org.hallinger.flightgear.FGCom-mumble/host</property> | ||
</input> | ||
</group> | ||
|
||
<group> | ||
<layout>hbox</layout> | ||
|
||
<text> | ||
<label>Port</label> | ||
<halign>left</halign> | ||
</text> | ||
|
||
<input> | ||
<height>25</height> | ||
<halign>left</halign> | ||
<property>/addons/by-id/org.hallinger.flightgear.FGCom-mumble/port</property> | ||
</input> | ||
</group> | ||
|
||
<hrule/> | ||
|
||
<group> | ||
<layout>hbox</layout> | ||
<empty><stretch>1</stretch></empty> | ||
<button> | ||
<legend>OK</legend> | ||
<pref-width>90</pref-width> | ||
<pref-height>30</pref-height> | ||
<binding> | ||
<command>dialog-apply</command> | ||
</binding> | ||
<binding> | ||
<command>dialog-close</command> | ||
</binding> | ||
</button> | ||
|
||
<button> | ||
<legend>Cancel</legend> | ||
<pref-width>90</pref-width> | ||
<pref-height>30</pref-height> | ||
<binding> | ||
<command>dialog-close</command> | ||
</binding> | ||
</button> | ||
<empty><stretch>1</stretch></empty> | ||
</group> | ||
</PropertyList> |