mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
add CLI support
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package com.github.google.bumble.remotehci
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
class CommandLineInterface {
|
||||
companion object {
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
System.out.println("Starting proxy")
|
||||
|
||||
var tcpPort = DEFAULT_TCP_PORT
|
||||
if (args.size >= 1) {
|
||||
try {
|
||||
tcpPort = args[0].toInt()
|
||||
} catch (error: NumberFormatException) {
|
||||
System.out.println("ERROR: invalid TCP port argument")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
val hciProxy = HciProxy(tcpPort, object : HciProxy.Listener {
|
||||
override fun onHostConnectionState(connected: Boolean) {
|
||||
}
|
||||
|
||||
override fun onHciPacketCountChange(
|
||||
commandPacketsReceived: Int,
|
||||
aclPacketsReceived: Int,
|
||||
scoPacketsReceived: Int,
|
||||
eventPacketsSent: Int,
|
||||
aclPacketsSent: Int,
|
||||
scoPacketsSent: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onMessage(message: String?) {
|
||||
System.out.println(message)
|
||||
}
|
||||
|
||||
})
|
||||
hciProxy.run()
|
||||
} catch (error: IOException) {
|
||||
System.err.println("Exception while running HCI Server: $error")
|
||||
} catch (error: HciProxy.HalException) {
|
||||
System.err.println("HAL exception: ${error.message}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
[versions]
|
||||
agp = "8.3.0-alpha11"
|
||||
agp = "8.3.0-alpha16"
|
||||
kotlin = "1.8.10"
|
||||
core-ktx = "1.9.0"
|
||||
junit = "4.13.2"
|
||||
|
||||
Reference in New Issue
Block a user