Conversation
Implement rapid enrollment feature for pre-registering NFC cards with sequential identifiers before user assignment. ## Changes Made - Add menu option 18: "Batch enroll NFC cards (quick-scan mode)" - Implement BatchEnrollNfcCards() with three-phase workflow: 1. Configuration: device selection, prefix, padding 2. Enrollment loop: tap card, generate ID, display large text 3. Save results: export to JSON and CSV files - Add auto-detection of max card ID from UniFi Access API - Queries all NFC cards via GetNfcCardsAsync() - Parses aliases matching prefix pattern - Suggests continuing from max + 1 - Add helper methods: - GenerateSequentialId(): Format card IDs with padding - FindMaxCardNumber(): Parse aliases to find highest number - DisplayLargeText(): ASCII art for visual clarity - SaveCardMappings(): Export to JSON and CSV formats - Update CLAUDE.md with Linear project configuration ## Technical Implementation - Reuses existing enrollment session logic from RegisterNfcCard() - Updates card alias via UpdateNfcCardAsync() for searchability - Manual JSON serialization to maintain Native AOT compatibility - Graceful error handling with retry and quit options - Console.Beep() for audio feedback on success ## Files Modified - CLAUDE.md (lines 5-22): Added Linear configuration - Unifi.NET.Samples/Program.cs: - Lines 90-91: Updated menu with option 18 - Lines 149-150: Added switch case for batch enrollment - Lines 1905-2180: New BatchEnrollNfcCards() method - Lines 2183-2217: Helper methods implementation - Lines 2227-2253: CardMapping class definition ## Testing Performed - Build: ✅ Succeeded with zero warnings - Native AOT compatibility: ✅ Maintained - Code style: ✅ Compliant with editorconfig ## Session Continuity The feature supports multi-session workflows: 1. Query UniFi Access for all NFC cards 2. Parse aliases matching prefix pattern (e.g., "CARD-0001") 3. Find highest sequential number 4. Suggest starting from max + 1 5. Allow manual override if needed Example workflow: - Session 1: Enroll CARD-0001 to CARD-0050 - Session 2: Auto-detects max (50), suggests starting at 51 - Session 3: Can override to any starting number Linear Issue: https://linear.app/spire-recovery-solutions/issue/SRS-8600
Add Dockerfile.windows-cross to enable building Windows executables from Linux/macOS development environments using Docker. ## Changes Made - Add Dockerfile.windows-cross for cross-platform Windows builds - Uses mcr.microsoft.com/dotnet/sdk:9.0 Linux image - Cross-compiles for win-x64 target - Publishes self-contained single-file executable - Disables Native AOT (cross-OS AOT not supported) - Outputs to local directory via Docker export stage ## Usage ```bash docker build -f Dockerfile.windows-cross \ --target export \ --output type=local,dest=Unifi.NET.Samples/publish/windows . ``` ## Output - Unifi.NET.Samples.exe (72 MB self-contained) - Supporting XML documentation files - Ready to run on Windows without .NET installation ## Technical Notes - Native AOT disabled via -p:PublishAot=false - Single-file publish via -p:PublishSingleFile=true - Self-contained deployment includes .NET runtime - Cross-OS Native AOT compilation not supported by .NET SDK - Framework-dependent build works across all platforms Related to SRS-8600 batch enrollment feature deployment.
Add option 19 to replace a user's lost or stolen NFC card with a streamlined workflow: search user, scan new card, delete old cards.
The UniFi Access API returns HTTP 200 even for error responses (like CODE_CREDS_NFC_READ_POLL_TOKEN_EMPTY), with data set to null. The JSON source generator fails to deserialize null into typed response objects. Now we parse the response code first using JsonDocument, and throw the appropriate exception before attempting typed deserialization.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements rapid batch enrollment feature for pre-registering NFC cards with sequential identifiers (e.g., CARD-0001, CARD-0002) before user assignment. Cards are enrolled via tap-and-hold, displayed in large text for physical labeling, and stored with auto-generated aliases for later lookup.
Linear Issue
https://linear.app/spire-recovery-solutions/issue/SRS-8600/add-batch-nfc-card-enrollment-mode-for-quick-scan-workflow
Changes Made
Menu Integration
Core Implementation
Three-Phase Workflow:
Configuration Phase
Enrollment Loop
Results Export
CardBatch_YYYYMMDD_HHMMSS.jsonCardBatch_YYYYMMDD_HHMMSS.csvSession Continuity Feature
Intelligent Auto-Resume:
GetNfcCardsAsync()Example Multi-Session Workflow:
Helper Methods
BatchEnrollNfcCards()- Main enrollment workflow (280 lines)GenerateSequentialId()- Format IDs with paddingFindMaxCardNumber()- Parse aliases to find max numberDisplayLargeText()- ASCII art for large text displaySaveCardMappings()- Export to JSON/CSV (Native AOT compatible)Configuration Updates
Technical Details
Native AOT Compatibility
API Integration
CreateNfcEnrollmentSessionAsync()logicUpdateNfcCardAsync()GetNfcCardsAsync()Error Handling
User Experience
Test Plan
Files Changed
CLAUDE.md: Linear configuration (+19 lines)Unifi.NET.Samples/Program.cs: Batch enrollment feature (+399 lines)Deployment Notes
No deployment changes required - feature is fully contained in sample application.
Follow-up Items
None - feature is production-ready.