分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow
也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!
源码文件2
MyTimerCheck.java
package
edu
.
cdut
.
robin
.
hotspot
;
public
abstract
class
MyTimerCheck
{
private
int
mCount
=
0
;
private
int
mTimeOutCount
=
1
;
private
int
mSleepTime
=
1000
;
// 1s
private boolean mExitFlag = false;
private Thread mThread = null;
/**
* Do not process UI work in this.
*/
public abstract void doTimerCheckWork();
public abstract void doTimeOutWork();
public MyTimerCheck() {
mThread = new Thread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
while (!mExitFlag) {
mCount++;
if (mCount < mTimeOutCount) {
doTimerCheckWork();
try {
mThread.sleep(mSleepTime);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
exit();
}
} else {
doTimeOutWork();
}
}
}
});
}
/**
* start
* @param times How many times will check?
* @param sleepTime ms, Every check sleep time.
*/
public void start(int timeOutCount, int sleepTime) {
mTimeOutCount = timeOutCount;
mSleepTime = sleepTime;
mThread.start();
}
public void exit() {
mExitFlag = true;
}
}
源码文件3
WifiAdmin.java
package
edu
.
cdut
.
robin
.
hotspot
;
import
java
.
util
.
List
;
import
java
.
util
.
Timer
;
import
java
.
util
.
TimerTask
;
import
android
.
content
.
BroadcastReceiver
;
import
android
.
content
.
Context
;
import
android
.
content
.
Intent
;
import
android
.
content
.
IntentFilter
;
import
android
.
net
.
ConnectivityManager
;
import
android
.
net
.
NetworkInfo
;
import
android
.
net
.
NetworkInfo
.
DetailedState
;
import
android
.
net
.
wifi
.
ScanResult
;
import
android
.
net
.
wifi
.
WifiConfiguration
;
import
android
.
net
.
wifi
.
WifiInfo
;
import
android
.
net
.
wifi
.
WifiManager
;
import
android
.
net
.
wifi
.
WifiManager
.
WifiLock
;
import
android
.
util
.
Log
;
public
abstract
class
WifiAdmin
{
private
static
final
String
TAG
=
"WifiAdmin"
;
private
WifiManager
mWifiManager
;
private
WifiInfo
mWifiInfo
;
// 扫描出的网络连接列表
private List<ScanResult> mWifiList;
private List<WifiConfiguration> mWifiConfiguration;
private
WifiLock
mWifiLock
;
private
String
mPasswd
=
""
;
private
String
mSSID
=
""
;