register static method

Future<void> register()

Register the QHexRT backend with the C++ plugin registry. Safe to call multiple times; on unsupported devices registration is rejected.

Implementation

static Future<void> register() async {
  if (_isRegistered) {
    _logger.debug('QHexRT already registered');
    return;
  }
  if (!isAvailable) {
    _logger.error('QHexRT native library not available');
    return;
  }
  try {
    _bindings ??= QhexrtBindings();
    final result = _bindings!.register();
    _logger.info('rac_backend_qhexrt_register() returned: $result');
    if (result == RacResultCode.errorBackendUnavailable ||
        result == RacResultCode.errorCapabilityUnsupported) {
      _logger.error(
          'QHexRT unavailable; a Hexagon v75+ NPU is required.');
      return;
    }
    if (result != RacResultCode.success &&
        result != RacResultCode.errorModuleAlreadyRegistered) {
      _logger.error('QHexRT registration failed with code: $result');
      return;
    }
    _isRegistered = true;
    _logger.info('QHexRT backend registered (LLM/VLM/STT/TTS)');
  } catch (e) {
    _logger.error('QHexRT registration error: $e');
  }
}