gps (nmea) Daten Distanz aufrufen

  • VB6

Es gibt 2 Antworten in diesem Thema. Der letzte Beitrag () ist von Marcus Gräfe.

    gps (nmea) Daten Distanz aufrufen

    Hallo!
    Ich habe hier mehrere nmea Dateien wo ich die Distanz auslesen möchte.
    Dazu habe ich bis jetzt immer die Seite gpsvisualizer.com verwendet.

    Seit kurzem habe ich festgestellt, dass dies nicht mehr funktioniert bzw. ich keine Daten mehr erhalte.
    Ein Muster einer nmea Datei habe ich angehängt.
    Hier mein Code den ich für das auslesen verwende:

    Visual Basic-Quellcode

    1. Public Function gpsdistance(datei As String) As Double
    2. Dim strFile As String
    3. Dim strHttp As String
    4. Dim DestUrl As URL
    5. Dim intdisplay As Integer
    6. 'Dim datei As String
    7. strdatei = Mid(datei, InStrRev(datei, "\", -1) + 1)
    8. strUrl = "http://www.gpsvisualizer.com/convert?output"
    9. strName = "uploaded_file_1"
    10. strname2 = "convert_add_distance"
    11. strMIMEType = "multipart/form-data"
    12. ' if a request is allredy being sent
    13. ' exit
    14. If blnConnected Then Exit Function
    15. ' check that a file was selected
    16. If datei = vbNullString Then
    17. MsgBox "No File Chosen", vbCritical, "ERROR"
    18. Exit Function
    19. End If
    20. ' extract the URL using a helper function
    21. DestUrl = ExtractUrl(strUrl)
    22. If DestUrl.Host = vbNullString Then
    23. MsgBox "Invalid Host", vbCritical, "ERROR"
    24. Exit Function
    25. End If
    26. ' clear the old response
    27. strResponse = ""
    28. ' read the file contents as a string
    29. ' N.B: in HTTP everything is a string, even binary files
    30. strFile = GetFileContents(datei)
    31. ' build the HTTP request
    32. strHttp = BuildFileUploadRequest2(strFile, DestUrl, strName, strdatei, strname2, strMIMEType)
    33. ' assign the protocol host and port
    34. Winsock1.Protocol = sckTCPProtocol
    35. Winsock1.RemoteHost = DestUrl.Host
    36. If DestUrl.Port <> 0 Then
    37. Winsock1.RemotePort = DestUrl.Port
    38. Else
    39. Winsock1.RemotePort = 80
    40. End If
    41. ' make the connection and send the HTTP request
    42. Winsock1.Connect
    43. While Not blnConnected
    44. DoEvents
    45. Wend
    46. strRequest = strHttp
    47. 'Clipboard.Clear
    48. 'Clipboard.SetText strHttp
    49. Winsock1.SendData strHttp
    50. While blnConnected
    51. DoEvents
    52. Wend
    53. 'Clipboard.SetText strResponse
    54. 'Debug.Print Len(strResponse)
    55. Dim intview As Integer
    56. Dim pfad As String
    57. intdisplay = InStr(1, strResponse, "display")
    58. If intdisplay > 0 Then
    59. pfad = "www.gpsvisualizer.com" & Mid(strResponse, intdisplay - 1, InStr(intdisplay, strResponse, ">") - intdisplay)
    60. gpsdistance = distance(pfad)
    61. ' gpslink = Mid(pfad, InStrRev(pfad, "/", -1))
    62. 'gpslink = "http://www.gpsvisualizer.com/display" & gpslink & " "
    63. Else
    64. gpsdistance = 0
    65. End If
    66. If blnConnected Then blnConnected = False
    67. End Function


    sowie

    Visual Basic-Quellcode

    1. Private Function BuildFileUploadRequest2(ByRef strData As String, _
    2. ByRef DestUrl As URL, _
    3. ByVal UploadName As String, _
    4. ByVal FileName As String, _
    5. ByVal uploadname2 As String, _
    6. ByVal MimeType As String) As String
    7. Dim strHttp As String ' holds the entire HTTP request
    8. Dim strBoundary As String 'the boundary between each entity
    9. Dim strBody As String ' holds the body of the HTTP request
    10. Dim lngLength As Long ' the length of the HTTP request
    11. ' create a boundary consisting of a random string
    12. strBoundary = RandomAlphaNumString(32)
    13. wert1 = "convert_add_distance"
    14. wert2 = "true"
    15. ' create the body of the http request in the form
    16. '
    17. ' --boundary
    18. ' Content-Disposition: form-data; name="UploadName"; filename="FileName"
    19. ' Content-Type: MimeType
    20. '
    21. ' file data here
    22. '--boundary--
    23. strBody = "--" & strBoundary & vbCrLf
    24. strBody = strBody & "Content-Disposition: form-data; name=""" & wert1 & """" & vbCrLf & vbCrLf & " True "
    25. strBody = strBody & vbCrLf & "--" & strBoundary & vbCrLf
    26. strBody = strBody & "Content-Disposition: form-data; name=""" & UploadName & """; filename=""" & _
    27. FileName & """" & vbCrLf
    28. strBody = strBody & "Content-Type: " & MimeType & vbCrLf
    29. strBody = strBody & vbCrLf & strData
    30. strBody = strBody & vbCrLf & "--" & strBoundary & "--"
    31. 'strBody = strBody & "--" & strBoundary & vbCrLf
    32. 'Clipboard.SetText "strBody"
    33. ' find the length of the request body - this is required for the
    34. ' Content-Length header
    35. lngLength = Len(strBody)
    36. ' construct the HTTP request in the form:
    37. '
    38. ' POST /path/to/reosurce HTTP/1.0
    39. ' Host: host
    40. ' Content-Type: multipart-form-data, boundary=boundary
    41. ' Content-Length: len(strbody)
    42. '
    43. ' HTTP request body
    44. strHttp = "POST " & DestUrl.URI & "?" & DestUrl.Query & " HTTP/1.0" & vbCrLf
    45. strHttp = strHttp & "Host: " & DestUrl.Host & vbCrLf
    46. strHttp = strHttp & "Content-Type: multipart/form-data, boundary=" & strBoundary & vbCrLf
    47. strHttp = strHttp & "Content-Length: " & lngLength & vbCrLf & vbCrLf
    48. strHttp = strHttp & strBody
    49. BuildFileUploadRequest2 = strHttp
    50. End Function


    Bei gpsdistance sollte ich eine Distanz bekommen.
    Wenn ich die nmea Datei über gpsvisualizer.com manuell öffne bekomme ich ein Ergebnis.
    Vielen Dank für jede Antwort
    Dateien

    Neu

    Laut diesem Thread: vbforums.com/showthread.php?833523-Https-in-Winsock unterstützt das Winsock-Control unter VB6 kein HTTPS. Da sind Alternativen aufgelistet.
    Besucht auch mein anderes Forum:
    Das Amateurfilm-Forum