Skip to content

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 MobileScanner package 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 scan package for scanning

Key Differences ​

FeatureNew Scanner PageLegacy Scanner Page
Packagemobile_scannerscan
PerformanceOptimized for newer devicesCompatible with older devices
Orientation HandlingEnhancedBasic
Rapid ConnectSupportedLimited support
UI ComponentsModern implementationLegacy implementation

Best Practices ​

  1. Always check device type before routing
  2. Maintain both implementations for compatibility
  3. Test routing logic on all supported devices
  4. Document device-specific features
  5. 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);
  }
}

Released under the MIT License.