This commit is contained in:
zhongchao
2022-09-14 11:58:43 +08:00
parent 501e82ea45
commit 699389a794
4 changed files with 308 additions and 223 deletions

View File

@@ -9,37 +9,122 @@ class EventTypeHelper {
companion object {
fun getLCW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
) {
when {
direction.isLeft() -> {
data.invoke(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType + ""),
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType + "")
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + "")
)
}
direction.isRight() -> {
data.invoke(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType + ""),
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType + "")
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + "")
)
}
else -> {
data.invoke(
EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType),
EventTypeEnum.getWarningTts(EventTypeEnum.TYPE_USECASE_ID_LCW.poiType)
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
}
}
fun getCLW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
){
data.invoke(EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_CLW.poiType + direction.desc)
,EventTypeEnum.getWarningContent(EventTypeEnum.TYPE_USECASE_ID_CLW.poiType + direction.desc))
) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
EventTypeEnum.getWarningContent(appId.toString() + direction.desc)
)
}
fun getLTA(appId: Int, data: ((alert: String, tts: String) -> Unit)) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString())
)
}
fun getAVW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String) -> Unit)
) {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + direction.desc),
EventTypeEnum.getWarningTts(appId.toString() + direction.desc)
)
}
fun getBSW(
appId: Int,
direction: WarningDirectionEnum,
data: ((alert: String, tts: String, visualAngle: Boolean) -> Unit)
) {
when {
direction.isLeft() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + ""),
true
)
}
direction.isRight() -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString() + ""),
EventTypeEnum.getWarningTts(appId.toString() + ""),
true
)
}
else -> {
data.invoke(
EventTypeEnum.getWarningContent(appId.toString()),
EventTypeEnum.getWarningTts(appId.toString()),
false
)
}
}
}
fun getVRU(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.tts,
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.content
)
}
fun getVRURI(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_ID_VRUCW_PERSON.poiType.toInt(),
"行人逆行预警",
"行人逆行预警"
)
}
fun getOptLine(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.poiType.toInt(),
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.tts,
EventTypeEnum.TYPE_USECASE_OPTIMAL_LANE.content
)
}
fun getTJW(data: ((appId: Int, tts: String, content: String) -> Unit)) {
data.invoke(
EventTypeEnum.FOURS_BLOCK_UP.poiType.toInt(),
EventTypeEnum.FOURS_BLOCK_UP.tts,
EventTypeEnum.FOURS_BLOCK_UP.content
)
}
}
}