Kaydet (Commit) 2244bb14 authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Add comments, logging, empty lines

Change-Id: Ife81ec74b36f71782997219e36ac926ea429c297
üst b3729421
......@@ -183,6 +183,8 @@ public class SelectorActivity extends SherlockActivity {
}
void doBindService() {
// This is what creates the first (only?) CommunicationService instance
// and calls its run() method (in another thread).
Intent aIntent = new Intent(this, CommunicationService.class);
startService(aIntent);
bindService(aIntent, mConnection, Context.BIND_IMPORTANT);
......
......@@ -36,6 +36,9 @@ public class BluetoothClient extends Client {
Receiver aReceiver, boolean aBluetoothWasEnabled)
throws IOException {
super(aServer, aCommunicationService, aReceiver);
Log.i(Globals.TAG, "BluetoothClient(" + aServer + ")");
mAdapter = BluetoothAdapter.getDefaultAdapter();
mBluetoothWasEnabled = aBluetoothWasEnabled;
if (!mBluetoothWasEnabled) {
......@@ -45,18 +48,21 @@ public class BluetoothClient extends Client {
BluetoothDevice aDevice = mAdapter
.getRemoteDevice(aServer.getAddress());
mAdapter.cancelDiscovery();
// This is the "standard UUID for the Serial Port Profile".
// I.e. the 16-bit SerialPort UUID 0x1101 inserted into the
// Bluetooth BASE_UUID. See
// https://www.bluetooth.org/Technical/AssignedNumbers/service_discovery.htm
mSocket = aDevice.createRfcommSocketToServiceRecord(UUID
.fromString("00001101-0000-1000-8000-00805F9B34FB"));
mSocket.connect();
Log.i(Globals.TAG, "BluetoothClient: connected");
mInputStream = mSocket.getInputStream();
mReader = new BufferedReader(new InputStreamReader(mInputStream,
CHARSET));
mOutputStream = mSocket.getOutputStream();
String aTemp = mReader.readLine();
......
......@@ -53,6 +53,9 @@ public class Server {
return mTimeDiscovered;
}
public String toString() {
return getClass().getName() + '@' + Integer.toHexString(hashCode()) + ":{" + mAddress + "," + mName + "}";
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment