Android Question esp8266 access point mode

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

paul fredrick

Member
Licensed User
Longtime User
thanks for the reply, but I've already tried successfully what you tell me, I mean a connection between android and esp8266 direct.
I would like to connect to 192.168.4.1 (ssid = esp)
I tried this code:
B4X:
Sub Process_Globals
   Public Serial1 As Serial
   Private Server As WiFiServerSocket
   Private Astream As AsyncStreams

    Private APSSID As String = "esp"
    Public WiFi As ESP8266WiFi
End Sub

Private Sub AppStart

   Serial1.Initialize(115200)
   Log("AppStart")
    Select WiFi.StartAccessPoint(APSSID)
       Case 1
            Log("Access Point Initialisation Successful")
            Log("SSID: ",APSSID)
            Log("ip: ", WiFi.AccessPointIp)
            Server.Initialize(80,"Server_NewConnection")
            Server.Listen
        Case 0
            Log("Something Went wrong!")
            WiFi.Disconnect
   End Select
End Sub

Sub Server_NewConnection(NewSocket As WiFiSocket)
   Log("new connection")
    Astream.Initialize(NewSocket.Stream,"Astream_NewData", "Astream_Error")
    Astream.Write("ok".GetBytes())
End Sub

Sub astream_NewData (Buffer() As Byte)
       Log("stream")
End Sub

Sub Astream_Error
    Log("Error.")
End Sub
I do not know how to do it in b4a ...
 
Upvote 0

paul fredrick

Member
Licensed User
Longtime User
I tried with your project b4a client and I connected the tablet to ssid "esp" with ip "192.168.4.1", but it don't work ...
help :(
 
Upvote 0
Top