Jump to content

LUA Problem with Bluetooth Virtual Serial Port


Holton181

Recommended Posts

First I would like to say I'm not a programmer but have enough basic knowledge to read code and create simple scripts, but without knowledge about what is going on under the hood. So please bare with me.

 

I have an export script to export NMEA 0183 sentences (GGA and GMC) to any devise/app that can connect via UDP or Serial Port and utilize these sentences. It now finally work pretty well if one can live with the position error that exist between real, spherical world and DCS flat counterpart. I don't consider this cheating, since we already have the NS430 and position is grabbed by LoGetSelfData, so should not trigger any server anti-cheating flags.

 

There is only one minor but irritating issue I would like to know if possible to handle from the script. I hope some of you LUA wizards can help me. The problem is with Bluetooth Virtual Serial Ports (I can't test for physical serial ports). It works perfectly fine, as long as I have something listening to the port. But as soon as I stop the listener DCS freeze. Starting the listener and DCS unfreeze as if nothing had happen. I suspect it is something with the Bluetooth part of the connection, and since DCS basically only sees a COM port it might not be possible to avoid. Or is it?

 

This is the tree blocks involved in the serial communication:

Start=function(self)
...
--Bluetooth
---[[
sPort = "COM3"
com = io.open(sPort,"w+b")
--]]
...
end

ActivityNextEvent=function(self,t)
...
--Bluetooth
---[[
com:write(string.format("$%s*%x\r\n$%s*%x\r\n", GGA,csGGA,RMC,csRMC)) -- fills the serial buffer
com:flush() -- send the serial buffer
--]]
...
end

Stop=function(self)
...
--Bluetooth
---[[
com:close(sPort)
--]]
...
 end

And I have this in the end if involved some how:

-- =============
-- Overload
-- =============
do
   local PrevLuaExportStart=LuaExportStart
   LuaExportStart=function()
       BS_NMEA:Start()
       if PrevLuaExportStart then
           PrevLuaExportStart()
       end
   end
end

do
   local PrevLuaExportActivityNextEvent=LuaExportActivityNextEvent
   LuaExportActivityNextEvent=function(t)
       local tNext = t
       tNext = BS_NMEA:ActivityNextEvent(t)
       if PrevLuaExportActivityNextEvent then
           PrevLuaExportActivityNextEvent()
       end
       return tNext
   end
end

do
   local PrevLuaExportStop=LuaExportStop
   LuaExportStop=function()
       BS_NMEA:Stop()
       if PrevLuaExportStop then
           PrevLuaExportStop()
       end
   end
end

COM3 is the Bluetooth VP configured as "incoming" in Windows 7 Pro. The listener I'm using is my Android phone with an app specially for overriding the devise GPS with NMEA sentences from an external Bluetooth GPS.

 

So, what do you say?

Helicopters and Viggen

DCS 1.5.7 and OpenBeta

Win7 Pro 64bit

i7-3820 3.60GHz

P9X79 Pro

32GB

GTX 670 2GB

VG278H + a Dell

PFT Lynx

TrackIR 5

Link to comment
Share on other sites

  • 2 weeks later...
So you managed to export GPS position to an external software like Foreflight?
I haven't tried with Foreflight, or any application on the same PC for that matter. But I guess it could be done. Will try it out.

I have used my Android phone as receiver and any maping app on that, both with UDP and Bluetooth virtual serial port.

Helicopters and Viggen

DCS 1.5.7 and OpenBeta

Win7 Pro 64bit

i7-3820 3.60GHz

P9X79 Pro

32GB

GTX 670 2GB

VG278H + a Dell

PFT Lynx

TrackIR 5

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...