Exemple #1
0
  /**
   * @param ovrHmdCtx
   * @param ovrHmdIndex only for informal purposes, OVR HMD index of created <code>ovrHmdHandle
   *     </code>
   * @param sb
   * @return
   */
  public static StringBuilder getAvailableCapabilitiesInfo(
      final OvrHmdContext ovrHmdCtx, final int ovrHmdIndex, StringBuilder sb) {
    if (null == ovrHmdCtx) {
      throw new IllegalArgumentException("null ovrHmdHandle");
    }
    if (null == sb) {
      sb = new StringBuilder();
    }
    final ovrHmdDesc hmdDesc = ovrHmdDesc.create();
    OVR.ovrHmd_GetDesc(ovrHmdCtx, hmdDesc);
    getAvailableCapabilitiesInfo(hmdDesc, ovrHmdIndex, sb);

    final ovrSensorDesc sensorDesc = ovrSensorDesc.create();
    if (OVR.ovrHmd_GetSensorDesc(ovrHmdCtx, sensorDesc)) {
      sb.append(
              "\thmd."
                  + ovrHmdIndex
                  + ".sensor.productId:\t0x"
                  + Integer.toHexString(sensorDesc.getProductId()))
          .append(Platform.getNewline());
      sb.append(
              "\thmd."
                  + ovrHmdIndex
                  + ".sensor.vendorId:\t0x"
                  + Integer.toHexString(sensorDesc.getVendorId()))
          .append(Platform.getNewline());
      sb.append("\thmd." + ovrHmdIndex + ".sensor.serial:\t" + sensorDesc.getSerialNumberAsString())
          .append(Platform.getNewline());
    } else {
      sb.append("\thmd." + ovrHmdIndex + ".sensor:\tn/a").append(Platform.getNewline());
    }
    return sb;
  }
Exemple #2
0
 public static StringBuilder getAvailableCapabilitiesInfo(
     final int ovrHmdIndex, StringBuilder sb) {
   if (null == sb) {
     sb = new StringBuilder();
   }
   if (!OVR.ovr_Initialize()) { // recursive ..
     sb.append("\tOVR not available").append(Platform.getNewline());
   } else {
     final OvrHmdContext ovrHmdCtx = OVR.ovrHmd_Create(ovrHmdIndex);
     if (null != ovrHmdCtx) {
       getAvailableCapabilitiesInfo(ovrHmdCtx, ovrHmdIndex, sb);
       OVR.ovrHmd_Destroy(ovrHmdCtx);
     } else {
       sb.append("\thmd." + ovrHmdIndex + " not available").append(Platform.getNewline());
     }
   }
   // Nope .. ovr.ovr_Shutdown();
   sb.append(Platform.getNewline());
   return sb;
 }