-
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.
- add ability to filter same remotes - fix next channel button
- Loading branch information
1 parent
1358f05
commit a27081e
Showing
6 changed files
with
106 additions
and
16 deletions.
There are no files selected for viewing
Submodule IRDB
updated
4077 files
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 |
---|---|---|
|
@@ -5,10 +5,10 @@ org.gradle.configureondemand=true | |
org.gradle.caching=true | ||
org.gradle.parallel=true | ||
# Gradle project core | ||
makeevrserg.project.name=IfrBackend | ||
makeevrserg.project.url=https://github.com/makeevrserg/IfrSample | ||
makeevrserg.project.name=IRDBBackend | ||
makeevrserg.project.url=https://github.com/flipperdevices/IRDB-Backend | ||
makeevrserg.project.group=com.flipperdevices.ifrmvp.backend | ||
makeevrserg.project.version.string=0.3.0 | ||
makeevrserg.project.version.string=0.4.0 | ||
makeevrserg.project.description=Api for IfrSample | ||
makeevrserg.project.developers=makeevrserg|Makeev Roman|[email protected] | ||
# Java | ||
|
68 changes: 68 additions & 0 deletions
68
modules/infrared/src/main/kotlin/com/flipperdevices/infrared/editor/util/InfraredMapper.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,68 @@ | ||
package com.flipperdevices.infrared.editor.util | ||
|
||
import com.flipperdevices.bridge.dao.api.model.FlipperFileFormat | ||
import com.flipperdevices.infrared.editor.model.InfraredRemote | ||
import com.flipperdevices.infrared.editor.viewmodel.FULL_IR_FILETYPE | ||
import com.flipperdevices.infrared.editor.viewmodel.FULL_VERSION_1 | ||
import com.flipperdevices.infrared.editor.viewmodel.InfraredKeyParser | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_ADDRESS | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_COMMAND | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_DATA | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_DUTY_CYCLE | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_FREQUENCY | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_NAME | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_PROTOCOL | ||
import com.flipperdevices.infrared.editor.viewmodel.KEY_TYPE | ||
import java.io.File | ||
|
||
object InfraredMapper { | ||
fun parseRemotes(raw: String): List<InfraredRemote> { | ||
return raw | ||
.let(FlipperFileFormat.Companion::fromFileContent) | ||
.let(InfraredKeyParser::mapParsedKeyToInfraredRemotes) | ||
|
||
} | ||
|
||
fun parseRemotes(file: File): List<InfraredRemote> { | ||
return file | ||
.readText() | ||
.let(::parseRemotes) | ||
} | ||
|
||
fun toInfraredFormat(remotes: List<InfraredRemote>): String { | ||
return buildString { | ||
append(FULL_IR_FILETYPE) | ||
append("\n") | ||
append(FULL_VERSION_1) | ||
|
||
remotes.forEachIndexed { index, remote -> | ||
append("\n") | ||
append("# ") | ||
append("\n") | ||
append("$KEY_NAME: ${remote.name}") | ||
append("\n") | ||
append("$KEY_TYPE: ${remote.type}") | ||
append("\n") | ||
when (remote) { | ||
is InfraredRemote.Parsed -> { | ||
append("${KEY_PROTOCOL}: ${remote.protocol}") | ||
append("\n") | ||
append("${KEY_ADDRESS}: ${remote.address}") | ||
append("\n") | ||
append("${KEY_COMMAND}: ${remote.command}") | ||
} | ||
|
||
is InfraredRemote.Raw -> { | ||
append("${KEY_FREQUENCY}: ${remote.frequency}") | ||
append("\n") | ||
append("${KEY_DUTY_CYCLE}: ${remote.dutyCycle}") | ||
append("\n") | ||
append("${KEY_DATA}: ${remote.data}") | ||
} | ||
} | ||
} | ||
append("\n") | ||
} | ||
} | ||
|
||
} |
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