- Jun 6, 2020
- 11,559
- 4,422
Hi.
I have an Arduino IDE which is sending a log (String) every second by WIFI set up as an AP.
I have made the following in Starter service;
Sub Process_Globals
Public sok As Socket
End Sub
Sub Service_Create
sok.Initialize("SOKK")
sok.Connect( "192.168.11.254",8080,2000)
End Sub
public Sub SOKK_Connected (Successful As Boolean)
End Sub
Then in Main I have;
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private l2 As B4XView
Private tmr As Timer
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("APAM_WHITE_BIrd")
tmr.Initialize("tmr", 1000)
tmr.Enabled =True
end sub
Sub tmr_Tick
If Starter.sok.Connected Then
Dim tr As TextReader
tr.Initialize(Starter.Sok.InputStream)
Dim sb As StringBuilder
sb.Initialize
sb.Append(tr.ReadLine )
l2.Text= sb.ToString
Else
l2.Text="No Connect"
End If
End Sub
Compiling...
I have an Arduino IDE which is sending a log (String) every second by WIFI set up as an AP.
I have made the following in Starter service;
Sub Process_Globals
Public sok As Socket
End Sub
Sub Service_Create
sok.Initialize("SOKK")
sok.Connect( "192.168.11.254",8080,2000)
End Sub
public Sub SOKK_Connected (Successful As Boolean)
End Sub
Then in Main I have;
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Private l2 As B4XView
Private tmr As Timer
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("APAM_WHITE_BIrd")
tmr.Initialize("tmr", 1000)
tmr.Enabled =True
end sub
Sub tmr_Tick
If Starter.sok.Connected Then
Dim tr As TextReader
tr.Initialize(Starter.Sok.InputStream)
Dim sb As StringBuilder
sb.Initialize
sb.Append(tr.ReadLine )
l2.Text= sb.ToString
Else
l2.Text="No Connect"
End If
End Sub
Compiling...
برای دیدن لینک ها باید ثبت نام کنید
برای دیدن لینک ها باید ثبت نام کنید