Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@general-galactic/capacitor-esp-idf-provisioning

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@general-galactic/capacitor-esp-idf-provisioning

A capacitor plugin that wraps the Espressif IDF Provisioning libraries for iOS and Android.

  • 0.0.97
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
81
decreased by-38.17%
Maintainers
1
Weekly downloads
 
Created
Source

@general-galactic/capacitor-esp-idf-provisioning

A capacitor plugin that wraps the Espressif IDF Provisioning libraries for iOS and Android.

  • IDF Provisioning Overview
  • IDF Provisioning Library for iOS
  • IDF Provisioning Library for Android

Using this library will allow you to use an Ionic app to provision Espressif devices running the WiFi provisioning stack.

NOTE:

I've regained access to our npm organization so this package is now published on npm instead of github packages. To consume future versions you should remove the github packages config for this repo.

Android Support

This project will only work in Android apps using SDK Level 25 or higher. Android SDK Distribution Stats

Install

npm install @general-galactic/capacitor-esp-idf-provisioning
npx cap sync

Initial Integration into an Android App

Apps will need to add the maven repo to their build.gradle file so that the ESPProvision library from Espressif can be included:

allprojects {
    repositories {
        google()
        jcenter()
        maven { url 'https://jitpack.io' } // <-- Add This line
    }
}

Troubleshooting

Android build won't run after adding the npm dependency You need to add the https://jitpack.io repository to your build.gradle. See 'Initial Integration into an Android App' above.

ESPProvisioning is not implemented on [iOS|Android] You need to run npx cap sync

API

checkPermissions()

checkPermissions() => Promise<PermissionStatus>

Check the status of system permissions:

  • ble - Bluetooth access
  • location - Location access, android only

Returns: Promise<PermissionStatus>


requestPermissions()

requestPermissions() => Promise<PermissionStatus>

Have the system prompt the user for access to the proper permissions - Android only.

Returns: Promise<PermissionStatus>


checkStatus()

checkStatus() => Promise<EspProvisioningStatus>

See if the bluetooth adapter is up and running

Returns: Promise<EspProvisioningStatus>


searchESPDevices(...)

searchESPDevices(options: { devicePrefix: string; transport: ESPTransport; security: ESPSecurity; }) => Promise<{ devices?: ESPDevice[]; }>

Perform a BLE scan to find devices that are connection with the given devicePrefix. The transport and security parameters map directly to ESPProvision's own values.

ParamType
options{ devicePrefix: string; transport: ESPTransport; security: ESPSecurity; }

Returns: Promise<{ devices?: ESPDevice[]; }>


connect(...)

connect(options: { deviceName: string; proofOfPossession: string; }) => Promise<{ connected: boolean; }>

Connect to the device with the given name using the given proofOfPossession.

ParamType
options{ deviceName: string; proofOfPossession: string; }

Returns: Promise<{ connected: boolean; }>


scanWifiList(...)

scanWifiList(options: { deviceName: string; }) => Promise<{ networks?: ESPNetwork[]; }>

Request a list of available WiFi networks from the device with the given name.

ParamType
options{ deviceName: string; }

Returns: Promise<{ networks?: ESPNetwork[]; }>


provision(...)

provision(options: { deviceName: string; ssid: string; passPhrase?: string; }) => Promise<{ success: boolean; }>

Provision the device onto WiFi using the given ssid and passPhrase.

ParamType
options{ deviceName: string; ssid: string; passPhrase?: string; }

Returns: Promise<{ success: boolean; }>


sendCustomDataString(...)

sendCustomDataString(options: { deviceName: string; path: string; dataString: string; }) => Promise<{ success: boolean; returnString?: string; }>

Send a custom string to the device with the given name. This is usefull if you need to share other data with your device during provisioning. NOTE: Android will truncate returned strings to around 512 bytes. If you need to send more than 512 bytes back on a read you'll need to implement a mechanism to do so.

ParamType
options{ deviceName: string; path: string; dataString: string; }

Returns: Promise<{ success: boolean; returnString?: string; }>


disconnect(...)

disconnect(options: { deviceName: string; }) => Promise<void>

Disconnect from the device.

ParamType
options{ deviceName: string; }

openLocationSettings()

openLocationSettings() => Promise<{ value: boolean; }>

Open the user's location settings for your app. Android only.

Returns: Promise<{ value: boolean; }>


openBluetoothSettings()

openBluetoothSettings() => Promise<{ value: boolean; }>

Open the user's bluetooth settings for your app. Android only.

Returns: Promise<{ value: boolean; }>


openAppSettings()

openAppSettings() => Promise<{ value: boolean; }>

Open the OS settings for your app.

Returns: Promise<{ value: boolean; }>


enableLogging()

enableLogging() => Promise<void>

Enable extra logging - useful for troubleshooting. Best on iOS because the iOS ESPProvision library offers much more verbose logging when enabled.


disableLogging()

disableLogging() => Promise<void>

Disable detailed logging.


Interfaces

PermissionStatus
PropType
blePermissionState
locationPermissionState
EspProvisioningStatus
PropType
ble{ supported: boolean; allowed: boolean; poweredOn: boolean; }
location{ allowed: boolean; }

Type Aliases

PermissionState

'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'

ESPDevice

{ name: string // Your devices must have a unique name advertisementData?: ESPDeviceAdvertisingData }

ESPDeviceAdvertisingData

{ localName?: string isConnectable?: number manufacturerData?: any serviceUUIDs?: string[] }

ESPNetwork

{ ssid: string rssi: number auth: 'open' | 'wep' | 'wpapsk' | 'wpawpa2psk' | 'wpa2enterprise' | 'unknown' }

Enums

ESPTransport
MembersValue
ble'ble'
softap'softap'
ESPSecurity
MembersValue
unsecure'unsecure'
secure'secure'

Keywords

FAQs

Package last updated on 15 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc