diff --git a/android/.classpath b/android/.classpath
new file mode 100644
index 0000000..eb19361
--- /dev/null
+++ b/android/.classpath
@@ -0,0 +1,6 @@
+
+
+
+
+
+
diff --git a/android/.project b/android/.project
new file mode 100644
index 0000000..04c0c85
--- /dev/null
+++ b/android/.project
@@ -0,0 +1,23 @@
+
+
+ flutter_smartconfig
+ Project android created by Buildship.
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.buildship.core.gradleprojectbuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+ org.eclipse.buildship.core.gradleprojectnature
+
+
diff --git a/android/.settings/org.eclipse.buildship.core.prefs b/android/.settings/org.eclipse.buildship.core.prefs
new file mode 100644
index 0000000..6aa97a9
--- /dev/null
+++ b/android/.settings/org.eclipse.buildship.core.prefs
@@ -0,0 +1,2 @@
+connection.project.dir=../example/android
+eclipse.preferences.version=1
diff --git a/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketClient.java b/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketClient.java
index 6a73d45..7ca7880 100644
--- a/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketClient.java
+++ b/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketClient.java
@@ -30,7 +30,7 @@ public class UDPSocketClient {
this.mIsClosed = false;
} catch (SocketException e) {
if (__IEsptouchTask.DEBUG) {
- Log.e(TAG, "SocketException");
+ Log.w(TAG, "SocketException");
}
e.printStackTrace();
}
@@ -85,7 +85,7 @@ public class UDPSocketClient {
String targetHostName, int targetPort, long interval) {
if ((data == null) || (data.length <= 0)) {
if (__IEsptouchTask.DEBUG) {
- Log.e(TAG, "sendData(): data == null or length <= 0");
+ Log.w(TAG, "sendData(): data == null or length <= 0");
}
return;
}
@@ -100,14 +100,14 @@ public class UDPSocketClient {
this.mSocket.send(localDatagramPacket);
} catch (UnknownHostException e) {
if (__IEsptouchTask.DEBUG) {
- Log.e(TAG, "sendData(): UnknownHostException");
+ Log.w(TAG, "sendData(): UnknownHostException");
}
e.printStackTrace();
mIsStop = true;
break;
} catch (IOException e) {
if (__IEsptouchTask.DEBUG) {
- Log.e(TAG, "sendData(): IOException, but just ignore it");
+ Log.w(TAG, "sendData(): IOException, but just ignore it");
}
// for the Ap will make some troubles when the phone send too many UDP packets,
// but we don't expect the UDP packet received by others, so just ignore it
@@ -117,7 +117,7 @@ public class UDPSocketClient {
} catch (InterruptedException e) {
e.printStackTrace();
if (__IEsptouchTask.DEBUG) {
- Log.e(TAG, "sendData is Interrupted");
+ Log.w(TAG, "sendData is Interrupted");
}
mIsStop = true;
break;
diff --git a/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketServer.java b/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketServer.java
index 61b217e..a98fa6c 100644
--- a/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketServer.java
+++ b/android/src/main/java/com/espressif/iot/esptouch/udp/UDPSocketServer.java
@@ -37,7 +37,7 @@ public class UDPSocketServer {
this.mServerSocket.bind(new InetSocketAddress(port));
this.mServerSocket.setSoTimeout(socketTimeout);
} catch (IOException e) {
- Log.e(TAG, "IOException");
+ Log.w(TAG, "IOException");
e.printStackTrace();
}
this.mIsClosed = false;
@@ -113,9 +113,9 @@ public class UDPSocketServer {
byte[] recDatas = Arrays.copyOf(mReceivePacket.getData(), mReceivePacket.getLength());
Log.d(TAG, "received len : " + recDatas.length);
for (int i = 0; i < recDatas.length; i++) {
- Log.e(TAG, "recDatas[" + i + "]:" + recDatas[i]);
+ Log.w(TAG, "recDatas[" + i + "]:" + recDatas[i]);
}
- Log.e(TAG, "receiveSpecLenBytes: " + new String(recDatas));
+ Log.w(TAG, "receiveSpecLenBytes: " + new String(recDatas));
if (recDatas.length != len) {
Log.w(TAG,
"received len is different from specific len, return null");
@@ -135,7 +135,7 @@ public class UDPSocketServer {
public synchronized void close() {
if (!this.mIsClosed) {
- Log.e(TAG, "mServerSocket is closed");
+ Log.w(TAG, "mServerSocket is closed");
mServerSocket.close();
releaseLock();
this.mIsClosed = true;
diff --git a/lib/flutter_smartconfig.dart b/lib/flutter_smartconfig.dart
index 283425e..be83a65 100644
--- a/lib/flutter_smartconfig.dart
+++ b/lib/flutter_smartconfig.dart
@@ -28,13 +28,13 @@ class FlutterSmartconfig {
}
static Future configureEsp(
- {String ssid, String bssid, String password}) async {
+ {String ssid, String bssid, String password, bool multicast, Duration timeout}) async {
if (Platform.isAndroid) {
try {
// Change if required.
const String deviceCount = "1"; // the expect result count
- const String broadcast = "1"; // broadcast or multicast
- const Duration _kLongTimeout = const Duration(seconds: 20);
+ String broadcast = (multicast != null && multicast) ? "0" : "1"; // broadcast (1) or multicast (0)
+ Duration _kLongTimeout = timeout ?? const Duration(seconds: 20);
final String result =
await platform.invokeMethod('startSmartConfig', {
diff --git a/pubspec.yaml b/pubspec.yaml
index d9948bd..d657c21 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_smartconfig
description: A new flutter plugin project.
-version: 0.0.1
+version: 0.0.3
author:
homepage: