diff --git a/app/src/main/java/org/sheedon/demo/MainActivity.java b/app/src/main/java/org/sheedon/demo/MainActivity.java index 851a19d..bbb3a2b 100644 --- a/app/src/main/java/org/sheedon/demo/MainActivity.java +++ b/app/src/main/java/org/sheedon/demo/MainActivity.java @@ -37,8 +37,6 @@ protected void onCreate(Bundle savedInstanceState) { .build(); - - Call call = client.newCall(request); Observable observable = client.newObservable(request); observable.subscribe(new Callback() { @@ -76,6 +74,11 @@ public void onResponse(Response response) { @Override public void onCallback(ResponseBody data) { - Log.v("SXD",data.toString()); + Log.v("SXD", data.toString()); + } + + @Override + public void onRequest(String message) { + Log.v("SXD", message); } } diff --git a/serial/build.gradle b/serial/build.gradle index 945445b..7bd19ba 100644 --- a/serial/build.gradle +++ b/serial/build.gradle @@ -8,8 +8,8 @@ android { defaultConfig { minSdkVersion 15 targetSdkVersion 28 - versionCode 12 - versionName "1.2.8" + versionCode 13 + versionName "1.2.9" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' diff --git a/serial/src/main/java/org/sheedon/serial/RealCall.java b/serial/src/main/java/org/sheedon/serial/RealCall.java index 4914df8..f128c77 100644 --- a/serial/src/main/java/org/sheedon/serial/RealCall.java +++ b/serial/src/main/java/org/sheedon/serial/RealCall.java @@ -163,6 +163,7 @@ protected void execute() { } boolean isSuccess = serialClient.port.sendMessage(data); + serialClient.onRequest(data); if (!isSuccess) { client.dispatcher().finishedByLocal(id(), new IllegalStateException("publish is failure")); diff --git a/serial/src/main/java/org/sheedon/serial/SerialClient.java b/serial/src/main/java/org/sheedon/serial/SerialClient.java index 0e79135..f7fa6f1 100644 --- a/serial/src/main/java/org/sheedon/serial/SerialClient.java +++ b/serial/src/main/java/org/sheedon/serial/SerialClient.java @@ -95,6 +95,13 @@ public void onCallback(ResponseBody data) { callback.onCallback(data); } + @Override + public void onRequest(String message) { + if (callback == null) + return; + callback.onRequest(message); + } + /** * 获取调度器 */ diff --git a/serial/src/main/java/org/sheedon/serial/serialport/SerialRealCallback.java b/serial/src/main/java/org/sheedon/serial/serialport/SerialRealCallback.java index b61ff48..83a413a 100644 --- a/serial/src/main/java/org/sheedon/serial/serialport/SerialRealCallback.java +++ b/serial/src/main/java/org/sheedon/serial/serialport/SerialRealCallback.java @@ -13,4 +13,6 @@ public interface SerialRealCallback { void onCallback(ResponseBody data); + void onRequest(String message); + }