Appearance
Overview
The HVC XR application implements device-specific routing for QR code scanning functionality. Based on the device type, the application routes to different scanner implementations to ensure optimal performance and compatibility.
Device-Specific Routing
Routing Logic
dart
// Example routing logic
if (deviceId == 'Navigator-500') {
// Route to the new scanner implementation
Get.toNamed(NewScannerPage.routeName);
} else {
// Route to the legacy scanner implementation
Get.toNamed(ScannerPage.routeName);
}Scanner Implementations
New Scanner Page (new_scanner_page.dart)
- Device Support: Optimized for Navigator-500 devices
- Features:
- Enhanced QR code scanning capabilities
- Improved device orientation handling
- Better performance on newer devices
- Support for rapid connect functionality
- Implementation: Uses
MobileScannerpackage for scanning
Legacy Scanner Page (scanner_page.dart)
- Device Support: Compatible with other RealWear devices
- Features:
- Standard QR code scanning
- Basic device orientation handling
- Compatible with older device models
- Implementation: Uses
scanpackage for scanning
Key Differences
| Feature | New Scanner Page | Legacy Scanner Page |
|---|---|---|
| Package | mobile_scanner | scan |
| Performance | Optimized for newer devices | Compatible with older devices |
| Orientation Handling | Enhanced | Basic |
| Rapid Connect | Supported | Limited support |
| UI Components | Modern implementation | Legacy implementation |
Best Practices
- Always check device type before routing
- Maintain both implementations for compatibility
- Test routing logic on all supported devices
- Document device-specific features
- Handle fallback scenarios gracefully
Implementation Example
dart
void routeToScanner() {
final deviceId = getDeviceId(); // Get the current device ID
if (deviceId == 'Navigator-500') {
// Route to new scanner for Navigator-500
Get.toNamed(NewScannerPage.routeName);
} else {
// Route to legacy scanner for other devices
Get.toNamed(ScannerPage.routeName);
}
}