#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: esp8266
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
Dim Timer1 As Timer
End Sub
Sub Globals
Private links As Button
Private mitte As Button
Private rechts As Button
Private vor As Button
Private zurueck As Button
Private stop As Button
Private cls As Button
Private edit1 As EditText
Dim WebView1 As WebView
Dim WebViewExtras1 As WebViewExtras
Private image1 As Panel
Private cvsGraph As Canvas
Dim zs As String
Dim z As Int
Dim pi As Float
Dim x As Int
Dim y As Int
End Sub
Sub Activity_Create(FirstTime As Boolean)
Timer1.Initialize("Timer1", 300)
Activity.LoadLayout("esp8266")
edit1.text =""
WebView1.Initialize("WebView1")
WebViewExtras1.addJavascriptInterface(WebView1, "B4A")
cvsGraph.Initialize(image1)
End Sub
Sub Activity_Resume
Timer1.Enabled = True
pi=3.14159265
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Exit_App
Activity.Finish
ExitApplication
End Sub
Sub WebView1_PageFinished (Url As String)
Dim Javascript As String
Javascript = "B4A.CallSub('ProcessHTML', false, document.documentElement.innerText)"
' Javascript = "B4A.CallSub('ProcessHTML', false, document.documentElement.outerText)"
' Javascript = "B4A.CallSub('ProcessHTML', false, document.documentElement.innerHTML)"
' Javascript = "B4A.CallSub('ProcessHTML', false, document.documentElement.outerHTML)"
' Log("PageFinished: " & Javascript)
WebViewExtras1.executeJavascript(WebView1, Javascript)
End Sub
Sub ProcessHTML(Html As String)
' Log(Html)
zs = Html
End Sub
Sub Timer1_Tick
WebView1.LoadUrl("http://192.168.2.104/leer")
edit1.Text=zs
End Sub
Sub cls_Click
End Sub
Sub zeichne_Click
zeichne
End Sub
Sub rechts_Click
WebView1.LoadUrl("http://192.168.2.104/rechts")
End Sub
Sub mitte_Click
WebView1.LoadUrl("http://192.168.2.104/mitte")
End Sub
Sub links_Click
WebView1.LoadUrl("http://192.168.2.104/links")
End Sub
Sub zurueck_Click
WebView1.LoadUrl("http://192.168.2.104/zur")
End Sub
Sub vor_Click
WebView1.LoadUrl("http://192.168.2.104/vor")
End Sub
Sub stop_Click
WebView1.LoadUrl("http://192.168.2.104/stop")
End Sub
Sub zeichne
For z=0 To 360
x=Sin(z*pi/180)*100
y=Cos(z*pi/180)*100
image1.Invalidate
cvsGraph.DrawLine(130,130, 130+x,130+y, Colors.Red, 1.0)
Next
End Sub