SDKJava (Android) SDK

Debug logs

Android Java SDK: Debug logs

Current version · 2.0.0

Debug logs

Choose debug modules and detail through SdkConfig.builder().debug(...) before constructing the SDK. Start with summary information and increase detail only when needed.

import android.content.Context;
import com.qnbot.sdk.Sdk;
import com.qnbot.sdk.SdkConfig;
import com.qnbot.sdk.android.SerialTransport;
import com.qnbot.sdk.config.DebugConfig;
import com.qnbot.sdk.config.DebugDetail;
import com.qnbot.sdk.config.DebugModule;
import com.qnbot.sdk.config.DeviceSelector;
import com.qnbot.sdk.config.SerialConnection;
import com.qnbot.sdk.config.Side;
import com.qnbot.sdk.config.TargetAlgorithm;
import com.qnbot.sdk.config.TargetConfig;
import com.qnbot.sdk.glove.Glove;
import com.qnbot.sdk.glove.GloveConfig;
import com.qnbot.sdk.glove.GloveDevice;

/**
 * Streams retargeted output with sampled debug tracing enabled.
 *
 * <p>Pass the host {@link Context}, an authorized transport, the glove port and side, the installed
 * algorithm package, and the debug detail/rate. SDK logs are written under the SDK data root; the
 * target subscription prints each command.
 */
public final class DebugTrace {
  private DebugTrace() {}

  public static void run(Context context, SerialTransport transport, String port, Side side,
      String packageId, int sampleRate, DebugDetail detail) {
    SdkConfig config = SdkConfig.builder()
        .device(GloveConfig.builder()
                    .name("primary")
                    .side(side)
                    .connection(SerialConnection.port(port))
                    .build())
        .target(TargetConfig.builder()
                    .name("openxr_hand")
                    .side(side)
                    .source(new DeviceSelector("glove", "primary", side))
                    .algorithm(new TargetAlgorithm(packageId))
                    .build())
        .debug(DebugConfig.builder()
                   .modules(DebugModule.values())
                   .detail(detail)
                   .sampleRate(sampleRate)
                   .build())
        .build();
    try (Sdk sdk = new Sdk(config, context, transport); Glove glove = sdk.glove()) {
      GloveDevice device = glove.device();
      device.output("openxr_hand")
          .subscribe(sample
              -> System.out.println("retargeting sequence=" + sample.sequence
                  + " target=" + sample.value.target + " joints=" + sample.value.joints));
      glove.start();
      glove.runForever();
    }
  }
}

DebugTrace.run(...) enables every module in DebugModule.values(), records diagnostics at the caller's DebugDetail and sample rate, and subscribes to target output. sampleRate controls debug sampling, not device or subscription frequency. Modules include TRANSPORT, DEVICE, CAPTURE, CALIBRATION, RETARGETING and OUTPUT; detail is SUMMARY or FULL; a business app can select only the modules it needs.

Also record sdk.health() or device.health() and app logs around the problem. Avoid printing full payloads on every high-rate callback.

SDK update notices

Enabled Stable and RC Android deliveries check the corresponding Glove or Exo OTA catalog for a newer stable version at the component's first start. Dev versions skip checks; the SDK provides no independent Core update notice. Inspect update_checks_enabled in the delivery record.

View INFO notices with:

adb logcat -s qnbot-sdk:I

An applicable update produces an update_available line containing the component, installed version, available version and HTTPS upgrade source. The SDK does not download or install updates; upgrade the complete Maven dependency using your delivery instructions.

Each first-component-start boundary shares at most a one-second check budget. Repeated stop/start in the same instance does not recheck. Offline, timeout, malformed responses or no update produce no notice and leave connections/capture running. Keep start on a worker and include the bounded wait in app startup budgets.

Ordinary source builds disable checks by default; use --enable-update-checks at build time to enable them. An unavailable or invalid OTA catalog silently skips runtime notices and does not block the build. The switch does not establish official delivery availability; use the versions and configuration recorded in your actual matching delivery.