mirror of
https://github.com/google/bumble.git
synced 2026-04-16 00:25:31 +00:00
add intent parameters
This commit is contained in:
@@ -79,10 +79,32 @@ Airplane Mode, then rebooting. The bluetooth process should, in theory, not rest
|
||||
$ adb shell cmd bluetooth_manager disable
|
||||
```
|
||||
|
||||
### Selecting a TCP port
|
||||
### Starting the app
|
||||
You can start the app from the Android launcher, from Android Studio, or with `adb`
|
||||
|
||||
#### Launching from the launcher
|
||||
Just tap the app icon on the launcher, check the TCP port that is configured, and tap
|
||||
the "Start" button.
|
||||
|
||||
#### Launching with `adb`
|
||||
Using the `am` command, you can start the activity, and pass it arguments so that you can
|
||||
automatically start the proxy, and/or set the port number.
|
||||
|
||||
!!! tip "Launching from adb with auto-start"
|
||||
```bash
|
||||
$ adb shell am start -n com.github.google.bumble.remotehci/.MainActivity --ez autostart true
|
||||
```
|
||||
|
||||
!!! tip "Launching from adb with auto-start and a port"
|
||||
In this example, we auto-start the proxy upon launch, with the port set to 9995
|
||||
```bash
|
||||
$ adb shell am start -n com.github.google.bumble.remotehci/.MainActivity --ez autostart true --ei port 9995
|
||||
```
|
||||
|
||||
#### Selecting a TCP port
|
||||
The RemoteHCI app's main activity has a "TCP Port" setting where you can change the port on
|
||||
which the proxy is accepting connections. If the default value isn't suitable, you can
|
||||
change it there.
|
||||
change it there (you can also use the special value 0 to let the OS assign a port number for you).
|
||||
|
||||
### Connecting to the proxy
|
||||
To connect the Bumble stack to the proxy, you need to be able to reach the phone's network
|
||||
|
||||
@@ -3,7 +3,7 @@ HARDWARE
|
||||
|
||||
The Bumble Host connects to a controller over an [HCI Transport](../transports/index.md).
|
||||
To use a hardware controller attached to the host on which the host application is running, the transport is typically either [HCI over UART](../transports/serial.md) or [HCI over USB](../transports/usb.md).
|
||||
On Linux, the [VHCI Transport](../transports/vhci.md) can be used to communicate with any controller hardware managed by the operating system. Alternatively, a remote controller (a phyiscal controller attached to a remote host) can be used by connecting one of the networked transports (such as the [TCP Client transport](../transports/tcp_client.md), the [TCP Server transport](../transports/tcp_server.md) or the [UDP Transport](../transports/udp.md)) to an [HCI Bridge](../apps_and_tools/hci_bridge) bridging the network transport to a physical controller on a remote host.
|
||||
On Linux, the [VHCI Transport](../transports/vhci.md) can be used to communicate with any controller hardware managed by the operating system. Alternatively, a remote controller (a phyiscal controller attached to a remote host) can be used by connecting one of the networked transports (such as the [TCP Client transport](../transports/tcp_client.md), the [TCP Server transport](../transports/tcp_server.md) or the [UDP Transport](../transports/udp.md)) to an [HCI Bridge](../apps_and_tools/hci_bridge.md) bridging the network transport to a physical controller on a remote host.
|
||||
|
||||
In theory, any controller that is compliant with the HCI over UART or HCI over USB protocols can be used.
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
android:theme="@style/Theme.RemoteHCI">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
@@ -39,31 +39,30 @@ public class HciServer {
|
||||
|
||||
private void loop() throws IOException {
|
||||
mListener.onHostConnectionState(false);
|
||||
mListener.onMessage("Waiting for connection on port " + mPort);
|
||||
try (
|
||||
ServerSocket serverSocket = new ServerSocket(mPort);
|
||||
Socket clientSocket = serverSocket.accept()
|
||||
) {
|
||||
mListener.onHostConnectionState(true);
|
||||
mListener.onMessage("Connected");
|
||||
HciParser parser = new HciParser(mListener);
|
||||
InputStream inputStream = clientSocket.getInputStream();
|
||||
synchronized (this) {
|
||||
mOutputStream = clientSocket.getOutputStream();
|
||||
}
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
try {
|
||||
for (;;) {
|
||||
int bytesRead = inputStream.read(buffer);
|
||||
if (bytesRead < 0) {
|
||||
Log.d(TAG, "end of stream");
|
||||
break;
|
||||
}
|
||||
parser.feedData(buffer, bytesRead);
|
||||
try (ServerSocket serverSocket = new ServerSocket(mPort)) {
|
||||
mListener.onMessage("Waiting for connection on port " + serverSocket.getLocalPort());
|
||||
try (Socket clientSocket = serverSocket.accept()) {
|
||||
mListener.onHostConnectionState(true);
|
||||
mListener.onMessage("Connected");
|
||||
HciParser parser = new HciParser(mListener);
|
||||
InputStream inputStream = clientSocket.getInputStream();
|
||||
synchronized (this) {
|
||||
mOutputStream = clientSocket.getOutputStream();
|
||||
}
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
try {
|
||||
for (; ; ) {
|
||||
int bytesRead = inputStream.read(buffer);
|
||||
if (bytesRead < 0) {
|
||||
Log.d(TAG, "end of stream");
|
||||
break;
|
||||
}
|
||||
parser.feedData(buffer, bytesRead);
|
||||
}
|
||||
} catch (IOException error) {
|
||||
Log.d(TAG, "exception in read loop: " + error);
|
||||
}
|
||||
} catch (IOException error) {
|
||||
Log.d(TAG, "exception in read loop: " + error);
|
||||
}
|
||||
} finally {
|
||||
synchronized (this) {
|
||||
|
||||
@@ -111,14 +111,18 @@ class MainActivity : ComponentActivity() {
|
||||
super.onCreate(savedInstanceState)
|
||||
appViewModel.loadPreferences(getPreferences(Context.MODE_PRIVATE))
|
||||
|
||||
val tcpPort = intent.getIntExtra("port", -1)
|
||||
if (tcpPort >= 0) {
|
||||
appViewModel.tcpPort = tcpPport
|
||||
}
|
||||
|
||||
setContent {
|
||||
MainView(appViewModel, ::startProxy)
|
||||
}
|
||||
|
||||
run()
|
||||
}
|
||||
|
||||
private fun run() {
|
||||
if (intent.getBooleanExtra("autostart", false)) {
|
||||
startProxy()
|
||||
}
|
||||
}
|
||||
|
||||
private fun startProxy() {
|
||||
|
||||
Reference in New Issue
Block a user