class DataThread extends Thread implements Runnable {
final Handler handler = new Handler();
public DataThread() {
mstop = true;
}
public void stopThread() {
mstop = !mstop;
}
@Override
public void run() {
super.run();
while (mstop) {
while(isStop)
{
try {
Thread.sleep(500);
}catch (InterruptedException e) {
e.printStackTrace();
}
//Log.e(TAG, "쓰레드 대기 상태입니다...............대기 중 대기 중....");
}
if((btnflag == true) && (datanumbering > 0)) {
byte[] command = new byte[8];
address = 0;
Log.e(TAG, "데이타 갯수는......"+ datanumbering);
while(address < datanumbering) {
ksjflag = false;
command[0] = (byte)0xAA;
command[1] = (byte)0x55;
command[2] = (byte)5;
command[3] = (byte)52; //COM_READ_EACH_DATA
command[4] = (byte)(address & 0xFF);
command[5] = (byte)((address >> 8) & 0xFF);
command[6] = (byte)((address >> 16) & 0xFF);
command[7] = (byte)((address >> 24) & 0xFF);
mBluetoothLeService.writeCharacteristic(mBluetoothGattChar, command);
Log.e(TAG, " 52번 커맨드 날라갑니다..............받아라....................");
while (ksjflag == true) { // ready finish read data
try{
Thread.sleep(10);
}catch(InterruptedException e) {
e.printStackTrace();
}
bleRespWaitTime++;
if(bleRespWaitTime >= 100)
{
break;
}
} // whhile endreadflag end..
Log.e(TAG, " 52번 커맨드 받았고 데이타 읽기 완료하였다 ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ.");
bleRespWaitTime = 0;
//listInit();
//adapter.notifyDataSetChanged();
mpmeachdataflag = true;
try{
Thread.sleep(700);
} catch (InterruptedException e) {
e.printStackTrace();
}
address ++;
} // while(address < datanumbering) end..
Log.e(TAG, "데이타 다 읽었습니다................................................^^");
isStop = true;
btnflag = false;
} // if(btnflag == true) end..
mdataThread.stopThread();
//popupflag = true;
//mpmeachdataflag = false;
} //while (mstop) end..
}
}
쓰레드 내에서 다음 함수 2개를 호출하고 싶은데...
방안이 생각이 안나요....
도와주세요~~
//listInit();
//adapter.notifyDataSetChanged();