2.4 KiB
2.4 KiB
Smart Connect Client Fix
Issue
The smart connect client (nfc_autoconnect.py) was incompatible with the updated NFCNetworkClient v1.1.0, causing this error:
TypeError: NFCNetworkClient.__init__() missing 1 required positional argument: 'root'
Fix Applied
Updated nfc_autoconnect.py to v2.0.0 with proper compatibility:
- Now creates Tkinter root properly
- Passes root to parent NFCNetworkClient class
- Maintains all smart DNS resolution features
- Inherits global input capture from parent class
What's Fixed
Before (Broken)
class SmartAutoConnectClient(NFCNetworkClient):
def __init__(self, device_name: str, fallback_ip: str, port: int = 8547):
super().__init__() # ❌ Missing root parameter
After (Fixed)
class SmartAutoConnectClient(NFCNetworkClient):
def __init__(self, root: tk.Tk, device_name: str, fallback_ip: str, port: int = 8547):
super().__init__(root) # ✅ Properly passes root
Features Now Working
✅ Smart DNS resolution (Standard DNS, mDNS, Tailscale) ✅ Automatic fallback to known IP ✅ Auto-reconnect on failure ✅ Global input capture (inherited from NFCNetworkClient v1.1.0) ✅ NFC scans work without window focus ✅ Background operation capability
How to Update
- Pull latest from Gitea (already done automatically)
- Run the smart connect launcher:
connect_drivein_simple.bat
The launcher automatically checks for dependencies and installs them if needed.
Version History
v2.0.0 (Current)
- ✅ Fixed compatibility with NFCNetworkClient v1.1.0
- ✅ Proper Tkinter root initialization
- ✅ Inherits global input capture capability
- 🐛 Fixed TypeError on startup
v1.0.0 (Previous)
- Smart DNS resolution
- Auto-connect functionality
- ❌ Incompatible with NFCNetworkClient v1.1.0
Files Updated
✅ clients/nfc_autoconnect.py (v2.0.0)
✅ clients/connect_drivein_simple.bat (simplified launcher)
Testing
- Run
connect_drivein_simple.bat - Client should start without errors
- Should automatically connect to drive-in server
- NFC scans should work even when window is unfocused
Technical Notes
The smart connect client now:
- Creates
tk.Tk()root inmain() - Passes root to
SmartAutoConnectClient(root, ...) - Parent class handles all keyboard capture and UI
- Smart DNS resolution happens in background threads
- Auto-retry on connection failure
All working perfectly! 🎬