ABComm is a futuristic Android client application designed for high-performance, real-time control of 8-channel relay boards powered by Raspberry Pi Pico running microHIL firmware.
Developed with Kotlin, Android Jetpack, and Kotlin Coroutines.
The application features a Cyberpunk-styled interface supporting dual-mode connectivity (Bluetooth Low Energy / RFCOMM and Wi-Fi TCP Socket), automated hardware telemetry synchronization, and robust error handling.
mh:333:2023:0), Firmware Version (microHIL v1.0.0), and live relay states on connect.OFF when the device disconnects or powers down.ConnectionStatus, DeviceResponse), Dependency Inversion (DIP), Open/Closed (OCP) response matchers, and Coroutine-based background I/O (Dispatchers.IO).scripts/ to emulate both Bluetooth SPP and Wi-Fi TCP servers from a laptop without physical Pico hardware.All messages exchanged between the ABComm Android client and the Raspberry Pi Pico server are framed with < at the start and > at the end:
| Action | Command Frame | Response Format |
|---|---|---|
| Toggle Channel ON | <mh#ch#1#on#end> |
<mh#sys#channel 1 on#end> |
| Toggle Channel OFF | <mh#ch#1#off#end> |
<mh#sys#channel 1 off#end> |
| All Channels ON | <mh#all#on#end> |
<mh#sys#all channels on#end> |
| All Channels OFF | <mh#all#off#end> |
<mh#sys#all channels off#end> |
| Query All Channels | <mh#all#stat#end> |
<mh#sys#channels: 1:ON 2:OFF 3:OFF 4:OFF 5:OFF 6:OFF 7:OFF 8:OFF #end> |
| Query Board ID | <mh#sys#id#end> |
<mh#sys#mh:333:2023:0#end> |
| Query Firmware Version | <mh#sys#version#end> |
<mh#sys#microHIL v1.0.0#end> |
| System Reboot | <mh#sys#reset#end> |
<mh#sys#system resetting...#end> |
| Set Channel Mask | <mh#all#mask#10101010#end> |
<mh#sys#channels mask applied: 10101010#end> |
Developed and tested on Android 14 (API 34) and backwards compatible down to Android 7.0 (API 24).
# 1. Clone repository
git clone https://github.com/electux/abcomm.git
cd abcomm
# 2. Build Debug APK
./gradlew assembleDebug
# Output APK path:
# app/build/outputs/apk/debug/app-debug.apk
Execute the complete test suite (Protocol formatters, Stream parsers, OCP Matchers, ViewModel state, and Repositories):
./gradlew testDebugUnitTest
The app declares and dynamically requests appropriate permissions:
BLUETOOTH_SCAN, BLUETOOTH_CONNECT (Android 12+ / API 31+), ACCESS_FINE_LOCATION (Android 11 and earlier).INTERNET, ACCESS_NETWORK_STATE.The codebase strictly follows the Single Type per File and SOLID principles, organized into domain packages:
abcomm/
βββ app/
β βββ src/
β βββ main/java/com/abcomm/
β β βββ protocol/
β β β βββ MicrohilProtocolConstants.kt # Delimiters and command keywords
β β β βββ CommandFormatter.kt # Outbound formatting contract
β β β βββ MicrohilCommandFormatter.kt # Implementation of CommandFormatter
β β β βββ FrameParser.kt # Stream framing contract (<...>)
β β β βββ MicrohilFrameParser.kt # Chunked stream extractor
β β β βββ DeviceResponse.kt # Typed device response model
β β β βββ ResponseParser.kt # Response parser contract
β β β βββ ResponseMatcher.kt # Response matcher interface (OCP)
β β β βββ MicrohilResponseParser.kt # Parser delegating to matchers
β β β βββ matchers/ # Individual pattern matchers
β β β βββ ChannelStateMatcher.kt
β β β βββ AllChannelsStateMatcher.kt
β β β βββ AllChannelsSnapshotMatcher.kt
β β β βββ MaskAppliedMatcher.kt
β β β βββ BoardIdMatcher.kt
β β β βββ FirmwareVersionMatcher.kt
β β β βββ SystemResettingMatcher.kt
β β β
β β βββ communication/
β β β βββ ConnectionMode.kt # Enum: BLE, WIFI
β β β βββ ConnectionTarget.kt # Sealed: Bluetooth, Wifi
β β β βββ ConnectionStatus.kt # Sealed: Disconnected, Connecting, Connected, Error
β β β βββ ConnectionController.kt # Lifecycle contract
β β β βββ CommandSender.kt # Dispatch contract
β β β βββ ConnectionObservable.kt # Observer contract
β β β βββ CommunicationProvider.kt # Composite provider contract
β β β βββ CommunicationProviderRegistry.kt # Provider registry contract
β β β βββ DefaultCommunicationProviderRegistry.kt
β β β βββ BluetoothService.kt # RFCOMM provider (Coroutines / Dispatchers.IO)
β β β βββ WifiService.kt # TCP Socket provider (Coroutines / Dispatchers.IO)
β β β
β β βββ settings/
β β β βββ AppSettings.kt # Config data model & port boundaries
β β β βββ AppSettingsRepository.kt # Storage contract
β β β βββ SharedPreferencesSettingsRepository.kt
β β β
β β βββ ui/
β β β βββ MainUiState.kt # Immutable UI State model
β β β βββ MainViewModel.kt # ViewModel state machine
β β β βββ MainViewModelFactory.kt # Dependency injection factory
β β β βββ BluetoothPermissionChecker.kt # Permission checker interface
β β β βββ BluetoothPermissionHelper.kt # SDK version-aware helper
β β β βββ BluetoothDeviceProvider.kt # Bluetooth adapter interface
β β β βββ BluetoothDeviceManager.kt # Paired device manager
β β β
β β βββ MainActivity.kt # Primary Android Activity view layer
β β
β βββ test/java/com/abcomm/ # Complete MockK Unit Test Suite
β
βββ docs/ # Sphinx / ReadTheDocs Documentation
β βββ source/
β βββ conf.py
β βββ index.rst
β
βββ scripts/ # Hardware Emulation & Testing Scripts
βββ ble/
β βββ ble_listen.sh # Linux RFCOMM SPP sniffer/server script
β βββ README.md # Bluetooth test setup guide
βββ wifi/
βββ wifi_server.py # Python TCP microHIL mock server
βββ README.md # Wi-Fi test setup guide
192.168.1.100, Port 5000). Values are automatically saved for subsequent app launches.To test Bluetooth connectivity without physical Raspberry Pi Pico hardware, configure a Linux (Ubuntu) laptop as an RFCOMM server:
# In Terminal A on Ubuntu:
chmod +x scripts/ble/ble_listen.sh
./scripts/ble/ble_listen.sh
# In Terminal B (to monitor commands sent from phone):
sudo cat /dev/rfcomm10
Refer to scripts/ble/README.md for full Bluetooth pairing and compatibility instructions.
To test Wi-Fi communication without physical hardware, run the Python mock server:
# Run the mock server from the repository root
python3 scripts/wifi/wifi_server.py --port 5000
192.168.1.150).5000, and tap CONNECT.Refer to scripts/wifi/README.md for further details.
Contributions are welcome! Please read CONTRIBUTING.md for development guidelines.
Copyright (C) 2026 by electux.github.io/abcomm
ABComm is open-source software licensed under the MIT License.