// Path: src/java/VRE.Vridge.API/VRE.Vridge.API.Client/src/main/java/com/riftcat/vridge/api/client/java/proxy/ControllerProxy.java
// public class ControllerProxy extends ClientProxyBase {
// 
//     private int packetNum = 0;
// 
//     public ControllerProxy(String endpointAddress){
//         super(endpointAddress, true);
//     }
// 
//     /// <summary>
//     /// Send full single VR controller state to VR.
//     /// </summary>
//     public synchronized void sendControllerState(VRController state) throws TimeoutException {
//         ControllerStateRequest data = ControllerStateRequest
//                 .newBuilder()
//                 .setTaskType(ControllerStateRequestCodes.SendFullState)
//                 .setControllerState(state)
//                 .build();
// 
//         sendMessage(data);
//     }
// 
//     /**
//      * Send full single VR controller state to VR.
//      */
//     public synchronized void sendControllerState(int controllerId, long touchedMask, long pressedMask,
//                                                  List<Float> orientationMatrix,
//                                                  float triggerValue,
//                                                  float analogX, float analogY, float[] velocity,
//                                                  HandType hand) throws TimeoutException {
// 
//         VRControllerState_t.Builder buttonState = VRControllerState_t.newBuilder()
//                 .setRAxis0(VRControllerAxis_t.newBuilder()
//                         .setX(analogX)
//                         .setY(analogY))
//                 .setRAxis1(VRControllerAxis_t.newBuilder()
//                         .setX(triggerValue))
//                 .setUlButtonPressed(pressedMask)
//                 .setUlButtonTouched(touchedMask)
//                 .setUnPacketNum(++packetNum);
// 
// 
// 
//         VRController.Builder controllerState = VRController.newBuilder()
//                 .setControllerId(controllerId)
//                 .addAllOrientationMatrix(orientationMatrix)
//                 .setStatus(0)
//                 .setSuggestedHand(hand)
//                 .setButtonState(buttonState);
// 
//         if(velocity != null){
//             controllerState
//                     .addVelocity(velocity[0])
//                     .addVelocity(velocity[1])
//                     .addVelocity(velocity[2]);
//         }
// 
//         ControllerStateRequest request = ControllerStateRequest.newBuilder()
//                 .setTaskType(ControllerStateRequestCodes.SendFullState)
//                 .setControllerState(controllerState)
//                 .build();
// 
//         sendMessage(request);
//     }
// 
//     /** Recenter head tracking. Works the same as pressing recenter hotkey as configured in VRidge settings. */
//     public void recenterHead() throws TimeoutException{
//         ControllerStateRequest request = ControllerStateRequest
//                 .newBuilder()
//                 .setVersion(CurrentVersion)
//                 .setTaskType(ControllerStateRequestCodes.RecenterHead)
//                 .build();
//         sendMessage(request);
//     }
// 
//     /**
//      * Disconnected from controller API and frees the API for other clients.
//      */
//     public void disconnect(){
//         ControllerStateRequest disconnectRequest = ControllerStateRequest
//                 .newBuilder()
//                 .setVersion(CurrentVersion)
//                 .setTaskType(ControllerStateRequestCodes.Disconnect)
//                 .build();
// 
//         try{
//             sendMessage(disconnectRequest);
//         }
//         catch (Exception x){
//             // ignored
//         }
//         CloseSocket();
//     }
// 
//         private ControllerStateResponse sendMessage(ControllerStateRequest req) throws TimeoutException {
//         return SendMessage(req, ControllerStateResponse.parser());
//     }
// }
// 
// Path: src/java/VRE.Vridge.API/VRE.Vridge.API.Client/src/main/java/com/riftcat/vridge/api/client/java/utils/ButtonMask.java
// public class ButtonMask{
//     private static int k_EButton_System = 0;
//     private static int k_EButton_ApplicationMenu = 1;
//     private static int k_EButton_Grip = 2;
//     private static int k_EButton_DPad_Left = 3;
//     private static int k_EButton_DPad_Up = 4;
//     private static int k_EButton_DPad_Right = 5;
//     private static int k_EButton_DPad_Down = 6;
//     private static int k_EButton_A = 7;
// 
//     private static int k_EButton_ProximitySensor = 31;
// 
//     private static int k_EButton_Axis0 = 32;
//     private static int k_EButton_Axis1 = 33;
//     private static int k_EButton_Axis2 = 34;
//     private static int k_EButton_Axis3 = 35;
//     private static int k_EButton_Axis4 = 36;
// 
//     // aliases for well known controllers
//     private static int k_EButton_SteamVR_Touchpad = k_EButton_Axis0;
//     private static int k_EButton_SteamVR_Trigger = k_EButton_Axis1;
//     private static int k_EButton_Dashboard_Back = k_EButton_Grip;
//     private static int k_EButton_Max = 64;
// 
//     public static long System = (1L << (int)k_EButton_System);
//     public static long ApplicationMenu = (1L << (int)k_EButton_ApplicationMenu);
//     public static long Grip = (1L << (int)k_EButton_Grip);
//     public static long Axis0 = (1L << (int)k_EButton_Axis0);
//     public static long Axis1 = (1L << (int)k_EButton_Axis1);
//     public static long Axis2 = (1L << (int)k_EButton_Axis2);
//     public static long Axis3 = (1L << (int)k_EButton_Axis3);
//     public static long Axis4 = (1L << (int)k_EButton_Axis4);
//     public static long Touchpad = (1L << (int)k_EButton_SteamVR_Touchpad);
//     public static long Trigger = (1L << (int)k_EButton_SteamVR_Trigger);
// }


import com.riftcat.vridge.api.client.java.proto.HandType;
import com.riftcat.vridge.api.client.java.proto.HeadRelation;
import com.riftcat.vridge.api.client.java.proto.VRController;
import com.riftcat.vridge.api.client.java.proto.VRControllerAxis_t;
import com.riftcat.vridge.api.client.java.proto.VRControllerState_t;
import com.riftcat.vridge.api.client.java.proto.VRControllerState_tOrBuilder;
import com.riftcat.vridge.api.client.java.proxy.ControllerProxy;
import com.riftcat.vridge.api.client.java.utils.ButtonMask;
import java.util.concurrent.TimeoutException;
package com.riftcat.vridge.api.client.java.remotes;



public class ControllerRemote extends RemoteBase {

    private static int packetNum = 0;
// Path: src/java/VRE.Vridge.API/VRE.Vridge.API.Client/src/main/java/com/riftcat/vridge/api/client/java/proxy/ControllerProxy.java
// public class ControllerProxy extends ClientProxyBase {
// 
//     private int packetNum = 0;
// 
//     public ControllerProxy(String endpointAddress){
//         super(endpointAddress, true);
//     }
// 
//     /// <summary>
//     /// Send full single VR controller state to VR.
//     /// </summary>
//     public synchronized void sendControllerState(VRController state) throws TimeoutException {
//         ControllerStateRequest data = ControllerStateRequest
//                 .newBuilder()
//                 .setTaskType(ControllerStateRequestCodes.SendFullState)
//                 .setControllerState(state)
//                 .build();
// 
//         sendMessage(data);
//     }
// 
//     /**
//      * Send full single VR controller state to VR.
//      */
//     public synchronized void sendControllerState(int controllerId, long touchedMask, long pressedMask,
//                                                  List<Float> orientationMatrix,
//                                                  float triggerValue,
//                                                  float analogX, float analogY, float[] velocity,
//                                                  HandType hand) throws TimeoutException {
// 
//         VRControllerState_t.Builder buttonState = VRControllerState_t.newBuilder()
//                 .setRAxis0(VRControllerAxis_t.newBuilder()
//                         .setX(analogX)
//                         .setY(analogY))
//                 .setRAxis1(VRControllerAxis_t.newBuilder()
//                         .setX(triggerValue))
//                 .setUlButtonPressed(pressedMask)
//                 .setUlButtonTouched(touchedMask)
//                 .setUnPacketNum(++packetNum);
// 
// 
// 
//         VRController.Builder controllerState = VRController.newBuilder()
//                 .setControllerId(controllerId)
//                 .addAllOrientationMatrix(orientationMatrix)
//                 .setStatus(0)
//                 .setSuggestedHand(hand)
//                 .setButtonState(buttonState);
// 
//         if(velocity != null){
//             controllerState
//                     .addVelocity(velocity[0])
//                     .addVelocity(velocity[1])
//                     .addVelocity(velocity[2]);
//         }
// 
//         ControllerStateRequest request = ControllerStateRequest.newBuilder()
//                 .setTaskType(ControllerStateRequestCodes.SendFullState)
//                 .setControllerState(controllerState)
//                 .build();
// 
//         sendMessage(request);
//     }
// 
//     /** Recenter head tracking. Works the same as pressing recenter hotkey as configured in VRidge settings. */
//     public void recenterHead() throws TimeoutException{
//         ControllerStateRequest request = ControllerStateRequest
//                 .newBuilder()
//                 .setVersion(CurrentVersion)
//                 .setTaskType(ControllerStateRequestCodes.RecenterHead)
//                 .build();
//         sendMessage(request);
//     }
// 
//     /**
//      * Disconnected from controller API and frees the API for other clients.
//      */
//     public void disconnect(){
//         ControllerStateRequest disconnectRequest = ControllerStateRequest
//                 .newBuilder()
//                 .setVersion(CurrentVersion)
//                 .setTaskType(ControllerStateRequestCodes.Disconnect)
//                 .build();
// 
//         try{
//             sendMessage(disconnectRequest);
//         }
//         catch (Exception x){
//             // ignored
//         }
//         CloseSocket();
//     }
// 
//         private ControllerStateResponse sendMessage(ControllerStateRequest req) throws TimeoutException {
//         return SendMessage(req, ControllerStateResponse.parser());
//     }
// }
// 
// Path: src/java/VRE.Vridge.API/VRE.Vridge.API.Client/src/main/java/com/riftcat/vridge/api/client/java/utils/ButtonMask.java
// public class ButtonMask{
//     private static int k_EButton_System = 0;
//     private static int k_EButton_ApplicationMenu = 1;
//     private static int k_EButton_Grip = 2;
//     private static int k_EButton_DPad_Left = 3;
//     private static int k_EButton_DPad_Up = 4;
//     private static int k_EButton_DPad_Right = 5;
//     private static int k_EButton_DPad_Down = 6;
//     private static int k_EButton_A = 7;
// 
//     private static int k_EButton_ProximitySensor = 31;
// 
//     private static int k_EButton_Axis0 = 32;
//     private static int k_EButton_Axis1 = 33;
//     private static int k_EButton_Axis2 = 34;
//     private static int k_EButton_Axis3 = 35;
//     private static int k_EButton_Axis4 = 36;
// 
//     // aliases for well known controllers
//     private static int k_EButton_SteamVR_Touchpad = k_EButton_Axis0;
//     private static int k_EButton_SteamVR_Trigger = k_EButton_Axis1;
//     private static int k_EButton_Dashboard_Back = k_EButton_Grip;
//     private static int k_EButton_Max = 64;
// 
//     public static long System = (1L << (int)k_EButton_System);
//     public static long ApplicationMenu = (1L << (int)k_EButton_ApplicationMenu);
//     public static long Grip = (1L << (int)k_EButton_Grip);
//     public static long Axis0 = (1L << (int)k_EButton_Axis0);
//     public static long Axis1 = (1L << (int)k_EButton_Axis1);
//     public static long Axis2 = (1L << (int)k_EButton_Axis2);
//     public static long Axis3 = (1L << (int)k_EButton_Axis3);
//     public static long Axis4 = (1L << (int)k_EButton_Axis4);
//     public static long Touchpad = (1L << (int)k_EButton_SteamVR_Touchpad);
//     public static long Trigger = (1L << (int)k_EButton_SteamVR_Trigger);
// }


// Path: src/java/VRE.Vridge.API/VRE.Vridge.API.Client/src/main/java/com/riftcat/vridge/api/client/java/remotes/ControllerRemote.java
import com.riftcat.vridge.api.client.java.proto.HandType;
import com.riftcat.vridge.api.client.java.proto.HeadRelation;
import com.riftcat.vridge.api.client.java.proto.VRController;
import com.riftcat.vridge.api.client.java.proto.VRControllerAxis_t;
import com.riftcat.vridge.api.client.java.proto.VRControllerState_t;
import com.riftcat.vridge.api.client.java.proto.VRControllerState_tOrBuilder;
import com.riftcat.vridge.api.client.java.proxy.ControllerProxy;
import com.riftcat.vridge.api.client.java.utils.ButtonMask;
import java.util.concurrent.TimeoutException;

package com.riftcat.vridge.api.client.java.remotes;



public class ControllerRemote extends RemoteBase {

    private static int packetNum = 0;
    private ControllerProxy proxy;