Example #1
0
        public ControllerConnectionState GetConnectionState(int controllerIndex)
        {
            ControllerConnectionState state = ControllerConnectionState.CONTROLLER_CONNECTION_STATE_NOT_INITIALIZED;

            NativeApi.NRControllerStateGetConnectionState(m_StateHandles[controllerIndex], ref state);
            return(state);
        }
        public ControllerConnectionState GetConnectionState(int controllerIndex)
        {
            // ControllerConnectionState state = ControllerConnectionState.CONTROLLER_CONNECTION_STATE_NOT_INITIALIZED;
            ControllerConnectionState state = ControllerConnectionState.CONTROLLER_CONNECTION_STATE_CONNECTED;

            return(state);
        }
 public void Reset()
 {
     controllerType   = ControllerType.CONTROLLER_TYPE_UNKNOWN;
     connectionState  = ControllerConnectionState.CONTROLLER_CONNECTION_STATE_NOT_INITIALIZED;
     rotation         = Quaternion.identity;
     position         = Vector3.zero;
     gyro             = Vector3.zero;
     accel            = Vector3.zero;
     mag              = Vector3.zero;
     touchPos         = Vector2.zero;
     isTouching       = false;
     recentered       = false;
     buttonsState     = 0;
     buttonsDown      = 0;
     buttonsUp        = 0;
     isCharging       = false;
     batteryLevel     = 0;
     availableFeature = 0;
 }
        private static NetworkHealthReport GetHealthReportAfterConnectionStateChanged(ControllerConnectionState state,
            [NotNull] NetworkHealthReport previous)
        {
            previous = previous.ChangeIsConnected(state == ControllerConnectionState.Connected);

            if (previous.HasProtocolVersionMismatch)
            {
                if (state == ControllerConnectionState.Connected)
                {
                    previous = previous.ChangeHasProtocolVersionMismatch(false);
                }
            }
            else
            {
                if (state == ControllerConnectionState.ProtocolVersionMismatch)
                {
                    previous = previous.ChangeHasProtocolVersionMismatch(true);
                }
            }

            return previous;
        }
Example #5
0
 public static extern NativeResult NRControllerStateGetConnectionState(UInt64 controller_state_handle, ref ControllerConnectionState out_controller_connection_state);
Example #6
0
 public ControllerConnectionStateEventArgs(ControllerConnectionState state, string?comPort)
 {
     State   = state;
     ComPort = comPort;
 }
 private void OnStateChanged(ControllerConnectionState connectionState, [CanBeNull] string comPort)
 {
     Log.Debug($"Raising state change event with state={connectionState}, port={comPort}.");
     StateChanged?.Invoke(this, new ControllerConnectionStateEventArgs(connectionState, comPort));
 }
 public void HandleConnectionStateChanged(ControllerConnectionState state)
 {
     ExclusiveUpdateWithRaiseEvent(false, previous => GetHealthReportAfterConnectionStateChanged(state, previous));
 }
 public ControllerConnectionStateEventArgs(ControllerConnectionState state, [CanBeNull] string comPort)
 {
     State = state;
     ComPort = comPort;
 }