예제 #1
0
  public void testVariantCopyBoolean() {
    VARIANT variantSource = new VARIANT(Variant.VARIANT_TRUE);
    VARIANT variantDest = new VARIANT();

    HRESULT hr = OleAuto.INSTANCE.VariantCopy(variantDest.getPointer(), variantSource);

    assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
  }
예제 #2
0
  public void testVariantCopyShort() {
    VARIANT variantSource = new VARIANT(new SHORT(33333));
    VARIANT variantDest = new VARIANT();

    // System.out.println(variantSource.toString(true));
    HRESULT hr = OleAuto.INSTANCE.VariantCopy(variantDest.getPointer(), variantSource);

    assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
  }
  private void processInteraction() {
    NUI_INTERACTION_FRAME interactionFrame = new NUI_INTERACTION_FRAME();
    HRESULT hr = interactionStream.GetNextFrame(new DWORD(0), interactionFrame);

    if (FAILED(hr)) {

      // this happens when we did not process the data in the 1/30 of second required by the sdk
      // because we are in java we can sometimes run slow enough to hit this boundary
      // we can safely ignore this and as our code gets faster it will happen less
      if (hr.intValue() == KinectLibrary.E_NUI_FRAME_NO_DATA) {
        return;
      }

      checkRC(hr);
    }

    // get a list of all skeletons and hands with information
    List<Integer> ids = new ArrayList<>();
    List<NUI_HAND_TYPE> types = new ArrayList<>();

    for (NUI_USER_INFO info : interactionFrame.UserInfos) {

      if (info.HandPointerInfos[0].State.intValue() != 0) {

        ids.add(info.SkeletonTrackingId.intValue());
        types.add(info.HandPointerInfos[0].HandType.value);

        gestureTracker.update(
            device,
            interactionFrame.TimeStamp.getValue(),
            info.HandPointerInfos[0].RawX,
            info.HandPointerInfos[0].RawY,
            info.HandPointerInfos[0].RawZ,
            info.SkeletonTrackingId.intValue(),
            info.HandPointerInfos[0].HandType.value);
      }

      if (info.HandPointerInfos[1].State.intValue() != 0) {

        ids.add(info.SkeletonTrackingId.intValue());
        types.add(info.HandPointerInfos[1].HandType.value);

        gestureTracker.update(
            device,
            interactionFrame.TimeStamp.getValue(),
            info.HandPointerInfos[1].RawX,
            info.HandPointerInfos[1].RawY,
            info.HandPointerInfos[1].RawZ,
            info.SkeletonTrackingId.intValue(),
            info.HandPointerInfos[1].HandType.value);
      }
    }

    gestureTracker.findDestroyed(ids, types);
  }
예제 #4
0
  public void testVariantClear() {
    VARIANT variant = new VARIANT(new SHORT(33333));
    HRESULT hr = OleAuto.INSTANCE.VariantClear(variant.getPointer());

    assertTrue("hr: " + hr.intValue(), hr.intValue() == 0);
  }
 public static void checkRC(HRESULT hr) {
   if (FAILED(hr)) {
     throw new COMException(hr.toString());
   }
 }