changed timeout
This commit is contained in:
parent
4eabcc96fc
commit
45d7a76c8b
6
android/.classpath
Normal file
6
android/.classpath
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
</classpath>
|
23
android/.project
Normal file
23
android/.project
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>flutter_smartconfig</name>
|
||||||
|
<comment>Project android created by Buildship.</comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
2
android/.settings/org.eclipse.buildship.core.prefs
Normal file
2
android/.settings/org.eclipse.buildship.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
connection.project.dir=../example/android
|
||||||
|
eclipse.preferences.version=1
|
@ -30,7 +30,7 @@ public class UDPSocketClient {
|
|||||||
this.mIsClosed = false;
|
this.mIsClosed = false;
|
||||||
} catch (SocketException e) {
|
} catch (SocketException e) {
|
||||||
if (__IEsptouchTask.DEBUG) {
|
if (__IEsptouchTask.DEBUG) {
|
||||||
Log.e(TAG, "SocketException");
|
Log.w(TAG, "SocketException");
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ public class UDPSocketClient {
|
|||||||
String targetHostName, int targetPort, long interval) {
|
String targetHostName, int targetPort, long interval) {
|
||||||
if ((data == null) || (data.length <= 0)) {
|
if ((data == null) || (data.length <= 0)) {
|
||||||
if (__IEsptouchTask.DEBUG) {
|
if (__IEsptouchTask.DEBUG) {
|
||||||
Log.e(TAG, "sendData(): data == null or length <= 0");
|
Log.w(TAG, "sendData(): data == null or length <= 0");
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -100,14 +100,14 @@ public class UDPSocketClient {
|
|||||||
this.mSocket.send(localDatagramPacket);
|
this.mSocket.send(localDatagramPacket);
|
||||||
} catch (UnknownHostException e) {
|
} catch (UnknownHostException e) {
|
||||||
if (__IEsptouchTask.DEBUG) {
|
if (__IEsptouchTask.DEBUG) {
|
||||||
Log.e(TAG, "sendData(): UnknownHostException");
|
Log.w(TAG, "sendData(): UnknownHostException");
|
||||||
}
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
mIsStop = true;
|
mIsStop = true;
|
||||||
break;
|
break;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (__IEsptouchTask.DEBUG) {
|
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,
|
// 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
|
// 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) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
if (__IEsptouchTask.DEBUG) {
|
if (__IEsptouchTask.DEBUG) {
|
||||||
Log.e(TAG, "sendData is Interrupted");
|
Log.w(TAG, "sendData is Interrupted");
|
||||||
}
|
}
|
||||||
mIsStop = true;
|
mIsStop = true;
|
||||||
break;
|
break;
|
||||||
|
@ -37,7 +37,7 @@ public class UDPSocketServer {
|
|||||||
this.mServerSocket.bind(new InetSocketAddress(port));
|
this.mServerSocket.bind(new InetSocketAddress(port));
|
||||||
this.mServerSocket.setSoTimeout(socketTimeout);
|
this.mServerSocket.setSoTimeout(socketTimeout);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.e(TAG, "IOException");
|
Log.w(TAG, "IOException");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
this.mIsClosed = false;
|
this.mIsClosed = false;
|
||||||
@ -113,9 +113,9 @@ public class UDPSocketServer {
|
|||||||
byte[] recDatas = Arrays.copyOf(mReceivePacket.getData(), mReceivePacket.getLength());
|
byte[] recDatas = Arrays.copyOf(mReceivePacket.getData(), mReceivePacket.getLength());
|
||||||
Log.d(TAG, "received len : " + recDatas.length);
|
Log.d(TAG, "received len : " + recDatas.length);
|
||||||
for (int i = 0; i < recDatas.length; i++) {
|
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) {
|
if (recDatas.length != len) {
|
||||||
Log.w(TAG,
|
Log.w(TAG,
|
||||||
"received len is different from specific len, return null");
|
"received len is different from specific len, return null");
|
||||||
@ -135,7 +135,7 @@ public class UDPSocketServer {
|
|||||||
|
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
if (!this.mIsClosed) {
|
if (!this.mIsClosed) {
|
||||||
Log.e(TAG, "mServerSocket is closed");
|
Log.w(TAG, "mServerSocket is closed");
|
||||||
mServerSocket.close();
|
mServerSocket.close();
|
||||||
releaseLock();
|
releaseLock();
|
||||||
this.mIsClosed = true;
|
this.mIsClosed = true;
|
||||||
|
@ -28,13 +28,13 @@ class FlutterSmartconfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<dynamic> configureEsp(
|
static Future<dynamic> configureEsp(
|
||||||
{String ssid, String bssid, String password}) async {
|
{String ssid, String bssid, String password, bool multicast, Duration timeout}) async {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
try {
|
try {
|
||||||
// Change if required.
|
// Change if required.
|
||||||
const String deviceCount = "1"; // the expect result count
|
const String deviceCount = "1"; // the expect result count
|
||||||
const String broadcast = "1"; // broadcast or multicast
|
String broadcast = (multicast != null && multicast) ? "0" : "1"; // broadcast (1) or multicast (0)
|
||||||
const Duration _kLongTimeout = const Duration(seconds: 20);
|
Duration _kLongTimeout = timeout ?? const Duration(seconds: 20);
|
||||||
|
|
||||||
final String result =
|
final String result =
|
||||||
await platform.invokeMethod('startSmartConfig', <String, dynamic>{
|
await platform.invokeMethod('startSmartConfig', <String, dynamic>{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: flutter_smartconfig
|
name: flutter_smartconfig
|
||||||
description: A new flutter plugin project.
|
description: A new flutter plugin project.
|
||||||
version: 0.0.1
|
version: 0.0.3
|
||||||
author:
|
author:
|
||||||
homepage:
|
homepage:
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user