This commit is contained in:
Harald Hoyer 2017-04-26 08:17:30 +02:00 committed by Harald Hoyer
parent 6e7bb3598a
commit a9b0be831b
2 changed files with 13 additions and 13 deletions

View file

@ -343,7 +343,7 @@ public class BluetoothChatService {
mmOutStream = tmpOut; mmOutStream = tmpOut;
mState = STATE_CONNECTED; mState = STATE_CONNECTED;
mmIConsole = new IConsole(mmInStream, mmOutStream, new IConsole.DataListner() { mmIConsole = new IConsole(mmInStream, mmOutStream, new IConsole.DataListener() {
@Override @Override
public void onData(IConsole.Data data) { public void onData(IConsole.Data data) {
Log.i(TAG, "mConnectedThread: " + data.toString()); Log.i(TAG, "mConnectedThread: " + data.toString());
@ -357,7 +357,7 @@ public class BluetoothChatService {
if (e instanceof IOException) if (e instanceof IOException)
connectionLost(); connectionLost();
} }
}, new IConsole.DebugListner() { }, new IConsole.DebugListener() {
@Override @Override
public void onRead(byte[] buffer) { public void onRead(byte[] buffer) {
if (buffer.length > 0) { if (buffer.length > 0) {

View file

@ -37,14 +37,14 @@ public class IConsole {
private int mSetLevel; private int mSetLevel;
private final InputStream mInputStream; private final InputStream mInputStream;
private final OutputStream mOutputStream; private final OutputStream mOutputStream;
private final DataListner mDataListner; private final DataListener mDataListener;
private final DebugListner mDebugListner; private final DebugListener mDebugListener;
public IConsole(InputStream inputStream, OutputStream outputStream, DataListner dataListner, DebugListner debugListner) { public IConsole(InputStream inputStream, OutputStream outputStream, DataListener dataListener, DebugListener debugListener) {
this.mInputStream = inputStream; this.mInputStream = inputStream;
this.mOutputStream = outputStream; this.mOutputStream = outputStream;
this.mDataListner = dataListner; this.mDataListener = dataListener;
this.mDebugListner = debugListner; this.mDebugListener = debugListener;
this.mCurrentState = State.BEGIN; this.mCurrentState = State.BEGIN;
this.mNextState = State.PING; this.mNextState = State.PING;
this.mSetLevel = 1; this.mSetLevel = 1;
@ -83,12 +83,12 @@ public class IConsole {
} }
} }
public interface DataListner { public interface DataListener {
void onData(Data data); void onData(Data data);
void onError(Exception e); void onError(Exception e);
} }
public interface DebugListner { public interface DebugListener {
void onRead(byte[] bytes); void onRead(byte[] bytes);
void onWrite(byte[] bytes); void onWrite(byte[] bytes);
} }
@ -97,12 +97,12 @@ public class IConsole {
synchronized (this) { synchronized (this) {
Data data = new Data(0, 0, 0, 0, 0, 0, 0, 0); Data data = new Data(0, 0, 0, 0, 0, 0, 0, 0);
if (null != mDebugListner) { if (null != mDebugListener) {
mDebugListner.onWrite(PING); mDebugListener.onWrite(PING);
mDebugListner.onRead(PONG); mDebugListener.onRead(PONG);
} }
mDataListner.onData(data); mDataListener.onData(data);
} }
return true; return true;
} }