Sub cmbMountPoints_SelectedIndexChanged (index As Int)
CmbCorrType.Text=CGlobals.MntPnts(CmbMountPoints.SelectedIndex).Corr
Label67.Text=CGlobals.MntPnts(CmbMountPoints.SelectedIndex).Sat
CGlobals.DF(71)=CmbMountPoints.SelectedItem
CGlobals.DF(72)=CmbCorrType.Text
CGlobals.DF(99)=Label67.Text
SendGGA.Checked=False
End Sub
Sub FindMountPoints
Dim su As StringUtils
Dim HttpClient As HttpJob
HttpClient.Initialize("NTRIP", Me)
CmbMountPoints.cmbBox.Visible=True
Label68.Visible=False
' Set the NTRIP caster URL and credentials
Dim IPAddress As String = CGlobals.DF(64)
Dim Port As String = CGlobals.DF(65)
' Dim NTRIP_URL As String = "http://" & IPAddress & ":" & Port '& "/caster" 'This does not work..the IP adress for www.Trignet.co.za is 196.15.132.2 and the Port is 2101
Dim NTRIP_URL As String = "http://rtk2go.com:2101" 'This works
Dim Username As String = CGlobals.DF(66)
Dim Password As String = CGlobals.DF(67)
ProgressDialogShow2("Searching For Mount Points...", True)
Dim AuthString As String = Username & ":" & Password
Dim AuthHeader As String = "Basic " & su.EncodeBase64(AuthString.GetBytes("UTF8"))
HttpClient.Download(NTRIP_URL)
' Set headers before sending the request
HttpClient.GetRequest.SetHeader("Authorization", AuthHeader)
HttpClient.GetRequest.SetHeader("User-Agent", "Ceaser")
HttpClient.GetRequest.SetHeader("Accept", "*/*")
HttpClient.GetRequest.SetHeader("Host", IPAddress)
HttpClient.GetRequest.SetHeader("Connection", "close")
' Send the request
' HttpClient.Download(NTRIP_URL)
End Sub
Sub JobDone (Job As HttpJob)
CmbMountPoints.cmbBox.Clear
Dim Items8 As List
Items8.Initialize
If Job.Success Then
Dim response As String = Job.GetString
' Log("NTRIP Response: " & response)
' Process the NTRIP data here to extract mount points
' Dim MountPoints As List
' MountPoints.Initialize
i=0
Dim Lines() As String = Regex.Split(CRLF, response)
For Each Line As String In Lines
' Log(Line)
If Line.StartsWith("STR") And i<1950 Then
Dim Mnt() As String = Regex.Split(";", Line)
Sleep(0)
Try
CGlobals.MntPnts(i).MntPnt=Mnt(2)
CGlobals.MntPnts(i).Corr=Mnt(3)
CGlobals.MntPnts(i).Sat=Mnt(6)
Items8.Add(Mnt(2))
i=i+1
Catch
Log(LastException)
End Try
End If
Next
Dim cs As CSBuilder
Dim l8 As List
l8.Initialize
For i = 0 To Items8.Size -1
l8.Add(cs.Initialize.size(18).Typeface(Typeface.DEFAULT_BOLD).Append(Items8.Get(i)).PopAll)
Next
CmbMountPoints.SetItems(l8)
CmbCorrType.Text=""
Label67.Text=""
' If CGlobals.DF(71)<>0 Then
'
' End If
' CmbMountPoints.SetItems(l8)
' CmbMountPoints.SelectedIndex=CGlobals.DF(71)
' CmbCorrType.Text=CGlobals.DF(72)
' Label67.Text=CGlobals.DF(99)
Else
Log("Job failed: " & Job.ErrorMessage)
Log("HTTP Status Code: " & Job.Response.StatusCode) ' Log the status code for more details
Log(Job.Response.ErrorResponse)
' Log("Full Response: " & Job.GetString) ' Log the full response to understand why it fails
' MsgboxAsync("Mount Points Are Not Available" & CRLF & "The Server Might Be Down", "No Mount Points")
End If
Job.Release
ProgressDialogHide
End Sub