mirror of
https://github.com/KeymonSoft/Monitor-Keymon.git
synced 2026-04-17 21:06:19 +00:00
18/10/23 - Se agregó que el monitor haga un ping a la IP 8.8.8.8 e indique el resultado
This commit is contained in:
@@ -5,7 +5,7 @@ Type=Class
|
|||||||
Version=9.85
|
Version=9.85
|
||||||
@EndOfDesignText@
|
@EndOfDesignText@
|
||||||
#Region Shared Files
|
#Region Shared Files
|
||||||
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
|
'#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
|
||||||
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
|
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
|
||||||
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
|
||||||
'###########################################################################################################
|
'###########################################################################################################
|
||||||
@@ -25,13 +25,15 @@ Version=9.85
|
|||||||
Sub Class_Globals
|
Sub Class_Globals
|
||||||
Private Root As B4XView
|
Private Root As B4XView
|
||||||
Private xui As XUI
|
Private xui As XUI
|
||||||
|
Dim ph As Phone
|
||||||
Public login As B4XMainPage
|
Public login As B4XMainPage
|
||||||
Dim s As C_Subs
|
Dim s As C_Subs
|
||||||
Private b_monitorActivo As Button
|
Private b_monitorActivo As Button
|
||||||
Private p_bMonitor As Panel
|
' Private p_bMonitor As Panel
|
||||||
Private l_version As Label
|
Private l_version As Label
|
||||||
Dim l_status As Label
|
Dim l_status As Label
|
||||||
Private p_estatus As Panel
|
Private p_estatus As Panel
|
||||||
|
Dim cb_conexion As CheckBox
|
||||||
Dim cb_internet As CheckBox
|
Dim cb_internet As CheckBox
|
||||||
Dim cb_dbreqserver As CheckBox
|
Dim cb_dbreqserver As CheckBox
|
||||||
Dim cb_db As CheckBox
|
Dim cb_db As CheckBox
|
||||||
@@ -56,6 +58,7 @@ Sub Class_Globals
|
|||||||
Private clv_server As CustomListView
|
Private clv_server As CustomListView
|
||||||
Private p_listItemServer As Panel
|
Private p_listItemServer As Panel
|
||||||
Private l_server As Label
|
Private l_server As Label
|
||||||
|
Private l_info As Label
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub Initialize
|
Public Sub Initialize
|
||||||
@@ -81,6 +84,7 @@ Private Sub B4XPage_Created (Root1 As B4XView)
|
|||||||
#if not(DEBUG)
|
#if not(DEBUG)
|
||||||
logger = False
|
logger = False
|
||||||
#end if
|
#end if
|
||||||
|
s.centraEtiqueta(l_info, Root.Width)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub B4XPage_Appear
|
Sub B4XPage_Appear
|
||||||
@@ -130,7 +134,6 @@ End Sub
|
|||||||
|
|
||||||
'Revisa si la aplicación tiene permiso para acceder a las notificaciones.
|
'Revisa si la aplicación tiene permiso para acceder a las notificaciones.
|
||||||
Sub CheckNotificationAccess As Boolean
|
Sub CheckNotificationAccess As Boolean
|
||||||
Dim ph As Phone
|
|
||||||
Dim nstr, pstr As String
|
Dim nstr, pstr As String
|
||||||
Dim r As Reflector
|
Dim r As Reflector
|
||||||
pstr = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
|
pstr = r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
|
||||||
@@ -218,6 +221,18 @@ Private Sub b_ping_Click
|
|||||||
b_ping.Background = cd1
|
b_ping.Background = cd1
|
||||||
b_ping.Text = "Buscando ..."
|
b_ping.Text = "Buscando ..."
|
||||||
CallSubDelayed(Monitor, "Timer1_Tick")
|
CallSubDelayed(Monitor, "Timer1_Tick")
|
||||||
|
|
||||||
|
CallSubDelayed(Monitor, "probamosConexion")
|
||||||
|
|
||||||
|
|
||||||
|
' Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 2", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||||
|
' If Success Then
|
||||||
|
' Log("ExitValue:" & ExitValue)
|
||||||
|
' Log("StdError:" & StdErr)
|
||||||
|
' LogColor("StdOut: " & StdOut, Colors.Magenta)
|
||||||
|
' Else
|
||||||
|
' Log("Error: " & LastException)
|
||||||
|
' End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub b_timeout_Click
|
Private Sub b_timeout_Click
|
||||||
@@ -245,3 +260,28 @@ Sub CreateListItem(Text As String, Width As Int, Height As Int) As Panel 'ignore
|
|||||||
' i_prod.Bitmap = img
|
' i_prod.Bitmap = img
|
||||||
Return p
|
Return p
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub l_info_Click
|
||||||
|
l_info.Visible = False
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub l_db_Click
|
||||||
|
l_info.Visible = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub l_dbreqserver_Click
|
||||||
|
l_info.Visible = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub l_internet_Click
|
||||||
|
l_info.Visible = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub l_conexion_Click
|
||||||
|
l_info.Visible = True
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub p_Main_Click
|
||||||
|
l_info.Visible = False
|
||||||
|
End Sub
|
||||||
@@ -446,3 +446,31 @@ Sub notiLowReturn(title As String, Body As String, id As Int) As Notification 'i
|
|||||||
Return notification
|
Return notification
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub ping
|
||||||
|
Private ph As Phone
|
||||||
|
Wait For (ph.ShellAsync("ping", Array As String("-c 1","-W 5", "8.8.8.8"))) Complete (Success As Boolean, ExitValue As Int, StdOut As String, StdErr As String)
|
||||||
|
If Success Then
|
||||||
|
' Log("ExitValue:" & ExitValue)
|
||||||
|
' Log("StdError:" & StdErr)
|
||||||
|
Private res() As String = Regex.Split(",", StdOut)
|
||||||
|
For i = 0 To res.Length - 1
|
||||||
|
If res(i).Contains("1 received") Then
|
||||||
|
If Starter.logger Then LogColor(">>> HAY CONEXION", Colors.Green)
|
||||||
|
Starter.ping = True
|
||||||
|
Else If res(i).Contains("0 received") Then
|
||||||
|
If Starter.logger Then LogColor(">>> NO HAY CONEXION", Colors.Red)
|
||||||
|
Starter.ping = False
|
||||||
|
End If
|
||||||
|
' Log(res(i))
|
||||||
|
Next
|
||||||
|
' LogColor("StdOut: " & res, Colors.Blue)
|
||||||
|
If B4XPages.IsInitialized Then B4XPages.MainPage.cb_internet.Checked = Starter.ping
|
||||||
|
If Not(Starter.ping) Then
|
||||||
|
If Starter.logger Then Log("Sin conexión a Google!!!")
|
||||||
|
notiLowReturn("SIN INTERNET ❌", "NO hay conexion a Google.", Monitor.nid)
|
||||||
|
If B4XPages.IsInitialized Then B4XPages.MainPage.l_status.Text = "NO hay conexión a Google!!"
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
Log("Error: " & LastException)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
Binary file not shown.
@@ -42,7 +42,7 @@ Version=12.5
|
|||||||
#Region Project Attributes
|
#Region Project Attributes
|
||||||
#ApplicationLabel: Monitor Keymon
|
#ApplicationLabel: Monitor Keymon
|
||||||
#VersionCode: 1
|
#VersionCode: 1
|
||||||
#VersionName: 3.09.20
|
#VersionName: 3.10.18
|
||||||
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
'SupportedOrientations possible values: unspecified, landscape or portrait.
|
||||||
#SupportedOrientations: portrait
|
#SupportedOrientations: portrait
|
||||||
#CanInstallToExternalStorage: False
|
#CanInstallToExternalStorage: False
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ ModuleBreakpoints5=
|
|||||||
ModuleBreakpoints6=
|
ModuleBreakpoints6=
|
||||||
ModuleBreakpoints7=
|
ModuleBreakpoints7=
|
||||||
ModuleClosedNodes0=
|
ModuleClosedNodes0=
|
||||||
ModuleClosedNodes1=2
|
ModuleClosedNodes1=
|
||||||
ModuleClosedNodes2=
|
ModuleClosedNodes2=
|
||||||
ModuleClosedNodes3=
|
ModuleClosedNodes3=
|
||||||
ModuleClosedNodes4=
|
ModuleClosedNodes4=
|
||||||
ModuleClosedNodes5=8,10
|
ModuleClosedNodes5=
|
||||||
ModuleClosedNodes6=
|
ModuleClosedNodes6=
|
||||||
ModuleClosedNodes7=
|
ModuleClosedNodes7=
|
||||||
NavigationStack=Visual Designer,login.bal,-100,3,B4XMainPage,clv_server_ItemClick,164,0,B4XMainPage,lv_server_ItemClick,160,0,Visual Designer,listItem.bal,-100,6,B4XMainPage,B4XPage_Created,60,6,Monitor,probamosConexion,77,6,Monitor,JobDone,124,4,B4XMainPage,b_monitorActivo_Click,146,1,B4XMainPage,tb_monitorActivo_CheckedChange,137,0,B4XMainPage,Class_Globals,53,0,B4XMainPage,Initialize,55,0
|
NavigationStack=C_Subs,ping,461,6,B4XMainPage,Class_Globals,55,0,B4XMainPage,CreateListItem,255,0,B4XMainPage,l_db_Click,262,0,B4XMainPage,l_internet_Click,270,0,B4XMainPage,l_conexion_Click,274,0,B4XMainPage,l_info_Click,258,4,B4XMainPage,p_Main_Click,278,0,Visual Designer,login.bal,-100,6,B4XMainPage,B4XPage_Created,80,4
|
||||||
SelectedBuild=0
|
SelectedBuild=0
|
||||||
VisibleModules=1,7,3,5,6,4
|
VisibleModules=1,7,3,5,6,4
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ Sub Process_Globals
|
|||||||
' Dim DBReqServerOk As Boolean = True
|
' Dim DBReqServerOk As Boolean = True
|
||||||
' Dim DBOk As Boolean = True
|
' Dim DBOk As Boolean = True
|
||||||
Dim logger As Boolean = False
|
Dim logger As Boolean = False
|
||||||
|
Dim ping As Boolean = False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Sub Service_Create
|
Sub Service_Create
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Sub Process_Globals
|
|||||||
Dim reqManager As DBRequestManager
|
Dim reqManager As DBRequestManager
|
||||||
' Dim DBReqServer As String = "http://keymon.lat:1782"
|
' Dim DBReqServer As String = "http://keymon.lat:1782"
|
||||||
' Dim skmt As SQL
|
' Dim skmt As SQL
|
||||||
|
' Dim ph As Phone
|
||||||
Dim Timer1 As Timer
|
Dim Timer1 As Timer
|
||||||
Private lock As PhoneWakeState
|
Private lock As PhoneWakeState
|
||||||
Dim Interval As Int
|
Dim Interval As Int
|
||||||
@@ -67,14 +68,17 @@ End Sub
|
|||||||
Sub probamosConexion
|
Sub probamosConexion
|
||||||
If logger Then Log("probamos probamosConexion")
|
If logger Then Log("probamos probamosConexion")
|
||||||
If B4XPages.IsInitialized Then
|
If B4XPages.IsInitialized Then
|
||||||
|
B4XPages.MainPage.cb_conexion.Checked = False
|
||||||
B4XPages.MainPage.cb_internet.Checked = False
|
B4XPages.MainPage.cb_internet.Checked = False
|
||||||
B4XPages.MainPage.cb_dbreqserver.Checked = False
|
B4XPages.MainPage.cb_dbreqserver.Checked = False
|
||||||
B4XPages.MainPage.cb_db.Checked = False
|
B4XPages.MainPage.cb_db.Checked = False
|
||||||
End If
|
End If
|
||||||
If IsConnectedToInternet Then
|
If IsConnectedToInternet Then
|
||||||
|
s.ping
|
||||||
InternetOk = True
|
InternetOk = True
|
||||||
If B4XPages.IsInitialized Then
|
If B4XPages.IsInitialized Then
|
||||||
B4XPages.MainPage.cb_internet.Checked = True
|
B4XPages.MainPage.cb_conexion.Checked = True
|
||||||
|
B4XPages.MainPage.cb_internet.Checked = Starter.ping
|
||||||
Dim cd1 As ColorDrawable
|
Dim cd1 As ColorDrawable
|
||||||
cd1.Initialize(Colors.RGB(16, 141, 0), 10dip)
|
cd1.Initialize(Colors.RGB(16, 141, 0), 10dip)
|
||||||
B4XPages.MainPage.b_ping.Background = cd1
|
B4XPages.MainPage.b_ping.Background = cd1
|
||||||
@@ -94,7 +98,7 @@ Sub probamosConexion
|
|||||||
Else
|
Else
|
||||||
If logger Then Log("Sin conexión a internet!!!")
|
If logger Then Log("Sin conexión a internet!!!")
|
||||||
s.notiLowReturn("SIN INTERNET ❌", "NO hay conexion a internet.", nid)
|
s.notiLowReturn("SIN INTERNET ❌", "NO hay conexion a internet.", nid)
|
||||||
If B4XPages.IsInitialized Then B4XPages.MainPage.l_status.Text = "NO hay conexion a internet!!"
|
If B4XPages.IsInitialized Then B4XPages.MainPage.l_status.Text = "NO hay conexión a internet!!"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
@@ -153,7 +157,9 @@ Sub JobDone(Job As HttpJob)
|
|||||||
' Log(resultado.Rows.Size)
|
' Log(resultado.Rows.Size)
|
||||||
End If
|
End If
|
||||||
If B4XPages.IsInitialized Then
|
If B4XPages.IsInitialized Then
|
||||||
B4XPages.MainPage.cb_internet.Checked = InternetOk
|
B4XPages.MainPage.cb_conexion.Checked = InternetOk
|
||||||
|
B4XPages.MainPage.cb_internet.Checked = Starter.ping
|
||||||
|
If DBReqServerOk Then B4XPages.MainPage.cb_internet.Checked = True
|
||||||
B4XPages.MainPage.cb_dbreqserver.Checked = DBReqServerOk
|
B4XPages.MainPage.cb_dbreqserver.Checked = DBReqServerOk
|
||||||
B4XPages.MainPage.cb_db.Checked = DBOk
|
B4XPages.MainPage.cb_db.Checked = DBOk
|
||||||
End If
|
End If
|
||||||
@@ -173,3 +179,4 @@ Sub IsConnectedToInternet As Boolean 'ignore
|
|||||||
If logger Then LogColor("Not connected", Colors.red)
|
If logger Then LogColor("Not connected", Colors.red)
|
||||||
Return False
|
Return False
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user