Skip to content

Commit

Permalink
add example for sequence, prepare release 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
froks committed Jan 13, 2022
1 parent a1c566f commit 0250acf
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion doip-sim-ecu-dsl-example/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.github.froks.exampleproject"
version = "0.1-SNAPSHOT"
version = "0.1"

repositories {
mavenCentral()
Expand Down
17 changes: 17 additions & 0 deletions doip-sim-ecu-dsl-example/src/main/kotlin/MyCustomGateway.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0250acf

Please sign in to comment.