How skollip/bluetooth-walkie-talkie works
Project type & purpose (from README + tree)
This is a native Android application (“Push to Talk” walkie-talkie) that uses Bluetooth to create a peer-to-peer connection and transmit audio while a user holds a microphone button (PTT). It’s not a client/server web system; the “system” is primarily an Android app + Android Bluetooth stack + a peer Android device.
Key evidence:
• src/AndroidManifest.xml → Android app
• src/build.gradle → Android build
• Core Java classes: ConnectThread.java, ListenThread.java, MainConversation.java, UserSelection.java
• Layout: activity_user_selection.xml
• Prebuilt APK: bin/WalkieTalkie.apk
• Root HTML files (index.html, software.html, etc.) look like project documentation, not runtime components.
What the file structure tells you architecturally
Treat these as your main “modules” when drawing components:
Runtime code (Android app)
• Activities / UI layer
• UserSelection.java + activity_user_selection.xml
Likely handles device discovery/selection and initiating connection.
• MainConversation.java
Likely the “PTT” screen: capture mic, send audio, receive audio, playback.
• Bluetooth connection management
• ConnectThread.java
Outgoing connection logic (client role) using BluetoothSocket.connect().
• ListenThread.java
Incoming connection logic (server role) using BluetoothServerSocket.accept().
• Model / data
• DeviceInfo.java
Likely encapsulates Bluetooth device metadata (name, MAC, etc.).
Non-runtime artifacts (do not confuse with system components)
• bin/ contains packaged output + some HTML
• doc/, data/, root *.html, finalReport.* are documentation/reporting assets
Device/Platform boundary
• Android Device A (your app process)
• Android Device B (peer app process)
• Android OS services (Bluetooth stack, audio stack)
• Bluetooth Radio / Link between devices
Application internal subsystems
Inside each device, break the app into:
Bluetooth Transport Layer
• ListenThread (server accept loop)
• ConnectThread (client connect)
• BluetoothSocket I/O (InputStream/OutputStream)
Audio Pipeline
• Audio Capture (e.g., AudioRecord) → produces PCM frames
• Audio Playback (e.g., AudioTrack) ← consumes PCM frames
• (If the code compresses/frames audio, represent an Audio Framing/Codec block; if not obvious, label it “PCM frames / raw audio”)
Session/State
• Connected/Disconnected state
• Selected device identity (DeviceInfo)
• Push-to-talk state (button held → transmit mode)
Discovery/Selection → Connection
• UserSelection triggers connect:
• UI event (“Connect”) → ConnectThread.start() (client role)
• Or app listens:
• App starts ListenThread.start() (server role) awaiting incoming connection
Connection → Socket Established
• ConnectThread → Android Bluetooth API → BluetoothSocket (connected)
• ListenThread → Android Bluetooth API → BluetoothServerSocket.accept() → BluetoothSocket (connected)
Push-to-Talk Audio Transmit
• PTT button down (in MainConversation) → Audio Capture starts
• Audio frames → (optional framing/encoding) → BluetoothSocket OutputStream → Bluetooth link → peer InputStream
Audio Receive/Playback
• BluetoothSocket InputStream → (optional deframe/decode) → Audio Playback
Concurrency explicitly
• UI thread (Activities)
• Connection threads (listen/connect)
• I/O loop thread(s) (often same as connect/listen thread post-connection, or separate)
• Audio capture/playback running loops (could be separate threads or within main conversation logic)
Architectural patterns to highlight (based on this structure)
This is effectively:
• Layered architecture inside the app:
• Presentation (Activities + XML)
• Transport (Bluetooth threads + sockets)
• Media (capture/playback)
• Peer-to-peer topology:
• Either device can act as server (listener) or client (connector).
• Event-driven UI controlling long-running background operations:
• Android SDK / Gradle build (build.gradle)
• Android Bluetooth APIs:
• BluetoothAdapter, BluetoothDevice, BluetoothServerSocket, BluetoothSocket
• Android Audio APIs (very likely even if not visible in tree):
• AudioRecord (capture), AudioTrack (playback)
• Threading model:
• Java Threads / Android main thread
Diagramming rules to follow (so it’s readable and unambiguous)
Elements explicitly:
Clear labels
• Use exact class names where relevant: ConnectThread, ListenThread, MainConversation, UserSelection, DeviceInfo
• “PCM frames / audio bytes”
• “Bluetooth socket stream”
• “Connection status/events”
Boundaries
• App Process
• Android OS
• Hardware/Radio
• Remote peer device
Practical “don’t overthink it” decomposition (maximize components)
• Split “Bluetooth” into: Adapter/Discovery, Connect, Listen, Socket I/O
• Split “Audio” into: Capture, Buffering/Framing, Playback
• Split “UI” into screens and key UI events (connect/disconnect/PTT press)
Even if some of these are implemented in the same class, representing them separately makes the architecture easier to reason about.
Before finalizing, quickly scan:
• AndroidManifest.xml for:
• Permissions: BLUETOOTH, BLUETOOTH_ADMIN, RECORD_AUDIO
• Bluetooth feature flags
• ConnectThread.java and ListenThread.java for:
• UUID/service name (RFCOMM service UUID)
• Who closes sockets, lifecycle handling
• MainConversation.java for:
• Whether audio is raw PCM vs encoded
• Threading model for audio loops
• UserSelection.java for:
• Discovery mechanism (paired devices only vs discovery scan)