From a873ee42e7296e45275445e00be4306e830f5e96 Mon Sep 17 00:00:00 2001 From: Sheedon Date: Fri, 28 Aug 2020 15:29:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=95=B0=E6=8D=AE=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=A2=AB=E6=9B=BF=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- seriallibrary/build.gradle | 6 +++--- .../java/org/sheedon/serial/retrofit/SerialMessage.java | 9 +++++++++ .../java/org/sheedon/serial/retrofit/ServiceMethod.java | 8 ++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/seriallibrary/build.gradle b/seriallibrary/build.gradle index f212c4f..de38c01 100644 --- a/seriallibrary/build.gradle +++ b/seriallibrary/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 16 targetSdkVersion 28 - versionCode 6 - versionName "1.2.1" + versionCode 7 + versionName "1.2.2" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' @@ -31,5 +31,5 @@ dependencies { androidTestImplementation 'com.android.support.test:runner:1.0.2' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - implementation 'com.github.Sheedon:SerialDispatcher:1.2.1' + implementation 'com.github.Sheedon:SerialDispatcher:1.3' } diff --git a/seriallibrary/src/main/java/org/sheedon/serial/retrofit/SerialMessage.java b/seriallibrary/src/main/java/org/sheedon/serial/retrofit/SerialMessage.java index 25c6c6c..ca085a9 100644 --- a/seriallibrary/src/main/java/org/sheedon/serial/retrofit/SerialMessage.java +++ b/seriallibrary/src/main/java/org/sheedon/serial/retrofit/SerialMessage.java @@ -61,4 +61,13 @@ public String getEndBit() { public void setEndBit(String endBit) { this.endBit = endBit; } + + public SerialMessage clone(){ + SerialMessage message = new SerialMessage(); + message.startBit = startBit; + message.messageBit = messageBit; + message.parityBit = parityBit; + message.endBit = endBit; + return message; + } } diff --git a/seriallibrary/src/main/java/org/sheedon/serial/retrofit/ServiceMethod.java b/seriallibrary/src/main/java/org/sheedon/serial/retrofit/ServiceMethod.java index bcf5f34..97ef5bd 100644 --- a/seriallibrary/src/main/java/org/sheedon/serial/retrofit/ServiceMethod.java +++ b/seriallibrary/src/main/java/org/sheedon/serial/retrofit/ServiceMethod.java @@ -83,7 +83,7 @@ final class ServiceMethod { Request toRequest(@Nullable Object... args) throws IOException { - RequestBuilder requestBuilder = new RequestBuilder(this,serialMessage, + RequestBuilder requestBuilder = new RequestBuilder(this, serialMessage.clone(), bindCallback); @SuppressWarnings("unchecked") // It is an error to invoke a method with the wrong arg types. @@ -106,7 +106,7 @@ T adapt(Call call) { return callAdapter.adapt(call); } - T adapt(Observable observable){ + T adapt(Observable observable) { return callAdapter.adapt(observable); } @@ -124,7 +124,7 @@ String toParityBit(SerialMessage serialMessage) { return parityBitConverter.convert(serialMessage); } - String toRequestBody(SerialMessage serialMessage){ + String toRequestBody(SerialMessage serialMessage) { return requestBodyConverter.convert(serialMessage); } @@ -341,7 +341,7 @@ private ParameterHandler parseParameterAnnotation( Converter converter = retrofit.stringConverter(type, annotations); return new ParameterHandler.Path<>(name, converter, path.encoded()); - }else if(annotation instanceof BackPath){ + } else if (annotation instanceof BackPath) { BackPath path = (BackPath) annotation; String name = path.value(); Converter converter = retrofit.stringConverter(type, annotations);