Skip to content

Driver Contribution Guide

This guide is the fastest path to add a new radio family driver.

1. Start from the contract

Implement a RadioDriver:

  • id, displayName, testingOnly
  • probe
  • optional downloadPreview, downloadImage, uploadChannels

Use existing Baofeng drivers as references:

  • src/domain/drivers/baofeng/uv5rFamilyProbeDriver.ts
  • src/domain/drivers/baofeng/uv5rxFamilyProbeDriver.ts
  • src/domain/drivers/baofeng/uv82FamilyProbeDriver.ts

2. Keep concerns separated

  • protocol framing/handshake in protocol helpers
  • binary decode/encode in adapter/codec modules
  • driver orchestrates these pieces and returns typed results

3. Register the driver

Add it to:

  • src/services/radios/radioDriverRegistry.ts

Probe order matters. Put the most specific signatures first.

4. Add required tests

Minimum coverage:

  • probe matched
  • probe not-matched
  • download path success
  • upload path success (if supported)
  • protocol mismatch handling

Add service-level coverage where behavior changes auto-probe ordering, hydration, or bounds.

5. Verify quality gates

Run:

bash
npm run lint
npm run test:run
npm run build

For emulator changes:

bash
cd tools/emulator-go
go test ./...

6. Contribution checklist

  • no UI-layer protocol logic
  • clear not-matched messages
  • structured logger events
  • no any
  • tests cover happy and failure paths