Skip to content

Commit abe3e56

Browse files
committed
Use slf4j logger
1 parent 3fa1fc1 commit abe3e56

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/se/bitcraze/crazyflielib/BleLink.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
import java.util.TimerTask;
3333
import java.util.UUID;
3434

35+
import org.slf4j.Logger;
36+
import org.slf4j.LoggerFactory;
37+
3538
import se.bitcraze.crazyflielib.crazyradio.ConnectionData;
3639
import se.bitcraze.crazyflielib.crtp.CrtpDriver;
3740
import se.bitcraze.crazyflielib.crtp.CrtpPacket;
@@ -49,12 +52,11 @@
4952
import android.bluetooth.BluetoothProfile;
5053
import android.content.Context;
5154
import android.content.Intent;
52-
import android.util.Log;
5355

5456
@SuppressLint("NewApi")
5557
public class BleLink extends CrtpDriver {
5658

57-
private static final String TAG = "BleLink";
59+
final Logger mLogger = LoggerFactory.getLogger("BLELink");
5860

5961
// Set to -40 to connect only to close-by Crazyflie
6062
private static final int rssiThreshold = -100;
@@ -120,7 +122,7 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
120122
descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
121123
gatt.writeDescriptor(descriptor);
122124

123-
Log.d(TAG, "Connected!");
125+
mLogger.debug( "Connected!");
124126

125127
mConnected = true;
126128
mWritten = false;
@@ -133,35 +135,35 @@ public void onServicesDiscovered(BluetoothGatt gatt, int status) {
133135
@Override
134136
public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
135137
super.onCharacteristicWrite(gatt, characteristic, status);
136-
//Log.d(TAG, "On write called for char: " + characteristic.getUuid().toString());
138+
//mLogger.debug("On write called for char: " + characteristic.getUuid().toString());
137139
mWritten = true;
138140
}
139141

140142
@Override
141143
public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) {
142144
super.onDescriptorWrite(gatt, descriptor, status);
143-
Log.d(TAG, "On write called for descriptor: " + descriptor.getUuid().toString());
145+
mLogger.debug("On write called for descriptor: " + descriptor.getUuid().toString());
144146
mWritten = true;
145147
}
146148

147149
@Override
148150
public void onCharacteristicRead(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic, int status) {
149151
super.onCharacteristicRead(gatt, characteristic, status);
150-
Log.d(TAG, "On read call for characteristic: " + characteristic.getUuid().toString());
152+
mLogger.debug("On read call for characteristic: " + characteristic.getUuid().toString());
151153
}
152154

153155
@Override
154156
public void onCharacteristicChanged(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) {
155157
//super.onCharacteristicChanged(gatt, characteristic);
156-
Log.d(TAG, "On changed call for characteristic: " + characteristic.getUuid().toString());
158+
mLogger.debug("On changed call for characteristic: " + characteristic.getUuid().toString());
157159
}
158160
};
159161

160162
private LeScanCallback mLeScanCallback = new LeScanCallback() {
161163
@Override
162164
public void onLeScan(BluetoothDevice device, int rssi, byte[] anounce) {
163165
if (device != null && device.getName() != null) {
164-
Log.d(TAG, "Scanned device \"" + device.getName() + "\" RSSI: " + rssi);
166+
mLogger.debug("Scanned device \"" + device.getName() + "\" RSSI: " + rssi);
165167

166168
if (device.getName().equals(CF_DEVICE_NAME) && rssi>rssiThreshold) {
167169
mBluetoothAdapter.stopLeScan(this);

0 commit comments

Comments
 (0)