예제 #1
0
        public bool SendReport(PSVRReport Report)
        {
            var data = Report.Serialize();
            int len;

            return(writer.Write(data, 1000, out len) == LibUsbDotNet.Main.ErrorCode.None);
        }
예제 #2
0
        public static PSVRReport GetReadDeviceInfo()
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = 0x81;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 8;
            cmd.Data       = new byte[] { 0x80, 0, 0, 0, 0, 0, 0, 0 };

            return(cmd);
        }
예제 #3
0
        public static PSVRReport GetSetHDMLeds(LedMask Mask, byte ValueA, byte ValueB, byte ValueC, byte ValueD, byte ValueE, byte ValueF, byte ValueG, byte ValueH, byte ValueI)
        {
            ushort     mMask = (ushort)Mask;
            PSVRReport cmd   = new PSVRReport();

            cmd.ReportID   = 0x15;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 16;
            cmd.Data       = new byte[] { (byte)(mMask & 0xFF), (byte)((mMask >> 8) & 0xFF), ValueA, ValueB, ValueC, ValueD, ValueE, ValueF, ValueG, ValueH, ValueI, 0, 0, 0, 0, 0 };
            return(cmd);
        }
예제 #4
0
        public static PSVRReport GetSetHDMLed(LedMask Mask, byte Value)
        {
            ushort     mMask = (ushort)Mask;
            PSVRReport cmd   = new PSVRReport();

            cmd.ReportID   = 0x15;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 16;
            cmd.Data       = new byte[] { (byte)(mMask & 0xFF), (byte)((mMask >> 8) & 0xFF), Value, Value, Value, Value, Value, Value, Value, Value, Value, 0, 0, 0, 0, 0 };
            return(cmd);
        }
예제 #5
0
        public static PSVRReport GetSetCinematicConfiguration(byte Mask, byte ScreenDistance, byte ScreenSize, byte IPD, byte Brightness, byte MicVolume, bool UnknownVRSetting)
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = 0x21;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 16;
            cmd.Data       = new byte[] { Mask, ScreenSize, ScreenDistance, IPD, 0, 0, 0, 0, 0, 0, Brightness, MicVolume, 0, 0, (byte)(UnknownVRSetting ? 0 : 1), 0 };

            return(cmd);
        }
예제 #6
0
        public static PSVRReport GetBoxOff()
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = 0x13;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 4;
            cmd.Data       = BitConverter.GetBytes(0x00000001);

            return(cmd);
        }
예제 #7
0
        public static PSVRReport GetOff(byte id)
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = id;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 4;
            cmd.Data       = BitConverter.GetBytes(0x00000000);

            return(cmd);
        }
예제 #8
0
        public static PSVRReport GetExitVRMode()
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = 0x23;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 4;
            cmd.Data       = BitConverter.GetBytes(0x00000000);

            return(cmd);
        }
예제 #9
0
        public static PSVRReport ParseResponse(byte[] Data, int Offset, out int BytesConsumed)
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID      = Data[Offset];
            cmd.CommandStatus = Data[Offset + 1];
            cmd.DataStart     = Data[Offset + 2];
            cmd.DataLength    = Data[Offset + 3];
            cmd.Data          = new byte[cmd.DataLength];
            Buffer.BlockCopy(Data, Offset + 4, cmd.Data, 0, cmd.DataLength);
            BytesConsumed = cmd.DataLength + 4;
            return(cmd);
        }
예제 #10
0
        public static PSVRReport GetEnableVRTrackingTest(byte value)
        {
            PSVRReport cmd = new PSVRReport();

            cmd.ReportID   = 0x11;
            cmd.DataStart  = 0xaa;
            cmd.DataLength = 8;
            byte[] data = new byte[8];
            byte[] tmp  = new byte[] { value, 0x00, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF };
            Buffer.BlockCopy(tmp, 0, data, 0, 8);
            tmp = BitConverter.GetBytes(0x00000000);
            Buffer.BlockCopy(tmp, 0, data, 4, 4);
            cmd.Data = data;

            return(cmd);
        }
예제 #11
0
        private void CmdReader_DataReceived(object sender, LibUsbDotNet.Main.EndpointDataEventArgs e)
        {
            int pos = 0;

            while (pos < e.Count)
            {
                int consumed;

                PSVRReport msg = PSVRReport.ParseResponse(e.Buffer, pos, out consumed);
                if (INReport != null)
                {
                    INReport(this, new PSVRINEventArgs {
                        Response = msg
                    });
                }

                pos += consumed;
            }
        }