Skip to content

Module Comparison

This document provides a quick reference comparison of all modules in the HamBench ecosystem.

Quick Reference Table

ModulePurposeKey ExportsDependenciesType
@springfield/ham-radio-apiCore type definitions and interfacesRadioDriver, RadioCodec, branded typesloglayer, ts-brandCore API
@springfield/ham-radio-driverProtocol interpreter and serial communicationRadioDriver, ProtocolInterpreter@springfield/ham-radio-api, @springfield/ham-radio-utils, serialportDriver
@springfield/ham-radio-utilsShared utilities and helper functionsSegmentedMemory, UILogger, validation functions@springfield/ham-radio-api, ajv, fisheryUtilities
@springfield/ham-radio-registryPlugin discovery and managementRadioConfigRegistry, NpmBasedConfigRegistry@springfield/ham-radio-api, loglayerRegistry
radio-module-baofengBaofeng radio-specific implementationJSON configs + memory maps@springfield/ham-radio-api, @springfield/ham-radio-utilsRadio Module
radio-module-kenwoodKenwood TH-F6 (live CAT memories), TH-D74 (clone + CAT), TM-D710A (clone + CAT)JSON configs + memory maps@springfield/ham-radio-api, @springfield/ham-radio-utilsRadio Module

Module Details

@springfield/ham-radio-api

Layer: Core API
Role: Foundation layer that defines all types and interfaces

Key Responsibilities:

  • Define core interfaces (RadioDriver, RadioCodec, etc.)
  • Provide branded types for type safety
  • Define spectrum and license management types
  • Establish contracts between all modules

When to use: Required by all other modules as the foundation layer

@springfield/ham-radio-driver

Layer: Driver
Role: Implements radio communication logic

Key Responsibilities:

  • Execute DSL-based radio protocols
  • Handle serial port communication
  • Manage protocol step execution
  • Provide progress tracking and cancellation

When to use: When you need to communicate with physical radio hardware

@springfield/ham-radio-utils

Layer: Utilities
Role: Provides shared utilities and helper functions

Key Responsibilities:

  • Memory management utilities
  • Schema validation
  • UI logging and progress reporting
  • Test data factories
  • Data conversion utilities

When to use: When you need common utilities for memory handling, validation, or testing

@springfield/ham-radio-registry

Layer: Registry
Role: Manages plugin discovery and configuration loading

Key Responsibilities:

  • Discover radio configurations from installed JSON modules
  • Validate and load configurations
  • Manage shared components
  • Handle plugin installation

When to use: When you need to discover and load radio configurations dynamically

radio-module-baofeng

Layer: Radio Module
Role: Radio-specific implementation example

Key Responsibilities:

  • Provide Baofeng UV-5R specific configuration
  • Implement Baofeng-specific codec
  • Define memory layout and protocols
  • Handle Baofeng communication protocols

When to use: As a reference implementation for creating new radio modules

Dependency Graph

Module Relationships

Core Dependencies

  • ham-radio-api is the foundation that all other modules depend on
  • ham-radio-utils provides utilities used by driver and radio modules
  • ham-radio-registry discovers and manages radio modules
  • ham-radio-driver implements the communication layer
  • radio-module-baofeng is an example radio-specific implementation

Usage Patterns

Application Development

typescript
// 1. Use registry to discover available radios
import { createRegistry } from '@springfield/ham-radio-registry';
const registry = createRegistry(logger);
const configs = await registry.discoverConfigurations();

// 2. Get specific configuration and codec
const config = await registry.getConfiguration('baofeng:uv5r');
const codec = await registry.getCodec('baofeng:uv5r');

// 3. Use driver for communication
import { RadioDriver } from '@springfield/ham-radio-driver';
const driver = new RadioDriver(config, logger);
const memory = await driver.readRadio('/dev/ttyUSB0', progress);

// 4. Use codec for data conversion
const program = codec.decode(memory);

Radio Module Development

typescript
// 1. Depend on core API
import type { RadioCodec, RadioModelId } from '@springfield/ham-radio-api';

// 2. Use utilities for common operations
import { SegmentedMemory, validateSchema } from '@springfield/ham-radio-utils';

// 3. Implement radio-specific codec
export class MyRadioCodec implements RadioCodec {
  decode(memory: RadioMemory): RadioProgram { /* ... */ }
  encode(program: RadioProgram, memory: RadioMemory): RadioMemory { /* ... */ }
}

Module Selection Guide

For Application Developers

  1. Start with ham-radio-api - Understand the core types and interfaces
  2. Use ham-radio-registry - Discover and load radio configurations
  3. Use ham-radio-driver - Communicate with physical radios
  4. Use ham-radio-utils - For memory handling and validation

For Radio Module Developers

  1. Depend on ham-radio-api - Implement the required interfaces
  2. Use ham-radio-utils - Leverage shared utilities and test factories
  3. Follow radio-module-baofeng pattern - Use as reference implementation
  4. Register with ham-radio-registry - Make your module discoverable

For Driver Extensions

  1. Extend ham-radio-driver - Add custom protocol executors
  2. Use ham-radio-utils - For logging and progress reporting
  3. Follow existing patterns - Maintain consistency with core driver

Version Compatibility

All modules follow semantic versioning and maintain compatibility within major versions:

  • ham-radio-api: Breaking changes require major version bumps
  • ham-radio-driver: Compatible with ham-radio-api v16+
  • ham-radio-utils: Compatible with ham-radio-api v14+
  • ham-radio-registry: Compatible with ham-radio-api v16+
  • radio-module-baofeng: Compatible with ham-radio-api v16+

Performance Characteristics

ModuleStartup TimeMemory UsageRuntime Performance
ham-radio-apiFastLowN/A (types only)
ham-radio-driverMediumMediumHigh (serial I/O)
ham-radio-utilsFastLowHigh (utilities)
ham-radio-registrySlowMediumMedium (file I/O)
radio-module-baofengFastLowHigh (data conversion)

Security Considerations

ModuleSecurity LevelKey ConcernsMitigations
ham-radio-apiHighType safetyBranded types, strict TypeScript
ham-radio-driverMediumSerial I/OInput validation, error handling
ham-radio-utilsHighData validationSchema validation, sanitization
ham-radio-registryMediumPlugin loadingSchema validation, sandboxing
radio-module-baofengHighData integrityValidation, error handling