Coder Social home page Coder Social logo

esp-idf-provisioning-android's Introduction

Provisioning Library

Provisioning library provides a mechanism to send network credentials and/or custom data to ESP32 (or its variants like S2, S3, C3, etc.) or ESP8266 devices.

This repository contains the source code for the companion Android app for this provisioning mechanism. To get this app please clone this repository using the below command:

 git clone https://github.com/espressif/esp-idf-provisioning-android.git

Features

  • Search for available BLE devices.
  • Scan device QR code to provide reference to ESP device.
  • Create reference of ESPDevice manually.
  • Data Encryption
  • Data transmission through BLE and SoftAP.
  • Scan for available Wi-Fi networks.
  • Provision device.
  • Scan for available Wi-Fi networks.
  • Support for exchanging custom data.
  • Support for security version 2.

Requirements

  • Supports Android 8.0 (API level 26) and above.

How to include

Add this in your root build.gradle at the end of repositories:

allprojects {
    repositories {
   	 ...
   	 maven { url 'https://jitpack.io' }
    }
}

And add a dependency code to your app module's build.gradle file.

 implementation 'com.github.espressif:esp-idf-provisioning-android:lib-2.2.1'

Using Provisioning Library

Introduction

Provisioning library provides a simpler mechanism to communicate with an ESP-32, ESP32-S2 and ESP8266 devices. It gives an efficient search and scan model to listen and return devices which are in provisioning mode. It embeds security protocol and allow for safe transmission of data by doing end to end encryption. It supports BLE and SoftAP as mode of transmission which are configurable at runtime. Its primarily use is to provide home network credentials to a device and ensure device connectivity status is returned to the application.

Getting ESPDevice

ESPDevice object is virtual representation of ESP-32/ESP32-S2/ESP8266 devices. It provides interface to interact with devices directly in a simpler manner. ESPProvisionManager is a singleton class that encompasses APIs for searching ESP devices using BLE or SoftAP transport. Once app has received ESPDevice instance, app can maintain it for other API calls or it can receive same ESPDevice instance by calling API getEspDevice() of ESPProvisionManager class.

ESPDevice instances can be obtained from two ways as described following :

QR Code Scan

Device information can be extracted from scanning valid QR code. API returns single ESPDevice instance on success. It supports both SoftAP and BLE. If your device does not have QR code, you can use any online QR code generator. QR code payload is a JSON string representing a dictionary with key value pairs listed in the table below. An example payload : {"ver":"v1","name":"PROV_CE03C0","pop":"abcd1234","transport":"softap"}

Payload information :

Key Detail Values Required
ver Version of the QR code. Currently, it must be v1. Yes
name Name of the device. PROV_XXXXXX Yes
pop Proof of possession. POP value of the device like abcd1234 Optional. Considered empty string if not available in QR code data.
transport Wi-Fi provisioning transport type. It can be softap or ble. Yes
security Security for device communication. It can be 0, 1 or 2 int value. Optional. Considered Sec2 if not available in QR code data.
password Password of SoftAP device. Password to connect with SoftAP device. Optional

In provisioning library, there are two options for QR code scanning API.

  1. User of this API decides the camera preview layer frame by providing CameraSourcePreview as parameter.

    Include CameraSourcePreview in your layout file.

    <com.espressif.provisioning.CameraSourcePreview
    	android:id="@+id/preview"
    	android:layout_width="match_parent"
    	android:layout_height="match_parent"
    	/>

    Provide this CameraSourcePreview instance to below API.

     ESPProvisionManager.getInstance(context).scanQRCode(Activity activityContext, CameraSourcePreview cameraSourcePreview, QRCodeScanListener qrCodeScanListener)
  2. User of this API needs to provide CodeScanner. For providing `CodeScanner' following things to be added in app.

    Add dependency in your app/build.gradle.

    implementation 'com.budiyev.android:code-scanner:2.1.0'
    

    Include CodeScannerView in your layout file.

    <com.budiyev.android.codescanner.CodeScannerView  
    	android:id="@+id/scanner_view"
    	android:layout_width="match_parent"
    	android:layout_height="match_parent"
    	app:autoFocusButtonColor="@android:color/white"
    	app:autoFocusButtonVisible="false"
    	app:flashButtonColor="@android:color/white"
    	app:flashButtonVisible="false"
    	app:frameColor="@android:color/white"
    	app:frameCornersSize="50dp"
    	app:frameCornersRadius="0dp"
    	app:frameAspectRatioWidth="1"
    	app:frameAspectRatioHeight="1"
    	app:frameSize="0.75"
    	app:frameThickness="2dp"
    	app:maskColor="#77000000"/>

    Provide this CodeScanner instance to below API.

    ESPProvisionManager.getInstance(context).scanQRCode(CodeScanner codeScanner, QRCodeScanListener qrCodeScanListener)

Manually Create ESPDevice

ESPDevice can be also created by passing necessary parameters as argument of below function.

ESPProvisionManager.getInstance(context).createESPDevice(TransportType transportType, SecurityType securityType);  

This will return ESPDevice with given transport and security type. For manually creating ESPDevice flow, after creating ESPDevice instance, app also needs to call connect API as described below.

  1. For BLE Transport : For BLE transport type, library will need BluetoothDevice to connect with actual device. To get BluetoothDevice app can call search API or also app can use own BLE scanning. Library supports searching of BLE devices which are currently in provisioning mode. It returns list of devices that are discoverable and matches the parameter criteria. This API will return BluetoothDevice objects for the devices found in BLE scan with given prefix.

    ESPProvisionManager.getInstance(context).searchBleEspDevices(String prefix, BleScanListener bleScannerListener)

    After user select BLE device, app can call connect API. Primary service UUID will also require to call connect API. App can get that from ScanResult.

    espDevice.connectBLEDevice(BluetoothDevice bluetoothDevice, String primaryServiceUuid)
  2. For SoftAP Transport : For SoftAP transport type, app can call connect API to connect with the device.

    espDevice.connectWiFiDevice()

For both transport app can listen device connected / disconnected events by registering for events.

After device connection, app needs to get Proof of Possession from user, if device has pop capability. App needs to set proof of possession for the device.

espDevice.setProofOfPossession(pop)

For security version 2, app needs to provide username as shown below :

espDevice.setUserName(username)

Provisioning

The main feature of Provisioning library is to provision ESP devices. Once we get instance of ESPDevice from above APIs we need to establish session with the device before we can transmit/receive data from it. After receiving device connected event, app can get device capabilities and also set Proof of possession if device has pop capability.

After that application can proceed to scan list of available networks visible to device. This list can be used to give option to the user to choose network of their own choice.

  
espDevice.scanNetworks(final WiFiScanListener wifiScanListener); 
  

User can choose to apply Wi-Fi settings from the above list or choose other Wi-Fi network to provision the device.

  
espDevice.provision(final String ssid, final String passphrase, final ProvisionListener provisionListener);  
  

Other Configuration

Enable / Disable QR code support

QR code support can be enable/disable by setting true/false value of isQrCodeSupported filed available in app/build.gradle.

License

Copyright 2020 Espressif Systems (Shanghai) PTE LTD  
 
Licensed under the Apache License, Version 2.0 (the "License");  
you may not use this file except in compliance with the License.  
You may obtain a copy of the License at  
 
    http://www.apache.org/licenses/LICENSE-2.0  
 
Unless required by applicable law or agreed to in writing, software  
distributed under the License is distributed on an "AS IS" BASIS,  
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
See the License for the specific language governing permissions and  
limitations under the License.

esp-idf-provisioning-android's People

Contributors

adwait-esp avatar ameyinamdar avatar brunoro avatar cvonk avatar duanju avatar jamie-pate avatar jochemml avatar khushbushah25 avatar ninadkheratkar avatar pavlostze avatar shahpiyushv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

esp-idf-provisioning-android's Issues

Getting the BSSID/MAC in BLE

I wanted to know how it would be possible to retrieve the BSSID/MAC of the currently connected device in BLE mode. I've learned how to do it in softAP mode from #18, but this approach wouldn't work for BLE. How can I do this? Thank you.

Remove unnecessary bluetoothGatt.readDescriptor(descriptor)

BLETransport.java:
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {

        if (status == BluetoothGatt.GATT_SUCCESS) {
            Log.d(TAG, "Read Descriptor : " + bluetoothGatt.readDescriptor(descriptor));
  • This last call to bluetoothGatt.readDescriptor() is unnecessary and must be an error.
    readDescriptor starts new remote BLE operation, which causes onDescriptorRead to be called later.
    Since BLE can handle only one pending BLE operation at a time, this makes it impossible to do anything else at this time.

Custom endpoint response truncated to the first 600 bytes (BLE transport)

I have created a custom endpoint to handle our custom provisioning needs over BLE transport.
When the esp response is smaller than 600 bytes, every thing is fine.
But if the esp response is bigger, the response is truncated to the first 600 bytes.

How protocomm handle the communication when the request/response size is higher than the MTU?
Does protocomm or esp-idf-provisioning-android lib have any known limitation regarding the request/response size?

Thanks for your help.

scanNetoworks not works without set "ProofOfPossession"

I am creating the instance and the ESPDevice like this:

mProvisionManager = ESPProvisionManager.getInstance(requireContext());
mProvisionManager.createESPDevice(ESPConstants.TransportType.TRANSPORT_BLE, ESPConstants.SecurityType.SECURITY_1);

But to start with scanNetowork I need to setProofOfPossession("")
like this:

mProvisionManager.getEspDevice().setProofOfPossession("");
mProvisionManager.getEspDevice().scanNetworks()...

If I am not set as empty, the scanNetowork failed.

I see that should set pop otherwise the Security instance is null
new Security1(proofOfPossession)
end cannot create Session -> new Session(transport, security)

So is it normal force to set setProofOfPossession as empty string?

No matching client found for package name

Hi!
I followed README instruction to build a custom app. When building got an error:

No matching client found for package name 'com.klika.provision'

When I set applicationId back to com.espressif.provbleavs it works.
Should package name and applicationId be the same?

Support Android SDK-21

Why is the minSdkVersion set to 23? I tried running the provisioning with a minSdkVersion set to 21 and everything seems to work.

SDK v3.3rc --> Provisioning failed to find device during scan

Give it try to update SDK into latest v3.3 release candidate version, but no luck with provisioning via BT. Scanning device is end with no device found , below is android debug log:
D/BluetoothAdapter: STATE_ON D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6 D/BluetoothAdapter: STATE_ON V/RenderScript: 0x55c16f33a0 Launching thread(s), CPUs 8 V/BoostFramework: BoostFramework() : mPerf = com.qualcomm.qti.Performance@da3614d D/BluetoothAdapter: STATE_ON

with previous sdk v3.2.2 , provisioning via BT is running well,BLE transport work well during scan:
D/BluetoothAdapter: STATE_ON D/BluetoothLeScanner: onClientRegistered() - status=0 clientIf=6 D/Espressif::BLETransport: Got scan result D/Espressif::BLETransport: Got scan result2 D/Espressif::BLETransport: Got scan result

Is there anyone have similar issue?

Write to BLE failed

I'm using the latest code from versions/avs-ble branch of this repo with head version of esp-va-sdk master.
I'm trying to provision using BLE. I see my device in the list but when I select the device it gets stuck.

The logs on Android app side:

W/System.err: org.json.JSONException: Value SUCCESS of type java.lang.String cannot be converted to JSONObject (at BLETransportLatest.java:301)
java.lang.Exception: Write to BLE failed (at BLETransportLatest.java:377)

On the device side:
W (30371) BT_APPL: BTA got unregistered event id 31
E (32291) security1: Security version mismatch. Closing connection
E (32291) protocomm_ble: Invalid content received, killing connection

On the Android side I am using bleSec1AvsDebug build variant. I tried bleSec0AvsDebug as well but I get the same error.

Looks like a version mismatch. Any suggestion on how I can get it working quickly?

provision Fail

Hi, following readme (https://github.com/espressif/esp-idf-provisioning-android)
All in manual mode (without QR)
i can connect to device succesfully but on provisioning not and i cant understand what happening:

  1. connection code:
        WiFiAccessPoint wiFiAccessPoint = new WiFiAccessPoint();
        wiFiAccessPoint.setWifiName(ssid);
        wiFiAccessPoint.setPassword("123456781");
        wiFiAccessPoint.setSecurity(1);
        espDevice.setWifiDevice(wiFiAccessPoint);
        espDevice.connectToDevice();

        ConnectivityManager.NetworkCallback networkCallback = new ConnectivityManager.NetworkCallback() {
            @Override
            public void onAvailable(Network network) {
                super.onAvailable(network);
                if(checkWifiConnect(ssid))
                    **provisioning();**
            }

            @Override
            public void onLost(Network network) {
                super.onLost(network);
            }
        };
        connectivityManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
        connectivityManager.registerDefaultNetworkCallback(networkCallback);


        };
        connectivityManager = (ConnectivityManager) getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
        connectivityManager.registerDefaultNetworkCallback(networkCallback);
  1. provisioning (provisioning())
onCreateView:
        wifiManager = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE);
        espDevice = ESPProvisionManager.getInstance(getActivity().getApplicationContext()).getEspDevice();
        espDevice.provision("M_9053", "Z333bwSEWrsPQRirvda6", new ProvisionListener() {
          ...
        });

Log:


2020-10-23 14:20:20.900 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESPDEVICE: com.espressif.provisioning.ESPDevice@92f023e
2020-10-23 14:20:20.900 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESPDEVICE: ----EMPEZANDO connectWiFiDevice----
2020-10-23 14:20:20.900 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: enableOnlyWifiNetwork()
2020-10-23 14:20:20.901 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESPDEVICE: ----FIN connectWiFiDevice----
2020-10-23 14:20:21.002 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Connecting to device
2020-10-23 14:20:22.828 10978-11083/com.nts.teka.tekahomeandroid.debug V/FA: Activity resumed, time: 103797443
2020-10-23 14:20:22.836 10978-11083/com.nts.teka.tekahomeandroid.debug V/FA: Connecting to remote service
2020-10-23 14:20:22.843 10978-11083/com.nts.teka.tekahomeandroid.debug D/FA: Connected to remote service
2020-10-23 14:20:22.844 10978-11083/com.nts.teka.tekahomeandroid.debug V/FA: Processing queued up service tasks: 1
2020-10-23 14:20:22.876 10978-11138/com.nts.teka.tekahomeandroid.debug E/ESP:ESPDevice: Network is available - 3
2020-10-23 14:20:22.881 10978-11138/com.nts.teka.tekahomeandroid.debug E/ESP:ESPDevice: Network is available - 1
2020-10-23 14:20:22.982 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Connecting to device
2020-10-23 14:20:27.853 10978-11083/com.nts.teka.tekahomeandroid.debug V/FA: Inactivity, disconnecting from the service
2020-10-23 14:20:29.640 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->arrayBaseOffset(Ljava/lang/Class;)I (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->copyMemory(JJJ)V (greylist, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->objectFieldOffset(Ljava/lang/reflect/Field;)J (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getByte(J)B (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getByte(Ljava/lang/Object;J)B (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getLong(J)J (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.641 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->putByte(JB)V (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.642 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->putByte(Ljava/lang/Object;JB)V (greylist,core-platform-api, linking, allowed)
2020-10-23 14:20:29.643 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-10-23 14:20:29.643 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden method Lsun/misc/Unsafe;->getLong(Ljava/lang/Object;J)J (greylist,core-platform-api, reflection, allowed)
2020-10-23 14:20:29.644 10978-10978/com.nts.teka.tekahomeandroid.debug W/meandroid.debu: Accessing hidden field Ljava/nio/Buffer;->address:J (greylist, reflection, allowed)
2020-10-23 14:20:30.612 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err: java.lang.NullPointerException: Attempt to get length of null array
2020-10-23 14:20:30.614 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.lang.StringFactory.newStringFromBytes(StringFactory.java:249)
2020-10-23 14:20:30.614 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at com.espressif.provisioning.ESPDevice$14$1.onSuccess(ESPDevice.java:1033)
2020-10-23 14:20:30.615 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:112)
2020-10-23 14:20:30.615 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
2020-10-23 14:20:30.615 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2020-10-23 14:20:30.615 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2020-10-23 14:20:30.616 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2020-10-23 14:20:30.616 10978-11272/com.nts.teka.tekahomeandroid.debug W/System.err:     at java.lang.Thread.run(Thread.java:919)
2020-10-23 14:20:30.703 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Value : {
    	"prov":	{
    		"ver":	"v1.1",
    		"cap":	["no_pop", "wifi_scan"]
    	}
    }
2020-10-23 14:20:30.703 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Device Version : v1.1
2020-10-23 14:20:30.706 10978-11272/com.nts.teka.tekahomeandroid.debug E/ESP:ESPDevice: Returning ssid : TEKA_CACE7C
2020-10-23 14:20:30.706 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Capabilities : [no_pop, wifi_scan]
2020-10-23 14:20:30.708 10978-11272/com.nts.teka.tekahomeandroid.debug D/EventBus: No subscribers registered for event class com.espressif.provisioning.DeviceConnectionEvent
2020-10-23 14:20:30.709 10978-11272/com.nts.teka.tekahomeandroid.debug D/EventBus: No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent
2020-10-23 14:20:30.719 10978-10978/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Connecting to device
2020-10-23 14:20:31.531 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Value : {
    	"prov":	{
    		"ver":	"v1.1",
    		"cap":	["no_pop", "wifi_scan"]
    	}
    }
2020-10-23 14:20:31.532 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Device Version : v1.1
2020-10-23 14:20:31.537 10978-11272/com.nts.teka.tekahomeandroid.debug E/ESP:ESPDevice: Returning ssid : TEKA_CACE7C
2020-10-23 14:20:31.537 10978-11272/com.nts.teka.tekahomeandroid.debug D/ESP:ESPDevice: Capabilities : [no_pop, wifi_scan]
2020-10-23 14:20:31.538 10978-11272/com.nts.teka.tekahomeandroid.debug D/EventBus: No subscribers registered for event class com.espressif.provisioning.DeviceConnectionEvent
2020-10-23 14:20:31.538 10978-11272/com.nts.teka.tekahomeandroid.debug D/EventBus: No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent

espDevice.provision() returns createSessionFailed exception -> Failed to create session

before espDevice.provision i try espDevice.scanNetworks withouth result.

ScanNetworks produce an Failed to create session error

The connection fails when I try to scan networks when a BLE device is already connected.
My Flow is:

  1. Scan for BLE devices:
    manager.searchBleEspDevices(this)

  2. Create the ESPDevice when the device is found:
    manager.createESPDevice(ESPConstants.TransportType.TRANSPORT_BLE,ESPConstants.SecurityType.SECURITY_1)
    manager.espDevice.connectBLEDevice(device, serviceUUID)

  3. Try to scan for Networks
    manager.espDevice.proofOfPossession = "POP_VALUE"
    manager.espDevice.scanNetworks(this)

Then I always receive the onWiFiScanFailed error:

E/ProvisionManager: NAILAH onWiFiScanFailed: java.lang.RuntimeException: Failed to create session.
    java.lang.RuntimeException: Failed to create session.
        at com.espressif.provisioning.ESPDevice$3.onFailure(ESPDevice.java:475)
        at com.espressif.provisioning.ESPDevice$6.OnSessionEstablishFailed(ESPDevice.java:570)
        at com.espressif.provisioning.Session$1.onFailure(Session.java:108)
        at com.espressif.provisioning.transport.BLETransport$1.onCharacteristicWrite(BLETransport.java:354)
        at android.bluetooth.BluetoothGatt$1$7.run(BluetoothGatt.java:474)
        at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:882)
        at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:42)
        at android.bluetooth.BluetoothGatt$1.onCharacteristicWrite(BluetoothGatt.java:469)
        at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:267)
        at android.os.Binder.execTransactInternal(Binder.java:1195)
        at android.os.Binder.execTransact(Binder.java:1159)

I even tried this in the application in this repository and got the same problem.

Support of i18n

Do you consider i18n feature for both android and ios provisioning apps?

If so I can translate to Turkish.

I'm asking this because we have a project and want to use these apps just with translating to Turkish but don't want to duplicate projects and push to stores also I'm not sure if it's ok to do this for you because of legal issues?

What is the best approach for this situation?

Problem during Alexa Authentication

Hi,

First of all, thank you for your amazing work.
I'm experiencing a strange issue during the login phase.

What the problem is:
I cannot authenticate an user with Amazon Alexa Login becase once inserted credentials I receive "500 internal server error". The webpage doesn't close itself automatically and then the provisioning process can't complete so I dindn't receive any kind of callback like onSuccess, onError or onCancel.

What I have done:

  • I cloned the repo
  • I registered my application to the Amazon Developer Console
  • I configured the Security Profile and configured the Alexa Voice Settings
  • I created an Amazon Api Key wich I have put in the "api_key.txt" file
  • I built and run the app

So, the LWA sdk is working fine and the Amazon Api Key is working, the login page is correctly shown to the user but unfortunately the authenticatuon process never complets because receive an 500 internal server error.

In your Readme.me file I saw that a "clientId" property should be declared under the Build Types settings. How can I set that field? Can you please share to me the code?
By using the LWA sdk, the clientId is necessary to get the Authorization?

The Amazon Login page once introduced the user credentials asks to allow the Amazon Alexa project. In your app version published on the Play Store the Amazon login page asks to allow at the esp_avs_open. Why there are two different scenarios? Iโ€™m missing some web or client configurations?

What about the error during the authentication phase?
How can I solve that issue?

Thank you in advance.

softAp mode

Dear
I compile and program on my Samsung. It's OK.
However, it only has ble mode, right? If not, please help me to enable SoftAP mode.

Regards,

import espressif.Sec0; not working in Android Studio

I downloaded release 1_0_1 and imported it into Android Studio, and now I am getting many errors:

It can not resolve this:
import espressif.Sec0;

I found Sec0 in the following directory:

/Users/nader/Documents/esp32_android/esp-idf-provisioning-android-release_1_0_1/app/src/main/proto

but for some reason, Android Studio is not able to find it.

screen shot 2018-12-13 at 8 42 18 am

Protobuf Lite Issue

Dear,

Crypto library needs to be updated to the last version. Also, protobuf Lite should be changed to use protobuf java Lite since protobuf lite makes duplicate classes when adding cloud firestore dependencies. Since firestore has updated their libraries from protobuf Lite to javaLite. And thus, I can't build my project with cloud firestore dependencies. So please if you may fix this in your package.

Best Regards,

ESPDevice.connectBLEDevice not working on Android SDK <=24

When I try to connect to a device using connectBLEDevice after scanning, it fails to fire the connection callback. I checked the logs and found that during the service and characteristic discovery process I get this Gatt error status 5 for 'onCharacteristicWrite', which maps to GATT_INSUFFICIENT_AUTHENTICATION.
I tested this on 3 seperate devices running Android 6 and 7.1 and they all have the same issue.

See logs below:

2022-03-29 13:49:34.430 25252-25467/za.co.digitlab.GFConnect D/Espressif::BLETransport: onConnectionStateChange2, New state : 2, Status : 0
2022-03-29 13:49:34.431 25252-25467/za.co.digitlab.GFConnect E/Espressif::BLETransport: Connected to GATT server.
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: On services discovered
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Characteristic UUID : 021aff50-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Characteristic UUID : 021aff51-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Characteristic UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Characteristic UUID : 021aff53-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.463 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Characteristic UUID : 021aff54-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.464 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Descriptor : 00002901-0000-1000-8000-00805f9b34fb
2022-03-29 13:49:34.467 25252-25264/za.co.digitlab.GFConnect D/Espressif::BLETransport: Des read : true
2022-03-29 13:49:34.543 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, : Status 0
2022-03-29 13:49:34.544 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, Value : prov-scan for UUID : 021aff50-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.544 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: Descriptor : 00002901-0000-1000-8000-00805f9b34fb
2022-03-29 13:49:34.546 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: Des read : true
2022-03-29 13:49:34.640 25252-25467/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, : Status 0
2022-03-29 13:49:34.640 25252-25467/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, Value : prov-session for UUID : 021aff51-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.641 25252-25467/za.co.digitlab.GFConnect D/Espressif::BLETransport: Descriptor : 00002901-0000-1000-8000-00805f9b34fb
2022-03-29 13:49:34.643 25252-25467/za.co.digitlab.GFConnect D/Espressif::BLETransport: Des read : true
2022-03-29 13:49:34.738 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, : Status 0
2022-03-29 13:49:34.738 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, Value : prov-config for UUID : 021aff52-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.738 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: Descriptor : 00002901-0000-1000-8000-00805f9b34fb
2022-03-29 13:49:34.739 25252-25468/za.co.digitlab.GFConnect D/Espressif::BLETransport: Des read : true
2022-03-29 13:49:34.836 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, : Status 0
2022-03-29 13:49:34.836 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, Value : proto-ver for UUID : 021aff53-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:34.837 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: Descriptor : 00002901-0000-1000-8000-00805f9b34fb
2022-03-29 13:49:34.839 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: Des read : true
2022-03-29 13:49:34.934 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, : Status 0
2022-03-29 13:49:34.934 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: DescriptorRead, Value : custom-data for UUID : 021aff54-0382-4aea-bff4-6b3f1c5adfb4
2022-03-29 13:49:35.031 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: onCharacteristicWrite, status : 5
2022-03-29 13:49:35.031 25252-25265/za.co.digitlab.GFConnect D/Espressif::BLETransport: UUID : 021aff53-0382-4aea-bff4-6b3f1c5adfb4

Write to BLE failed

My BLE provisioning flow is as follows:

  1. I start the provisioning process by scanning for BLE devices.
  2. I connect to the device.
  3. I make a request via provisionManager.getEspDevice().sendDataToCustomEndPoint and get back some data from the device.
  4. Then I connect to a Wifi network and provision.

Here's my test case:

  1. I run the provisioning flow listed above once with an incorrect WiFi password.
  2. The provisioning fails and the ESP32 automatically resets, and I restart the provisioning flow again.
  3. On the second run-through of the provisioning flow I get the below error on step 3.
2021-08-07 21:01:44.132 29608-29627/com.test W/System.err: java.lang.Exception: Write to BLE failed
2021-08-07 21:01:44.133 29608-29627/com.test W/System.err:     at com.espressif.provisioning.transport.BLETransport$1.onCharacteristicWrite(BLETransport.java:354)
2021-08-07 21:01:44.134 29608-29627/com.test W/System.err:     at android.bluetooth.BluetoothGatt$1$7.run(BluetoothGatt.java:473)
2021-08-07 21:01:44.134 29608-29627/com.test W/System.err:     at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:860)
2021-08-07 21:01:44.135 29608-29627/com.test W/System.err:     at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:45)
2021-08-07 21:01:44.135 29608-29627/com.test W/System.err:     at android.bluetooth.BluetoothGatt$1.onCharacteristicWrite(BluetoothGatt.java:468)
2021-08-07 21:01:44.136 29608-29627/com.test W/System.err:     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:265)
2021-08-07 21:01:44.138 29608-29627/com.test W/System.err:     at android.os.Binder.execTransactInternal(Binder.java:1021)
2021-08-07 21:01:44.139 29608-29627/com.test W/System.err:     at android.os.Binder.execTransact(Binder.java:994)
2021-08-07 21:01:44.140 29608-29608/com.test W/System.err: java.lang.Exception: Write to BLE failed
2021-08-07 21:01:44.141 29608-29608/com.test W/System.err:     at com.espressif.provisioning.transport.BLETransport$1.onCharacteristicWrite(BLETransport.java:354)
2021-08-07 21:01:44.141 29608-29608/com.test W/System.err:     at android.bluetooth.BluetoothGatt$1$7.run(BluetoothGatt.java:473)
2021-08-07 21:01:44.142 29608-29608/com.test W/System.err:     at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:860)
2021-08-07 21:01:44.143 29608-29608/com.test W/System.err:     at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:45)
2021-08-07 21:01:44.144 29608-29608/com.test W/System.err:     at android.bluetooth.BluetoothGatt$1.onCharacteristicWrite(BluetoothGatt.java:468)
2021-08-07 21:01:44.144 29608-29608/com.test W/System.err:     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:265)
2021-08-07 21:01:44.145 29608-29608/com.test W/System.err:     at android.os.Binder.execTransactInternal(Binder.java:1021)
2021-08-07 21:01:44.145 29608-29608/com.test W/System.err:     at android.os.Binder.execTransact(Binder.java:994)
2021-08-07 21:01:44.145 29608-29608/com.test I/BLELandingViewModel: Write to BLE failed
2021-08-07 21:01:44.167 29608-29974/com.test W/libEGL: EGLNativeWindowType 0x71767b7d10 disconnect failed
2021-08-07 21:01:44.207 29608-29608/com.test I/MultiWindowDecorSupport: updateCaptionType >> DecorView@f010a[], isFloating: true, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: false

I am using implementation 'com.github.espressif:esp-idf-provisioning-android:lib-2.0.9' in my applications gradle file.

Why does this error occur and how can I fix it? I also tried rescanning for BLE networks again, and it then returned 0 devices. I'm not sure why it returned 1 device on the first scan and then 0 on the second.

"Cannot establish session" error while provision

After we enter the home network credentials, it keeps saying "cannot establish session". The ssid and password are correct. its a 2.4GHz network and uses wpa2_psk security. Anything else we need to check for or try
prov-error
?

Getting the BSSID in softAP

I wanted to know how it would be possible to retrieve the BSSID of the currently connected device in softAP mode. I know that the ESPTouch sample android app has this, but I haven't found any way to do so in this Provisioning app. How can I do this?

add custom field

Is there a tutorial/documentation on how to work with this android studio app?

I recently added a custom endpoint on the provisioning manager example, but now I have no way to test its functionality unless I change the ESP BLE prov app by adding another input field.

esp softap_prov (3.3.1)

Hi, I have some problem that i can not handle. I am using esp32-Wroom with esp-idf 3.3.1. I have succesfuly run the softap_prov example with the esp_prov.py. Then I have tried to run this esp-idf-provisioning-android project in android studio and it was not succesfully run.
Untitled
The app gets stuck here and it doesn't go any further. I'm thinking that this esp-idf version may not mach the prov-android version.
The problem that i understand is application waiting a json string but it gets something else

I am getting this part of Logs from Android Studio below:

D/ESP:ESPDevice: enableOnlyWifiNetwork()
E/ESP:ESPDevice: Network is available - 3
D/NetdClient: setNetworkForTarget(268)
D/ESP:ESPDevice: Connecting to device
D/NetworkSecurityConfig: No Network Security Config specified, using platform default
D/ESP:ESPDevice: Value : V0.1
E/ESP:ESPDevice: Schedule wifiConnectionFailedTask
W/System.err: org.json.JSONException: Value V0.1 of type java.lang.String cannot be converted to JSONObjec
t
W/System.err: at org.json.JSON.typeMismatch(JSON.java:111)
at org.json.JSONObject.(JSONObject.java:163)
W/System.err: at org.json.JSONObject.(JSONObject.java:176)
at com.espressif.provisioning.ESPDevice$13$1.onSuccess(ESPDevice.java:1039)
at com.espressif.provisioning.transport.SoftAPTransport$1.run(SoftAPTransport.java:112)
W/System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
W/System.err: at java.lang.Thread.run(Thread.java:764)
D/ESP:ESPDevice: Capabilities JSON not available.
D/ProvisionLanding: On Device Prov Event RECEIVED : 1
E/ProvisionLanding: Device Connected Event Received
I/zygote64: Do partial code cache collection, code=124KB, data=100KB
I/zygote64: After code cache collection, code=124KB, data=100KB
Increasing code cache capacity to 512KB
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/chatty: uid=10203(u0_a203) com.espressif.wifi_provisioning identical 1 line
W/View: dispatchProvideAutofillStructure(): not laid out, ignoring
I/AssistStructure: Flattened final assist data: 3196 bytes, containing 1 windows, 13 views
D/ProofOfPossessionActivity: POP : abcd1234
D/ProvisionActivity: Selected AP -null

I/zygote64: Do full code cache collection, code=247KB, data=196KB
I/zygote64: After code cache collection, code=243KB, data=136KB

Write to BLE failed error

After selecting the SSID and entering the password, It says "configurations applied", but at the end it says write to BLE failed. Didnt see this error before. any suggestions what to look for or what can be done ? I' using amazon-alexa from esp-va-sdk if it matters.

Running with a custom Product ID

Hi!
I struggling to run provisioning with a custom AWS account and AVS product id. As I'm not an experienced Android developer, so could you kindly provide example files with changes(what and where) that I should make in the Android project to run with a custom product id.

Wil it Work for ESP 8266

Will this app Work in ESP 8266 Wifi ... the think is that when i try to scan , it automatically scans for bluetooth device .

AUTH_FAILED in provision

If I write an error wifi password, the callback go to AUTH_FAILED correctly

@Override
            public void provisioningFailedFromDevice(final ESPConstants.ProvisionFailureReason failureReason) {
                requireActivity().runOnUiThread(() -> {
                    switch (failureReason) {
                        case AUTH_FAILED: //HERE
                            setError(R.string.error_authentication_failed);
                            break;
                        case NETWORK_NOT_FOUND:
                            setError(R.string.error_network_not_found);
                            break;
                        case DEVICE_DISCONNECTED:
                        case UNKNOWN:
                            setError(R.string.error_prov_step_3);
                            break;
                    }
                });
            }

Than I try to call again
mProvisionManager.getEspDevice().provision(ssid, password, new ProvisionListener() {}

but recive createSessionFailed, than is all stopped. I cannot call again provision method.
I need to reconnect device and scan again wifi???

Can someone give me an implementation example?

I'm trying to write a bridge between react native and android for this lib, I want to do this only for Android first. Can someone give me an simple done app that implements this lib? Just for help me. Thanks.

How to use this Library

Hello.

i'm now Include library & define "private ESPProvisionManager espProvisionManager; "

but, I don't understand why Scan QRCODE?"

& What is "TransportType transportType", "SecurityType securityType" ?

Please let me know if there is an easy example of using the library.

Build failed with an exception

I download the latest projest and Build with Android Studio,but error happened:
Some problems were found with the configuration of task ':app:generateBleSec0AvsDebugProto'.

Directory 'D:\Android\AndroidAPP\ESP_Alexa\app\build\extracted-include-protos\avs' specified for property '$6' does not exist.
Directory 'D:\Android\AndroidAPP\ESP_Alexa\app\build\extracted-include-protos\ble' specified for property '$12' does not exist.
Directory 'D:\Android\AndroidAPP\ESP_Alexa\app\build\extracted-include-protos\bleSec0Avs' specified for property '$15' does not exist.
Directory 'D:\Android\AndroidAPP\ESP_Alexa\app\build\extracted-include-protos\main' specified for property '$3' does not exist.
Directory 'D:\Android\AndroidAPP\ESP_Alexa\app\build\extracted-include-protos\sec0' specified for property '$9' does not exist.

Help me, please!

Library never uses event type ESPConstants.EVENT_DEVICE_DISCONNECTED

I would expect the library to publish the event type ESPConstants.EVENT_DEVICE_DISCONNECTED some time after calling ESPDevice.disconnectDevice(). The only event type I am receiving after disconnecting is ESPDevice.EVENT_DEVICE_CONNECTION_FAILED which means I cannot discern between a connection failure and an expected disconnection.

ESP device didn't show up in app while scanning

I ran this app and tried to scan for my ESP32 device using BLE Scan, in the app UI, nothing shows up but I get the following in my Android Studio Console:

D/ESP:BleScanner: ========== Device Found : ESP32
D/ESP:BleScanner: ========== Device Found : ESP32
D/ESP:BleScanner: ========== Device Found : ESP32
D/ESP:BleScanner: ========== Device Found : ESP32
D/ESP:BleScanner: ========== Device Found : ESP32
D/ESP:BleScanner: ========== Device Found : ESP32

Screenshot from my android device:
image

Not sure what's wrong. I found the following error in the logcat:
2021-02-24 14:32:05.239 30204-30408/? E/QTagParser: Error reading from /proc/net/xt_qtaguid/stats. Please check if this file exists.

pollForWifiConnectionStatus fails with BLE read error.

I am testing provisioning on an Android 6.0, Android 8.0, and an iOS device.

I am using the ESP BLE provisioning app to do so. On iOS it works fine.

On both Android devices ESPDevice.pollForWifiConnectionStatus() fails with the exception...

java.lang.Exception: Read from BLE failed

This failure only occurs if a correct SSID and password are entered. If an incorrect SSID and password are entered, pollForConnected does not fail, and onSuccess is called with the expected ConnectionFailed result.

Selecting a device to provision and cancelling makes the devices disappear from the list

This is a behavior we found in the library version 2.0.5 while developing our app, and it is reproducible in the companion app. Calling ESPDevice.disconnectDevice() on a device leaves the actually hardware in a state where it stops advertising BLE for a while.

Steps to reproduce:

  • Sample app in master
  • Select "Provision New Device"
  • Select "I don't have a QR code"
  • Select "BLE"
  • Select a device
  • Wait for Proof of Possession screen
  • Select "Cancel"
  • Select "Provision New Device"
  • Select "I don't have a QR code"
  • Select "BLE"

Expected result:

  • See all BLE devices

Actual result:

  • See all BLE devices EXCEPT the one previously selected

RuntimeException: Session could not be established

Hi, I tried to send wifi creditales to device, but i get error on int responseCode = urlConnection.getResponseCode(); error message ( \n not found: size=0 content=...) unexpected end of stream on com.android.okhttp.Address@59e02351

New source for Android app to support esp-va-sdk 1.0-RC1

Will the source code for Provisioning Android app that supports release esp-va-sdk-v1.0-rc1-193877:
espressif/esp-va-sdk@0b8a9fb

be available this week?

I have a Proof-of-Concept (PoC) demo using an ESP32 board that's blocked from using the newer BLE-enabled esp-va-sdk in a prototype product.

Or maybe info on what I need to patch in sending the credentials via protobufs.
I do see the Wi-Fi credentials appear at the board, but get an unpack/format error for what I assume are the Amazon credentials

BLE provisioning under Android 11

I am working with an esp32-vroom mcu based board, and I've been provisioning it using both the ESP BLE Prov, and the ESP RainMaker which is working all great. I've recently upgraded my phone to the most recent Android OS, and under this os, provisioning becomes unreliable.
When selecting a device to pair with within the app, the wifi menu doesn't show up anymore, pairing action just hangs until the device is eventually disconnected, and the following error appears :
image

error! communication failed. device may not be supported.
Resetting the network settings of the phone allows and relaunching the esp application "fixes" the issue as now, after selecting my device, I am prompted to pair the device by the following message: Do you want to pair with MY_DEVICE device?
image

The pairing here prompts the wifi menu and I am then able to provision my board.
I would like to know if anyone else has been meeting the same behavior with the new OS, knows what exactly causes this behavior, and has a better workaround than resetting network settings everytime?

Edit : Add pictures.

If it possible ,please update protobuf-lite-3.0.1 to protobuf-javalite-3.14.0

Hi, I try to use this library and my project is already containing 'com.google.firebase:firebase-firestore-ktx' dependency which is using 'protobuf-javalite-3.14.0' and I got Duplicated class error when I try to run the application. I tried so may ways to resolve this , but I'm stuckd in.

I get the following error (just a first few lines):

> A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
   > Duplicate class com.google.protobuf.AbstractMessageLite found in modules protobuf-javalite-3.14.0 (com.google.protobuf:protobuf-javalite:3.14.0) and protobuf-lite-3.0.1 (com.google.protobuf:protobuf-lite:3.0.1)
     Duplicate class com.google.protobuf.AbstractMessageLite$Builder found in modules protobuf-javalite-3.14.0 (com.google.protobuf:protobuf-javalite:3.14.0) and protobuf-lite-3.0.1 (com.google.protobuf:protobuf-lite:3.0.1)
     Duplicate class com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream found in modules protobuf-javalite-3.14.0 (com.google.protobuf:protobuf-javalite:3.14.0) and protobuf-lite-3.0.1 (com.google.protobuf:protobuf-lite:3.0.1)

Thank you!

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/crypto/tink/subtle/X25519;

If We create a Library with this we are facing issue as
java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/crypto/tink/subtle/X25519;
at com.espressif.provisioning.security.Security1.generateKeyPair(Security1.java:199)
at com.espressif.provisioning.security.Security1.getStep0Request(Security1.java:98)
at com.espressif.provisioning.security.Security1.getNextRequestInSession(Security1.java:78)
at com.espressif.provisioning.Session.init(Session.java:82)
at com.espressif.provisioning.ESPDevice.initSession(ESPDevice.java:558)
at com.espressif.provisioning.ESPDevice.scanNetworks(ESPDevice.java:461)
at com.espressif.provisioning.appConnect.ProvisionConnect.startWifiScanning(ProvisionConnect.java:111)
at com.jio.provisiontest.MainActivity.onBLEDeviceConnectionEvent(MainActivity.java:74)
at java.lang.reflect.Method.invoke(Native Method)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:507)
at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:501)
at org.greenrobot.eventbus.HandlerPoster.handleMessage(HandlerPoster.java:67)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6626)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.crypto.tink.subtle.X25519" on path: DexPathList[[zip file "/data/app/com.jio.provisiontest-n24Ll1Ak33nxkuWvGbrCgg==/base.apk"],nativeLibraryDirectories=[/data/app/com.jio.provisiontest-n24Ll1Ak33nxkuWvGbrCgg==/lib/arm, /system/lib, /system/vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:125)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
issue.txt

How is "success" possible with SoftAP mode?

Once the ApplyWiFiConfigMsg has been sent to a device in SoftAP mode, the device applies the WiFi credentials and therefore we can no longer communicate with the device (the SoftAP is closed).

But ESPDevice.java then sends a GetWiFiConfigStatusMsg to check that the provisioning is successful. But of course, this always fails, because we are no longer connected to the device.

How is a successful provisioning event possible here?

"Write to BLE failed" on ESPDevice.scanNetworks

Sometimes, randomly, I'm getting "Write to BLE failed" error in the onFailure callback of scanNetworks. From there, I always got this error when retrying to call scanNetworks.

image

I/chromium: [INFO:CONSOLE(2198)] "java.lang.RuntimeException: Failed to create session.", source: http://localhost:8100/main.js (2198)
D/ESPIdfProvisioningPlugin: action = scanNetworks
D/ESP:ESPDevice: Send Wi-Fi scan command to device
W/PluginManager: THREAD WARNING: exec() call to ESPIdfProvisioning.scanNetworks blocked the main thread for 160ms. Plugin should use CordovaInterface.getThreadPool().
D/Espressif::BLETransport: onCharacteristicWrite, status : 0
    UUID : 1775ff51-6b43-439b-877c-060f2d9bed07
D/Espressif::BLETransport: onCharacteristicRead, status 0 UUID : 1775ff51-6b43-439b-877c-060f2d9bed07
D/Espressif::BLETransport: onCharacteristicWrite, status : 4
    UUID : 1775ff51-6b43-439b-877c-060f2d9bed07
W/System.err: java.lang.Exception: Write to BLE failed
W/System.err:     at com.espressif.provisioning.transport.BLETransport$1.onCharacteristicWrite(BLETransport.java:376)
W/System.err:     at android.bluetooth.BluetoothGatt$1$7.run(BluetoothGatt.java:448)
W/System.err:     at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:780)
W/System.err:     at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:41)
W/System.err:     at android.bluetooth.BluetoothGatt$1.onCharacteristicWrite(BluetoothGatt.java:443)
W/System.err:     at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:258)
W/System.err:     at android.os.Binder.execTransactInternal(Binder.java:1159)
W/System.err:     at android.os.Binder.execTransact(Binder.java:1123)

Not controll on No device found modal

Hi,
In Android > 9 after using provisionManager.getEspDevice().connectWiFiDevice(...) appear a modal with option to connect network or cancel it.
MI 8_2

After 30 sec aprox without interaction, appear a new modal with text No device found. Check that they are turned on and ready to connect and with option to cancel and try again.

MI 8

How can I control the onClick event of those buttons (Modal 2) ?

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.