-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #363 from google/gbg/android-remote-proxy-cli
android remote proxy cli
- Loading branch information
Showing
4 changed files
with
112 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[versions] | ||
agp = "8.3.0-alpha11" | ||
agp = "8.2.0" | ||
kotlin = "1.9.0" | ||
core-ktx = "1.12.0" | ||
junit = "4.13.2" | ||
|
57 changes: 57 additions & 0 deletions
57
...id/RemoteHCI/app/src/main/java/com/github/google/bumble/remotehci/CommandLineInterface.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,57 @@ | ||
package com.github.google.bumble.remotehci | ||
|
||
import java.io.IOException | ||
|
||
class CommandLineInterface { | ||
companion object { | ||
fun printUsage() { | ||
System.out.println("usage: <launch-command> [-h|--help] [<tcp-port>]") | ||
} | ||
|
||
@JvmStatic fun main(args: Array<String>) { | ||
System.out.println("Starting proxy") | ||
|
||
var tcpPort = DEFAULT_TCP_PORT | ||
if (args.isNotEmpty()) { | ||
if (args[0] == "-h" || args[0] == "--help") { | ||
printUsage() | ||
return | ||
} | ||
try { | ||
tcpPort = args[0].toInt() | ||
} catch (error: NumberFormatException) { | ||
System.out.println("ERROR: invalid TCP port argument") | ||
printUsage() | ||
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}") | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[versions] | ||
agp = "8.3.0-alpha11" | ||
agp = "8.2.0" | ||
kotlin = "1.8.10" | ||
core-ktx = "1.9.0" | ||
junit = "4.13.2" | ||
|