Page 569 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 569
//}
//catch(NullPointerException e)
//{
//e.printStackTrace();
// }
}
}
public synchronized void connected(BluetoothSocket socket, BluetoothDevice
device, final String socketType) {
if (D) Log.d(TAG, "connected, Socket Type:" + socketType);
// Start the thread to manage the connection and perform transmissions
mConnectedThread = new ConnectedThread(socket, socketType);
// 실제 데이터 송수신 클래스 생성
mConnectedThread.start();
}
public class ConnectedThread extends Thread {
private final BluetoothSocket mmSocket;
public ConnectedThread(BluetoothSocket socket, String socketType) {
Log.d(TAG, "create ConnectedThread: " + socketType);
mmSocket = socket;
InputStream tmpIn = null;
OutputStream tmpOut = null;
// Get the BluetoothSocket input and output streams
try {
tmpIn = socket.getInputStream();
tmpOut = socket.getOutputStream();
- 562 -