#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim Timer1 As Timer
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim Command As String
Dim Result As Int
Dim Ph As Phone
Dim Adr As String
Dim Start As Int
Dim stop As Int
Dim M As Int
Dim blocker As Boolean = False
Dim FTP As FTP_Auto
Dim address As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
'Timer1.Initialize("Timer1", 1000)
'Timer1.Enabled=True
RunPing
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub RunPing
Command = File.Combine(File.DirInternalCache, "command")
Adr="192.168.0."
Start=1
stop=254
For M=Start To stop
File.WriteString(File.DirInternalCache, "command", "ping -w 1 -c 1 -n " & Adr & M & CRLF & "exit")
Dim StdOut, StdErr As StringBuilder
StdOut.Initialize
StdErr.Initialize
Result = Ph.Shell("sh", Array As String(Command), StdOut, StdErr)
Dim R As String
R=StdOut.ToString
If R.Contains("1 received") Then
check (Adr&m)
Log(Adr & M & " On")
Else
Log(Adr & M & " Off")
End If
Next
End Sub
Sub FTP_FileExist(Found As Boolean)
If Found Then Log("FTP connection successful") Else Log("Nope!")
End Sub
Sub check(addr As String)
FTP.Initialize(Activity, Me, addr, "root", "", 21, False, False)
Log (addr)
'Log (FTP.IsInitialized)
FTP.FileOrFolderExist("font.cfg" , "etc", False)
End Sub