From 0250acf33077668e82ebcc287b5afe8ec8b65475 Mon Sep 17 00:00:00 2001 From: Florian Roks Date: Thu, 13 Jan 2022 22:41:52 +0100 Subject: [PATCH] add example for sequence, prepare release 0.1 --- doip-sim-ecu-dsl-example/build.gradle.kts | 2 +- .../src/main/kotlin/MyCustomGateway.kt | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/doip-sim-ecu-dsl-example/build.gradle.kts b/doip-sim-ecu-dsl-example/build.gradle.kts index 2f480df..ed0f162 100644 --- a/doip-sim-ecu-dsl-example/build.gradle.kts +++ b/doip-sim-ecu-dsl-example/build.gradle.kts @@ -5,7 +5,7 @@ plugins { } group = "com.github.froks.exampleproject" -version = "0.1-SNAPSHOT" +version = "0.1" repositories { mavenCentral() diff --git a/doip-sim-ecu-dsl-example/src/main/kotlin/MyCustomGateway.kt b/doip-sim-ecu-dsl-example/src/main/kotlin/MyCustomGateway.kt index 286fff4..591c076 100644 --- a/doip-sim-ecu-dsl-example/src/main/kotlin/MyCustomGateway.kt +++ b/doip-sim-ecu-dsl-example/src/main/kotlin/MyCustomGateway.kt @@ -174,6 +174,23 @@ fun myCustomGateway(gateway: CreateGatewayFunc) { // ecu.reset() } + // You can also respond with a sequence, advancing in the list of responses with each matched request + + // When the end of the responses-list is reached, either stop at the end and repeat the last answer until reset is called + request("3E 00") { + sequenceStopAtEnd( + "7E 00", + "7F 10" + ) + } + + // Or wrap around to the beginning when the end has been reached (reset will reset the sequence to the first entry) + request("3E 00") { + sequenceWrapAround( + "7E 00", + "7F 10" + ) + } // Since usually there are other ECUs behind a gateway, we can define them too