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);