Sub VerifyServer ' OK Android V 170
' hdPan.ProgressDialogShow("Control for transponder update")
hdPan.ProgressDialogShow(Starter.ResourceStrings.Get("msg_ctrl_tp_upd"))
Dim Ver As HttpJob
If File.Exists(File.DirDocuments,"VERSION.TXT") = True Then
' Applicazione connessa ma potrebbe essere stata connessa ad un diverso box rispetto a quello attuale
' Ritirare su la versione di FW
' Ritirare su la versione di TP
' Confronto FW e TP con quelle del box che deve comandare
' Modifica del file VERSION.TXT direttamente
DebLog("Version.txt o datasat.txt esistono")
Starter.MyMapVer = File.ReadMap(File.DirDocuments, "VERSION.TXT")
FwStringApp = Starter.MyMapVer.Get("FWver")
TpStringApp = Starter.MyMapVer.Get("TPver")
Ver.Initialize("VerTp",Me)
' DA SERVER LOCALE
' Ver.Download2("http://" & Starter.ServerIP & "/www.example.com/fwswdb/verserver.php", Array As String ("action","verify","boxv",FwString,"tplv",TpString)) ' Operativo
' DA SERVER REMOTO
Ver.Download2("http://www.example.com/fwswdb/verserver.php", Array As String ("action","verify","boxv",FwString,"tplv",TpString)) ' Operativo
Else
DebLog("Version.txt o datasat.txt non esistono")
Ver.Initialize("VerTp",Me)
' DA SERVER LOCALE
' Ver.Download2("http://" & Starter.ServerIP & "/www.example.com/fwswdb/verserver.php", Array As String ("action","verify","boxv",FwString,"tplv",TpString)) ' Operativo
' DA SERVER REMOTO
Ver.Download2("http://www.example.com/fwswdb/verserver.php", Array As String ("action","verify","boxv",FwString,"tplv",TpString)) ' Operativo
End If
End Sub
Sub JobDone(Job As HttpJob) ' OK Android V 170
hdPan.ProgressDialogHide
If Job.Success Then
Dim res As String
res = Job.GetString
DebLog("Back from Job:" & Job.JobName )
DebLog("Response from server: " & res)
Select Job.JobName
Case "VerTp"
Job.Release
If res.CompareTo("ERR") = 0 Then
If TpString = "19700101_000000" Then
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
' CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
Else
' Msgbox("Try to download the transponder list later, list uploaded by box.","Warning")
Msgbox(Starter.ResourceStrings.Get("msg_down_up_tp"), Starter.ResourceStrings.Get("title_warning"))
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
' CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
End If
Else if res.CompareTo("OK") = 0 Then
DebLog("Server OK")
If TpStringApp.CompareTo(TpString) = 0 Then
' Msgbox("Transponder list is already updated.","Update")
' Msgbox(Starter.ResourceStrings.Get("msg_tp_ok"), Starter.ResourceStrings.Get("title_update"))
cnttxerr = 0
cntagg = 0
parseOk = REQIDLE
indiceCode = 0
ProgressBar1.Visible = False
If fpan = False Then
fpan = True
ProgressBar1.Visible = False
ShowInitMsg
tabsel = 1
tabstate = ALLTAB
TabEnable
timResumeTabs.Enabled = False
WriteTxRepetition("LSAT"&CRLF)
' SE PRESSIONE DEL TASTO UPDATE E RISPONDE OK NON DEVO CAMBIARE NULLA OK
End If
Else ' Lista Transponder App o non esiste o è diversa da quella del box
Dim Upd As HttpJob
Upd.Initialize("UpdTpApp",Me)
' DA SERVER LOCALE
' Upd.Download2("http://" & Starter.ServerIP & "/www.example.com/fwswdb/verserver.php", Array As String ("action","updateapp","tpfile",TpString))
' DA SERVER REMOTO
Upd.Download2("http://www.example.com/fwswdb/verserver.php", Array As String ("action","updateapp","tpfile",TpString))
End If
Else
Starter.tpfilename = "DATASAT_"&res&".TXT" ' Anche togliere info è in TpStringServer
TpStringServer = res
Dim Upd As HttpJob
Upd.Initialize("UpdTp",Me)
' DA SERVER LOCALE
' Upd.Download2("http://" & Starter.ServerIP & "/www.example.com/fwswdb/verserver.php", Array As String ("action","update","tpfile",TpStringServer))
' DA SERVER REMOTO
Upd.Download2("http://www.example.com/fwswdb/verserver.php", Array As String ("action","update","tpfile",TpStringServer))
End If
Case "UpdTpApp"
Job.Release
If res.CompareTo("ERR") = 0 Then
' Msgbox("Try to download the transponder list later, list uploaded by box.","Warning")
Msgbox(Starter.ResourceStrings.Get("msg_down_up_tp"), Starter.ResourceStrings.Get("title_warning"))
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
' CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
Else
Starter.payload = res
File.WriteString(File.DirDocuments, "DATASAT.TXT", Starter.payload)
SatNameFromFile("DATASAT_"&TpString&".TXT", False)
Starter.MyMapVer.Put("FWver",FwString)
Starter.MyMapVer.Put("TPver",TpString)
File.WriteMap(File.DirDocuments, "VERSION.TXT", Starter.MyMapVer)
cnttxerr = 0
cntagg = 0
parseOk = REQIDLE
indiceCode = 0
ProgressBar1.Visible = False
If fpan = False Then
fpan = True
ProgressBar1.Visible = False
ShowInitMsg
tabsel = 1
tabstate = ALLTAB
TabEnable
timResumeTabs.Enabled = False
WriteTxRepetition("LSAT"&CRLF)
End If
End If
Case "UpdTp"
Job.Release
If res.CompareTo("ERR") = 0 Then
' Msgbox("Try to download the transponder list later, list uploaded by box.","Warning")
Msgbox(Starter.ResourceStrings.Get("msg_down_up_tp"), Starter.ResourceStrings.Get("title_warning"))
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
Else
Starter.payload = res
File.WriteString(File.DirDocuments, "DATASAT.TXT", Starter.payload)
SatNameFromFile("DATASAT_"&TpStringServer&".TXT", True)
End If
End Select
Else
Job.Release
DebLog("Error: " & Job.ErrorMessage)
' Controllo tra versioni di FW e TP tra app e box se torna allora vado aventi ugualmente senza internet
DebLog("BOX TP: "&TpString&" FW: "&FwString)
DebLog("APP TP: "&TpStringApp&" FW: "&FwStringApp)
If TpString = "19700101_000000" Then
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
' CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
Else If TpString.CompareTo(TpStringApp) = 0 Then
cnttxerr = 0
cntagg = 0
parseOk = REQIDLE
indiceCode = 0
ProgressBar1.Visible = False
ivDownload.Visible = False
ivDownload.UserInteractionEnabled = False
ivDownload.Width = 0
ivDownloadOff.Visible = False
ivDownloadOff.UserInteractionEnabled = False
lblSat.UserInteractionEnabled = False
lblSat.Visible = False
lblFoundSat.UserInteractionEnabled = True
lblFoundSat.Visible = True
lblSelSat.UserInteractionEnabled = True
lblSelSat.Visible = True
If fpan = False Then
fpan = True
indSat = 0
pckSat.SelectRow(0, indSat, True)
selectedSat = 30
foundSat = 30
' lblSelSat.Text = "Last Sel: -"
lblSelSat.Text = Starter.ResourceStrings.Get("lbl_selsat")&" -"
' lblFoundSat.Text = "Last Found: -"
lblFoundSat.Text = Starter.ResourceStrings.Get("lbl_foundsat")&" -"
ProgressBar1.Visible = False
ShowInitMsg
tabsel = 1
tabstate = ALLTAB
TabEnable
timResumeTabs.Enabled = False
WriteTxRepetition("LSAT"&CRLF)
End If
Else
Log("TPLists not comparable.")
cntagg = 400 ' OK senza controllo a server
parseOk = REQTPNAMEBOX
lblFoundSat.Visible = False
lblFoundSat.UserInteractionEnabled = False
lblSelSat.Visible = False
lblSelSat.UserInteractionEnabled = False
lblSat.Visible = True
lblSat.UserInteractionEnabled = True
' lblSat.Text = "Uploading Tp: "
lblSat.Text = Starter.ResourceStrings.Get("lbl_up_tp")&" "
ivDownload.UserInteractionEnabled = True
ivDownload.Width = 0
ivDownload.Visible = True
ivDownloadOff.UserInteractionEnabled = True
ivDownloadOff.Visible = True
' CallSub2(Starter, "WriteData",Con.StringToBytes("GETBMEM"&CRLF,"UTF-8")) ' ---- GESTIONE NOMI SATELLITI DA BOX
WriteTxRepetition("GETBMEM"&CRLF)
End If
End If
Return
End Sub