Jump to content
The simFlight Network Forums

rheitzman

Members
  • Posts

    17
  • Joined

  • Last visited

About rheitzman

  • Birthday 01/01/1970

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Male
  • Location
    SLO CA USA

rheitzman's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Thanks - here is my modified code. This is a simple one button form that gets the lat/lon from the a/c and offers to open a chart web site. I used your format string but it had some non-numeric'ness to the returned string. I resorted to the deprciated, but handy, Val() to clean it up. The code is verbose, I didn't want to string a bunch of operations together for the post. Is there an elegant way to check to see if Open() was called and we're still connected? What's the check that the a/c is "ready?" (loaded by FSX/P3D and ready to respond) In the code sample I Open() once then error out on other calls. I close the conenction when the form closes. Bad technique? If the form made other calls to other offsets would things get balled up? GetLatLongString() below should probably have some busy logic to avoid a second call from wherever. I couldn't find a good list of offsets - is FSUIPC4 Offsets Status.pdf the best available? Option Explicit On Imports FSUIPC ' Project Reference to FSUIPCClient.dll Public Class frmACLocation Private Sub btnGetLatLong_Click(sender As Object, e As EventArgs) Handles btnGetLatLong.Click Try Dim sLatLon As String = GetLatLongString() If sLatLon <> "error" Then If MsgBox("a/c Lat/Lon: " & sLatLon & vbCrLf & "Open Chart?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Process.Start("http:\\skyvector.com/?ll=" & sLatLon & "&zoom=3") End If End If Catch ex As Exception MsgBox(ex.Message, , "btnGetLatLong_Click") End Try End Sub Function GetLatLongString() As String Dim ofsLatitude As Offset(Of Long) = New Offset(Of Long)(&H560) Dim ofsLongitude As Offset(Of Long) = New Offset(Of Long)(&H568) Dim mlat As FsLatitude Dim mlon As FsLongitude Dim sLat As String = "" Dim sLon As String = "" Try Try ' is there a better test to see if Open() has happened and we're connected FSUIPCConnection.Open() Catch ex As Exception ' assume already Open ' next call with throw an error if that was not the case End Try FSUIPCConnection.Process() mlat = New FsLatitude(ofsLatitude.Value) mlon = New FsLongitude(ofsLongitude.Value) sLat = mlat.ToString(False, "d", 6) sLon = mlon.ToString(False, "d", 6) sLat = Val(sLat) ' strip off leading zeros and * symbol sLon = Val(sLon) Return sLat & "," & sLon Catch ex As Exception ' Badness occurred - show the error message MsgBox(ex.Message, , "GetLatLongString") Return "error" End Try End Function Private Sub frmACLocation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing Try FSUIPCConnection.Close() Catch ex As Exception End Try End Sub End Class
  2. Great tool! My BeattlesBlog connection stopped working after I installed P3D and I started looking around for solutions - this one is great! I think I did look at it ages ago via the old FSUIPC VB.Net demo but I think it required treading which is a huge pain. This tool (is there a short name?) seems to do the trick w/o any serious hoop jumping. In the VB.Net code below (VS2013 Express, .Net 4.0, FSX) is a minimal proof of concept of opening a connection on demand and getting the curretn lat/long and closing the connection - seems to work OK. How about garbage collection? This code would run in a "moving map" type tool that would stay open. The app has a button to "Center on the a/c" that gets clicked every once in awhile - it does not try to track the a/c. Can I call GetLatLongString() using the garabge collection code shown - or is it overkill, or? Also - for the latlong class - how to I get a decimal string instead of DDHHMMSS? Thanks! Option Explicit On Imports FSUIPC Public Class frmACLocation Dim ofsLatitude As Offset(Of Long) = New Offset(Of Long)(&H560) Dim ofsLongitude As Offset(Of Long) = New Offset(Of Long)(&H568) Dim mlat As FsLatitude Dim mlon As FsLongitude Dim mlatlon As New FsLatLonPoint Private Sub btnGetLatLong_Click(sender As Object, e As EventArgs) Handles btnGetLatLong.Click Try MsgBox(GetLatLongString) Catch ex As Exception MsgBox(ex.Message, , "btnGetLatLong_Click") End Try End Sub Function GetLatLongString() As String Try FSUIPCConnection.Open() FSUIPCConnection.Process() mlat = New FsLatitude(ofsLatitude.Value) mlon = New FsLongitude(ofsLongitude.Value) mlatlon = New FsLatLonPoint(mlat, mlon) Return mlatlon.ToString ' how to get decimal lat/lon? FSUIPCConnection.Close() Catch ex As Exception ' Badness occurred - show the error message MsgBox(ex.Message, , "OpenFSUIPC") Return "error" Finally ' cleanup required? ' ofsLatitude = Nothing ' ofsLongitude = Nothing mlat = Nothing mlon = Nothing mlatlon = Nothing End Try End Function End Class
  3. Maybe... but it seems to be required for TCAS - at least the one I'm using in an F16 on a private network(Apollo). FSInn was working fine, just the TCAS didn't have the "targets" it should have. I remove the beta FSInn and TCAS stopped working (slight possibility it wasn't working before I removed the beta - lots of other issues). I moved back to the beta which I believe installed/ran AIBridge (I assume it was FSInn, caus' I didn't run it but it shows up on the icon tray). In any case my TCAS is now working on the private nework. Mileage may vary on VATSIM, offline, etc.
  4. There's a link for AIBridge on the web page I just gave you... The AIBridge link on the "Official" site leads to a dead end. Is version 1 from here: a good choice? http://www.simradar.com/File/Online_ATC/index.html ... didn't appear to work too well - seems to be looking for FS2002.
  5. There's a link for AIBridge on the web page I just gave you... The AIBridge link on the "Official" site leads to a dead end. Is version 1 from here: a good choice? http://www.simradar.com/File/Online_ATC/index.html
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.