Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use "D-Bus over TCP/IP over Ethernet over BLE" for communicating with the watch #216

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

I-asked
Copy link

@I-asked I-asked commented May 2, 2024

Hi @FlorentRevest!
What a coincidence indeed…
(We came up with the same idea within the span of two weeks 😳)


Sooo this is my attempt at replacing ATT-based comms with something more streamlined (D-Bus). ✌️

The session bus is exported over TCP to the companion for seamless event transfer between the two devices.

A simplified version of asteroid-tap2ble forwards packets from a TAP interface over BLE. (since the link is relatively slow [26 kbps avg.], we should stick to lightweight protocols, so D-Bus-over-TCP, 9p, etc.; SSH is sadly way too bulky for this connection.)

The packets should then be handled on the companion in an appropriate manner.

To achieve this on Android, I am using libslirp, which allows me to create a virtual network adapter that translates Ethernet packets into unprivileged calls.

To do

  • Link works
  • Security: Ensure the BLE transfer is encrypted (I am not sure if it is by default?)
  • Additional 9p link for remotely accessing the watch's FS (possible to use diod on the watch)
  • Port the rest of the services to D-Bus (most services) and 9p (services that transfer files, such as ScreenshotService)
    • MediaService
    • NotificationService (also made it bi-directional 😉; now it's just missing action buttons 😶‍🌫️)
    • ScreenshotService
    • TimeService (could be scrapped in favor of NTP)
    • WeatherService (could be scrapped in favor of the community daemon)

@I-asked
Copy link
Author

I-asked commented May 3, 2024

Currently working on the MediaService (MPRIS), also updated dbus-java locally.

app/build.gradle.kts Outdated Show resolved Hide resolved
@I-asked I-asked force-pushed the libslirp branch 2 times, most recently from acffbbd to 5c85a4c Compare May 3, 2024 14:24
@I-asked
Copy link
Author

I-asked commented May 3, 2024

I believe the 14-bytes Ethernet frame can be shaved down to 1 byte for point-to-point (a pair of nibbles for source + destination MAC)

import java.util.Objects

class NotificationService(private val mCtx: Context, private val connectionProvider: IDBusConnectionProvider) : INotificationHandler, DBusSigHandler<NotificationClosed?> {
private val mapping: BiMap<String, UInt32> = HashBiMap.create()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mapping should probably be persisted in case the application is closed…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants