-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
added more documentation to BatTags
- Loading branch information
Showing
16 changed files
with
393 additions
and
55 deletions.
There are no files selected for viewing
81 changes: 48 additions & 33 deletions
81
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/frame/tags/BatTag.kt
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
api/src/main/kotlin/de/jnkconsulting/e3dc/easyrscp/api/service/model/manual-charge.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.api.service.model | ||
|
||
import java.time.Instant | ||
|
||
data class ManualChargeState( | ||
val active: Boolean, | ||
val chargedEnergyWh: Double, | ||
val lastRun: Instant | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
...ain/kotlin/de/jnkconsulting/e3dc/easyrscp/service/converter/ManualChargeStateConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.service.converter | ||
|
||
import de.jnkconsulting.e3dc.easyrscp.api.frame.Frame | ||
import de.jnkconsulting.e3dc.easyrscp.api.frame.tags.EMSTag | ||
import de.jnkconsulting.e3dc.easyrscp.api.service.model.ManualChargeState | ||
|
||
/** | ||
* Converter to build a [ManualChargeState] object from a frame | ||
* | ||
* @since 2.2 | ||
*/ | ||
class ManualChargeStateConverter: FrameConverter<ManualChargeState> { | ||
|
||
override fun invoke(frame: Frame): ManualChargeState = | ||
ManualChargeState( | ||
active = frame.booleanByTag(EMSTag.MANUAL_CHARGE_ACTIVE, EMSTag.GET_MANUAL_CHARGE), | ||
chargedEnergyWh = frame.doubleByTag(EMSTag.MANUAL_CHARGE_ENERGY_COUNTER, EMSTag.GET_MANUAL_CHARGE), | ||
lastRun = frame.instantByTag(EMSTag.MANUAL_CHARGE_LASTSTART, EMSTag.GET_MANUAL_CHARGE), | ||
) | ||
} |
16 changes: 16 additions & 0 deletions
16
...in/de/jnkconsulting/e3dc/easyrscp/service/converter/StartManualChargeResponseConverter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.service.converter | ||
|
||
import de.jnkconsulting.e3dc.easyrscp.api.frame.Frame | ||
import de.jnkconsulting.e3dc.easyrscp.api.frame.tags.EMSTag | ||
import de.jnkconsulting.e3dc.easyrscp.api.service.model.ManualChargeState | ||
|
||
/** | ||
* Converter to build the response of a [EMSTag.REQ_START_MANUAL_CHARGE] request | ||
* | ||
* @since 2.2 | ||
*/ | ||
class StartManualChargeResponseConverter: FrameConverter<Boolean> { | ||
|
||
override fun invoke(frame: Frame) = | ||
frame.booleanByTag(EMSTag.START_MANUAL_CHARGE) | ||
} |
23 changes: 23 additions & 0 deletions
23
.../kotlin/de/jnkconsulting/e3dc/easyrscp/service/creator/RequestManualChargeStateCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.service.creator | ||
|
||
|
||
import de.jnkconsulting.e3dc.easyrscp.api.frame.Frame | ||
import de.jnkconsulting.e3dc.easyrscp.api.frame.tags.EMSTag | ||
import de.jnkconsulting.e3dc.easyrscp.api.frame.tags.InfoTag | ||
import de.jnkconsulting.e3dc.easyrscp.frame.DataBuilder | ||
import de.jnkconsulting.e3dc.easyrscp.frame.FrameBuilder | ||
|
||
/** | ||
* [de.jnkconsulting.e3dc.easyrscp.api.frame.Frame] generator to request the current manual charge state | ||
* | ||
* @since 2.2 | ||
*/ | ||
class RequestManualChargeStateCreator: FrameCreator<Nothing?> { | ||
|
||
override fun invoke(param: Nothing?): Frame = | ||
FrameBuilder() | ||
.addData( | ||
DataBuilder().tag(EMSTag.REQ_GET_MANUAL_CHARGE).build() | ||
) | ||
.build() | ||
} |
22 changes: 22 additions & 0 deletions
22
.../kotlin/de/jnkconsulting/e3dc/easyrscp/service/creator/RequestStartManualChargeCreator.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package de.jnkconsulting.e3dc.easyrscp.service.creator | ||
|
||
|
||
import de.jnkconsulting.e3dc.easyrscp.api.frame.Frame | ||
import de.jnkconsulting.e3dc.easyrscp.api.frame.tags.EMSTag | ||
import de.jnkconsulting.e3dc.easyrscp.frame.DataBuilder | ||
import de.jnkconsulting.e3dc.easyrscp.frame.FrameBuilder | ||
|
||
/** | ||
* [de.jnkconsulting.e3dc.easyrscp.api.frame.Frame] generator to request the the start of a manual charge | ||
* | ||
* @since 2.2 | ||
*/ | ||
class RequestStartManualChargeCreator: FrameCreator<Int> { | ||
|
||
override fun invoke(amount: Int): Frame = | ||
FrameBuilder() | ||
.addData( | ||
DataBuilder().tag(EMSTag.REQ_START_MANUAL_CHARGE).uint32(amount).build() | ||
) | ||
.build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.