Coder Social home page Coder Social logo

Comments (12)

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

Hi @gonbooster ,

We can add destroy API for ESPProvisionManager. But actually app should not crash.
Can you give some more detail about crash ?

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

Of course, those are the different crases that occur to me from time to time when connecting to the hotspot. After any crash, I need to be able to destroy the ESPProvisionManager provision object because otherwise it is left in a bad state and I cannot reconnect ever again.

another case is if the provisioning process fails due to wrong password, etc.. I need to be able to destroy and create a new object

Crash 1::on connect hotspot and try to get wifi (Android >9)

I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines
D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@e7400c7
D/ESP:ESPDevice: Send Wi-Fi scan command to device
I/Choreographer: Skipped 32 frames!  The application may be doing too much work on its main thread.
W/Looper: Slow Looper main: doFrame is 545ms late because of 1 msg, msg 1 took 557ms (seq=906 running=524ms runnable=1ms late=7ms h=android.os.Handler c=androidx.fragment.app.FragmentManager$4)
V/FA: Inactivity, disconnecting from the service
E/Espressif::SoftAPTransport: unexpected end of stream on com.android.okhttp.Address@1a06791a
W/System.err: java.io.IOException: unexpected end of stream on com.android.okhttp.Address@1a06791a
W/System.err:     at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:203)
        at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:129)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:750)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:475)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:89)
        at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
W/System.err: Caused by: java.io.EOFException: \n not found: size=0 content=...
        at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:202)
        at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:188)
    	... 14 more
W/System.err: java.lang.RuntimeException: Error ! Connection Lost
        at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:120)
        at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43)
        at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143)
W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
W/System.err: java.lang.RuntimeException: Session could not be established
        at com.espressif.provisioning.Session$1.onSuccess(Session.java:98)
        at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:144)
W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Crash2:: on connect to hotspot (Android <=9)


I/Choreographer: Skipped 42 frames!  The application may be doing too much work on its main thread.
I/OpenGLRenderer: Davey! duration=766ms; Flags=0, IntendedVsync=9421821144622, Vsync=9422521144594, OldestInputEvent=9223372036854775807, NewestInputEvent=0, HandleInputStart=9422527569841, AnimationStart=9422527618435, PerformTraversalsStart=9422528730935, DrawStart=9422578069685, SyncQueued=9422584730518, SyncStart=9422584906820, IssueDrawCommandsStart=9422585043227, SwapBuffers=9422586853748, FrameCompleted=9422588142602, DequeueBufferDuration=422000, QueueBufferDuration=315000, 
E/Espressif::SoftAPTransport: failed to connect to /192.168.4.1 (port 80) from **** (port ****) after 5000ms
W/System.err: java.net.SocketTimeoutException: failed to connect to /192.168.4.1 (port 80) from **** (port ****) after 5000ms
W/System.err:     at libcore.io.IoBridge.connectErrno(IoBridge.java:185)
W/System.err:     at libcore.io.IoBridge.connect(IoBridge.java:129)
W/System.err:     at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:137)
W/System.err:     at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
W/System.err:     at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
W/System.err:     at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
W/System.err:     at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
W/System.err:     at java.net.Socket.connect(Socket.java:621)
W/System.err:     at com.android.okhttp.internal.Platform.connectSocket(Platform.java:145)
W/System.err:     at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:141)
W/System.err:     at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
W/System.err:     at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:281)
W/System.err:     at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
        at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
W/System.err:     at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:85)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143)
W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
W/System.err:     at java.lang.Thread.run(Thread.java:764)
W/System.err: java.lang.RuntimeException: Error ! Connection Lost
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:120)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
W/System.err: java.lang.RuntimeException: Session could not be established
        at com.espressif.provisioning.Session$1.onSuccess(Session.java:98)
W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:144)
W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
		

Error 3:: Never get wifi networks

E/ESP:ESPDevice: Network is available - 1
E/ESP:ESPDevice: Network is available - 1
E/ESP:ESPDevice: Network is available - 1
E/ESP:ESPDevice: Network is available - 1
E/ESP:ESPDevice: Network is available - 1
D/ESP:ESPDevice: Connecting to device
D/ESP:ESPDevice: Connecting to device
D/ESP:ESPDevice: Connecting to device
D/ESP:ESPDevice: Connecting to device
D/ESP:ESPDevice: Connecting to device
D/ESP:ESPDevice: Value : {
    	"prov":	{
    		"ver":	"v1.1",
    		"cap":	["no_pop", "wifi_scan"]
    	}
    }
    Device Version : v1.1
D/ESP:ESPDevice: Capabilities : [no_pop, wifi_scan]
E/ESP:ESPDevice: Returning ssid : TEKA_0101
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/HotspotFragment: On Device Prov Event RECEIVED : 1
E/HotspotFragment: Device Connected Event Received
D/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity: Error: FragmentManager has been destroyed
I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 2 lines
D/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity: Error: FragmentManager has been destroyed
D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4
I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines
D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4
D/ESP:ESPDevice: Send Wi-Fi scan command to device
D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4
I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines
D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4
D/ESP:ESPDevice: Send Wi-Fi scan command to device
W/Looper: Slow Looper main: doFrame is 447ms late because of 1 msg, msg 1 took 462ms (seq=2684 running=437ms late=1ms h=android.os.Handler c=androidx.fragment.app.FragmentManager$4)
V/FA: Inactivity, disconnecting from the service
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=20 ms, max=20 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=18 ms, max=18 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=21 ms, max=21 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=19 ms, max=19 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=16 ms, max=16 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=16 ms, max=16 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms.
W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=22 ms, max=22 ms.

from esp-idf-provisioning-android.

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

Hi @gonbooster ,

I think just destroying ESPProvisionManager will not help much in this case. Because due app crash, Android system start app again from the screen where it was crashed. And ESPProvisionManager object also lost device information. So if you call ESPProvisionManager.getInstance(getApplicationContext()) then it will create new object of it.

Due to crash some other initialisation or provisioning flow will be affected too.
And for provision flow, we cannot start from it was crashed because it needs device connection and it's information.
For example, app has started any BLE device provisioning and suppose app crashes in wifi scan list screen. Due to crash process will be killed and app needs to connect BLE device again, it cannot start directly from wifi scan list. So app needs to start provisioning flow again.

"another case is if the provisioning process fails due to wrong password, etc.. I need to be able to destroy and create a new object"
-> App will display provisioning error in case of wrong password. User needs to start provisioning flow again and also needs to reset the device.
To start provisioning flow again for any device, you just need new object of ESPDevice, not ESPProvisionManager.

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

HI @khushbushah2302

I try changing

provisionManager = ESPProvisionManager.getInstance(getContext());

to

provisionManager = ESPProvisionManager.getInstance(getActivity().getApplicationContext());

unsuccessfully

Y have three fragments attached to one ACTIVITY

Fragmen1:


      provisionManager = ESPProvisionManager.getInstance(getContext());
        provisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_SOFTAP, ESPConstants.SecurityType.SECURITY_1);
...

                provisionManager.getEspDevice().connectWiFiDevice(Wifi.getSSIDFromFamily(softApListenner.getFamilyId()), Constants.CONFIGURATIONS.HOTSPOT_PASSWORD);

Fragment 2:

provisionManager = ESPProvisionManager.getInstance(getActivity().getApplicationContext());
...
provisionManager.getEspDevice().scanNetworks(new WiFiScanListener() {..}

Fragment3:

provisionManager = ESPProvisionManager.getInstance(getActivity().getApplicationContext());
  provisionManager.getEspDevice().provision(wifi.getSsid(), wifi.getPassword(), new ProvisionListener() {...]

When fragment 2 or 3 have and error i send it to fragment 1
(and call first provisionManager.getEspDevice().disconnectDevice();). And never work again. But if i exit from ACTIVITY and redo, all works fine.

so, is posible to create a new object please?

    public static ESPProvisionManager getInstance(Context context) {

        if (provision == null) {
            provision = new ESPProvisionManager(context);
        }
        return provision;
    }

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

Hello @khushbushah2302, I have downloaded and modified the library but my idea of deleting the object has not worked: S.
I need to end the activity and create a new one for it to work (after the provisioning process fails due to wrong password etc). any ideas?

from esp-idf-provisioning-android.

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

Hi @gonbooster ,

I am trying to understand your concern.
You want to finish activity if provisioning process fails due to wrong password or with any other reason.

You have ProvisionListener in your Fragment3. You can receive callback of failure in this listener.
App will receive provisioningFailedFromDevice callback with ProvisionFailureReason - AUTH_FAILED (for wrong password) or NETWORK_NOT_FOUND etc.
You can call getActivity().finish(); in this callback to end your activity.

Let me know what you expect from library in case of provisioning failure (due to wrong password).
Correct me if I misunderstood the issue.

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

Hi @khushbushah2302
i want to know First, what are the following errors and how to solve them on getting wifies.
Because when appears i never get wifi list. (usually appear after provisioning failure due to bad password, etc...)

E/ESP:ESPDevice: Network is available - 1 E/ESP:ESPDevice: Network is available - 1 E/ESP:ESPDevice: Network is available - 1 E/ESP:ESPDevice: Network is available - 1 E/ESP:ESPDevice: Network is available - 1 D/ESP:ESPDevice: Connecting to device D/ESP:ESPDevice: Connecting to device D/ESP:ESPDevice: Connecting to device D/ESP:ESPDevice: Connecting to device D/ESP:ESPDevice: Connecting to device D/ESP:ESPDevice: Value : { "prov": { "ver": "v1.1", "cap": ["no_pop", "wifi_scan"] } } Device Version : v1.1 D/ESP:ESPDevice: Capabilities : [no_pop, wifi_scan] E/ESP:ESPDevice: Returning ssid : TEKA_0101 D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/HotspotFragment: On Device Prov Event RECEIVED : 1 E/HotspotFragment: Device Connected Event Received D/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity: Error: FragmentManager has been destroyed I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 2 lines D/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity: Error: FragmentManager has been destroyed D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4 I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4 D/ESP:ESPDevice: Send Wi-Fi scan command to device D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4 I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@51effb4 D/ESP:ESPDevice: Send Wi-Fi scan command to device W/Looper: Slow Looper main: doFrame is 447ms late because of 1 msg, msg 1 took 462ms (seq=2684 running=437ms late=1ms h=android.os.Handler c=androidx.fragment.app.FragmentManager$4) V/FA: Inactivity, disconnecting from the service W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=20 ms, max=20 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=18 ms, max=18 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=21 ms, max=21 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=19 ms, max=19 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=16 ms, max=16 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=16 ms, max=16 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=17 ms, max=17 ms. W/RenderInspector: DequeueBuffer time out on com.nts.teka.tekahomeandroid.debug/com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity, count=1, avg=22 ms, max=22 ms.

I/chatty: uid=10977(com.nts.teka.tekahomeandroid.debug) identical 6 lines D/ForceDarkHelper: updateByCheckExcludeList: pkg: com.nts.teka.tekahomeandroid.debug activity: com.nts.teka.tekahomeandroid.UI.Activities.SoftApActivity@e7400c7 D/ESP:ESPDevice: Send Wi-Fi scan command to device I/Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread. W/Looper: Slow Looper main: doFrame is 545ms late because of 1 msg, msg 1 took 557ms (seq=906 running=524ms runnable=1ms late=7ms h=android.os.Handler c=androidx.fragment.app.FragmentManager$4) V/FA: Inactivity, disconnecting from the service E/Espressif::SoftAPTransport: unexpected end of stream on com.android.okhttp.Address@1a06791a W/System.err: java.io.IOException: unexpected end of stream on com.android.okhttp.Address@1a06791a W/System.err: at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:203) at com.android.okhttp.internal.http.Http1xStream.readResponseHeaders(Http1xStream.java:129) W/System.err: at com.android.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:750) W/System.err: at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:622) W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:475) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:411) W/System.err: at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:542) W/System.err: at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:89) at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43) W/System.err: at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) W/System.err: Caused by: java.io.EOFException: \n not found: size=0 content=... at com.android.okhttp.okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:202) at com.android.okhttp.internal.http.Http1xStream.readResponse(Http1xStream.java:188) ... 14 more W/System.err: java.lang.RuntimeException: Error ! Connection Lost at com.espressif.provisioning.transport.SoftAPTransport.sendPostRequest(SoftAPTransport.java:120) at com.espressif.provisioning.transport.SoftAPTransport.access$000(SoftAPTransport.java:43) at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:143) W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) W/System.err: java.lang.RuntimeException: Session could not be established at com.espressif.provisioning.Session$1.onSuccess(Session.java:98) at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:144) W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)

from esp-idf-provisioning-android.

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

This error indicates app is failed to create session with the device. And without session app will not be able to send wifi scan command and receive wifi list.
For the solution of this error, I need to know your app work flow. I have few question for this.

  • Once provisioning is failed, are you resetting the device ? (Device needs to be reset and app needs to start provisioning again.)
  • May I know how you are handling provisioning failure in your app and what app needs to do upon receiving provisioning failure?

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

Once provisioning is failed, are you resetting the device ? (Device needs to be reset and app needs to start provisioning again.)

  • Yes.
    May I know how you are handling provisioning failure in your app and what app needs to do upon receiving provisioning failure?
    Once provisioning Fail:
  1. call provisionManager.getEspDevice().disconnectDevice();
  2. destroy activity and create new with fragment 1 code:
provisionManager = ESPProvisionManager.getInstance(getContext());
        provisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_SOFTAP, ESPConstants.SecurityType.SECURITY_1);

                provisionManager.getEspDevice().connectWiFiDevice(Wifi.getSSIDFromFamily(softApListenner.getFamilyId()), Constants.CONFIGURATIONS.HOTSPOT_PASSWORD);

once user connect to hotspot by next control:

`@Subscribe(threadMode = ThreadMode.MAIN)
    public void onEvent(DeviceConnectionEvent event) {

        Log.d(TAG, "On Device Prov Event RECEIVED : " + event.getEventType());

        switch (event.getEventType()) {
            case ESPConstants.EVENT_DEVICE_CONNECTED:
...
                final Handler handler = new Handler(Looper.getMainLooper());
                handler.postDelayed(new Runnable() {
                    @Override
                    public void run() {

                        softApListenner.changeFragment(Constants.FRAGMENTS.WIFI_SCANNER,"");
//CHANGE TO WIFI SCANNER FRAGMENT
                    }
                }, 4000);
                break;

        }
    }`

On Fragment 2:

provisionManager = ESPProvisionManager.getInstance(getActivity().getApplicationContext());

provisionManager.getEspDevice().scanNetworks(new WiFiScanListener() {..}

If you want i can send you fragment code in email

from esp-idf-provisioning-android.

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

Fragment code seems good to me.
Please send fragment code. I will try to debug and check the issue.
If there is any issue from library side, we can fix that.

from esp-idf-provisioning-android.

gonbooster avatar gonbooster commented on September 16, 2024

Hi @khushbushah2302 .

It seems that the option to delete the activity and create a new one when an error occurs, is working fine. For this reason, we do not need to give it more importance for now. Thanks a lot.

from esp-idf-provisioning-android.

KhushbuShah25 avatar KhushbuShah25 commented on September 16, 2024

Hi @gonbooster ,
If there is no changes required in provisioning library and code is working fine, we can close this issue.

from esp-idf-provisioning-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.