Beispiel #1
0
		public DS4Device(HidDevice hidDevice)
		{
			HidDevice = hidDevice;
			ConnectionType = HidConnectionType(HidDevice);
			MacAddress = HidDevice.ReadSerial();
			if (ConnectionType == ConnectionType.USB)
			{
				inputReport = new byte[64];
				outputReport = new byte[HidDevice.Capabilities.OutputReportByteLength];
				outputReportBuffer = new byte[HidDevice.Capabilities.OutputReportByteLength];
			}
			else
			{
				btInputReport = new byte[BT_INPUT_REPORT_LENGTH];
				inputReport = new byte[btInputReport.Length - 2];
				outputReport = new byte[BT_OUTPUT_REPORT_LENGTH];
				outputReportBuffer = new byte[BT_OUTPUT_REPORT_LENGTH];
			}
			Touchpad = new DS4Touchpad();
			SixAxis = new DS4SixAxis();
		}
Beispiel #2
0
		public static ConnectionType HidConnectionType(HidDevice hidDevice)
		{
			return hidDevice.Capabilities.InputReportByteLength == 64 ? ConnectionType.USB : ConnectionType.BT;
		}