package com.joe.camera.webcam

import com.joe.camera.webcam.system.DisplayToggle

class UserService : IUserService.Stub() {
    override fun destroy() = Unit
    override fun exec(command: String?): String = runCatching {
        val process = Runtime.getRuntime().exec(arrayOf("sh", "-c", command.orEmpty()))
        process.inputStream.bufferedReader().readText()
    }.getOrElse { it.message.orEmpty() }
    override fun setDisplayPowerMode(mode: Int): Boolean = DisplayToggle.setDisplayPowerMode(mode)
}
