From 6f1c23ccd8c35ad33dc918fa6466b7848c790dcb Mon Sep 17 00:00:00 2001 From: Mateo Gianolio Date: Mon, 30 Oct 2023 16:43:50 +0100 Subject: [PATCH] fix(#8): add rssi value in returned wifi list --- .../java/com/espidfprovisioning/EspIdfProvisioningModule.kt | 2 +- ios/EspIdfProvisioning.swift | 3 ++- src/types.ts | 5 +++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt b/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt index 3c02e63..c9a0c15 100644 --- a/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt +++ b/android/src/main/java/com/espidfprovisioning/EspIdfProvisioningModule.kt @@ -356,8 +356,8 @@ class EspIdfProvisioningModule internal constructor(context: ReactApplicationCon wifiList?.forEach { item -> val resultMap = Arguments.createMap() resultMap.putString("ssid", item.wifiName) + resultMap.putInt("rssi", item.rssi) resultMap.putInt("auth", item.security) - resultArray.pushMap(resultMap) } diff --git a/ios/EspIdfProvisioning.swift b/ios/EspIdfProvisioning.swift index 9658ded..82c3d80 100644 --- a/ios/EspIdfProvisioning.swift +++ b/ios/EspIdfProvisioning.swift @@ -152,7 +152,8 @@ class EspIdfProvisioning: NSObject { resolve(wifiList!.map {[ "ssid": $0.ssid, - "bssid": $0.bssid, + "bssid": $0.bssid.toHexString(), + "rssi": $0.rssi, "auth": $0.auth.rawValue, "channel": $0.channel ]}) diff --git a/src/types.ts b/src/types.ts index 5e7acf6..883de7e 100644 --- a/src/types.ts +++ b/src/types.ts @@ -31,9 +31,10 @@ export interface ESPDeviceInterface { export interface ESPWifiList { ssid: string; - bssid: string; + rssi: number; auth: ESPWifiAuthMode; - channel: number; + bssid?: string; + channel?: number; } export interface ESPStatusResponse {