Written by Holton181
Version 1.4
Use this to export GPS NMEA GGA and RMC sentences to be used with any application or device capable of using them, or AHRS sentences (ForFlight, SkyDemon, WingX Pro, FltPlan Go, etc.).
UDP or Serial Port export is available. To activate any of these see the CONFIGURATION section.
REMEMBER!!! The world is flat! ...at least according to Eagle Dynamics. Therefor the position information taken from DCSW
does not perfectly correspond to the same in the real world. It gets worse the closer to map boarders you get.
Should not cause troubles in MP, but since I'm an exclusive SP myself I can't make any promises.

************** A little Heads up! *************
If you use SRS (DCS-SimpleRadioStandalone), make sure the line in Export.lua related to SRS comes AFTER the one for DCS-to-GPS. It won't work otherwise.
Thanks to Drakoz for this solution. Have been verified by myself.
*********************************************** 

Use, distribute and copy any parts of this script as you like, but please acknowledge your source.
Thanks to:
* leonpo, who created the telemetry export file upon which this script is based on originally.
Not much of the original file is left. His (no longer active) project can be found here:
https://forums.eagle.ru/showthread.php?t=97890
* BR=55=Sevas, who pointed me in the right direction regarding ground speed and course.
* Eagle_Rising for pointing me to ForeFlight communication instructions
* muehlema for testing ForeFlight functionality and pictures on User Files
* Drakoz for finding a workaround for the SRS conflict
* robgraham for making me aware of OzRunways and Pascal Scheffers at OzRunways for helping out
* "The Internet" for its vast amount of information required for me to complete this project...

Change-log
----------
1.0
* Initial release
1.1
* Corrected how LoGetSelfData is handled when it returns nil (happens in spectator mode, when crashed, etc)
  Still do not know for sure if LoGetSelfData is handled correctly when allow_ownship_export = false
1.2
* ForeFlight support
1.3
* Hopefully simplified setup procedure, everything in the same section in the beginning of DCS_NMEA.lua
1.4
* Enhanced the XATT sentence after some tips regarding OzRunways. Hopefully XATT is now fully implemented with 12 values
* Possibility to send data to several Serial Ports (COM ports) at the same time

CONTENT
-------
- This readme.txt
- Export.lua
- DCS_NMEA.lua


INSTALATION
-----------
- When editing any lua file, I recommend Notepad++ (with the Compare plugin). Do not use Windows Notepad or other general text editor.
- These instructions are for installation of this MOD. For setting up the listening side, firewalls, Bluetooth virtual serial port or the like: "Google is your friend!"
0)	Make sure the folder "Scripts" exists in your DCS Saved Games folder, i.e. C:\Users\[username]\Saved Games\DCS\Scripts. Otherwise create it.
1)	Copy Export.lua in this MOD to above Scripts folder. If the file already exists there, open both files and copy the content from the MOD file to the end of the ordinal.
************** A little Heads up! *************
If you use SRS (DCS-SimpleRadioStandalone), make sure the line in Export.lua related to SRS comes AFTER the one for DCS-to-GPS. It won't work otherwise.
Thanks to Drakoz for this solution. Have been verified by myself.
*********************************************** 
2)	Also copy DCS_NMEA.lua to above Scripts folder.
3)	Open the DCS_NMEA.lua now located in the Scripts folder for initial editing.
4)	There is one sections starting with this:
----------------------------------------------------------------------------------------------------------------------------------------------
-- CONFIGURATION
----------------------------------------------------------------------------------------------------------------------------------------------
	and ending with this:
----------------------------------------------------------------------------------------------------------------------------------------------
-- END OF CONFIGURATION
----------------------------------------------------------------------------------------------------------------------------------------------
	Any configuration is done within these.
5)	The above section contain three questions to answer.
	Read and follow the instructions (starting with --)
	Take note about the freezing tendencies when using Bluetooth virtual serial port.
6)	I think you are done...?


Three good apps for Android devises:
OruxMaps
--------
Mapping tool where it is possible to add both off-line and on-line maps like Chartbundle Aviation and Sectional charts (www.chartbundle.com/charts/).
It has a built in capability to connect to an external Bluetooth GPS provider without the need of a separate app like below (no GPS spoofing needed).
You can also use KMZ files exported with CombatFlite (www.combatflite.com)
Highly customizable.
Free: www.oruxmaps.com/cs/en/
Donation: play.google.com/store/apps/details?id=com.orux.oruxmapsDonate
Free and donation versions should be the same (sometimes the free version lags behind). The free doesn't update automatically due to not being on Google Play.

Bluetooth GPS Provider
----------------------
by mobile-j.de
play.google.com/store/apps/details?id=de.mobilej.btgps
www.mobile-j.de/snipsnap/space/start/

GPSBridge - NMEA via TCP/UDP
----------------------------
by Richard Bedard
play.google.com/store/apps/details?id=com.rbc.gpsbridge
(unfortunately seems to be pulled from Google Play? I bought it so I can still access it. Can be downloaded from several more or less dubious sources. I have not found any replacement)