An Android SDK for integrating and managing hardware peripherals (printers, scanners, and LED devices) for Fynd Kio kiosk systems. This SDK provides a unified interface for communication with USB and serial-connected hardware devices commonly used in retail and self-checkout applications.
The Fynd Kio SDK simplifies hardware integration by providing:
- Printer Management: Support for thermal receipt printers via USB
- Scanner Integration: Barcode/QR code scanning via serial port
- LED Control: RGB LED indicator control via serial communication
- USB Device Management: Automatic device detection, permission handling, and connection management
- Event-Driven Architecture: Callback-based event handling for device states and operations
- ✅ Unified hardware management through
KioHardwareManager - ✅ USB device automatic detection and permission handling
- ✅ Support for Fynd thermal printers (CSN Printer SDK)
- ✅ RT Scanner integration for barcode scanning
- ✅ RGB LED control for visual feedback
- ✅ Extensible adapter pattern for adding custom hardware
- ✅ Lifecycle-aware initialization and cleanup
- ✅ Comprehensive error handling and event callbacks
- Minimum SDK: Android 24 (Android 7.0)
- Compile SDK: Android 35
- Kotlin: 1.9.0+
- Java: 11
Clone the repository and include the SDK module in your project:
// settings.gradle.kts
include(":kiosdk")Add the dependency in your app's build.gradle.kts:
dependencies {
implementation(project(":kiosdk"))
}Ensure your settings.gradle.kts includes the required repositories:
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven { url = uri("https://zebratech.jfrog.io/artifactory/EMDK-Android/") }
maven { url = uri("https://jitpack.io") }
}
}Add the following permissions to your AndroidManifest.xml:
<uses-permission android:name="android.permission.USB_PERMISSION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.usb.host" />import com.fynd.kiosdk.hardware.KioHardwareManager
import com.fynd.kiosdk.core.printer.PrinterEvent
import com.fynd.kiosdk.core.scanner.ScannerEvent
import com.fynd.kiosdk.core.led.LEDEvent
import com.fynd.kiosdk.core.led.DeviceLight
class MainActivity : ComponentActivity() {
private lateinit var kioHardwareManager: KioHardwareManager
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Initialize the hardware manager
kioHardwareManager = KioHardwareManager(
context = this,
onPrinterEvent = { event -> handlePrinterEvent(event) },
onScannerEvent = { event -> handleScannerEvent(event) },
onLedEvent = { event -> handleLedEvent(event) }
)
// Initialize hardware connections
kioHardwareManager.init()
}
private fun handlePrinterEvent(event: PrinterEvent) {
when (event) {
PrinterEvent.DeviceConnected -> {
// Printer connected successfully
}
PrinterEvent.DeviceDisconnected -> {
// Printer disconnected
}
is PrinterEvent.Error -> {
// Handle printer error
Log.e("Printer", "Error: ${event.reason}", event.exception)
}
else -> {}
}
}
private fun handleScannerEvent(event: ScannerEvent) {
when (event) {
is ScannerEvent.ScanData -> {
// Handle scanned data
val barcode = event.data
Log.d("Scanner", "Scanned: $barcode")
}
ScannerEvent.DeviceConnected -> {
// Scanner connected
}
is ScannerEvent.Error -> {
// Handle scanner error
Log.e("Scanner", "Error: ${event.reason}")
}
else -> {}
}
}
private fun handleLedEvent(event: LEDEvent) {
when (event) {
LEDEvent.DeviceConnected -> {
// LED device connected
}
is LEDEvent.Error -> {
// Handle LED error
Log.e("LED", "Error: ${event.reason}")
}
else -> {}
}
}
override fun onDestroy() {
super.onDestroy()
kioHardwareManager.close()
}
}import android.graphics.Bitmap
// Create or load your receipt bitmap
val receiptBitmap: Bitmap = createReceiptBitmap()
// Print the receipt
kioHardwareManager.print(receiptBitmap)// Turn on green light (success indicator)
kioHardwareManager.setLightColor(DeviceLight.Green)
// Turn on red light (error indicator)
kioHardwareManager.setLightColor(DeviceLight.Red)
// Turn off the light
kioHardwareManager.setLightColor(DeviceLight.Off)Scanner data is automatically received through the onScannerEvent callback when a barcode is scanned. The RT Scanner operates continuously once initialized.
The main entry point for hardware management. Handles:
- Device initialization
- USB device detection and permissions
- Event routing to callbacks
- Adapter management
Hardware-specific implementations:
- KioPrinterAdapter: Abstract base for printer implementations
- KioScannerAdapter: Abstract base for scanner implementations
- KioLEDAdapter: Abstract base for LED implementations
- KioUsbAdapter: Interface for USB device adapters
- FyndPrinterAdapter: CSN thermal printer implementation
- RTScannerSerialAdapter: RT scanner serial port implementation
- FyndLedSerialAdapter: LED control via serial port
Type-safe sealed interfaces for device events:
- PrinterEvent: DeviceConnected, DeviceDisconnected, DeviceDetached, Error
- ScannerEvent: DeviceConnected, DeviceDisconnected, DeviceDetached, Error, ScanData
- LEDEvent: DeviceConnected, DeviceDisconnected, DeviceDetached, Error
The SDK includes sophisticated USB device management:
- KioUsbDeviceManager: Handles USB device lifecycle
- UsbDevicePermissionService: Manages permission requests
- UsbDeviceConnectionService: Handles device connections
- UsbPermissionQueue: Queues and processes permission requests
- CSN Thermal Printers
- Vendor ID: 4070 (0xFE6)
- Product ID: 33054 (0x811E)
- Features: Thermal printing, beep, half-cut, cash drawer kick
- RT Scanner (Serial)
- Port:
/dev/ttyS9 - Type: Serial barcode scanner
- Supports ISO-8859-1 encoding
- Port:
- Fynd LED Controller (Serial)
- Port:
/dev/ttyS3 - Baud Rate: 115200
- Features: RGB color control
- Port:
To add support for a new hardware device:
- Create an Adapter Class
class CustomPrinterAdapter(
private val context: Context,
override val onEvent: (PrinterEvent) -> Unit
) : KioPrinterAdapter(onEvent) {
override fun canUseDevice(device: UsbDevice): Boolean {
// Return true if this adapter can handle the device
return device.vendorId == YOUR_VENDOR_ID &&
device.productId == YOUR_PRODUCT_ID
}
override fun connect(device: UsbDevice) {
// Implement connection logic
}
override fun disconnect() {
// Implement disconnection logic
}
override fun print(bitmap: Bitmap) {
// Implement printing logic
}
}- Register the Adapter
val customAdapter = CustomPrinterAdapter(context, onPrinterEvent)
kioHardwareManager.addAdapter(customAdapter)The SDK uses the following libraries:
// USB Serial Communication
implementation("com.github.mik3y:usb-serial-for-android:3.9.0")
// Included AAR Libraries
- barcode-scanner-library-2.6.22.0.aar
- csn-printer-sdk-1.0.0.jar
- fynd-kiosk-hardware-jws-14.0.0.aar
- poslib-usb-1.0.11.aar
- rtscanner-1.0.0.aar
- scan-pro-1.0.0.jar
- scanner-sdk-2.2.2.aarA sample application is included in the app module demonstrating:
- Basic SDK initialization
- Event handling
- UI integration with Jetpack Compose
- Hardware lifecycle management
To run the sample:
./gradlew :app:installDebug./gradlew assembleDebug./gradlew assembleRelease- Verify USB permissions are granted
- Check device vendor/product IDs match supported hardware
- Ensure no other app is using the printer
- Verify serial port path (
/dev/ttyS9) is correct - Check scanner is properly connected
- Ensure barcode service is running
- Verify serial port path (
/dev/ttyS3) is correct - Check baud rate (115200) is supported
- Ensure proper serial permissions
- USB permissions are requested automatically
- Check AndroidManifest.xml includes USB permissions
- Verify USB host feature is declared
The SDK uses a custom Logger utility for debugging. Enable logs by:
// In your Application class or MainActivity
Logger.setDebugMode(true)- 1.0.0 - Initial release
- Printer support (CSN thermal printers)
- Scanner support (RT serial scanners)
- LED control (RGB serial LEDs)
- USB device management
- Event-driven architecture
This project is proprietary software developed for Fynd. All rights reserved.
For issues, questions, or feature requests, please contact the Fynd development team.
fynd-kio-sdk/
├── app/ # Sample application
│ └── src/main/
│ ├── java/com/fynd/fng/
│ │ └── MainActivity.kt # Sample implementation
│ └── res/ # App resources
├── kiosdk/ # Main SDK module
│ ├── libs/ # Third-party AAR/JAR files
│ └── src/main/kotlin/com/fynd/kiosdk/
│ ├── core/ # Core SDK components
│ │ ├── led/ # LED abstractions
│ │ ├── printer/ # Printer abstractions
│ │ ├── scanner/ # Scanner abstractions
│ │ ├── usb/ # USB management
│ │ └── utils/ # Utility classes
│ └── hardware/ # Hardware implementations
│ ├── led/
│ │ └── fynd/ # Fynd LED adapter
│ ├── printer/
│ │ └── fynd/ # Fynd printer adapter
│ ├── scanner/
│ │ └── rt/ # RT scanner adapter
│ └── KioHardwareManager.kt
├── gradle/ # Gradle configuration
├── build.gradle.kts # Root build script
├── settings.gradle.kts # Project settings
└── README.md # This file
Built with ❤️ by the Fynd Team