ESP-TOUCH protocol to seamlessly configure Wi-Fi devices connecting to a router.
npm install react-native-esp-smartconfigESP-TOUCH protocol to seamlessly configure Wi-Fi devices connecting to a router.
``sh`
npm install react-native-esp-smartconfig
- Add following permissions into android/src/main/AndroidManifest.xml
``
- Add following entitlements into ios/
``
- Add following capabilites into ios/
``
- Add adding them, run pod install inside ios directory.
- Available methods and interfaces
`typescript
interface SmartConfigResponse {
bssid: string;
ipv4: string;
}
interface WifiInfoState {
bssid: string | null;
ssid: string | null;
ipv4: string;
isConnected: boolean;
isWifi: boolean;
frequency: number | null; // android only
type: string; // connection type name i.e wifi/cellular/none
}
function start({
bssid: string;
ssid: string;
password: string;
}): Promise
function stop();
function getWifiInfo(): Promise
`
- Javascript example
`javascript
import espSmartconfig from 'react-native-esp-smartconfig';
espSmartconfig
.start({
bssid: 'wifi-network-bssid',
ssid: 'wifi-network-ssid',
password: 'wifi-password',
})
.then(function (results) {
// Array of devices, successfully handshaked by smartconfig
console.log(results);
/*[
{
'bssid': 'device-bssid', // device bssid
'ipv4': '192.168.1.11' // device local ip address
}
]*/
})
.catch(function (error) {});
// to cancel on-going smartconfig process
espSmartconfig.stop();
``
- [x] Android support
- [x] iOS support
- [x] getWifiInfo - android
- [ ] getWifiInfo - ios
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
---
Created by Alauddin Ansari (alauddinx27@gmail.com)