Jump to content
The simFlight Network Forums

Frédéric-O DUCHEMIN

Members
  • Posts

    113
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by Frédéric-O DUCHEMIN

  1. Hi Paul,

    I would like to print those offsets (P62/70)

    6010
    6018
    6020
    6030
    6048
    6078
    6081
    608C
    6094
    60A4
    60E4
    60E8
    60EC
    61A0

    offsets but I have no idea what type of offset is (string, integer, Int32, Short, etc..)

      Dim gps_distance As Offset(Of Integer) = New Offset(Of Integer)(&H60EC)

    for in the future don't ask how to declare offsets

    this is for this topic :

    Thanks

    Regards Fred

  2. Thanks I will

    But how use your.pdb no different message Paul

    5a71e03275254_2018-01-3116_25_55-AcarsSky(Dbogage)-MicrosoftVisualStudio.png.94193e3c66e0bac29b8f96bc601928e8.png

     

    System.OverflowException
      HResult=0x80131516
      Message=La valeur était trop grande ou trop petite pour un UInt16.
      Source=FSUIPCClient
      Arborescence des appels de procédure :
       at FSUIPC.AirportsDatabase.Load(String Folder, HashSet`1 AirportList) in C:\Dev\FsuipcClient\fsuipcClient\fsuipcClient\AirportsDatabase.cs:line 642
       at FSUIPC.AirportsDatabase.Load() in C:\Dev\FsuipcClient\fsuipcClient\fsuipcClient\AirportsDatabase.cs:line 59
       at Acars_Sky.Form1.OpenFSUIPC() in M:\Projet ACARS\Applications_2018\Acars_Sky\Acars Sky\Acars Sky\Form1.vb:line 57
       at Acars_Sky.Form1.Form1_Load(Object sender, EventArgs e) in M:\Projet ACARS\Applications_2018\Acars_Sky\Acars Sky\Acars Sky\Form1.vb:line 42
       at System.EventHandler.Invoke(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at MetroFramework.Forms.MetroForm.OnLoad(EventArgs e)
       at System.Windows.Forms.Form.OnCreateControl()
       at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       at System.Windows.Forms.Control.CreateControl()
       at System.Windows.Forms.Control.WmShowWindow(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.Form.WmShowWindow(Message& m)
       at MetroFramework.Forms.MetroForm.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

     

  3.  

    Hi Paul,

    P3Dv4.1 64 bits

    Visual Studio 2017 Entreprise

    FSUIPCConnection.AirportsDatabase.Load()
    System.OverflowException
      HResult=0x80131516
      Message=La valeur était trop grande ou trop petite pour un UInt16.
      Source=FSUIPCClient
      Arborescence des appels de procédure :
       à FSUIPC.AirportsDatabase.Load(String Folder, HashSet`1 AirportList)
       à FSUIPC.AirportsDatabase.Load(HashSet`1 AirportList)
       à FSUIPC.AirportsDatabase.Load()
       à Acars_Sky.Form1.OpenFSUIPC() dans M:\Projet ACARS\Applications_2018\Acars_Sky\Acars Sky\Acars Sky\Form1.vb :ligne 57
       à Acars_Sky.Form1.Form1_Load(Object sender, EventArgs e) dans M:\Projet ACARS\Applications_2018\Acars_Sky\Acars Sky\Acars Sky\Form1.vb :ligne 42
       à System.EventHandler.Invoke(Object sender, EventArgs e)
       à System.Windows.Forms.Form.OnLoad(EventArgs e)
       à MetroFramework.Forms.MetroForm.OnLoad(EventArgs e)
       à System.Windows.Forms.Form.OnCreateControl()
       à System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
       à System.Windows.Forms.Control.CreateControl()
       à System.Windows.Forms.Control.WmShowWindow(Message& m)
       à System.Windows.Forms.Control.WndProc(Message& m)
       à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       à System.Windows.Forms.Form.WmShowWindow(Message& m)
       à System.Windows.Forms.Form.WndProc(Message& m)
       à MetroFramework.Forms.MetroForm.WndProc(Message& m)
       à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

     

  4. Hi Paul,

    I have take your sample from SDK with your Latest dll and have error with :

    1) FSInstallationPath return nothing

    2) getActiveRunwayForNearbyAirport() return nothing

    3) FSUIPCConnection.AirportsDatabase.Load() just after FSUIPCConnection.Open() return me Exception can't connect

    5a717d2a817a1_2018-01-3109_23_43-FSUIPCClientExampleSimconnect_VB.png.05c907218898268006fb54e99228c6d3.png

     

    
    Imports FSUIPC
    Imports System
    Imports System.Collections
    Imports System.Drawing.Drawing2D
    Imports System.Windows.Forms
    Imports LockheedMartin.Prepar3D.SimConnect.SimConnect
    Imports Microsoft.FlightSimulator.SimConnect.SimConnect
    Imports System.Collections.Generic
    
    Public Class Form1
        ' Constants
        Private Const AppTitle As String = "FSUIPCClientExample & Simconnect_VB"
    
        ' Register the Offsets we're interesing in for this application
        ' Dim airSpeed As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2BC) ' Basic integer read example
        ' Dim avionics As Offset(Of Integer) = New FSUIPC.Offset(Of Integer)(&H2E80) ' Basic integer read and write example
        Dim fsLocalDateTime As Offset(Of Byte()) = New FSUIPC.Offset(Of Byte())(&H238, 10) ' Example of reading an arbitary set of bytes.
        Dim aircraftType As Offset(Of String) = New FSUIPC.Offset(Of String)("AircraftInfo", &H3160, 24) ' Example of string and use of a group
        Dim lights As Offset(Of BitArray) = New FSUIPC.Offset(Of BitArray)(&HD0C, 2) ' Example of BitArray used to manage a bit field type offset.
        Dim compass As Offset(Of Double) = New FSUIPC.Offset(Of Double)(&H2CC) ' Example for disconnecting/reconnecting
        Dim pause As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H262, True) ' Example of a write only offset.
        Dim com2bcd As Offset(Of Short) = New FSUIPC.Offset(Of Short)(&H3118) ' Example of reading a frequency coded in Binary Coded Decimal
        Dim playerLatitude As Offset(Of Long) = New Offset(Of Long)(&H560) ' Offset for Lat/Lon features
        Dim playerLongitude As Offset(Of Long) = New Offset(Of Long)(&H568) ' Offset for Lat/Lon features
        Dim onGround As Offset(Of Short) = New Offset(Of Short)(&H366) ' Offset for Lat/Lon features
        Dim magVar As Offset(Of Short) = New Offset(Of Short)(&H2A0) ' Offset for Lat/Lon features
        ' Dim playerHeadingTrue As Offset(Of UInteger) = New Offset(Of UInteger)(&H580) ' Offset for moving the plane
        Dim playerAltitude As Offset(Of Long) = New Offset(Of Long)(&H570) ' Offset for moving the plane
        Dim slewMode As Offset(Of Short) = New Offset(Of Short)(&H5DC, True) ' Offset for moving the plane
        'Dim sendControl As Offset(Of Integer) = New Offset(Of Integer)(&H3110, True) ' Offset for moving the plane
        'Dim AI As AITrafficServices ' Holds a reference to the AI Traffic Services object
        'Dim FSInstallationPath As Offset(Of String) = New Offset(Of String)(&H3E00, 256)
    
        ' Initialise some of the variables we will need later
        Public Sub New()
            InitializeComponent()
        End Sub
    
        ' Application started so try to open the connection to FSUIPC
        Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            OpenFSUIPC()
        End Sub
    
        ' User pressed connect button so try again...
        Private Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
            OpenFSUIPC()
        End Sub
    
        ' Opens FSUIPC - if all goes well then starts the 
        ' timer to drive start the main application cycle.
        ' If can't open display the error message.
        Private Sub OpenFSUIPC()
            Try
                ' Attempt to open a connection to FSUIPC (running on any version of Flight Sim)
                FSUIPCConnection.Open()
                FSUIPCConnection.AirportsDatabase.Load()
                getActiveRunwayForNearbyAirport()
                'FSUIPCConnection.AirportsDatabase.IsLoaded.ToString()
                ' Opened OK so disable the Connect button
                Me.Button1.Enabled = False
                Me.Label2.Text = "FSuipc V: " & FSUIPCConnection.FSUIPCVersion.ToString()
                Me.Label2.ForeColor = System.Drawing.Color.Green
                Me.Label1.Text = "Connected to " & FSUIPCConnection.FlightSimVersionConnected.ToString()
                Me.Label1.ForeColor = System.Drawing.Color.Green
                'Me.Label4.Text = FSInstallationPath.Value
                ' and start the timer ticking to drive the rest of the application
                Me.Timer1.Interval = 200
                Me.Timer1.Enabled = True
                ' Set the AI object
                'AI = FSUIPCConnection.AITrafficServices
            Catch ex As Exception
                ' Badness occurred - show the error message
                MessageBox.Show(ex.Message, AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)
            End Try
        End Sub
    
        ' Application is unloading so call close to cleanup the 
        ' UNMANAGED memory used by FSUIPC. 
        Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles MyBase.FormClosed
            FSUIPCConnection.Close()
        End Sub
        Private Sub getActiveRunwayForNearbyAirport()
            ' Clear current items in results listbox
            Me.lstActiveRunways.Items.Clear()
            ' Refresh the AI traffic
            FSUIPCConnection.AITrafficServices.RefreshAITrafficInformation()
            ' get the closest airport using the database
            Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase
            ' Set the reference position to the current player position
            ' This will calculate the distance from the player to the airports
            db.SetReferencePosition()
            ' Find the airports within 40nm (Closest will be first in the list)
            Dim within40 As FsAirportCollection = db.Airports.InRangeOfNauticalMiles(40)
            If within40.Count > 0 Then
                ' Loop through each airport
                For Each ap As FsAirport In within40
                    ' find the active arrival runway for this airport
                    Dim runways As List(Of FsRunwayID) = FSUIPCConnection.AITrafficServices.GetArrivalRunwaysInUse(ap.ICAO)
                    If runways.Count > 0 Then
                        Me.lstActiveRunways.Items.Add(ap.ICAO & " (" & ap.DistanceNauticalMiles.ToString("F0") & "nm): " & runways(0).ToString())
                    Else
                        Me.lstActiveRunways.Items.Add(ap.ICAO & " (" & ap.DistanceNauticalMiles.ToString("F0") & "nm): No active runway")
                    End If
                Next
            Else
                Me.lstActiveRunways.Items.Add("No airports within 40nm")
            End If
        End Sub
        ' The timer handles the real-time updating of the Form.
        ' The default group (ie, no group specified) is 
        ' Processed and every Offset in the default group is updated.
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    
            Try
    
                ' Process the default group
                FSUIPCConnection.Process()
    
                ' Advanced Concept: Reading Raw Blocks of Data.
                ' FS Local Date and Time
                ' This demonstrates getting back an arbitrary number of bytes from an offset.
                ' Here we're getting 10 back from Offset 0x0328 which contain info about the 
                ' local date and time in FS.
                ' Because it's returned as a byte array we need to handle everything ourselves...
                ' 1. Year (starts at Byte 8) for 2 bytes. (Int16)
                '    Use the BitConverter class to get it into a native Int16 variable
                Dim year As Short = BitConverter.ToInt16(fsLocalDateTime.Value, 8)
                '    You could also do it manually if you know about such things...
                '    Dim year As Short = (fsLocalDateTime.Value(8) + (fsLocalDateTime.Value(9) * &H100))
                ' 2. Make new datetime with the the time value at 01/01 of the year...
                '    Time - in bytes 0,1 and 2. (Hour, Minute, Second):
                Dim fsTime As DateTime = New DateTime(year, 1, 1, fsLocalDateTime.Value(0), fsLocalDateTime.Value(1), fsLocalDateTime.Value(2))
                ' 3. Get the Day of the Year back (not given as Day and Month) 
                '    and add this on to the Jan 1 date we created above 
                '    to give the final date:
                Dim dayNo As Short = BitConverter.ToInt16(fsLocalDateTime.Value, 6)
                fsTime = fsTime.Add(New TimeSpan(dayNo - 1, 0, 0, 0))
                ' Now print it out
                Me.txtFSDateTime.Text = fsTime.ToString("dddd, MMMM dd yyyy hh:mm:ss")
    
            Catch exFSUIPC As FSUIPCException
    
                If exFSUIPC.FSUIPCErrorCode = FSUIPCError.FSUIPC_ERR_SENDMSG Then
                    ' Send message error - connection to FSUIPC lost.
                    ' Show message, disable the main timer loop and relight the 
                    ' connection button:
                    ' Also Close the broken connection.
                    Me.Timer1.Enabled = False
    
                    Me.Button3.Enabled = False
                    Me.Button1.Enabled = True
                    FSUIPCConnection.Close()
                    MessageBox.Show("The connection to Flight Sim has been lost.", AppTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
                Else
                    ' not the disonnect error so some other baddness occured.
                    ' just rethrow to halt the application
                    Throw exFSUIPC
                End If
    
    
            Catch ex As Exception
                ' Sometime when the connection is lost, bad data gets returned 
                ' and causes problems with some of the other lines.  
                ' This catch block just makes sure the user doesn't see any
                ' other Exceptions apart from FSUIPCExceptions.
            End Try
    
    
        End Sub
    
        ' This demonstrates disconnecting an individual Offset.
        ' After it's disconnected it doesn't get updated from FSUIPC
        ' and changed to the value of this Offset do not get written
        ' when Process() is called.
        Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
            ' Stop the timer
            Me.Timer1.Stop()
            ' Close the connection
            'FSInstallationPath.Disconnect()
            FSUIPCConnection.Close()
        End Sub
    
        '
        Private Enum LightType
            Navigation
            Beacon
            Landing
            Taxi
            Strobes
            Instruments
            Recognition
            Wing
            Logo
            Cabin
        End Enum
    
    
    End Class

    Regards Fred

  5. I know,

    I have seen your sample code in vb.net easy to understand. But you have seen the project, and fsuipc is  open and call too many time.
    I think the first person write the code need to catch datas in real-time before track data with start button.

    On the top real-time flight information is given before the flight is started means (fsuipc connection is open).

    Try to remove this part of code to use to good way but it's an other story !!!

    26168589_2040629325947554_1004082741811615514_n.jpg.e35d0e2fc328483ad747513c83e82b8b.jpg

    Disconnect FSUIPC even it's harcoded

    Private Sub CbOver70_CheckStateChanged(sender As Object, e As EventArgs) Handles cbOver70.CheckStateChanged
            If cbOver70.Checked = True And chkonground.Checked = True And cbTakeOff.Checked = False Then
                runaway = Getrunaway(lblDeparture.Text)
                Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase
                Dim surfaceType As FsSurface = db.Airports("EHAM").Runways("22").Surface
                Surface = surfaceType.ToString()
                Dim flightypeSchedules As Boolean = Me.lblFlightNumber.Text Like "SDC?*"
                If Label19.Text = "Cargo:" Then
                    Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " lbs Cargo on board" & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt, True)
                    Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " lbs Cargo on board" & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml, True)
    
    
    
                    Dim vt1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt1, True)
                    Dim xml1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml1, True)
                    cbTakeOff.Checked = True
                    stopwatch.Start()
                    startTime = DateTime.UtcNow()
                Else
                    Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " passengers on board" & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt, True)
                    Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " passengers on board" & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml, True)
                    runaway = Getrunaway(lblDeparture.Text)
                    Dim vt1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt1, True)
                    Dim xml1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml1, True)
                    cbTakeOff.Checked = True
                    stopwatch.Start()
                    startTime = DateTime.UtcNow()
                    'stopwatch.Reset()
                    'stopwatch.Start()
                End If
            End If
        End Sub

    Fred

  6. Hi Paul,

    1 hour ago, Paul Henty said:

    1. What is the problem? Is there an error? Does it return the wrong surface, or nothing?

    2. Which airport and runway are you trying?

    3. What's being returned from the GetRunway() function?

    4. Maybe show me the GetRunway() function.

    1) No error just Disconnect Fsuipc when I takeoff

    2) EHAM

    3) Runway by wind

    Output:

    [18:03] Taxiing to Runway
    [18:03] Taking Off with 119 passengers on board
    [18:03] Taking Off from Runway 36C

     

    Public Function GetActiveRunway(ByVal ICAOcode As String, ByVal WindDirection As Double) As String
            Dim runwayReturn As String = ""
            ' Now get the runways at the airport
            ' For each one we test how far they are from the wind direction
            ' We keep the closest one.
            Dim pathto As String = My.Application.Info.DirectoryPath
            Using MyReader As New FileIO.TextFieldParser(pathto & "\runways.csv")
                MyReader.TextFieldType = FileIO.FieldType.Delimited
                MyReader.SetDelimiters(",")
                Dim runwayst As String
                Dim runwaynum As String
                Dim runwaydes1 As String
                Dim runwaydes2 As String = ""
                Dim currentRow As String()
                Dim smallestDifference As Double = 360
                While Not MyReader.EndOfData
                    Try
                        currentRow = MyReader.ReadFields()
                        If currentRow(0) = ICAOcode Then
                            runwayst = currentRow(1)
                            runwaynum = runwayst.Substring(1, 2)
                            runwaydes1 = runwayst.Substring(3, 1)
                            If runwaydes1 = "0" Then runwaydes2 = ""
                            If runwaydes1 = "1" Then runwaydes2 = "L"
                            If runwaydes1 = "2" Then runwaydes2 = "R"
                            If runwaydes1 = "3" Then runwaydes2 = "C"
                            If runwaydes1 = "4" Then runwaydes2 = "W"
                            Dim rwyMagHeading As Double = CDbl(currentRow(5))
                            Dim rwyMagVariation As Double = 0
    
                            ' I think winds are magnetic. If not we must use true heading instead (second line)
                            Dim rwyHeading As Double = rwyMagHeading
                            ' Dim rwyHeading As Double = rwyMagHeading + rwyMagVariation
    
                            ' Calculate the difference between the wind heading and the runway heading
                            ' You might need to expand this to ignore short runways
                            Dim difference As Double = 180D - Math.Abs(Math.Abs(WindDirection - rwyHeading) - 180D)
                            If difference < smallestDifference Then
                                smallestDifference = difference
                                runwayReturn = runwaynum & runwaydes2
                            End If
                        End If
                    Catch ex As FileIO.MalformedLineException
                        'MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                    End Try
                End While
                MyReader.Close()
                MyReader.Dispose()
            End Using
            Return runwayReturn
        End Function
    Public Function Getrunaway(ByVal icaocode As String) As String
            Dim lon As FsLongitude = New FsLongitude(playerLongitude.Value)
            Dim lat As FsLatitude = New FsLatitude(playerLatitude.Value)
            ' Get the point for the current plane position
            Dim currentPosition As FsLatLonPoint = New FsLatLonPoint(lat, lon)
            Dim pathto As String = My.Application.Info.DirectoryPath
            Using MyReader As New FileIO.TextFieldParser(pathto & "\runways.csv")
                MyReader.TextFieldType = FileIO.FieldType.Delimited
                MyReader.SetDelimiters(",")
                Dim runawayst As String
                Dim runawaynum As String
                Dim runawaydes1 As String
                Dim runawaydes2 As String = ""
                Dim runawayreturn As String
                Dim currentRow As String()
                While Not MyReader.EndOfData
                    Try
                        currentRow = MyReader.ReadFields()
                        If currentRow(0) = icaocode Then
                            runawayst = currentRow(1)
                            runawaynum = runawayst.Substring(1, 2)
                            runawaydes1 = runawayst.Substring(3, 1)
                            If runawaydes1 = "0" Then runawaydes2 = ""
                            If runawaydes1 = "1" Then runawaydes2 = "L"
                            If runawaydes1 = "2" Then runawaydes2 = "R"
                            If runawaydes1 = "3" Then runawaydes2 = "C"
                            If runawaydes1 = "4" Then runawaydes2 = "W"
                            Dim aaa As String = currentRow(2)
                            Dim bbb As String = currentRow(3)
                            Dim aaaa As Double
                            Dim bbbb As Double
                            aaaa = System.Convert.ToDouble(aaa)
                            bbbb = System.Convert.ToDouble(bbb)
                            Dim rwyThresholdLat As FsLatitude = New FsLatitude(aaaa)
                            Dim rwyThresholdLon As FsLongitude = New FsLongitude(bbbb)
                            Dim rwyMagHeading As Double = CDbl(currentRow(5))
                            Dim rwyMagVariation As Double = 0
                            Dim rwyLength As Double = CDbl(currentRow(6)) / 2
                            Dim rwyWidth As Double = 254D
    
                            Dim thresholdCentre As FsLatLonPoint = New FsLatLonPoint(rwyThresholdLat, rwyThresholdLon)
                            Dim trueHeading As Double = rwyMagHeading + rwyMagVariation
                            runwayQuad = FsLatLonQuadrilateral.ForRunway(thresholdCentre, trueHeading, rwyWidth, rwyLength)
                            If runwayQuad.ContainsPoint(currentPosition) = True Then
                                runawayreturn = runawaynum & runawaydes2
                                Return runawayreturn
                                MyReader.Close()
                                MyReader.Dispose()
                                Exit Function
                            End If
                        End If
                    Catch ex As FileIO.MalformedLineException
                        'MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
                    End Try
                End While
                MyReader.Close()
                MyReader.Dispose()
            End Using
    
            Return ""
        End Function

     

    1 hour ago, Paul Henty said:

    I can give general advice but you need to write your own code.

    I know Paul

  7. Hi Paul,

    I have a problem with your code :

     

    Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase
                Dim surfaceType As FsSurface = db.Airports(lblArrival.Text).Runways(Getrunaway(lblDeparture.Text)).Surface
                Surface = surfaceType.ToString()

     

    in your example here:

     

      Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase
            Dim surfaceType As FsSurface = db.Airports("EGJJ").Runways("09").Surface
            Me.txtSurface.Text = surfaceType.ToString() 

     

    complete code :

     Private Sub CbOver70_CheckStateChanged(sender As Object, e As EventArgs) Handles cbOver70.CheckStateChanged
            If cbOver70.Checked = True And chkonground.Checked = True And cbTakeOff.Checked = False Then
                Dim db As AirportsDatabase = FSUIPCConnection.AirportsDatabase
                Dim surfaceType As FsSurface = db.Airports(lblArrival.Text).Runways(Getrunaway(lblDeparture.Text)).Surface
                Surface = surfaceType.ToString()
                Dim flightypeSchedules As Boolean = Me.lblFlightNumber.Text Like "SDC?*"
                If Label19.Text = "Cargo:" Then
                    Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " lbs Cargo on board" & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt, True)
                    Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " lbs Cargo on board" & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml, True)
    
                    runaway = Getrunaway(lblDeparture.Text)
    
                    Dim vt1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt1, True)
                    Dim xml1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml1, True)
                    cbTakeOff.Checked = True
                    stopwatch.Start()
                    startTime = DateTime.UtcNow()
                Else
                    Dim vt As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " passengers on board" & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt, True)
                    Dim xml As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off with " & lblPAX.Text & " passengers on board" & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml, True)
                    runaway = Getrunaway(lblDeparture.Text)
                    Dim vt1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & vbCrLf
                    My.Computer.FileSystem.WriteAllText(Logname, vt1, True)
                    Dim xml1 As String = DateTime.UtcNow.ToString("[HH:mm]") & Chr(32) & "Taking Off from Runway " & runaway & Surface & "*"
                    My.Computer.FileSystem.WriteAllText(Reportname, xml1, True)
                    cbTakeOff.Checked = True
                    stopwatch.Start()
                    startTime = DateTime.UtcNow()
                    'stopwatch.Reset()
                    'stopwatch.Start()
                End If
            End If
        End Sub

    and I don't know how adding this: http://forum.simflight.com/topic/84752-vbnet-closest-navaids-sqlite/?do=findComment&comment=512376

    Some helps please regards Fred

     

  8. Hello Paul,

    Big problem most of my add-ons I have doesn't use GPS to follow a flight plan or a flightpath.ex:  PMDG DASH-8  Majestic GTN .

    For PMDG I have seen offsets to give NAVAID ID and distance somewhere

    Majestic Software use NAV 1&2

    GTN 750& 650 no idea

    So have you an idea to know the nearest Navaid with an other method. Or have you a sample somewhere to share ?

    Thanks

    Fred

  9. 4 minutes ago, Paul Henty said:

    Does your program have access to the lat/lat for the Navaids? Or are they are only on the server?

    Only on the server. No way to have a better or simple method to do this even I need a pln ? if yes how to adapt your code ?

    Forget one thing sorry for that need to catch also the status of the runways in realtime.

    Thanks again

    Fred

     

  10. The Tracker pass the route into php and plot the result to a map.

    I mean in Route form point are read and looking to the db to plot route

     

    5a537d13d0279_2018-01-0815_13_50-skydream_skydrea1_skydream_phpvms_phpvms_navdata_-HeidiSQLPortable9.5.0_5209.png.305a79bf470af3ce507e291b5a3b2eff.png

    Lat/Lon frequency type (FIX, VOR, VOR-DME) Region

    [{"id":"5","pilotid":"SDA0001","flightnum":"SDA8127","pilotname":"Frederic Duchemin","aircraft":"B-77D6","lat":"45.724445851774","lng":"5.0830752739348","heading":"180","alt":"0","gs":"0","depicao":"LFLL","depapt":"Lyon-Saint-Exup\u00e9ry","arricao":"CYYZ","arrapt":"Toronto Pearson Int\\'L. Ont.","deptime":"00:00:00","timeremaining":"00:00","arrtime":"14:26:06","route":"BUSIL UT133 AMORO UT140 PIBAT UM976 OKRIX UH10 AMODO UM729 RESMI UN491 LGL UN502 JSY UN160 NAKID UN83 LEDGO DOGAL . NATD55 . PORTI N112C ALLEX Q822 CAM Q84 PAYGE V490 UCA V2 BUF","route_details":{"BUSIL":{"id":"195475","name":"BUSIL","title":"BUSIL","airway":null,"airway_type":null,"seq":"0","loc":"EUR","lat":"46.293610","lng":"4.721944","freq":"","type":"5"},"AMORO":{"id":"322179","name":"AMORO","title":"AMORO","airway":"UT140","airway_type":"H","seq":"1","loc":"EUR","lat":"46.500000","lng":"4.538056","freq":"","type":"5"},"PIBAT":{"id":"316922","name":"PIBAT","title":"PIBAT","airway":"UM976","airway_type":"H","seq":"9","loc":"EUR","lat":"46.805832","lng":"4.259167","freq":"","type":"5"},"CACHI":{"id":"316923","name":"CACHI","title":"CACHI","airway":"UM976","airway_type":"H","seq":"10","loc":"EUR","lat":"47.066666","lng":"4.106667","freq":"","type":"5"},"AVLON":{"id":"316924","name":"AVLON","title":"AVLON","airway":"UM976","airway_type":"H","seq":"11","loc":"EUR","lat":"47.560001","lng":"3.813333","freq":"","type":"5"},"OKRIX":{"id":"309424","name":"OKRIX","title":"OKRIX","airway":"UH10","airway_type":"H","seq":"14","loc":"EUR","lat":"47.966110","lng":"3.567500","freq":"","type":"5"},"AMODO":{"id":"316015","name":"AMODO","title":"AMODO","airway":"UM729","airway_type":"H","seq":"2","loc":"EUR","lat":"48.419445","lng":"2.980278","freq":"","type":"5"},"RESMI":{"id":"317861","name":"RESMI","title":"RESMI","airway":"UN491","airway_type":"H","seq":"15","loc":"EUR","lat":"48.568611","lng":"2.191944","freq":"","type":"5"},"LGL":{"id":"317883","name":"LGL","title":"LAIGLE","airway":"UN502","airway_type":"H","seq":"8","loc":"EUR","lat":"48.790611","lng":"0.530278","freq":"115.00","type":"5"},"JSY":{"id":"317433","name":"JSY","title":"JERSEY","airway":"UN160","airway_type":"H","seq":"7","loc":"EUR","lat":"49.221104","lng":"-2.046153","freq":"112.20","type":"5"},"NAKID":{"id":"318531","name":"NAKID","title":"NAKID","airway":"UN83","airway_type":"H","seq":"2","loc":"EUR","lat":"49.715000","lng":"-4.623056","freq":"","type":"5"},"LEDGO":{"id":"318530","name":"LEDGO","title":"LEDGO","airway":"UN83","airway_type":"H","seq":"1","loc":"EUR","lat":"51.240002","lng":"-7.568056","freq":"","type":"5"},"DOGAL":{"id":"225471","name":"DOGAL","title":"DOGAL","airway":null,"airway_type":null,"seq":"0","loc":"NAT","lat":"54.000000","lng":"-15.000000","freq":"","type":"5"},"PORTI":{"id":"196243","name":"PORTI","title":"PORTI","airway":null,"airway_type":null,"seq":"0","loc":"NAT","lat":"46.500000","lng":"-52.000000","freq":"","type":"5"},"ALLEX":{"id":"186769","name":"ALLEX","title":"ALLEX","airway":null,"airway_type":null,"seq":"0","loc":"NAM","lat":"44.416668","lng":"-67.000000","freq":"","type":"5"},"CAM":{"id":"297907","name":"CAM","title":"CAMBRIDGE","airway":"Q84","airway_type":"H","seq":"5","loc":"NAM","lat":"42.994289","lng":"-73.344017","freq":"115.00","type":"5"},"PAYGE":{"id":"340995","name":"PAYGE","title":"PAYGE","airway":"V490","airway_type":"L","seq":"3","loc":"NAM","lat":"43.014023","lng":"-74.253548","freq":"","type":"5"},"UCA":{"id":"333083","name":"UCA","title":"UTICA","airway":"V2","airway_type":"L","seq":"128","loc":"NAM","lat":"43.026512","lng":"-75.164520","freq":"111.20","type":"5"},"BUF":{"id":"333071","name":"BUF","title":"BUFFALO","airway":"V2","airway_type":"L","seq":"116","loc":"NAM","lat":"42.928997","lng":"-78.646339","freq":"116.40","type":"5"}},"distremain":"3441","phasedetail":"Boarding","online":"","lastupdate":"2018-01-08 14:26:06","client":"SDAcars","network":"0","aircraftname":"B77L","registration":"B-77D6","code":"SDA","firstname":"Frederic","lastname":"Duchemin","depname":"Lyon-Saint-Exup\u00e9ry","deplat":"45.7204","deplng":"5.07951","arrname":"Toronto Pearson Int'L. Ont.","arrlat":"43.6772","arrlng":"-79.6306","distremaining":"3441"}] 

    5a537fbf6f026_2018-01-0815_25_49-SKYDreamTracker.png.95481384370b8e0b6d14aeb731d32a47.png

  11. 10 hours ago, Paul Henty said:

    I'm not sure what you are trying to do. It looks like you want to show the distances to way points (beacons) in a flight plan. Does your software have a flight plan? Or do your users load a flight plan in Flight Sim?

    Yes my software have a flight plan.

     

    10 hours ago, Paul Henty said:

    No need for a timer. You only need to call this once, just after the connection is open. It takes about 2-3 seconds. You don't need to call this again.

    I'm talking about the function you give me.

    Fred

  12. 2 hours ago, Paul Henty said:

    Yes, that's a good way of doing it. FSUIPC has offsets that give you the Lat/Lon of the ADF and VOR beacons tuned to the radios.

    Here is an example of getting the Lat/Lon of the beacons on the ADF1 and VOR1 radios:

    Thanks  but without db is Lat/Lon can't help me. Maybe use name and distance.

    Like:

    NIC (12NM) --> STP (15NM) --> MTG (23NM)

    Holding the first nearest in the array lock to a value take the second lock to a value etc.. (tree)

    And put all to the form.

    2 hours ago, Paul Henty said:

    After making the connection to FSUIPC you must load the database using:

    
            FSUIPCConnection.AirportsDatabase.Load()

    Ok need a timer to loop but at what frequency I do  that ? please.

    Thanks Paul

    Fred

     

     

  13. Hi Paul,

    Can you help me please in Vb.NET?

    1) I use the DB from Little Navmap or Navdatareader from Albert in SQLite

    2) Maybe catch frequencies tuned by ADF NAV (I have not idea how to work GPS or FMS in virtual life) and compare with the DB ?

    3) For Arrival runways maybe find the closest in range of 40NM around airplane.

    Private Sub getActiveRunways()
    ' Get a reference to the AITrafficServices class (saves typing)
    Dim AI As AITrafficServices = FSUIPCConnection.AITrafficServices
    ' Refresh the traffic information AI.RefreshAITrafficInformation()
    ' Get the arrival runways in use 
    Dim runways As List(Of FSRunway) = AI.GetArrivalRunwaysInUse("EGLL")
    ' Display in the listbox 
    Me.lstArrival.Items.Clear()
    For Each rw As FSRunway In runways
    Me.lstArrival.Items.Add(rw.ToString())
    Next rw 
    ' same for departure runways 
    runways = AI.GetDepartureRunwaysInUse("EGLL") 
    Me.lstDeparture.Items.Clear() 
    For Each rw As FSRunway In runways
    Me.lstDeparture.Items.Add(rw.ToString())
    Next rw
    End Sub

    But no idea howto do that (Again)

    Have examples fro the latest version of DLL in Vb.NET ? please

    Regards Fred

  14. Hello Paul,

    
    I would like to know how to display the closest NAVAIDS that the aircraft is crossing either by reading a SQlite database or by comparing a flight plan loaded in the tracker.
    Always comparing the position of the aircraft to the beacon.
    
    Second point you gave me code to find the runway in service against the wind.
    But in the latest version of your dll you have also implemented AI traffic from IVAO.
    
    How to find either according to the Metar or according to the AI traffic.
    
    Sincerely Fred

     

×
×
  • 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.