Giter VIP home page Giter VIP logo

esp-idf-provisioning-ios's Introduction

ESPProvision

ESPProvision is a provisioning library written in Swift. It provides mechanism to provide network credentials and/or custom data to an ESP32, ESP32-S2 or ESP8266 devices.

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.
  • Provision device.
  • Scan for available Wi-Fi networks.
  • Console logs

Requirements

  • iOS 11.0+ / macOS 10.12+
  • Xcode 11+
  • Swift 5.1+
  • Enable Hotspot Configuration capability in Xcode.
  • Enable Access WiFI Information capability in Xcode.

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate ESPProvision into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'ESPProvision'

Using ESPProvision

Introduction

ESPProvision 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. ESProvision 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 managing these objects. ESPDevice instances can be obtained from any of the following techniques :

Search

ESPProvision supports searching of BLE devices which are currently in provisioning mode. It returns list of devices that are discoverable and matches the parameter criteria.

ESPProvisionManager.shared.searchESPDevices(devicePrefix:"Prefix",    transport:.ble, security:.secure) { deviceList, _ in
}

Transport parameter is medium of data transmission, ESPProvision support .softAP and .ble transport. Security parameter describe if connection needed to be secure or unsecure. SoftAP search is not supported in iOS currently.

Scan

Device information can be extracted from scanning valid QR code. User of this API decides the camera preview layer frame by providing UIView as parameter. It return single ESPDevice instance on success. Supports both SoftAP and BLE.

ESPProvisionManager.shared.scanQRCode(scanView: scannerView) { espDevice, _ in
}

Create

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

ESPProvisionManager.shared.createESPDevice(deviceName: deviceName, transport: transport, security: security){ espDevice, _ in
}

Provisioning

The main feature of ESPProvision 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. This can be achieved by calling connect as shown below :

espDevice.connect(delegate: self) { status in
}

Delegate is required to get Proof of Possession from user, if device has pop capability.

If status is connected then 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.scanWifiList { wifiList, _ in 
}

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

espDevice.provision(ssid: ssid, passPhrase: passphrase) { status in
}

License

ESPProvision is released under the Apache License Version 2.0.

esp-idf-provisioning-ios's People

Contributors

vikas-chandra-mnnit avatar shahpiyushv avatar ameyinamdar avatar

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.