ChTask.java
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package com.xgimi.smartscreen.confignetwork;
import android.content.Context;
import com.xgimi.smartscreen.confignetwork.task.ChTaskParameter;
import com.xgimi.smartscreen.confignetwork.task.IChTaskParameter;
import com.xgimi.smartscreen.confignetwork.task.__ChTask;
import java.util.List;
public class ChTask implements IChTask {
public __ChTask _mChTask;
private IChTaskParameter _mParameter;
/**
* Constructor of ChTask
*
* @param apSsid the Ap's ssid
* @param apBssid the Ap's bssid
* @param apPassword the Ap's password
* @param isSsidHidden whether the Ap's ssid is hidden
* @param context the Context of the Application
*/
public ChTask(String apSsid, String apBssid, String apPassword, boolean isSsidHidden, Context context) {
_mParameter = new ChTaskParameter();
_mChTask = new __ChTask(apSsid, apBssid, apPassword, context, _mParameter, isSsidHidden);
}
/**
* Constructor of ChTask
*
* @param apSsid the Ap's ssid
* @param apBssid the Ap's bssid
* @param apPassword the Ap's password
* @param isSsidHidden whether the Ap's ssid is hidden
* @param timeoutMillisecond (it should be >= 15000+6000) millisecond of total timeout
* @param context the Context of the Application
*/
public ChTask(String apSsid, String apBssid, String apPassword, boolean isSsidHidden, int timeoutMillisecond, Context context) {
_mParameter = new ChTaskParameter();
_mParameter.setWaitUdpTotalMillisecond(timeoutMillisecond);
_mChTask = new __ChTask(apSsid, apBssid, apPassword, context, _mParameter, isSsidHidden);
}
@Override
public void interrupt() {
_mChTask.interrupt();
}
@Override
public IChResult executeForResult() throws RuntimeException {
return _mChTask.executeForResult();
}
@Override
public boolean isCancelled() {
return _mChTask.isCancelled();
}
@Override
public List<IChResult> executeForResults(int expectTaskResultCount) throws RuntimeException {
if (expectTaskResultCount <= 0) {
expectTaskResultCount = Integer.MAX_VALUE;
}
return _mChTask.executeForResults(expectTaskResultCount);
}
@Override
public void setChListener(IChListener chListener) {
_mChTask.setChListener(chListener);
}
}