v0.1.20 - MockDevice Updates for Real Device Compatibility (2025-12-07)¶
What Changed?¶
This release updates the MockDevice to match the actual OSECHI detector response format and data structure. The mock device now returns responses identical to the real hardware, making testing and development more reliable. Detection events from MockGenerator now include all fields present in real detector output, including GNSS data.
What's New¶
MockDevice Response Format Updates¶
What it does:
GET_STATUS now returns a nested structure with system, detection, and features objects, matching the actual device firmware v1.11.2. GET_HELP returns detailed command metadata with descriptions, categories, and aliases.
How to use it: No changes required for existing code. The MockDevice is a drop-in replacement for PortDevice and now provides more accurate testing.
Code example:
from kazunoko import MockDevice, Command
device = MockDevice()
with device:
cmd = Command(device)
status = cmd.status()
# Returns nested structure matching real device
print(status.system.version) # "1.11.2"
print(status.detection.poll_count) # 100
Detection Data Format Alignment¶
What it does:
MockGenerator now generates detection events with all fields from the actual device, including:
- hit1, hit2, hit3 (detector hit values)
- adc, adc_raw, adc_mv (ADC readings)
- gnss_latitude, gnss_longitude, gnss_altitude (GNSS coordinates)
- gnss_satellites, gnss_fix_quality, gnss_hdop, gnss_fix_valid (GNSS status)
How to use it:
Simply use MockGenerator.from_random() or from_file() as before. The data now matches real detector output exactly.
Installation¶
Quick Start¶
# Get the release
git checkout vX.Y.Z
# Setup
task env:setup
# Run CLI
uv run kazunoko --help
What's Different from the Last Version?¶
✅ Added¶
- SET_THRESHOLD response handling (returns channel and threshold value)
- GET_HELP response with detailed command metadata (21 commands with categories and aliases)
- GNSS fields to MockGenerator detection events
- Test coverage for mock device compatibility
🔧 Changed¶
- GET_STATUS response structure: now nested with
system,detection,featuresobjects - MockDevice version updated to 1.11.2
- MockDevice uptime updated to 16530ms
- GET_UPTIME field name changed from
uptimetouptime_msfor consistency - MockGenerator detection data:
signal1/2/3renamed tohit1/2/3 - MockGenerator ADC ranges updated to match real device output
- MockGenerator unix_timestamp now uses device-like values (starting at 459)
🐛 Fixed¶
- MockDevice responses now match actual OSECHI detector firmware output
- Inconsistent field naming between different command responses
Is It Safe to Upgrade?¶
Backward Compatible: Yes
- The MockDevice is a drop-in replacement for PortDevice and maintains the same interface
- Response parsing is flexible and accepts additional fields dynamically
- No changes required to existing code using MockDevice or MockGenerator
- All device commands continue to work as before
Tests Passed¶
- ✅ Builds without errors
- ✅ MockDevice responses match actual device output
- ✅ GET_STATUS nested structure correctly formatted
- ✅ GET_HELP returns all 21 commands with metadata
- ✅ MockGenerator produces device-compatible detection events
- ✅ Backward compatibility maintained
Release Details¶
- Date: 2025-12-07
- Version: v0.1.20
- Files Changed: 1 (src/kazunoko/mock.py)
- Commits:
- 53cca64 refactor: update mock detection data format to match actual device
- 7e243f9 fix: update GET_UPTIME response field from uptime to uptime_ms
- 0ce7bb1 fix: add SET_THRESHOLD response handling to mock device
- 71c650a refactor: update mock device responses to match actual device format
Next Steps¶
- Implement remaining GET_ commands (GET_BME280, GET_MAC_ADDRESS, GET_RTC_TIME, GET_GNSS_)
- Implement SET_* commands (SET_POLL_COUNT, SET_DEADTIME, SET_RTC_TIME)
- Add comprehensive test suite for MockDevice and MockGenerator
- Performance benchmarking against real device communication