• Stars
    star
    184
  • Rank 209,187 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Android Provisioning application for ESP-IDF Unified provisioning

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 6.0 (API level 23) 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.1.2'

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.

More Repositories

1

esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
C
13,620
star
2

arduino-esp32

Arduino core for the ESP32
C++
13,280
star
3

esptool

Espressif SoC serial bootloader utility
Python
5,521
star
4

ESP8266_RTOS_SDK

Latest ESP8266 SDK based on FreeRTOS, esp-idf style.
C
3,333
star
5

esp-iot-solution

Espressif IoT Library. IoT Device Drivers, Documentations And Solutions.
C
1,856
star
6

esp-who

Face detection and recognition framework
C
1,660
star
7

esp-adf

Espressif Audio Development Framework
C
1,523
star
8

esp32-camera

C
1,259
star
9

vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
TypeScript
1,032
star
10

ESP8266_NONOS_SDK

ESP8266 nonOS SDK
C
926
star
11

esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
C
860
star
12

esp-mdf

Espressif Mesh Development Framework, limited maintain, recommend to use https://github.com/espressif/esp-mesh-lite
C
774
star
13

esp-drone

Mini Drone/Quadcopter Firmware for ESP32 and ESP32-S Series SoCs.
C
766
star
14

esp-box

The ESP-BOX is a new generation AIoT development platform released by Espressif Systems.
HTML
757
star
15

ESP8266_MP3_DECODER

A demo that should be run with ESP8266 Non-OS SDK
C
739
star
16

kicad-libraries

KiCad libraries for Espressif SoCs, modules, and DevKits.
Python
703
star
17

esp-csi

Applications based on Wi-Fi CSI (Channel state information), such as indoor positioning, human detection
C
690
star
18

esp-matter

Espressif's SDK for Matter
C++
638
star
19

esp-mqtt

ESP32 mqtt component
C
602
star
20

esp-apple-homekit-adk

This is a port for Apple's Open Source HomeKit ADK
C
599
star
21

esp-skainet

Espressif intelligent voice assistant
C
570
star
22

esp-hosted

Hosted Solution (Linux/MCU) with ESP32 (Wi-Fi + BT + BLE)
C
562
star
23

esp-homekit-sdk

C
552
star
24

esp-sr

Speech recognition
C
551
star
25

esp-now

A connectionless Wi-Fi communication protocol
C
503
star
26

ESP8266_AT

This project is not maintained, please use https://github.com/espressif/esp-at.
C
472
star
27

esp32-nesemu

Proof-of-concept NES emulator for the ESP32
C
471
star
28

esp-dsp

DSP library for ESP-IDF
C
458
star
29

esp-rainmaker

ESP RainMaker Agent for firmware development
C
442
star
30

rust-esp32-example

Example of Rust integration into an ESP-IDF project, for ESP32 series of chips
Rust
432
star
31

esp-serial-flasher

Library for flashing Espressif SoCs from other MCUs.
C
371
star
32

esp-dl

Espressif deep-learning library for AIoT applications
C++
369
star
33

openocd-esp32

OpenOCD branch with ESP32 JTAG support
C
355
star
34

esp-tflite-micro

TensorFlow Lite Micro for Espressif Chipsets
C++
348
star
35

esp-dev-kits

Docs, Schematics, Factory Firmwares for ESP Development Kits
C
343
star
36

esp-aliyun

Aliyun Iotkit-embedded, support esp32 & esp8266.
C
338
star
37

esp-idf-template

Template application for https://github.com/espressif/esp-idf
Makefile
336
star
38

idf-eclipse-plugin

Espressif-IDE (based on Eclipse CDT) for ESP-IDF CMake based projects 4.x and above
Java
306
star
39

esp-usb-bridge

USB to UART&JTAG bridge, implemented on ESP32-S2 or ESP32-S3
C
292
star
40

esp-va-sdk

Espressif's Voice Assistant SDK: Alexa, Google Voice Assistant, Google DialogFlow
C
290
star
41

esptool-js

Javascript implementation of flasher tool for Espressif chips, running in web browser using WebSerial.
TypeScript
276
star
42

esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
C
266
star
43

ESP31_RTOS_SDK

ESP31B SDK based on FreeRTOS. For ESP32 please see http://github.com/espressif/esp-idf
HTML
189
star
44

esp-protocols

Collection of ESP-IDF components related to networking protocols
C
185
star
45

esp-azure

SDK to connect ESP8266 and ESP32 to Microsoft Azure IoT services
C
174
star
46

esp-jumpstart

Jumpstart from concept to production
C
173
star
47

esp-bsp

Board support components for Espressif development boards
C
172
star
48

esp32-wifi-lib

ESP32 WiFi stack precompiled libraries
Shell
165
star
49

esp-gdbstub

C
157
star
50

esp-iot-bridge

A smart bridge to make both ESP and the other MCU or smart device can access the Internet.
C
153
star
51

idf-extra-components

Additional components for ESP-IDF, maintained by Espressif
C
151
star
52

esp32-doom

A proof-of-concept port of PrBoom to the ESP32. Needs psram hardware.
C++
151
star
53

esp-zigbee-sdk

Espressif Zigbee SDK
C
144
star
54

esp-google-iot

Google Cloud IoT SDK as an ESP-IDF Component
C
142
star
55

esp-nn

Optimised Neural Network functions for Espressif chipsets
Assembly
130
star
56

esp8266-rtos-sample-code

C
129
star
57

esp-idf-provisioning-ios

Swift
125
star
58

esp32-arduino-lib-builder

C
120
star
59

esp-mesh-lite

A lite version Wi-Fi Mesh, each node can access the network over the IP layer.
C
115
star
60

esp-modbus

ESP-Modbus - the officially suppported library for Modbus protocol (serial RS485 + TCP over WiFi or Ethernet).
C
110
star
61

esp-thread-br

Espressif Thread Border Router SDK
C
105
star
62

idf-installer

ESP IDF Windows Installer
Inno Setup
102
star
63

esp-insights

ESP Insights: A remote diagnostics/observability framework for connected devices
C
99
star
64

book-esp32c3-iot-projects

《ESP32-C3 物联网工程开发实战》配套代码
Swift
96
star
65

esp-rainmaker-android

ESP RainMaker Android app sources
Java
87
star
66

usb-pids

Customer-allocated USB PIDs under the Espressif VID
Shell
85
star
67

esp-lwip

Fork of lwIP (https://savannah.nongnu.org/projects/lwip/) with ESP-IDF specific patches
C
83
star
68

pytest-embedded

A pytest plugin that designed for embedded testing
Python
80
star
69

esp-ali-smartliving

阿里云生活物联网平台 & 天猫精灵 IoT 开放平台
C
77
star
70

esp-idf-cxx

C++ wrapper classes for ESP-IDF components.
C++
77
star
71

esp32c3-direct-boot-example

Example of ESP32-C3 (rev. 3 and later) "direct boot" feature.
CMake
68
star
72

esp32-bt-lib

ESP32 Bluetooth stack (below HCI layer) precompiled libraries
67
star
73

esp8266-nonos-sample-code

C
66
star
74

esp-qcloud

基于 ESP-IDF 原生开发接入腾讯 IoT Explorer,支持 ESP32/ESP32S2,快速实现腾讯连连控制。
C
65
star
75

esp-wasmachine

The Machine which can run WASM applications.
C
61
star
76

freertos-gdb

Python module for operating with freeRTOS kernel objects in GDB
Python
56
star
77

esp-moonlight

C
54
star
78

svd

SVD files for Espressif devices
54
star
79

openocd-on-esp32

OpenOCD port running on ESP32-S3 microcontrollers
C
54
star
80

xtensa-isa-doc

TeX
48
star
81

binutils-esp32ulp

Binutils fork with support for the ESP32 ULP co-processor
C
46
star
82

idf-component-manager

Tool for installing ESP-IDF components
Python
43
star
83

esp-rainmaker-ios

ESP RainMaker iOS app sources
Swift
41
star
84

esp-privilege-separation

Espressif Privilege Separation Framework
C
39
star
85

esp-adf-libs

C
38
star
86

esp-launchpad

Configurable Browser-based Image Flasher
CSS
38
star
87

esp-wolfssl

WolfSSL port for ESP-IDF & ESP8266_RTOS_SDK
C
38
star
88

ESP8266_RTOS_ALINK_DEMO

Alink 1.0 早期版本
Assembly
36
star
89

esp-faq

Python
35
star
90

esp-wdf

Espressif WASM Development Framework.
C
34
star
91

esp31-smsemu

C
34
star
92

esp-joylink

Demo project for JD joylink, support esp32 & esp8266.
C
34
star
93

esp8266-alink-v1.0

alink v1.0
C
32
star
94

newlib-esp32

Version of newlib used in ESP32 ROM and ESP-IDF
C
31
star
95

idf-env

idf-env tool helps set up and manage ESP-IDF installations
Rust
31
star
96

esp32-c3-book-en

Read the book here:
HTML
30
star
97

esp32-alink-demo

Demo project for alink, include embed and SDS
C
30
star
98

esp32-iotivity

Guide you to make your ESP32 support OCF/OIC.
C
29
star
99

esp8266-alink-sds

Demo project for alink SDS
C
27
star
100

esp-cryptoauthlib

Release only fork of https://github.com/MicrochipTech/cryptoauthlib
C
27
star