Page 570 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 570
} catch (IOException e) {
Log.e(TAG, "temp sockets not created", e);
}
mmInStream = tmpIn;
mmOutStream = tmpOut;
}
public void run() {
Log.i(TAG, "BEGIN mConnectedThread");
byte[] buffer = new byte[1024];
int bytes;
while (true) {
try {
// Read from the InputStream
bytes = mmInStream.read(buffer);
// Send the obtained bytes to the UI Activity
mHandler.obtainMessage(Main1.MESSAGE_READ, bytes, -1, buffer)
.sendToTarget();
} catch (IOException e) {
// Start the service over to restart listening mode
BluetoothTestService.this.start();
break;
}
}
}
// 출력버퍼에 데이터를 쓴다.
public void write(byte buffer) {
- 563 -