语言中英文完善
This commit is contained in:
@@ -178,36 +178,6 @@ public class EspProvisionManager {
|
|||||||
espDevice.connectBLEDevice(bluetoothDevice, primaryServiceUuid);
|
espDevice.connectBLEDevice(bluetoothDevice, primaryServiceUuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scanDeviceWifiList() {
|
|
||||||
if (!checkConnected()) {
|
|
||||||
notifyWifiListFailed("设备未连接");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
espDevice.scanNetworks(new WiFiScanListener() {
|
|
||||||
@Override
|
|
||||||
public void onWifiListReceived(ArrayList<WiFiAccessPoint> wifiList) {
|
|
||||||
Set<String> wifiNames = new LinkedHashSet<>();
|
|
||||||
if (wifiList != null) {
|
|
||||||
for (WiFiAccessPoint accessPoint : wifiList) {
|
|
||||||
if (accessPoint != null && !TextUtils.isEmpty(accessPoint.getWifiName())) {
|
|
||||||
wifiNames.add(accessPoint.getWifiName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
notifyWifiListReceived(wifiNames.toArray(new String[0]));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onWiFiScanFailed(Exception e) {
|
|
||||||
notifyWifiListFailed(getErrorMessage(e, "获取设备 WiFi 列表失败"));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void provision(String ssid, String password) {
|
|
||||||
provisionWifi(ssid, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void provisionWifi(String ssid, String password) {
|
public void provisionWifi(String ssid, String password) {
|
||||||
if (!checkConnected()) {
|
if (!checkConnected()) {
|
||||||
@@ -278,18 +248,6 @@ public class EspProvisionManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
|
||||||
disconnect();
|
|
||||||
callback = null;
|
|
||||||
mainHandler.removeCallbacksAndMessages(null);
|
|
||||||
if (eventBusRegistered) {
|
|
||||||
EventBus.getDefault().unregister(this);
|
|
||||||
eventBusRegistered = false;
|
|
||||||
}
|
|
||||||
if (instance == this) {
|
|
||||||
instance = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
public void onDeviceConnectionEvent(DeviceConnectionEvent event) {
|
public void onDeviceConnectionEvent(DeviceConnectionEvent event) {
|
||||||
@@ -490,27 +448,6 @@ public class EspProvisionManager {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyWifiListReceived(final String[] wifiList) {
|
|
||||||
runOnMainThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (callback != null) {
|
|
||||||
callback.onWifiListReceived(wifiList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyWifiListFailed(final String message) {
|
|
||||||
runOnMainThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (callback != null) {
|
|
||||||
callback.onWifiListFailed(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyProvisioningRejected() {
|
private void notifyProvisioningRejected() {
|
||||||
runOnMainThread(new Runnable() {
|
runOnMainThread(new Runnable() {
|
||||||
|
|||||||
Reference in New Issue
Block a user