Skip to content

Commit

Permalink
bindings/kotlin: Fix native function names
Browse files Browse the repository at this point in the history
  • Loading branch information
madadam committed Jan 22, 2025
1 parent fab05a2 commit 8c35b08
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@ internal interface Bindings : Library {
}
}

fun service_start(
fun start_service(
config_dir: String,
debug_label: String?,
callback: StatusCallback,
callback_context: Pointer?,
): Pointer

fun service_stop(
fun stop_service(
handle: Pointer,
callback: StatusCallback,
callback_context: Pointer?,
)

fun log_init(
fun init_log(
file: String?,
callback: LogCallback?,
tag: String,
): Short
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Server private constructor(private val handle: Pointer) {
debugLabel: String? = null,
): Server {
val result = ResultHandler()
val handle = bindings.service_start(configPath, debugLabel, result, null)
val handle = bindings.start_service(configPath, debugLabel, result, null)
result.await()

return Server(handle)
Expand All @@ -22,7 +22,7 @@ class Server private constructor(private val handle: Pointer) {

suspend fun stop() {
val result = ResultHandler()
bindings.service_stop(handle, result, null)
bindings.stop_service(handle, result, null)
result.await()
}
}
Expand All @@ -32,13 +32,8 @@ typealias LogFunction = (level: LogLevel, message: String) -> Unit
fun initLog(
file: String? = null,
callback: LogFunction? = null,
tag: String = "",
) {
bindings.log_init(
file,
callback?.let(::LogHandler),
tag,
)
bindings.init_log(file, callback?.let(::LogHandler))
}

private class ResultHandler() : StatusCallback {
Expand Down

0 comments on commit 8c35b08

Please sign in to comment.