diff --git a/README.md b/README.md index 5cbbb18..3b84e92 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,133 @@ -# WiimoteLib -A library for using a Nintendo Wii Remote (Wiimote) from .NET. +# Managed Library for Nintendo's Wiimote v1.7.0.0 +**by [Brian Peek](http://www.brianpeek.com/)** + +For more information, please visit the associated article for this project at +[Coding4Fun](http://msdn.microsoft.com/coding4fun/hardware/article.aspx?articleid=1879033). There you will find documentation on how all of this works. If all else fails, please contact me at the address above. Enjoy! + +## Changes + +v1.7.0.0 +-------- + o Writing registers is now properly waiting for the Wiimote to reply + before continuing...this removes all of the Thread.Sleep() calls and + should *greatly* improve performance when setting LEDs and rumble + (Serial Nightmare & wwibrew.org) + o Guitar Hero: World Tour Guitar and Drums now properly recognized and + used (wiibrew.org, tested by Tyler Tolley and Mauro Milazzo) + o Guitar whammy bar is now a 5-bit value instead of 4 (wiibrew.org) + o Position of 4 IRs now properly reported in Basic reporting mode + (Dan Carter) + o Found1/2 now properly reported in MSRS (reported by akka243) + o MSRS project updated to Microsoft Robotics Developer Studio 2008 + +v1.6.0.0 +-------- + o Added "center of gravity" calculation to the Wii Fit Balance Board + (thanks to Steven Battersby) + o Structs are now marked [Serializable] (suggested by Caio) + o Battery property is now a float containing the calculated percentage + of battery remaining + o BatteryRaw is the byte value that used to be stored in the Battery + property + o WiimoteTest app now reads extensions properly when inserted at startup + o Exposed HID device path in new HIDDevicePath property on Wiimote object + o Changed the time delay on writes to 50ms from 100ms...this should + improve responsiveness of setting LEDs and rumble + +v1.5.2.0 +-------- + o Ok, Balance Board support is *really* fixed this time + (thanks to Manuel Schroeder, Eduard Kujit and Alex Wilkinson for testing) + o LED checkboxes are properly set on the WiimoteTest tabs + +v1.5.1.0 +-------- + o Oops...a last minute change broke the one thing I was adding: Balance + Board support. Should be working now...(identified by Manuel Schroeder) + +v1.5.0.0 +-------- + o Wii Fit Balance Board support + o The GetStatus() method now waits for a response from the Wiimote before + continuing + o Bug fix for ButtonsExtension report type (0x34) + +v1.4.0.0 +-------- + o Multiple Wiimotes supported! + o Slight change to ExtensionType enum for better extension detection + o Decided I didn't like the dependency on System.Drawing for the 2D point + so am now using my own Point structs. Sorry... + o WiimoteTest app updated to show multiple Wiimotes working + +v1.3.0.0 +-------- + o SetReportType contains an overload taking a new IRSensitivity parameter + which will set the IR camera sensitivity when using an IR report type + o Created new WiimoteException type which is now thrown by the library + o Moved InputReport enum to namespace level + o Events now using the generic EventHandler class instead of custom + delegates + o Refactored the state structures to use Point/PointF and my own + Point3/Point3F + o Refactored IR sensors to be an array + o Added support for the Guitar Hero controller + (tested by Matthias Shapiro, Evan Jacovier) + o Test app will run without Wiimote connected (Andrea Leganza) + o ReadData now returns the proper amount of data for requests of more than + 16 bytes (reported by David Hawley) + o Test application updated with above changes + o Lots of breaking changes, but the survey on my site said most didn't care + about backwards compatibility... :) + +v1.2.1.0 +-------- + o Added support for IR 3 and 4 (Johnny Lee) + +v1.2.0.0 +-------- + o Moved to CodePlex! (http://www.codeplex.com/WiimoteLib) + o New license! Please read the included license.txt/copyright.txt for more + info. This likely doesn't change anything for anyone, but at least now + it's official. + o AltWriteMethod deprecated. Connect will now determine which write method + to use at runtime. It remains in case someone needs to override the + write method for some reason. (gl.tter) + o WiimoteState.LEDState is now filled with proper values. + (identified by gl.tter/Leif902) + o Extensions that are attached at startup are now recognized properly. + (identified by Will Pressly) + o "Partially inserted" extensions now handled properly (Michael Dorman) + o SetRumble method now does this via the SetLEDs method instead of using the + status report to avoid a needless response from the Wiimote. (Michael Dorman) + o IRState now contains RawMidX/Y and MidX/Y containing the value of the + midpoint between the IR points. + o Async reads now begin after the data parsing and event has been raised. + This should lead to non-overlapping events. + o Updated the test application with the above changes and cleaned up the UI + updates by using delegates a bit more effeciently. + + Breaking Changes (may not be a complete list) + ---------------------------------------------- + o LEDs renamed to LEDState + o GetBatteryLevel renamed to GetStatus + o OnWiimoteChanged renamed to WiimoteChanged + o OnWiimoteExtensionChanged renamed to WiimoteExtensionChanged + o CalibrationInfo renamed to AccelCalibrationInfo + o Event handlers renamed to WiimoteChangedEventHandler and + WiimoteExtensionChangedEventHandler + +v1.1.0.0 +-------- + o Support for XP and Vista x64 (Paul Miller) + o VB fix in ParseExtension (Evan Merz) + o New "AltWriteMethod" property which will try a secondary approach to writing + to the Wiimote. If you get an error when connecting, set this property and + try again to see if it fixes the issue. + o Microsoft Robotics Studio project + Open the WiimoteMSRS directory and start the Wiimote.sln solution to take a + look! (David Lee) + +v1.0.1.0 +-------- + o Calibration copy/paste error (James Darpinian) \ No newline at end of file diff --git a/WiimoteCS/Wiimote.sln b/WiimoteCS/Wiimote.sln new file mode 100644 index 0000000..3b33886 --- /dev/null +++ b/WiimoteCS/Wiimote.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WiimoteTest", "WiimoteTest\WiimoteTest.csproj", "{48223EAB-B2E0-4A64-9074-4444662EB693}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WiimoteLib", "WiimoteLib\WiimoteLib.csproj", "{37A555DF-7012-4B99-8A47-1C922A361E52}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {48223EAB-B2E0-4A64-9074-4444662EB693}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Release|Any CPU.Build.0 = Release|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WiimoteCS/WiimoteLib/DataTypes.cs b/WiimoteCS/WiimoteLib/DataTypes.cs new file mode 100644 index 0000000..4155356 --- /dev/null +++ b/WiimoteCS/WiimoteLib/DataTypes.cs @@ -0,0 +1,907 @@ +////////////////////////////////////////////////////////////////////////////////// +// DataTypes.cs +// Managed Wiimote Library +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; + +// if we're building the MSRS version, we need to bring in the MSRS Attributes +// if we're not doing the MSRS build then define some fake attribute classes for DataMember/DataContract +#if MSRS + using Microsoft.Dss.Core.Attributes; +#else + sealed class DataContract : Attribute + { + } + + sealed class DataMember: Attribute + { + } +#endif + +namespace WiimoteLib +{ +#if MSRS + [DataContract] + public struct RumbleRequest + { + [DataMember] + public bool Rumble; + } +#endif + + /// + /// Point structure for floating point 2D positions (X, Y) + /// + [Serializable] + [DataContract] + public struct PointF + { + /// + /// X, Y coordinates of this point + /// + [DataMember] + public float X, Y; + + /// + /// Convert to human-readable string + /// + /// A string that represents the point + public override string ToString() + { + return string.Format("{{X={0}, Y={1}}}", X, Y); + } + + } + + /// + /// Point structure for int 2D positions (X, Y) + /// + [Serializable] + [DataContract] + public struct Point + { + /// + /// X, Y coordinates of this point + /// + [DataMember] + public int X, Y; + + /// + /// Convert to human-readable string + /// + /// A string that represents the point. + public override string ToString() + { + return string.Format("{{X={0}, Y={1}}}", X, Y); + } + } + + /// + /// Point structure for floating point 3D positions (X, Y, Z) + /// + [Serializable] + [DataContract] + public struct Point3F + { + /// + /// X, Y, Z coordinates of this point + /// + [DataMember] + public float X, Y, Z; + + /// + /// Convert to human-readable string + /// + /// A string that represents the point + public override string ToString() + { + return string.Format("{{X={0}, Y={1}, Z={2}}}", X, Y, Z); + } + + } + + /// + /// Point structure for int 3D positions (X, Y, Z) + /// + [Serializable] + [DataContract] + public struct Point3 + { + /// + /// X, Y, Z coordinates of this point + /// + [DataMember] + public int X, Y, Z; + + /// + /// Convert to human-readable string + /// + /// A string that represents the point. + public override string ToString() + { + return string.Format("{{X={0}, Y={1}, Z={2}}}", X, Y, Z); + } + } + + /// + /// Current overall state of the Wiimote and all attachments + /// + [Serializable] + [DataContract] + public class WiimoteState + { + /// + /// Current calibration information + /// + [DataMember] + public AccelCalibrationInfo AccelCalibrationInfo; + /// + /// Current state of accelerometers + /// + [DataMember] + public AccelState AccelState; + /// + /// Current state of buttons + /// + [DataMember] + public ButtonState ButtonState; + /// + /// Current state of IR sensors + /// + [DataMember] + public IRState IRState; + /// + /// Raw byte value of current battery level + /// + [DataMember] + public byte BatteryRaw; + /// + /// Calculated current battery level + /// + [DataMember] + public float Battery; + /// + /// Current state of rumble + /// + [DataMember] + public bool Rumble; + /// + /// Is an extension controller inserted? + /// + [DataMember] + public bool Extension; + /// + /// Extension controller currently inserted, if any + /// + [DataMember] + public ExtensionType ExtensionType; + /// + /// Current state of Nunchuk extension + /// + [DataMember] + public NunchukState NunchukState; + /// + /// Current state of Classic Controller extension + /// + [DataMember] + public ClassicControllerState ClassicControllerState; + /// + /// Current state of Guitar extension + /// + [DataMember] + public GuitarState GuitarState; + /// + /// Current state of Drums extension + /// + [DataMember] + public DrumsState DrumsState; + /// + /// Current state of the Wii Fit Balance Board + /// + public BalanceBoardState BalanceBoardState; + /// + /// Current state of LEDs + /// + [DataMember] + public LEDState LEDState; + + /// + /// Constructor for WiimoteState class + /// + public WiimoteState() + { + IRState.IRSensors = new IRSensor[4]; + } + } + + /// + /// Current state of LEDs + /// + [Serializable] + [DataContract] + public struct LEDState + { + /// + /// LED on the Wiimote + /// + [DataMember] + public bool LED1, LED2, LED3, LED4; + } + + /// + /// Calibration information stored on the Nunchuk + /// + [Serializable] + [DataContract] + public struct NunchukCalibrationInfo + { + /// + /// Accelerometer calibration data + /// + public AccelCalibrationInfo AccelCalibration; + /// + /// Joystick X-axis calibration + /// + [DataMember] + public byte MinX, MidX, MaxX; + /// + /// Joystick Y-axis calibration + /// + [DataMember] + public byte MinY, MidY, MaxY; + } + + /// + /// Calibration information stored on the Classic Controller + /// + [Serializable] + [DataContract] + public struct ClassicControllerCalibrationInfo + { + /// + /// Left joystick X-axis + /// + [DataMember] + public byte MinXL, MidXL, MaxXL; + /// + /// Left joystick Y-axis + /// + [DataMember] + public byte MinYL, MidYL, MaxYL; + /// + /// Right joystick X-axis + /// + [DataMember] + public byte MinXR, MidXR, MaxXR; + /// + /// Right joystick Y-axis + /// + [DataMember] + public byte MinYR, MidYR, MaxYR; + /// + /// Left analog trigger + /// + [DataMember] + public byte MinTriggerL, MaxTriggerL; + /// + /// Right analog trigger + /// + [DataMember] + public byte MinTriggerR, MaxTriggerR; + } + + /// + /// Current state of the Nunchuk extension + /// + [Serializable] + [DataContract] + public struct NunchukState + { + /// + /// Calibration data for Nunchuk extension + /// + [DataMember] + public NunchukCalibrationInfo CalibrationInfo; + /// + /// State of accelerometers + /// + [DataMember] + public AccelState AccelState; + /// + /// Raw joystick position before normalization. Values range between 0 and 255. + /// + [DataMember] + public Point RawJoystick; + /// + /// Normalized joystick position. Values range between -0.5 and 0.5 + /// + [DataMember] + public PointF Joystick; + /// + /// Digital button on Nunchuk extension + /// + [DataMember] + public bool C, Z; + } + + /// + /// Curernt button state of the Classic Controller + /// + [Serializable] + [DataContract] + public struct ClassicControllerButtonState + { + /// + /// Digital button on the Classic Controller extension + /// + [DataMember] + public bool A, B, Plus, Home, Minus, Up, Down, Left, Right, X, Y, ZL, ZR; + /// + /// Analog trigger - false if released, true for any pressure applied + /// + [DataMember] + public bool TriggerL, TriggerR; + } + + /// + /// Current state of the Classic Controller + /// + [Serializable] + [DataContract] + public struct ClassicControllerState + { + /// + /// Calibration data for Classic Controller extension + /// + [DataMember] + public ClassicControllerCalibrationInfo CalibrationInfo; + /// + /// Current button state + /// + [DataMember] + public ClassicControllerButtonState ButtonState; + /// + /// Raw value of left joystick. Values range between 0 - 255. + /// + [DataMember] + public Point RawJoystickL; + /// + /// Raw value of right joystick. Values range between 0 - 255. + /// + [DataMember] + public Point RawJoystickR; + /// + /// Normalized value of left joystick. Values range between -0.5 - 0.5 + /// + [DataMember] + public PointF JoystickL; + /// + /// Normalized value of right joystick. Values range between -0.5 - 0.5 + /// + [DataMember] + public PointF JoystickR; + /// + /// Raw value of analog trigger. Values range between 0 - 255. + /// + [DataMember] + public byte RawTriggerL, RawTriggerR; + /// + /// Normalized value of analog trigger. Values range between 0.0 - 1.0. + /// + [DataMember] + public float TriggerL, TriggerR; + } + + /// + /// Current state of the Guitar controller + /// + [Serializable] + [DataContract] + public struct GuitarState + { + /// + /// Guitar type + /// + [DataMember] + public GuitarType GuitarType; + /// + /// Current button state of the Guitar + /// + [DataMember] + public GuitarButtonState ButtonState; + /// + /// Current fret button state of the Guitar + /// + [DataMember] + public GuitarFretButtonState FretButtonState; + /// + /// Current touchbar state of the Guitar + /// + [DataMember] + public GuitarFretButtonState TouchbarState; + /// + /// Raw joystick position. Values range between 0 - 63. + /// + [DataMember] + public Point RawJoystick; + /// + /// Normalized value of joystick position. Values range between 0.0 - 1.0. + /// + [DataMember] + public PointF Joystick; + /// + /// Raw whammy bar position. Values range between 0 - 10. + /// + [DataMember] + public byte RawWhammyBar; + /// + /// Normalized value of whammy bar position. Values range between 0.0 - 1.0. + /// + [DataMember] + public float WhammyBar; + } + + /// + /// Current fret button state of the Guitar controller + /// + [Serializable] + [DataContract] + public struct GuitarFretButtonState + { + /// + /// Fret buttons + /// + [DataMember] + public bool Green, Red, Yellow, Blue, Orange; + } + + + /// + /// Current button state of the Guitar controller + /// + [Serializable] + [DataContract] + public struct GuitarButtonState + { + /// + /// Strum bar + /// + [DataMember] + public bool StrumUp, StrumDown; + /// + /// Other buttons + /// + [DataMember] + public bool Minus, Plus; + } + + /// + /// Current state of the Drums controller + /// + [Serializable] + [DataContract] + public struct DrumsState + { + /// + /// Drum pads + /// + public bool Red, Green, Blue, Orange, Yellow, Pedal; + /// + /// Speed at which the pad is hit. Values range from 0 (very hard) to 6 (very soft) + /// + public int RedVelocity, GreenVelocity, BlueVelocity, OrangeVelocity, YellowVelocity, PedalVelocity; + /// + /// Other buttons + /// + public bool Plus, Minus; + /// + /// Raw value of analong joystick. Values range from 0 - 15 + /// + public Point RawJoystick; + /// + /// Normalized value of analog joystick. Values range from 0.0 - 1.0 + /// + public PointF Joystick; + } + + /// + /// Current state of the Wii Fit Balance Board controller + /// + [Serializable] + [DataContract] + public struct BalanceBoardState + { + /// + /// Calibration information for the Balance Board + /// + [DataMember] + public BalanceBoardCalibrationInfo CalibrationInfo; + /// + /// Raw values of each sensor + /// + [DataMember] + public BalanceBoardSensors SensorValuesRaw; + /// + /// Kilograms per sensor + /// + [DataMember] + public BalanceBoardSensorsF SensorValuesKg; + /// + /// Pounds per sensor + /// + [DataMember] + public BalanceBoardSensorsF SensorValuesLb; + /// + /// Total kilograms on the Balance Board + /// + [DataMember] + public float WeightKg; + /// + /// Total pounds on the Balance Board + /// + [DataMember] + public float WeightLb; + /// + /// Center of gravity of Balance Board user + /// + [DataMember] + public PointF CenterOfGravity; + } + + /// + /// Calibration information + /// + [Serializable] + [DataContract] + public struct BalanceBoardCalibrationInfo + { + /// + /// Calibration information at 0kg + /// + [DataMember] + public BalanceBoardSensors Kg0; + /// + /// Calibration information at 17kg + /// + [DataMember] + public BalanceBoardSensors Kg17; + /// + /// Calibration information at 34kg + /// + [DataMember] + public BalanceBoardSensors Kg34; + } + + /// + /// The 4 sensors on the Balance Board (short values) + /// + [Serializable] + [DataContract] + public struct BalanceBoardSensors + { + /// + /// Sensor at top right + /// + [DataMember] + public short TopRight; + /// + /// Sensor at top left + /// + [DataMember] + public short TopLeft; + /// + /// Sensor at bottom right + /// + [DataMember] + public short BottomRight; + /// + /// Sensor at bottom left + /// + [DataMember] + public short BottomLeft; + } + + /// + /// The 4 sensors on the Balance Board (float values) + /// + [Serializable] + [DataContract] + public struct BalanceBoardSensorsF + { + /// + /// Sensor at top right + /// + [DataMember] + public float TopRight; + /// + /// Sensor at top left + /// + [DataMember] + public float TopLeft; + /// + /// Sensor at bottom right + /// + [DataMember] + public float BottomRight; + /// + /// Sensor at bottom left + /// + [DataMember] + public float BottomLeft; + } + + /// + /// Current state of a single IR sensor + /// + [Serializable] + [DataContract] + public struct IRSensor + { + /// + /// Raw values of individual sensor. Values range between 0 - 1023 on the X axis and 0 - 767 on the Y axis. + /// + [DataMember] + public Point RawPosition; + /// + /// Normalized values of the sensor position. Values range between 0.0 - 1.0. + /// + [DataMember] + public PointF Position; + /// + /// Size of IR Sensor. Values range from 0 - 15 + /// + [DataMember] + public int Size; + /// + /// IR sensor seen + /// + [DataMember] + public bool Found; + /// + /// Convert to human-readable string + /// + /// A string that represents the point. + public override string ToString() + { + return string.Format("{{{0}, Size={1}, Found={2}}}", Position, Size, Found); + } + } + + /// + /// Current state of the IR camera + /// + [Serializable] + [DataContract] + public struct IRState + { + /// + /// Current mode of IR sensor data + /// + [DataMember] + public IRMode Mode; + /// + /// Current state of IR sensors + /// + [DataMember] + public IRSensor[] IRSensors; + /// + /// Raw midpoint of IR sensors 1 and 2 only. Values range between 0 - 1023, 0 - 767 + /// + [DataMember] + public Point RawMidpoint; + /// + /// Normalized midpoint of IR sensors 1 and 2 only. Values range between 0.0 - 1.0 + /// + [DataMember] + public PointF Midpoint; + } + + /// + /// Current state of the accelerometers + /// + [Serializable] + [DataContract] + public struct AccelState + { + /// + /// Raw accelerometer data. + /// Values range between 0 - 255 + /// + [DataMember] + public Point3 RawValues; + /// + /// Normalized accelerometer data. Values range between 0 - ?, but values > 3 and < -3 are inaccurate. + /// + [DataMember] + public Point3F Values; + } + + /// + /// Accelerometer calibration information + /// + [Serializable] + [DataContract] + public struct AccelCalibrationInfo + { + /// + /// Zero point of accelerometer + /// + [DataMember] + public byte X0, Y0, Z0; + /// + /// Gravity at rest of accelerometer + /// + [DataMember] + public byte XG, YG, ZG; + } + + /// + /// Current button state + /// + [Serializable] + [DataContract] + public struct ButtonState + { + /// + /// Digital button on the Wiimote + /// + [DataMember] + public bool A, B, Plus, Home, Minus, One, Two, Up, Down, Left, Right; + } + + /// + /// The extension plugged into the Wiimote + /// + [DataContract] + public enum ExtensionType : long + { + /// + /// No extension + /// + None = 0x000000000000, + /// + /// Nunchuk extension + /// + Nunchuk = 0x0000a4200000, + /// + /// Classic Controller extension + /// + ClassicController = 0x0000a4200101, + /// + /// Guitar controller from Guitar Hero 3/WorldTour + /// + Guitar = 0x0000a4200103, + /// + /// Drum controller from Guitar Hero: World Tour + /// + Drums = 0x0100a4200103, + /// + /// Wii Fit Balance Board controller + /// + BalanceBoard = 0x0000a4200402, + /// + /// Partially inserted extension. This is an error condition. + /// + ParitallyInserted = 0xffffffffffff + }; + + /// + /// The mode of data reported for the IR sensor + /// + [DataContract] + public enum IRMode : byte + { + /// + /// IR sensor off + /// + Off = 0x00, + /// + /// Basic mode + /// + Basic = 0x01, // 10 bytes + /// + /// Extended mode + /// + Extended = 0x03, // 12 bytes + /// + /// Full mode (unsupported) + /// + Full = 0x05, // 16 bytes * 2 (format unknown) + }; + + /// + /// The report format in which the Wiimote should return data + /// + public enum InputReport : byte + { + /// + /// Status report + /// + Status = 0x20, + /// + /// Read data from memory location + /// + ReadData = 0x21, + /// + /// Register write complete + /// + OutputReportAck = 0x22, + /// + /// Button data only + /// + Buttons = 0x30, + /// + /// Button and accelerometer data + /// + ButtonsAccel = 0x31, + /// + /// IR sensor and accelerometer data + /// + IRAccel = 0x33, + /// + /// Button and extension controller data + /// + ButtonsExtension = 0x34, + /// + /// Extension and accelerometer data + /// + ExtensionAccel = 0x35, + /// + /// IR sensor, extension controller and accelerometer data + /// + IRExtensionAccel = 0x37, + }; + + /// + /// Sensitivity of the IR camera on the Wiimote + /// + + public enum IRSensitivity + { + /// + /// Equivalent to level 1 on the Wii console + /// + WiiLevel1, + /// + /// Equivalent to level 2 on the Wii console + /// + WiiLevel2, + /// + /// Equivalent to level 3 on the Wii console (default) + /// + WiiLevel3, + /// + /// Equivalent to level 4 on the Wii console + /// + WiiLevel4, + /// + /// Equivalent to level 5 on the Wii console + /// + WiiLevel5, + /// + /// Maximum sensitivity + /// + Maximum + } + + /// + /// Type of guitar extension: Guitar Hero 3 or Guitar Hero World Tour + /// + public enum GuitarType + { + /// + /// Guitar Hero 3 guitar controller + /// + GuitarHero3, + /// + /// Guitar Hero: World Tour guitar controller + /// + GuitarHeroWorldTour + } +} diff --git a/WiimoteCS/WiimoteLib/Events.cs b/WiimoteCS/WiimoteLib/Events.cs new file mode 100644 index 0000000..13e8648 --- /dev/null +++ b/WiimoteCS/WiimoteLib/Events.cs @@ -0,0 +1,60 @@ +////////////////////////////////////////////////////////////////////////////////// +// Events.cs +// Managed Wiimote Library +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; + +namespace WiimoteLib +{ + /// + /// Argument sent through the WiimoteExtensionChangedEvent + /// + public class WiimoteExtensionChangedEventArgs: EventArgs + { + /// + /// The extenstion type inserted or removed + /// + public ExtensionType ExtensionType; + /// + /// Whether the extension was inserted or removed + /// + public bool Inserted; + + /// + /// Constructor + /// + /// The extension type inserted or removed + /// Whether the extension was inserted or removed + public WiimoteExtensionChangedEventArgs(ExtensionType type, bool inserted) + { + ExtensionType = type; + Inserted = inserted; + } + } + + /// + /// Argument sent through the WiimoteChangedEvent + /// + public class WiimoteChangedEventArgs: EventArgs + { + /// + /// The current state of the Wiimote and extension controllers + /// + public WiimoteState WiimoteState; + + /// + /// Constructor + /// + /// Wiimote state + public WiimoteChangedEventArgs(WiimoteState ws) + { + WiimoteState = ws; + } + } +} diff --git a/WiimoteCS/WiimoteLib/HIDImports.cs b/WiimoteCS/WiimoteLib/HIDImports.cs new file mode 100644 index 0000000..a52f66d --- /dev/null +++ b/WiimoteCS/WiimoteLib/HIDImports.cs @@ -0,0 +1,165 @@ +////////////////////////////////////////////////////////////////////////////////// +// HIDImports.cs +// Managed Wiimote Library +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; +using System.Runtime.InteropServices; +using System.IO; +using Microsoft.Win32.SafeHandles; + +namespace WiimoteLib +{ + /// + /// Win32 import information for use with the Wiimote library + /// + internal class HIDImports + { + // + // Flags controlling what is included in the device information set built + // by SetupDiGetClassDevs + // + public const int DIGCF_DEFAULT = 0x00000001; // only valid with DIGCF_DEVICEINTERFACE + public const int DIGCF_PRESENT = 0x00000002; + public const int DIGCF_ALLCLASSES = 0x00000004; + public const int DIGCF_PROFILE = 0x00000008; + public const int DIGCF_DEVICEINTERFACE = 0x00000010; + + [Flags] + public enum EFileAttributes : uint + { + Readonly = 0x00000001, + Hidden = 0x00000002, + System = 0x00000004, + Directory = 0x00000010, + Archive = 0x00000020, + Device = 0x00000040, + Normal = 0x00000080, + Temporary = 0x00000100, + SparseFile = 0x00000200, + ReparsePoint = 0x00000400, + Compressed = 0x00000800, + Offline = 0x00001000, + NotContentIndexed= 0x00002000, + Encrypted = 0x00004000, + Write_Through = 0x80000000, + Overlapped = 0x40000000, + NoBuffering = 0x20000000, + RandomAccess = 0x10000000, + SequentialScan = 0x08000000, + DeleteOnClose = 0x04000000, + BackupSemantics = 0x02000000, + PosixSemantics = 0x01000000, + OpenReparsePoint = 0x00200000, + OpenNoRecall = 0x00100000, + FirstPipeInstance= 0x00080000 + } + + [StructLayout(LayoutKind.Sequential)] + public struct SP_DEVINFO_DATA + { + public uint cbSize; + public Guid ClassGuid; + public uint DevInst; + public IntPtr Reserved; + } + + [StructLayout(LayoutKind.Sequential)] + public struct SP_DEVICE_INTERFACE_DATA + { + public int cbSize; + public Guid InterfaceClassGuid; + public int Flags; + public IntPtr RESERVED; + } + + [StructLayout(LayoutKind.Sequential, Pack = 1)] + public struct SP_DEVICE_INTERFACE_DETAIL_DATA + { + public UInt32 cbSize; + [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] + public string DevicePath; + } + + [StructLayout(LayoutKind.Sequential)] + public struct HIDD_ATTRIBUTES + { + public int Size; + public short VendorID; + public short ProductID; + public short VersionNumber; + } + + [DllImport(@"hid.dll", CharSet=CharSet.Auto, SetLastError = true)] + public static extern void HidD_GetHidGuid(out Guid gHid); + + [DllImport("hid.dll")] + public static extern Boolean HidD_GetAttributes(IntPtr HidDeviceObject, ref HIDD_ATTRIBUTES Attributes); + + [DllImport("hid.dll")] + internal extern static bool HidD_SetOutputReport( + IntPtr HidDeviceObject, + byte[] lpReportBuffer, + uint ReportBufferLength); + + [DllImport(@"setupapi.dll", CharSet = CharSet.Auto, SetLastError = true)] + public static extern IntPtr SetupDiGetClassDevs( + ref Guid ClassGuid, + [MarshalAs(UnmanagedType.LPTStr)] string Enumerator, + IntPtr hwndParent, + UInt32 Flags + ); + + [DllImport(@"setupapi.dll", CharSet=CharSet.Auto, SetLastError = true)] + public static extern Boolean SetupDiEnumDeviceInterfaces( + IntPtr hDevInfo, + //ref SP_DEVINFO_DATA devInfo, + IntPtr devInvo, + ref Guid interfaceClassGuid, + Int32 memberIndex, + ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData + ); + + [DllImport(@"setupapi.dll", SetLastError = true)] + public static extern Boolean SetupDiGetDeviceInterfaceDetail( + IntPtr hDevInfo, + ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData, + IntPtr deviceInterfaceDetailData, + UInt32 deviceInterfaceDetailDataSize, + out UInt32 requiredSize, + IntPtr deviceInfoData + ); + + [DllImport(@"setupapi.dll", SetLastError = true)] + public static extern Boolean SetupDiGetDeviceInterfaceDetail( + IntPtr hDevInfo, + ref SP_DEVICE_INTERFACE_DATA deviceInterfaceData, + ref SP_DEVICE_INTERFACE_DETAIL_DATA deviceInterfaceDetailData, + UInt32 deviceInterfaceDetailDataSize, + out UInt32 requiredSize, + IntPtr deviceInfoData + ); + + [DllImport(@"setupapi.dll", CharSet=CharSet.Auto, SetLastError = true)] + public static extern UInt16 SetupDiDestroyDeviceInfoList( IntPtr hDevInfo ); + + [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Auto)] + public static extern SafeFileHandle CreateFile( + string fileName, + [MarshalAs(UnmanagedType.U4)] FileAccess fileAccess, + [MarshalAs(UnmanagedType.U4)] FileShare fileShare, + IntPtr securityAttributes, + [MarshalAs(UnmanagedType.U4)] FileMode creationDisposition, + [MarshalAs(UnmanagedType.U4)] EFileAttributes flags, + IntPtr template); + + [DllImport("kernel32.dll", SetLastError=true)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool CloseHandle(IntPtr hObject); + } +} diff --git a/WiimoteCS/WiimoteLib/Properties/AssemblyInfo.cs b/WiimoteCS/WiimoteLib/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..0f981c4 --- /dev/null +++ b/WiimoteCS/WiimoteLib/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WiimoteLib")] +[assembly: AssemblyDescription("Managed library for the Nintendo Wiimote")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyProduct("WiimoteLib")] +[assembly: AssemblyCopyright("Copyright © 2008 Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("195343f6-ec42-4531-9e84-389bbc1a09b5")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.7.0.0")] +[assembly: AssemblyFileVersion("1.7.0.0")] diff --git a/WiimoteCS/WiimoteLib/Wiimote.cs b/WiimoteCS/WiimoteLib/Wiimote.cs new file mode 100644 index 0000000..bb672d5 --- /dev/null +++ b/WiimoteCS/WiimoteLib/Wiimote.cs @@ -0,0 +1,1358 @@ +////////////////////////////////////////////////////////////////////////////////// +// Wiimote.cs +// Managed Wiimote Library +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; +using System.Runtime.InteropServices; +using System.Diagnostics; +using System.IO; +using System.Runtime.Serialization; +using Microsoft.Win32.SafeHandles; +using System.Threading; + +namespace WiimoteLib +{ + /// + /// Implementation of Wiimote + /// + public class Wiimote : IDisposable + { + /// + /// Event raised when Wiimote state is changed + /// + public event EventHandler WiimoteChanged; + + /// + /// Event raised when an extension is inserted or removed + /// + public event EventHandler WiimoteExtensionChanged; + + // VID = Nintendo, PID = Wiimote + private const int VID = 0x057e; + private const int PID = 0x0306; + + // sure, we could find this out the hard way using HID, but trust me, it's 22 + private const int REPORT_LENGTH = 22; + + // Wiimote output commands + private enum OutputReport : byte + { + LEDs = 0x11, + Type = 0x12, + IR = 0x13, + Status = 0x15, + WriteMemory = 0x16, + ReadMemory = 0x17, + IR2 = 0x1a, + }; + + // Wiimote registers + private const int REGISTER_IR = 0x04b00030; + private const int REGISTER_IR_SENSITIVITY_1 = 0x04b00000; + private const int REGISTER_IR_SENSITIVITY_2 = 0x04b0001a; + private const int REGISTER_IR_MODE = 0x04b00033; + + private const int REGISTER_EXTENSION_INIT_1 = 0x04a400f0; + private const int REGISTER_EXTENSION_INIT_2 = 0x04a400fb; + private const int REGISTER_EXTENSION_TYPE = 0x04a400fa; + private const int REGISTER_EXTENSION_CALIBRATION = 0x04a40020; + + // length between board sensors + private const int BSL = 43; + + // width between board sensors + private const int BSW = 24; + + // read/write handle to the device + private SafeFileHandle mHandle; + + // a pretty .NET stream to read/write from/to + private FileStream mStream; + + // report buffer + private readonly byte[] mBuff = new byte[REPORT_LENGTH]; + + // read data buffer + private byte[] mReadBuff; + + // address to read from + private int mAddress; + + // size of requested read + private short mSize; + + // current state of controller + private readonly WiimoteState mWiimoteState = new WiimoteState(); + + // event for read data processing + private readonly AutoResetEvent mReadDone = new AutoResetEvent(false); + private readonly AutoResetEvent mWriteDone = new AutoResetEvent(false); + + // event for status report + private readonly AutoResetEvent mStatusDone = new AutoResetEvent(false); + + // use a different method to write reports + private bool mAltWriteMethod; + + // HID device path of this Wiimote + private string mDevicePath = string.Empty; + + // unique ID + private readonly Guid mID = Guid.NewGuid(); + + // delegate used for enumerating found Wiimotes + internal delegate bool WiimoteFoundDelegate(string devicePath); + + // kilograms to pounds + private const float KG2LB = 2.20462262f; + + /// + /// Default constructor + /// + public Wiimote() + { + } + + internal Wiimote(string devicePath) + { + mDevicePath = devicePath; + } + + /// + /// Connect to the first-found Wiimote + /// + /// Wiimote not found in HID device list + public void Connect() + { + if(string.IsNullOrEmpty(mDevicePath)) + FindWiimote(WiimoteFound); + else + OpenWiimoteDeviceHandle(mDevicePath); + } + + internal static void FindWiimote(WiimoteFoundDelegate wiimoteFound) + { + int index = 0; + bool found = false; + Guid guid; + SafeFileHandle mHandle; + + // get the GUID of the HID class + HIDImports.HidD_GetHidGuid(out guid); + + // get a handle to all devices that are part of the HID class + // Fun fact: DIGCF_PRESENT worked on my machine just fine. I reinstalled Vista, and now it no longer finds the Wiimote with that parameter enabled... + IntPtr hDevInfo = HIDImports.SetupDiGetClassDevs(ref guid, null, IntPtr.Zero, HIDImports.DIGCF_DEVICEINTERFACE);// | HIDImports.DIGCF_PRESENT); + + // create a new interface data struct and initialize its size + HIDImports.SP_DEVICE_INTERFACE_DATA diData = new HIDImports.SP_DEVICE_INTERFACE_DATA(); + diData.cbSize = Marshal.SizeOf(diData); + + // get a device interface to a single device (enumerate all devices) + while(HIDImports.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, ref guid, index, ref diData)) + { + UInt32 size; + + // get the buffer size for this device detail instance (returned in the size parameter) + HIDImports.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref diData, IntPtr.Zero, 0, out size, IntPtr.Zero); + + // create a detail struct and set its size + HIDImports.SP_DEVICE_INTERFACE_DETAIL_DATA diDetail = new HIDImports.SP_DEVICE_INTERFACE_DETAIL_DATA(); + + // yeah, yeah...well, see, on Win x86, cbSize must be 5 for some reason. On x64, apparently 8 is what it wants. + // someday I should figure this out. Thanks to Paul Miller on this... + diDetail.cbSize = (uint)(IntPtr.Size == 8 ? 8 : 5); + + // actually get the detail struct + if(HIDImports.SetupDiGetDeviceInterfaceDetail(hDevInfo, ref diData, ref diDetail, size, out size, IntPtr.Zero)) + { + Debug.WriteLine(string.Format("{0}: {1} - {2}", index, diDetail.DevicePath, Marshal.GetLastWin32Error())); + + // open a read/write handle to our device using the DevicePath returned + mHandle = HIDImports.CreateFile(diDetail.DevicePath, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, HIDImports.EFileAttributes.Overlapped, IntPtr.Zero); + + // create an attributes struct and initialize the size + HIDImports.HIDD_ATTRIBUTES attrib = new HIDImports.HIDD_ATTRIBUTES(); + attrib.Size = Marshal.SizeOf(attrib); + + // get the attributes of the current device + if(HIDImports.HidD_GetAttributes(mHandle.DangerousGetHandle(), ref attrib)) + { + // if the vendor and product IDs match up + if(attrib.VendorID == VID && attrib.ProductID == PID) + { + // it's a Wiimote + Debug.WriteLine("Found one!"); + found = true; + + // fire the callback function...if the callee doesn't care about more Wiimotes, break out + if(!wiimoteFound(diDetail.DevicePath)) + break; + } + } + mHandle.Close(); + } + else + { + // failed to get the detail struct + throw new WiimoteException("SetupDiGetDeviceInterfaceDetail failed on index " + index); + } + + // move to the next device + index++; + } + + // clean up our list + HIDImports.SetupDiDestroyDeviceInfoList(hDevInfo); + + // if we didn't find a Wiimote, throw an exception + if(!found) + throw new WiimoteNotFoundException("No Wiimotes found in HID device list."); + } + + private bool WiimoteFound(string devicePath) + { + mDevicePath = devicePath; + + // if we didn't find a Wiimote, throw an exception + OpenWiimoteDeviceHandle(mDevicePath); + + return false; + } + + private void OpenWiimoteDeviceHandle(string devicePath) + { + // open a read/write handle to our device using the DevicePath returned + mHandle = HIDImports.CreateFile(devicePath, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, HIDImports.EFileAttributes.Overlapped, IntPtr.Zero); + + // create an attributes struct and initialize the size + HIDImports.HIDD_ATTRIBUTES attrib = new HIDImports.HIDD_ATTRIBUTES(); + attrib.Size = Marshal.SizeOf(attrib); + + // get the attributes of the current device + if(HIDImports.HidD_GetAttributes(mHandle.DangerousGetHandle(), ref attrib)) + { + // if the vendor and product IDs match up + if(attrib.VendorID == VID && attrib.ProductID == PID) + { + // create a nice .NET FileStream wrapping the handle above + mStream = new FileStream(mHandle, FileAccess.ReadWrite, REPORT_LENGTH, true); + + // start an async read operation on it + BeginAsyncRead(); + + // read the calibration info from the controller + try + { + ReadWiimoteCalibration(); + } + catch + { + // if we fail above, try the alternate HID writes + mAltWriteMethod = true; + ReadWiimoteCalibration(); + } + + // force a status check to get the state of any extensions plugged in at startup + GetStatus(); + } + else + { + // otherwise this isn't the controller, so close up the file handle + mHandle.Close(); + throw new WiimoteException("Attempted to open a non-Wiimote device."); + } + } + } + + /// + /// Disconnect from the controller and stop reading data from it + /// + public void Disconnect() + { + // close up the stream and handle + if(mStream != null) + mStream.Close(); + + if(mHandle != null) + mHandle.Close(); + } + + /// + /// Start reading asynchronously from the controller + /// + private void BeginAsyncRead() + { + // if the stream is valid and ready + if(mStream != null && mStream.CanRead) + { + // setup the read and the callback + byte[] buff = new byte[REPORT_LENGTH]; + mStream.BeginRead(buff, 0, REPORT_LENGTH, new AsyncCallback(OnReadData), buff); + } + } + + /// + /// Callback when data is ready to be processed + /// + /// State information for the callback + private void OnReadData(IAsyncResult ar) + { + // grab the byte buffer + byte[] buff = (byte[])ar.AsyncState; + + try + { + // end the current read + mStream.EndRead(ar); + + // parse it + if(ParseInputReport(buff)) + { + // post an event + if(WiimoteChanged != null) + WiimoteChanged(this, new WiimoteChangedEventArgs(mWiimoteState)); + } + + // start reading again + BeginAsyncRead(); + } + catch(OperationCanceledException) + { + Debug.WriteLine("OperationCanceledException"); + } + } + + /// + /// Parse a report sent by the Wiimote + /// + /// Data buffer to parse + /// Returns a boolean noting whether an event needs to be posted + private bool ParseInputReport(byte[] buff) + { + InputReport type = (InputReport)buff[0]; + + switch(type) + { + case InputReport.Buttons: + ParseButtons(buff); + break; + case InputReport.ButtonsAccel: + ParseButtons(buff); + ParseAccel(buff); + break; + case InputReport.IRAccel: + ParseButtons(buff); + ParseAccel(buff); + ParseIR(buff); + break; + case InputReport.ButtonsExtension: + ParseButtons(buff); + ParseExtension(buff, 3); + break; + case InputReport.ExtensionAccel: + ParseButtons(buff); + ParseAccel(buff); + ParseExtension(buff, 6); + break; + case InputReport.IRExtensionAccel: + ParseButtons(buff); + ParseAccel(buff); + ParseIR(buff); + ParseExtension(buff, 16); + break; + case InputReport.Status: + ParseButtons(buff); + mWiimoteState.BatteryRaw = buff[6]; + mWiimoteState.Battery = (((100.0f * 48.0f * (float)((int)buff[6] / 48.0f))) / 192.0f); + + // get the real LED values in case the values from SetLEDs() somehow becomes out of sync, which really shouldn't be possible + mWiimoteState.LEDState.LED1 = (buff[3] & 0x10) != 0; + mWiimoteState.LEDState.LED2 = (buff[3] & 0x20) != 0; + mWiimoteState.LEDState.LED3 = (buff[3] & 0x40) != 0; + mWiimoteState.LEDState.LED4 = (buff[3] & 0x80) != 0; + + // extension connected? + bool extension = (buff[3] & 0x02) != 0; + Debug.WriteLine("Extension: " + extension); + + if(mWiimoteState.Extension != extension) + { + mWiimoteState.Extension = extension; + + if(extension) + { + BeginAsyncRead(); + InitializeExtension(); + } + else + mWiimoteState.ExtensionType = ExtensionType.None; + + // only fire the extension changed event if we have a real extension (i.e. not a balance board) + if(WiimoteExtensionChanged != null && mWiimoteState.ExtensionType != ExtensionType.BalanceBoard) + WiimoteExtensionChanged(this, new WiimoteExtensionChangedEventArgs(mWiimoteState.ExtensionType, mWiimoteState.Extension)); + } + mStatusDone.Set(); + break; + case InputReport.ReadData: + ParseButtons(buff); + ParseReadData(buff); + break; + case InputReport.OutputReportAck: + Debug.WriteLine("ack: " + buff[0] + " " + buff[1] + " " +buff[2] + " " +buff[3] + " " +buff[4]); + mWriteDone.Set(); + break; + default: + Debug.WriteLine("Unknown report type: " + type.ToString("x")); + return false; + } + + return true; + } + + /// + /// Handles setting up an extension when plugged in + /// + private void InitializeExtension() + { + WriteData(REGISTER_EXTENSION_INIT_1, 0x55); + WriteData(REGISTER_EXTENSION_INIT_2, 0x00); + + // start reading again + BeginAsyncRead(); + + byte[] buff = ReadData(REGISTER_EXTENSION_TYPE, 6); + long type = ((long)buff[0] << 40) | ((long)buff[1] << 32) | ((long)buff[2]) << 24 | ((long)buff[3]) << 16 | ((long)buff[4]) << 8 | buff[5]; + + switch((ExtensionType)type) + { + case ExtensionType.None: + case ExtensionType.ParitallyInserted: + mWiimoteState.Extension = false; + mWiimoteState.ExtensionType = ExtensionType.None; + return; + case ExtensionType.Nunchuk: + case ExtensionType.ClassicController: + case ExtensionType.Guitar: + case ExtensionType.BalanceBoard: + case ExtensionType.Drums: + mWiimoteState.ExtensionType = (ExtensionType)type; + this.SetReportType(InputReport.ButtonsExtension, true); + break; + default: + throw new WiimoteException("Unknown extension controller found: " + type.ToString("x")); + } + + switch(mWiimoteState.ExtensionType) + { + case ExtensionType.Nunchuk: + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 16); + + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0 = buff[0]; + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0 = buff[1]; + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0 = buff[2]; + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.XG = buff[4]; + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.YG = buff[5]; + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.ZG = buff[6]; + mWiimoteState.NunchukState.CalibrationInfo.MaxX = buff[8]; + mWiimoteState.NunchukState.CalibrationInfo.MinX = buff[9]; + mWiimoteState.NunchukState.CalibrationInfo.MidX = buff[10]; + mWiimoteState.NunchukState.CalibrationInfo.MaxY = buff[11]; + mWiimoteState.NunchukState.CalibrationInfo.MinY = buff[12]; + mWiimoteState.NunchukState.CalibrationInfo.MidY = buff[13]; + break; + case ExtensionType.ClassicController: + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 16); + + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL = (byte)(buff[0] >> 2); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinXL = (byte)(buff[1] >> 2); + mWiimoteState.ClassicControllerState.CalibrationInfo.MidXL = (byte)(buff[2] >> 2); + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL = (byte)(buff[3] >> 2); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinYL = (byte)(buff[4] >> 2); + mWiimoteState.ClassicControllerState.CalibrationInfo.MidYL = (byte)(buff[5] >> 2); + + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR = (byte)(buff[6] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinXR = (byte)(buff[7] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MidXR = (byte)(buff[8] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR = (byte)(buff[9] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinYR = (byte)(buff[10] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MidYR = (byte)(buff[11] >> 3); + + // this doesn't seem right... +// mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MinTriggerL = (byte)(buff[12] >> 3); +// mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MaxTriggerL = (byte)(buff[14] >> 3); +// mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MinTriggerR = (byte)(buff[13] >> 3); +// mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MaxTriggerR = (byte)(buff[15] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerL = 0; + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL = 31; + mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerR = 0; + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR = 31; + break; + case ExtensionType.Guitar: + case ExtensionType.Drums: + // there appears to be no calibration data returned by the guitar controller + break; + case ExtensionType.BalanceBoard: + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 32); + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopRight = (short)((short)buff[4] << 8 | buff[5]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomRight = (short)((short)buff[6] << 8 | buff[7]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopLeft = (short)((short)buff[8] << 8 | buff[9]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomLeft = (short)((short)buff[10] << 8 | buff[11]); + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopRight = (short)((short)buff[12] << 8 | buff[13]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomRight = (short)((short)buff[14] << 8 | buff[15]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopLeft = (short)((short)buff[16] << 8 | buff[17]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomLeft = (short)((short)buff[18] << 8 | buff[19]); + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopRight = (short)((short)buff[20] << 8 | buff[21]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomRight = (short)((short)buff[22] << 8 | buff[23]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopLeft = (short)((short)buff[24] << 8 | buff[25]); + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomLeft = (short)((short)buff[26] << 8 | buff[27]); + break; + } + } + + /// + /// Decrypts data sent from the extension to the Wiimote + /// + /// Data buffer + /// Byte array containing decoded data + private byte[] DecryptBuffer(byte[] buff) + { + for(int i = 0; i < buff.Length; i++) + buff[i] = (byte)(((buff[i] ^ 0x17) + 0x17) & 0xff); + + return buff; + } + + /// + /// Parses a standard button report into the ButtonState struct + /// + /// Data buffer + private void ParseButtons(byte[] buff) + { + mWiimoteState.ButtonState.A = (buff[2] & 0x08) != 0; + mWiimoteState.ButtonState.B = (buff[2] & 0x04) != 0; + mWiimoteState.ButtonState.Minus = (buff[2] & 0x10) != 0; + mWiimoteState.ButtonState.Home = (buff[2] & 0x80) != 0; + mWiimoteState.ButtonState.Plus = (buff[1] & 0x10) != 0; + mWiimoteState.ButtonState.One = (buff[2] & 0x02) != 0; + mWiimoteState.ButtonState.Two = (buff[2] & 0x01) != 0; + mWiimoteState.ButtonState.Up = (buff[1] & 0x08) != 0; + mWiimoteState.ButtonState.Down = (buff[1] & 0x04) != 0; + mWiimoteState.ButtonState.Left = (buff[1] & 0x01) != 0; + mWiimoteState.ButtonState.Right = (buff[1] & 0x02) != 0; + } + + /// + /// Parse accelerometer data + /// + /// Data buffer + private void ParseAccel(byte[] buff) + { + mWiimoteState.AccelState.RawValues.X = buff[3]; + mWiimoteState.AccelState.RawValues.Y = buff[4]; + mWiimoteState.AccelState.RawValues.Z = buff[5]; + + mWiimoteState.AccelState.Values.X = (float)((float)mWiimoteState.AccelState.RawValues.X - ((int)mWiimoteState.AccelCalibrationInfo.X0)) / + ((float)mWiimoteState.AccelCalibrationInfo.XG - ((int)mWiimoteState.AccelCalibrationInfo.X0)); + mWiimoteState.AccelState.Values.Y = (float)((float)mWiimoteState.AccelState.RawValues.Y - mWiimoteState.AccelCalibrationInfo.Y0) / + ((float)mWiimoteState.AccelCalibrationInfo.YG - mWiimoteState.AccelCalibrationInfo.Y0); + mWiimoteState.AccelState.Values.Z = (float)((float)mWiimoteState.AccelState.RawValues.Z - mWiimoteState.AccelCalibrationInfo.Z0) / + ((float)mWiimoteState.AccelCalibrationInfo.ZG - mWiimoteState.AccelCalibrationInfo.Z0); + } + + /// + /// Parse IR data from report + /// + /// Data buffer + private void ParseIR(byte[] buff) + { + mWiimoteState.IRState.IRSensors[0].RawPosition.X = buff[6] | ((buff[8] >> 4) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[0].RawPosition.Y = buff[7] | ((buff[8] >> 6) & 0x03) << 8; + + switch(mWiimoteState.IRState.Mode) + { + case IRMode.Basic: + mWiimoteState.IRState.IRSensors[1].RawPosition.X = buff[9] | ((buff[8] >> 0) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[1].RawPosition.Y = buff[10] | ((buff[8] >> 2) & 0x03) << 8; + + mWiimoteState.IRState.IRSensors[2].RawPosition.X = buff[11] | ((buff[13] >> 4) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[2].RawPosition.Y = buff[12] | ((buff[13] >> 6) & 0x03) << 8; + + mWiimoteState.IRState.IRSensors[3].RawPosition.X = buff[14] | ((buff[13] >> 0) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[3].RawPosition.Y = buff[15] | ((buff[13] >> 2) & 0x03) << 8; + + mWiimoteState.IRState.IRSensors[0].Size = 0x00; + mWiimoteState.IRState.IRSensors[1].Size = 0x00; + mWiimoteState.IRState.IRSensors[2].Size = 0x00; + mWiimoteState.IRState.IRSensors[3].Size = 0x00; + + mWiimoteState.IRState.IRSensors[0].Found = !(buff[6] == 0xff && buff[7] == 0xff); + mWiimoteState.IRState.IRSensors[1].Found = !(buff[9] == 0xff && buff[10] == 0xff); + mWiimoteState.IRState.IRSensors[2].Found = !(buff[11] == 0xff && buff[12] == 0xff); + mWiimoteState.IRState.IRSensors[3].Found = !(buff[14] == 0xff && buff[15] == 0xff); + break; + case IRMode.Extended: + mWiimoteState.IRState.IRSensors[1].RawPosition.X = buff[9] | ((buff[11] >> 4) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[1].RawPosition.Y = buff[10] | ((buff[11] >> 6) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[2].RawPosition.X = buff[12] | ((buff[14] >> 4) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[2].RawPosition.Y = buff[13] | ((buff[14] >> 6) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[3].RawPosition.X = buff[15] | ((buff[17] >> 4) & 0x03) << 8; + mWiimoteState.IRState.IRSensors[3].RawPosition.Y = buff[16] | ((buff[17] >> 6) & 0x03) << 8; + + mWiimoteState.IRState.IRSensors[0].Size = buff[8] & 0x0f; + mWiimoteState.IRState.IRSensors[1].Size = buff[11] & 0x0f; + mWiimoteState.IRState.IRSensors[2].Size = buff[14] & 0x0f; + mWiimoteState.IRState.IRSensors[3].Size = buff[17] & 0x0f; + + mWiimoteState.IRState.IRSensors[0].Found = !(buff[6] == 0xff && buff[7] == 0xff && buff[8] == 0xff); + mWiimoteState.IRState.IRSensors[1].Found = !(buff[9] == 0xff && buff[10] == 0xff && buff[11] == 0xff); + mWiimoteState.IRState.IRSensors[2].Found = !(buff[12] == 0xff && buff[13] == 0xff && buff[14] == 0xff); + mWiimoteState.IRState.IRSensors[3].Found = !(buff[15] == 0xff && buff[16] == 0xff && buff[17] == 0xff); + break; + } + + mWiimoteState.IRState.IRSensors[0].Position.X = (float)(mWiimoteState.IRState.IRSensors[0].RawPosition.X / 1023.5f); + mWiimoteState.IRState.IRSensors[1].Position.X = (float)(mWiimoteState.IRState.IRSensors[1].RawPosition.X / 1023.5f); + mWiimoteState.IRState.IRSensors[2].Position.X = (float)(mWiimoteState.IRState.IRSensors[2].RawPosition.X / 1023.5f); + mWiimoteState.IRState.IRSensors[3].Position.X = (float)(mWiimoteState.IRState.IRSensors[3].RawPosition.X / 1023.5f); + + mWiimoteState.IRState.IRSensors[0].Position.Y = (float)(mWiimoteState.IRState.IRSensors[0].RawPosition.Y / 767.5f); + mWiimoteState.IRState.IRSensors[1].Position.Y = (float)(mWiimoteState.IRState.IRSensors[1].RawPosition.Y / 767.5f); + mWiimoteState.IRState.IRSensors[2].Position.Y = (float)(mWiimoteState.IRState.IRSensors[2].RawPosition.Y / 767.5f); + mWiimoteState.IRState.IRSensors[3].Position.Y = (float)(mWiimoteState.IRState.IRSensors[3].RawPosition.Y / 767.5f); + + if(mWiimoteState.IRState.IRSensors[0].Found && mWiimoteState.IRState.IRSensors[1].Found) + { + mWiimoteState.IRState.RawMidpoint.X = (mWiimoteState.IRState.IRSensors[1].RawPosition.X + mWiimoteState.IRState.IRSensors[0].RawPosition.X) / 2; + mWiimoteState.IRState.RawMidpoint.Y = (mWiimoteState.IRState.IRSensors[1].RawPosition.Y + mWiimoteState.IRState.IRSensors[0].RawPosition.Y) / 2; + + mWiimoteState.IRState.Midpoint.X = (mWiimoteState.IRState.IRSensors[1].Position.X + mWiimoteState.IRState.IRSensors[0].Position.X) / 2.0f; + mWiimoteState.IRState.Midpoint.Y = (mWiimoteState.IRState.IRSensors[1].Position.Y + mWiimoteState.IRState.IRSensors[0].Position.Y) / 2.0f; + } + else + mWiimoteState.IRState.Midpoint.X = mWiimoteState.IRState.Midpoint.Y = 0.0f; + } + + /// + /// Parse data from an extension controller + /// + /// Data buffer + /// Offset into data buffer + private void ParseExtension(byte[] buff, int offset) + { + switch(mWiimoteState.ExtensionType) + { + case ExtensionType.Nunchuk: + mWiimoteState.NunchukState.RawJoystick.X = buff[offset]; + mWiimoteState.NunchukState.RawJoystick.Y = buff[offset + 1]; + mWiimoteState.NunchukState.AccelState.RawValues.X = buff[offset + 2]; + mWiimoteState.NunchukState.AccelState.RawValues.Y = buff[offset + 3]; + mWiimoteState.NunchukState.AccelState.RawValues.Z = buff[offset + 4]; + + mWiimoteState.NunchukState.C = (buff[offset + 5] & 0x02) == 0; + mWiimoteState.NunchukState.Z = (buff[offset + 5] & 0x01) == 0; + + mWiimoteState.NunchukState.AccelState.Values.X = (float)((float)mWiimoteState.NunchukState.AccelState.RawValues.X - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0) / + ((float)mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.XG - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0); + mWiimoteState.NunchukState.AccelState.Values.Y = (float)((float)mWiimoteState.NunchukState.AccelState.RawValues.Y - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0) / + ((float)mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.YG - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0); + mWiimoteState.NunchukState.AccelState.Values.Z = (float)((float)mWiimoteState.NunchukState.AccelState.RawValues.Z - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0) / + ((float)mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.ZG - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0); + + if(mWiimoteState.NunchukState.CalibrationInfo.MaxX != 0x00) + mWiimoteState.NunchukState.Joystick.X = (float)((float)mWiimoteState.NunchukState.RawJoystick.X - mWiimoteState.NunchukState.CalibrationInfo.MidX) / + ((float)mWiimoteState.NunchukState.CalibrationInfo.MaxX - mWiimoteState.NunchukState.CalibrationInfo.MinX); + + if(mWiimoteState.NunchukState.CalibrationInfo.MaxY != 0x00) + mWiimoteState.NunchukState.Joystick.Y = (float)((float)mWiimoteState.NunchukState.RawJoystick.Y - mWiimoteState.NunchukState.CalibrationInfo.MidY) / + ((float)mWiimoteState.NunchukState.CalibrationInfo.MaxY - mWiimoteState.NunchukState.CalibrationInfo.MinY); + + break; + + case ExtensionType.ClassicController: + mWiimoteState.ClassicControllerState.RawJoystickL.X = (byte)(buff[offset] & 0x3f); + mWiimoteState.ClassicControllerState.RawJoystickL.Y = (byte)(buff[offset + 1] & 0x3f); + mWiimoteState.ClassicControllerState.RawJoystickR.X = (byte)((buff[offset + 2] >> 7) | (buff[offset + 1] & 0xc0) >> 5 | (buff[offset] & 0xc0) >> 3); + mWiimoteState.ClassicControllerState.RawJoystickR.Y = (byte)(buff[offset + 2] & 0x1f); + + mWiimoteState.ClassicControllerState.RawTriggerL = (byte)(((buff[offset + 2] & 0x60) >> 2) | (buff[offset + 3] >> 5)); + mWiimoteState.ClassicControllerState.RawTriggerR = (byte)(buff[offset + 3] & 0x1f); + + mWiimoteState.ClassicControllerState.ButtonState.TriggerR = (buff[offset + 4] & 0x02) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Plus = (buff[offset + 4] & 0x04) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Home = (buff[offset + 4] & 0x08) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Minus = (buff[offset + 4] & 0x10) == 0; + mWiimoteState.ClassicControllerState.ButtonState.TriggerL = (buff[offset + 4] & 0x20) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Down = (buff[offset + 4] & 0x40) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Right = (buff[offset + 4] & 0x80) == 0; + + mWiimoteState.ClassicControllerState.ButtonState.Up = (buff[offset + 5] & 0x01) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Left = (buff[offset + 5] & 0x02) == 0; + mWiimoteState.ClassicControllerState.ButtonState.ZR = (buff[offset + 5] & 0x04) == 0; + mWiimoteState.ClassicControllerState.ButtonState.X = (buff[offset + 5] & 0x08) == 0; + mWiimoteState.ClassicControllerState.ButtonState.A = (buff[offset + 5] & 0x10) == 0; + mWiimoteState.ClassicControllerState.ButtonState.Y = (buff[offset + 5] & 0x20) == 0; + mWiimoteState.ClassicControllerState.ButtonState.B = (buff[offset + 5] & 0x40) == 0; + mWiimoteState.ClassicControllerState.ButtonState.ZL = (buff[offset + 5] & 0x80) == 0; + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL != 0x00) + mWiimoteState.ClassicControllerState.JoystickL.X = (float)((float)mWiimoteState.ClassicControllerState.RawJoystickL.X - mWiimoteState.ClassicControllerState.CalibrationInfo.MidXL) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinXL); + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL != 0x00) + mWiimoteState.ClassicControllerState.JoystickL.Y = (float)((float)mWiimoteState.ClassicControllerState.RawJoystickL.Y - mWiimoteState.ClassicControllerState.CalibrationInfo.MidYL) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinYL); + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR != 0x00) + mWiimoteState.ClassicControllerState.JoystickR.X = (float)((float)mWiimoteState.ClassicControllerState.RawJoystickR.X - mWiimoteState.ClassicControllerState.CalibrationInfo.MidXR) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinXR); + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR != 0x00) + mWiimoteState.ClassicControllerState.JoystickR.Y = (float)((float)mWiimoteState.ClassicControllerState.RawJoystickR.Y - mWiimoteState.ClassicControllerState.CalibrationInfo.MidYR) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinYR); + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL != 0x00) + mWiimoteState.ClassicControllerState.TriggerL = (mWiimoteState.ClassicControllerState.RawTriggerL) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerL); + + if(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR != 0x00) + mWiimoteState.ClassicControllerState.TriggerR = (mWiimoteState.ClassicControllerState.RawTriggerR) / + (float)(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerR); + break; + + case ExtensionType.Guitar: + mWiimoteState.GuitarState.GuitarType = ((buff[offset] & 0x80) == 0) ? GuitarType.GuitarHeroWorldTour : GuitarType.GuitarHero3; + + mWiimoteState.GuitarState.ButtonState.Plus = (buff[offset + 4] & 0x04) == 0; + mWiimoteState.GuitarState.ButtonState.Minus = (buff[offset + 4] & 0x10) == 0; + mWiimoteState.GuitarState.ButtonState.StrumDown = (buff[offset + 4] & 0x40) == 0; + + mWiimoteState.GuitarState.ButtonState.StrumUp = (buff[offset + 5] & 0x01) == 0; + mWiimoteState.GuitarState.FretButtonState.Yellow = (buff[offset + 5] & 0x08) == 0; + mWiimoteState.GuitarState.FretButtonState.Green = (buff[offset + 5] & 0x10) == 0; + mWiimoteState.GuitarState.FretButtonState.Blue = (buff[offset + 5] & 0x20) == 0; + mWiimoteState.GuitarState.FretButtonState.Red = (buff[offset + 5] & 0x40) == 0; + mWiimoteState.GuitarState.FretButtonState.Orange = (buff[offset + 5] & 0x80) == 0; + + // it appears the joystick values are only 6 bits + mWiimoteState.GuitarState.RawJoystick.X = (buff[offset + 0] & 0x3f); + mWiimoteState.GuitarState.RawJoystick.Y = (buff[offset + 1] & 0x3f); + + // and the whammy bar is only 5 bits + mWiimoteState.GuitarState.RawWhammyBar = (byte)(buff[offset + 3] & 0x1f); + + mWiimoteState.GuitarState.Joystick.X = (float)(mWiimoteState.GuitarState.RawJoystick.X - 0x1f) / 0x3f; // not fully accurate, but close + mWiimoteState.GuitarState.Joystick.Y = (float)(mWiimoteState.GuitarState.RawJoystick.Y - 0x1f) / 0x3f; // not fully accurate, but close + mWiimoteState.GuitarState.WhammyBar = (float)(mWiimoteState.GuitarState.RawWhammyBar) / 0x0a; // seems like there are 10 positions? + + mWiimoteState.GuitarState.TouchbarState.Yellow = false; + mWiimoteState.GuitarState.TouchbarState.Green = false; + mWiimoteState.GuitarState.TouchbarState.Blue = false; + mWiimoteState.GuitarState.TouchbarState.Red = false; + mWiimoteState.GuitarState.TouchbarState.Orange = false; + + switch(buff[offset + 2] & 0x1f) + { + case 0x04: + mWiimoteState.GuitarState.TouchbarState.Green = true; + break; + case 0x07: + mWiimoteState.GuitarState.TouchbarState.Green = true; + mWiimoteState.GuitarState.TouchbarState.Red = true; + break; + case 0x0a: + mWiimoteState.GuitarState.TouchbarState.Red = true; + break; + case 0x0c: + case 0x0d: + mWiimoteState.GuitarState.TouchbarState.Red = true; + mWiimoteState.GuitarState.TouchbarState.Yellow = true; + break; + case 0x12: + case 0x13: + mWiimoteState.GuitarState.TouchbarState.Yellow = true; + break; + case 0x14: + case 0x15: + mWiimoteState.GuitarState.TouchbarState.Yellow = true; + mWiimoteState.GuitarState.TouchbarState.Blue = true; + break; + case 0x17: + case 0x18: + mWiimoteState.GuitarState.TouchbarState.Blue = true; + break; + case 0x1a: + mWiimoteState.GuitarState.TouchbarState.Blue = true; + mWiimoteState.GuitarState.TouchbarState.Orange = true; + break; + case 0x1f: + mWiimoteState.GuitarState.TouchbarState.Orange = true; + break; + } + break; + + case ExtensionType.Drums: + // it appears the joystick values are only 6 bits + mWiimoteState.DrumsState.RawJoystick.X = (buff[offset + 0] & 0x3f); + mWiimoteState.DrumsState.RawJoystick.Y = (buff[offset + 1] & 0x3f); + + mWiimoteState.DrumsState.Plus = (buff[offset + 4] & 0x04) == 0; + mWiimoteState.DrumsState.Minus = (buff[offset + 4] & 0x10) == 0; + + mWiimoteState.DrumsState.Pedal = (buff[offset + 5] & 0x04) == 0; + mWiimoteState.DrumsState.Blue = (buff[offset + 5] & 0x08) == 0; + mWiimoteState.DrumsState.Green = (buff[offset + 5] & 0x10) == 0; + mWiimoteState.DrumsState.Yellow = (buff[offset + 5] & 0x20) == 0; + mWiimoteState.DrumsState.Red = (buff[offset + 5] & 0x40) == 0; + mWiimoteState.DrumsState.Orange = (buff[offset + 5] & 0x80) == 0; + + mWiimoteState.DrumsState.Joystick.X = (float)(mWiimoteState.DrumsState.RawJoystick.X - 0x1f) / 0x3f; // not fully accurate, but close + mWiimoteState.DrumsState.Joystick.Y = (float)(mWiimoteState.DrumsState.RawJoystick.Y - 0x1f) / 0x3f; // not fully accurate, but close + + if((buff[offset + 2] & 0x40) == 0) + { + int pad = (buff[offset + 2] >> 1) & 0x1f; + int velocity = (buff[offset + 3] >> 5); + + if(velocity != 7) + { + switch(pad) + { + case 0x1b: + mWiimoteState.DrumsState.PedalVelocity = velocity; + break; + case 0x19: + mWiimoteState.DrumsState.RedVelocity = velocity; + break; + case 0x11: + mWiimoteState.DrumsState.YellowVelocity = velocity; + break; + case 0x0f: + mWiimoteState.DrumsState.BlueVelocity = velocity; + break; + case 0x0e: + mWiimoteState.DrumsState.OrangeVelocity = velocity; + break; + case 0x12: + mWiimoteState.DrumsState.GreenVelocity = velocity; + break; + } + } + } + + break; + + case ExtensionType.BalanceBoard: + mWiimoteState.BalanceBoardState.SensorValuesRaw.TopRight = (short)((short)buff[offset + 0] << 8 | buff[offset + 1]); + mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomRight = (short)((short)buff[offset + 2] << 8 | buff[offset + 3]); + mWiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft = (short)((short)buff[offset + 4] << 8 | buff[offset + 5]); + mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomLeft = (short)((short)buff[offset + 6] << 8 | buff[offset + 7]); + + mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopLeft); + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopRight); + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomLeft); + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomRight); + + mWiimoteState.BalanceBoardState.SensorValuesLb.TopLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft * KG2LB); + mWiimoteState.BalanceBoardState.SensorValuesLb.TopRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight * KG2LB); + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft * KG2LB); + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight * KG2LB); + + mWiimoteState.BalanceBoardState.WeightKg = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight) / 4.0f; + mWiimoteState.BalanceBoardState.WeightLb = (mWiimoteState.BalanceBoardState.SensorValuesLb.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesLb.TopRight + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomRight) / 4.0f; + + float Kx = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft) / (mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight); + float Ky = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight) / (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight); + + mWiimoteState.BalanceBoardState.CenterOfGravity.X = ((float)(Kx - 1) / (float)(Kx + 1)) * (float)(-BSL / 2); + mWiimoteState.BalanceBoardState.CenterOfGravity.Y = ((float)(Ky - 1) / (float)(Ky + 1)) * (float)(-BSW / 2); + break; + } + } + + private float GetBalanceBoardSensorValue(short sensor, short min, short mid, short max) + { + if(max == mid || mid == min) + return 0; + + if(sensor < mid) + return 68.0f * ((float)(sensor - min) / (mid - min)); + else + return 68.0f * ((float)(sensor - mid) / (max - mid)) + 68.0f; + } + + + /// + /// Parse data returned from a read report + /// + /// Data buffer + private void ParseReadData(byte[] buff) + { + if((buff[3] & 0x08) != 0) + throw new WiimoteException("Error reading data from Wiimote: Bytes do not exist."); + + if((buff[3] & 0x07) != 0) + throw new WiimoteException("Error reading data from Wiimote: Attempt to read from write-only registers."); + + // get our size and offset from the report + int size = (buff[3] >> 4) + 1; + int offset = (buff[4] << 8 | buff[5]); + + // add it to the buffer + Array.Copy(buff, 6, mReadBuff, offset - mAddress, size); + + // if we've read it all, set the event + if(mAddress + mSize == offset + size) + mReadDone.Set(); + } + + /// + /// Returns whether rumble is currently enabled. + /// + /// Byte indicating true (0x01) or false (0x00) + private byte GetRumbleBit() + { + return (byte)(mWiimoteState.Rumble ? 0x01 : 0x00); + } + + /// + /// Read calibration information stored on Wiimote + /// + private void ReadWiimoteCalibration() + { + // this appears to change the report type to 0x31 + byte[] buff = ReadData(0x0016, 7); + + mWiimoteState.AccelCalibrationInfo.X0 = buff[0]; + mWiimoteState.AccelCalibrationInfo.Y0 = buff[1]; + mWiimoteState.AccelCalibrationInfo.Z0 = buff[2]; + mWiimoteState.AccelCalibrationInfo.XG = buff[4]; + mWiimoteState.AccelCalibrationInfo.YG = buff[5]; + mWiimoteState.AccelCalibrationInfo.ZG = buff[6]; + } + + /// + /// Set Wiimote reporting mode (if using an IR report type, IR sensitivity is set to WiiLevel3) + /// + /// Report type + /// Continuous data + public void SetReportType(InputReport type, bool continuous) + { + SetReportType(type, IRSensitivity.Maximum, continuous); + } + + /// + /// Set Wiimote reporting mode + /// + /// Report type + /// IR sensitivity + /// Continuous data + public void SetReportType(InputReport type, IRSensitivity irSensitivity, bool continuous) + { + // only 1 report type allowed for the BB + if(mWiimoteState.ExtensionType == ExtensionType.BalanceBoard) + type = InputReport.ButtonsExtension; + + switch(type) + { + case InputReport.IRAccel: + EnableIR(IRMode.Extended, irSensitivity); + break; + case InputReport.IRExtensionAccel: + EnableIR(IRMode.Basic, irSensitivity); + break; + default: + DisableIR(); + break; + } + + ClearReport(); + mBuff[0] = (byte)OutputReport.Type; + mBuff[1] = (byte)((continuous ? 0x04 : 0x00) | (byte)(mWiimoteState.Rumble ? 0x01 : 0x00)); + mBuff[2] = (byte)type; + + WriteReport(); + } + + /// + /// Set the LEDs on the Wiimote + /// + /// LED 1 + /// LED 2 + /// LED 3 + /// LED 4 + public void SetLEDs(bool led1, bool led2, bool led3, bool led4) + { + mWiimoteState.LEDState.LED1 = led1; + mWiimoteState.LEDState.LED2 = led2; + mWiimoteState.LEDState.LED3 = led3; + mWiimoteState.LEDState.LED4 = led4; + + ClearReport(); + + mBuff[0] = (byte)OutputReport.LEDs; + mBuff[1] = (byte)( + (led1 ? 0x10 : 0x00) | + (led2 ? 0x20 : 0x00) | + (led3 ? 0x40 : 0x00) | + (led4 ? 0x80 : 0x00) | + GetRumbleBit()); + + WriteReport(); + } + + /// + /// Set the LEDs on the Wiimote + /// + /// The value to be lit up in base2 on the Wiimote + public void SetLEDs(int leds) + { + mWiimoteState.LEDState.LED1 = (leds & 0x01) > 0; + mWiimoteState.LEDState.LED2 = (leds & 0x02) > 0; + mWiimoteState.LEDState.LED3 = (leds & 0x04) > 0; + mWiimoteState.LEDState.LED4 = (leds & 0x08) > 0; + + ClearReport(); + + mBuff[0] = (byte)OutputReport.LEDs; + mBuff[1] = (byte)( + ((leds & 0x01) > 0 ? 0x10 : 0x00) | + ((leds & 0x02) > 0 ? 0x20 : 0x00) | + ((leds & 0x04) > 0 ? 0x40 : 0x00) | + ((leds & 0x08) > 0 ? 0x80 : 0x00) | + GetRumbleBit()); + + WriteReport(); + } + + /// + /// Toggle rumble + /// + /// On or off + public void SetRumble(bool on) + { + mWiimoteState.Rumble = on; + + // the LED report also handles rumble + SetLEDs(mWiimoteState.LEDState.LED1, + mWiimoteState.LEDState.LED2, + mWiimoteState.LEDState.LED3, + mWiimoteState.LEDState.LED4); + } + + /// + /// Retrieve the current status of the Wiimote and extensions. Replaces GetBatteryLevel() since it was poorly named. + /// + public void GetStatus() + { + ClearReport(); + + mBuff[0] = (byte)OutputReport.Status; + mBuff[1] = GetRumbleBit(); + + WriteReport(); + + // signal the status report finished + if(!mStatusDone.WaitOne(3000, false)) + throw new WiimoteException("Timed out waiting for status report"); + } + + /// + /// Turn on the IR sensor + /// + /// The data report mode + /// IR sensitivity + private void EnableIR(IRMode mode, IRSensitivity irSensitivity) + { + mWiimoteState.IRState.Mode = mode; + + ClearReport(); + mBuff[0] = (byte)OutputReport.IR; + mBuff[1] = (byte)(0x04 | GetRumbleBit()); + WriteReport(); + + ClearReport(); + mBuff[0] = (byte)OutputReport.IR2; + mBuff[1] = (byte)(0x04 | GetRumbleBit()); + WriteReport(); + + WriteData(REGISTER_IR, 0x08); + switch(irSensitivity) + { + case IRSensitivity.WiiLevel1: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x64, 0x00, 0xfe}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0xfd, 0x05}); + break; + case IRSensitivity.WiiLevel2: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x96, 0x00, 0xb4}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0xb3, 0x04}); + break; + case IRSensitivity.WiiLevel3: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xaa, 0x00, 0x64}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x63, 0x03}); + break; + case IRSensitivity.WiiLevel4: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0xc8, 0x00, 0x36}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x35, 0x03}); + break; + case IRSensitivity.WiiLevel5: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x07, 0x00, 0x00, 0x71, 0x01, 0x00, 0x72, 0x00, 0x20}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x1, 0x03}); + break; + case IRSensitivity.Maximum: + WriteData(REGISTER_IR_SENSITIVITY_1, 9, new byte[] {0x02, 0x00, 0x00, 0x71, 0x01, 0x00, 0x90, 0x00, 0x41}); + WriteData(REGISTER_IR_SENSITIVITY_2, 2, new byte[] {0x40, 0x00}); + break; + default: + throw new ArgumentOutOfRangeException("irSensitivity"); + } + WriteData(REGISTER_IR_MODE, (byte)mode); + WriteData(REGISTER_IR, 0x08); + } + + /// + /// Disable the IR sensor + /// + private void DisableIR() + { + mWiimoteState.IRState.Mode = IRMode.Off; + + ClearReport(); + mBuff[0] = (byte)OutputReport.IR; + mBuff[1] = GetRumbleBit(); + WriteReport(); + + ClearReport(); + mBuff[0] = (byte)OutputReport.IR2; + mBuff[1] = GetRumbleBit(); + WriteReport(); + } + + /// + /// Initialize the report data buffer + /// + private void ClearReport() + { + Array.Clear(mBuff, 0, REPORT_LENGTH); + } + + /// + /// Write a report to the Wiimote + /// + private void WriteReport() + { + Debug.WriteLine("WriteReport: " + mBuff[0].ToString("x")); + if(mAltWriteMethod) + HIDImports.HidD_SetOutputReport(this.mHandle.DangerousGetHandle(), mBuff, (uint)mBuff.Length); + else if(mStream != null) + mStream.Write(mBuff, 0, REPORT_LENGTH); + + if(mBuff[0] == (byte)OutputReport.WriteMemory) + { + Debug.WriteLine("Wait"); + if(!mWriteDone.WaitOne(1000, false)) + Debug.WriteLine("Wait failed"); + //throw new WiimoteException("Error writing data to Wiimote...is it connected?"); + } + } + + /// + /// Read data or register from Wiimote + /// + /// Address to read + /// Length to read + /// Data buffer + public byte[] ReadData(int address, short size) + { + ClearReport(); + + mReadBuff = new byte[size]; + mAddress = address & 0xffff; + mSize = size; + + mBuff[0] = (byte)OutputReport.ReadMemory; + mBuff[1] = (byte)(((address & 0xff000000) >> 24) | GetRumbleBit()); + mBuff[2] = (byte)((address & 0x00ff0000) >> 16); + mBuff[3] = (byte)((address & 0x0000ff00) >> 8); + mBuff[4] = (byte)(address & 0x000000ff); + + mBuff[5] = (byte)((size & 0xff00) >> 8); + mBuff[6] = (byte)(size & 0xff); + + WriteReport(); + + if(!mReadDone.WaitOne(1000, false)) + throw new WiimoteException("Error reading data from Wiimote...is it connected?"); + + return mReadBuff; + } + + /// + /// Write a single byte to the Wiimote + /// + /// Address to write + /// Byte to write + public void WriteData(int address, byte data) + { + WriteData(address, 1, new byte[] { data }); + } + + /// + /// Write a byte array to a specified address + /// + /// Address to write + /// Length of buffer + /// Data buffer + + public void WriteData(int address, byte size, byte[] buff) + { + ClearReport(); + + mBuff[0] = (byte)OutputReport.WriteMemory; + mBuff[1] = (byte)(((address & 0xff000000) >> 24) | GetRumbleBit()); + mBuff[2] = (byte)((address & 0x00ff0000) >> 16); + mBuff[3] = (byte)((address & 0x0000ff00) >> 8); + mBuff[4] = (byte)(address & 0x000000ff); + mBuff[5] = size; + Array.Copy(buff, 0, mBuff, 6, size); + + WriteReport(); + } + + /// + /// Current Wiimote state + /// + public WiimoteState WiimoteState + { + get { return mWiimoteState; } + } + + /// + /// Unique identifier for this Wiimote (not persisted across application instances) + /// + public Guid ID + { + get { return mID; } + } + + /// + /// HID device path for this Wiimote (valid until Wiimote is disconnected) + /// + public string HIDDevicePath + { + get { return mDevicePath; } + } + + #region IDisposable Members + + /// + /// Dispose Wiimote + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + /// Dispose wiimote + /// + /// Disposing? + protected virtual void Dispose(bool disposing) + { + // close up our handles + if(disposing) + Disconnect(); + } + #endregion + } + + /// + /// Thrown when no Wiimotes are found in the HID device list + /// + [Serializable] + public class WiimoteNotFoundException : ApplicationException + { + /// + /// Default constructor + /// + public WiimoteNotFoundException() + { + } + + /// + /// Constructor + /// + /// Error message + public WiimoteNotFoundException(string message) : base(message) + { + } + + /// + /// Constructor + /// + /// Error message + /// Inner exception + public WiimoteNotFoundException(string message, Exception innerException) : base(message, innerException) + { + } + + /// + /// Constructor + /// + /// Serialization info + /// Streaming context + protected WiimoteNotFoundException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } + + /// + /// Represents errors that occur during the execution of the Wiimote library + /// + [Serializable] + public class WiimoteException : ApplicationException + { + /// + /// Default constructor + /// + public WiimoteException() + { + } + + /// + /// Constructor + /// + /// Error message + public WiimoteException(string message) : base(message) + { + } + + /// + /// Constructor + /// + /// Error message + /// Inner exception + public WiimoteException(string message, Exception innerException) : base(message, innerException) + { + } + + /// + /// Constructor + /// + /// Serialization info + /// Streaming context + protected WiimoteException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/WiimoteCollection.cs b/WiimoteCS/WiimoteLib/WiimoteCollection.cs new file mode 100644 index 0000000..0c63210 --- /dev/null +++ b/WiimoteCS/WiimoteLib/WiimoteCollection.cs @@ -0,0 +1,33 @@ +////////////////////////////////////////////////////////////////////////////////// +// WiimoteCollection.cs +// Managed Wiimote Library +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System.Collections.ObjectModel; + +namespace WiimoteLib +{ + /// + /// Used to manage multiple Wiimotes + /// + public class WiimoteCollection : Collection + { + /// + /// Finds all Wiimotes connected to the system and adds them to the collection + /// + public void FindAllWiimotes() + { + Wiimote.FindWiimote(WiimoteFound); + } + + private bool WiimoteFound(string devicePath) + { + this.Add(new Wiimote(devicePath)); + return true; + } + } +} diff --git a/WiimoteCS/WiimoteLib/WiimoteLib.csproj b/WiimoteCS/WiimoteLib/WiimoteLib.csproj new file mode 100644 index 0000000..75609cc --- /dev/null +++ b/WiimoteCS/WiimoteLib/WiimoteLib.csproj @@ -0,0 +1,156 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {37A555DF-7012-4B99-8A47-1C922A361E52} + Library + Properties + WiimoteLib + WiimoteLib + false + + + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + bin\Debug\WiimoteLib.XML + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + true + bin\x86\Debug\ + DEBUG;TRACE + full + x86 + true + GlobalSuppressions.cs + prompt + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + true + GlobalSuppressions.cs + prompt + + + true + bin\MSRS Debug\ + DEBUG;TRACE + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + true + bin\x86\MSRS Debug\ + DEBUG;TRACE + full + x86 + true + GlobalSuppressions.cs + prompt + + + true + bin\Debug MSRS\ + TRACE;DEBUG;MSRS + full + AnyCPU + true + GlobalSuppressions.cs + prompt + + + true + bin\x86\Debug MSRS\ + DEBUG;TRACE + full + x86 + true + GlobalSuppressions.cs + prompt + + + bin\Release MSRS\ + TRACE + true + pdbonly + AnyCPU + true + GlobalSuppressions.cs + prompt + + + bin\x86\Release MSRS\ + TRACE + true + pdbonly + x86 + true + GlobalSuppressions.cs + prompt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/changes.topic b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/changes.topic new file mode 100644 index 0000000..706e9d3 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/changes.topic @@ -0,0 +1,140 @@ + + + ]> + + + + Change Log + +
+Changes
+=======
+
+v1.7.0.0
+--------
+	o Writing registers is now properly waiting for the Wiimote to reply
+	  before continuing...this removes all of the Thread.Sleep() calls and
+	  should *greatly* improve performance when setting LEDs and rumble
+	  (Serial Nightmare & wwibrew.org)
+	o Guitar Hero: World Tour Guitar and Drums now properly recognized and
+	  used (wiibrew.org, tested by Tyler Tolley and Mauro Milazzo)
+	o Guitar whammy bar is now a 5-bit value instead of 4 (wiibrew.org)
+	o Position of 4 IRs now properly reported in Basic reporting mode
+	  (Dan Carter)
+	o Found1/2 now properly reported in MSRS (reported by akka243)
+	o MSRS project updated to Microsoft Robotics Developer Studio 2008
+
+v1.6.0.0
+--------
+	o Added "center of gravity" calculation to the Wii Fit Balance Board
+	  (thanks to Steven Battersby)
+	o Structs are now marked [Serializable] (suggested by Caio)
+	o Battery property is now a float containing the calculated percentage
+	  of battery remaining
+	o BatteryRaw is the byte value that used to be stored in the Battery
+	  property
+	o WiimoteTest app now reads extensions properly when inserted at startup
+	o Exposed HID device path in new HIDDevicePath property on Wiimote object
+	o Changed the time delay on writes to 50ms from 100ms...this should
+	  improve responsiveness of setting LEDs and rumble
+
+v1.5.2.0
+--------
+	o Ok, Balance Board support is *really* fixed this time
+	  (thanks to Manuel Schroeder, Alex Wilkinson and Eduard
+	  Kujit for testing this release)
+	o LED checkboxes are properly set on the WiimoteTest tabs
+
+v1.5.1.0
+--------
+	o Oops...a last minute change broke the one thing I was adding:  Balance
+	  Board support.  Should be working now...(identified by Manuel Schroeder)
+
+v1.5.0.0
+--------
+	o Wii Fit Balance Board support
+	o The GetStatus() method now waits for a response from the Wiimote before
+	  continuing
+	o Bug fix for ButtonsExtension report type (0x34)
+
+v1.4.0.0
+--------
+	o Multiple Wiimotes supported!
+	o Slight change to ExtensionType enum for better extension detection
+	o Decided I didn't like the dependency on System.Drawing for the 2D point
+	  so am now using my own Point structs.  Sorry...
+	o WiimoteTest app updated to show multiple Wiimotes working
+
+v1.3.0.0
+--------
+	o SetReportType contains an overload taking a new IRSensitivity parameter
+	  which will set the IR camera sensitivity when using an IR report type
+	o Created new WiimoteException type which is now thrown by the library
+	o Moved InputReport enum to namespace level
+	o Events now using the generic EventHandler class instead of custom
+	  delegates
+	o Refactored the state structures to use Point/PointF and my own
+	  Point3/Point3F
+	o Refactored IR sensors to be an array
+	o Added support for the Guitar Hero controller
+	  (tested by Matthias Shapiro, Evan Jacovier)
+	o Test app will run without Wiimote connected (Andrea Leganza)
+	o ReadData now returns the proper amount of data for requests of more than 16
+	  bytes (reported by David Hawley)
+	o Test application updated with above changes
+	o Lots of breaking changes, but the survey on my site said most didn't care
+	  about backwards compatibility...  :)
+
+v1.2.1.0
+--------
+	o Added support for IR 3 and 4 (Johnny Lee)
+
+v1.2.0.0
+--------
+	o Moved to CodePlex! (http://www.codeplex.com/WiimoteLib)
+	o New license!  Please read the included license.txt/copyright.txt for more
+	  info.  This likely doesn't change anything for anyone, but at least now
+	  it's official.
+	o AltWriteMethod deprecated.  Connect will now determine which write method
+	  to use at runtime.  It remains in case someone needs to override the
+	  write method for some reason. (gl.tter)
+	o WiimoteState.LEDState is now filled with proper values.
+	  (identified by gl.tter/Leif902)
+	o Extensions that are attached at startup are now recognized properly.
+	  (identified by Will Pressly)
+	o "Partially inserted" extensions now handled properly (Michael Dorman)
+	o SetRumble method now does this via the SetLEDs method instead of using the
+	  status report to avoid a needless response from the Wiimote. (Michael Dorman)
+	o IRState now contains RawMidX/Y and MidX/Y containing the value of the
+	  midpoint between the IR points.
+	o Async reads now begin after the data parsing and event has been raised.
+	  This should lead to non-overlapping events.
+	o Updated the test application with the above changes and cleaned up the UI
+	  updates by using delegates a bit more effeciently.
+
+	Breaking Changes (may not be a complete list)
+	----------------------------------------------
+	o LEDs renamed to LEDState
+	o GetBatteryLevel renamed to GetStatus
+	o OnWiimoteChanged renamed to WiimoteChanged
+	o OnWiimoteExtensionChanged renamed to WiimoteExtensionChanged
+	o CalibrationInfo renamed to AccelCalibrationInfo
+	o Event handlers renamed to WiimoteChangedEventHandler and
+	  WiimoteExtensionChangedEventHandler
+
+v1.1.0.0
+--------
+	o Support for XP and Vista x64 (Paul Miller)
+	o VB fix in ParseExtension (Evan Merz)
+	o New "AltWriteMethod" property which will try a secondary approach to writing
+	  to the Wiimote.  If you get an error when connecting, set this property and
+	  try again to see if it fixes the issue.
+	o Microsoft Robotics Studio project
+	  Open the WiimoteMSRS directory and start the Wiimote.sln solution to take a
+	  look! (David Lee)
+
+v1.0.1.0
+--------
+	o Calibration copy/paste error (James Darpinian)
+	
+
diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/copyright.topic b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/copyright.topic new file mode 100644 index 0000000..2ff76a7 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/copyright.topic @@ -0,0 +1,17 @@ + + + ]> + + + + Copyright + + +Copyright 2007-2009 Brian Peek
+http://www.brianpeek.com/
+http://www.codeplex.com/WiimoteLib
+http://www.wiimotelib.org/
+

+Licensed under the terms of the Microsoft Permissive License (Ms-PL).
+ + diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/license.topic b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/license.topic new file mode 100644 index 0000000..705679d --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/license.topic @@ -0,0 +1,41 @@ + + + ]> + + + + License (Ms-PL) + + +

Microsoft Public License (Ms-PL)

+This license governs use of the accompanying software. If you use the software, you accept this license. If you do not accept the license, do not use the software. +

+

1. Definitions

+

+The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning here as under U.S. copyright law. +

+A "contribution" is the original software, or any additions or changes to the software. +

+A "contributor" is any person that distributes its contribution under this license. +

+"Licensed patents" are a contributor's patent claims that read directly on its contribution. +

+

2. Grant of Rights

+

+(A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create. +

+(B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution in the software or derivative works of the contribution in the software. +

+

3. Conditions and Limitations

+

+(A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks. +

+(B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your patent license from such contributor to the software ends automatically. +

+(C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution notices that are present in the software. +

+(D) If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or object code form, you may only do so under a license that complies with this license. +

+(E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a particular purpose and non-infringement. + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/overview.topic b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/overview.topic new file mode 100644 index 0000000..ab49240 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/AdditionalContent/overview.topic @@ -0,0 +1,12 @@ + + + ]> + + + + Overview + + +WiimoteLib allows you to connect a Wiimote to your PC and communicate with it using .NET. This project started life as an article for Microsoft's Coding4Fun website. Basic usage and some internal details are all documented there for now. You can find this article here. + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/Help/WiimoteLib.chm b/WiimoteCS/WiimoteLib/docs/APIHelp/Help/WiimoteLib.chm new file mode 100644 index 0000000..408235a Binary files /dev/null and b/WiimoteCS/WiimoteLib/docs/APIHelp/Help/WiimoteLib.chm differ diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.shfb b/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.shfb new file mode 100644 index 0000000..d25c910 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.shfb @@ -0,0 +1,55 @@ + + + + + + + Functionality to communicate with a Nintendo Wii Remote (Wiimote) from .NET. + + + + + A library to communicate with the Nintendo Wii Remote (Wiimote) from .NET. + +This library started life as an article I authored at Coding4Fun. The original article can be found <a href="http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx">here</a>. It contains information on pairing the Wiimote to Bluetooth, details on the source code and how the library was built. You will want to read through this if you are at all interested on the internals. This help file only contains information on the API itself. + Summary, Parameter, Returns, AutoDocumentCtors, Namespace, TypeParameter + InheritedMembers, InheritedFrameworkMembers, Protected, SealedProtected + + + .\Help\ + + + True + True + + HtmlHelp1x + False + 2.0.50727 + False + False + False + + WiimoteLib + WiimoteLib + en-US + copyright.html + Copyright (C) 2007-2009 Brian Peek + wiimote@brianpeek.com + + + Contact me at my <a href="http://www.brianpeek.com">website</a>. For the full article written on this library, visit <a href="http://msdn.microsoft.com/coding4fun/hardware/article.aspx?articleid=1879033">Coding4Fun</a>. + Local + Msdn + Blank + vs2005 + Guid + Standard + False + True + False + Hierarchical + True + ms.vsipcc+, ms.vsexpresscc+ + 1.0.0.0 + AboveNamespaces + \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.sitemap b/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.sitemap new file mode 100644 index 0000000..9f4f972 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/APIHelp/WiimoteLib.sitemap @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/copyright.txt b/WiimoteCS/WiimoteLib/docs/copyright.txt new file mode 100644 index 0000000..b2b6eae --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/copyright.txt @@ -0,0 +1,7 @@ +Copyright 2007-2009 Brian Peek +http://www.brianpeek.com/ +http://www.codeplex.com/WiimoteLib +http://www.wiimotelib.org/ + +Licensed under the terms of the Microsoft Permissive License (Ms-PL). +See license.txt for details. \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/license.txt b/WiimoteCS/WiimoteLib/docs/license.txt new file mode 100644 index 0000000..6b46d57 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/license.txt @@ -0,0 +1,60 @@ +Microsoft Permissive License (Ms-PL) + +This license governs use of the accompanying software. If you use the software, +you accept this license. If you do not accept the license, do not use the +software. + +1. Definitions + +The terms "reproduce," "reproduction," "derivative works," and "distribution" +have the same meaning here as under U.S. copyright law. + +A "contribution" is the original software, or any additions or changes to the +software. + +A "contributor" is any person that distributes its contribution under this +license. + +"Licensed patents" are a contributor's patent claims that read directly on its +contribution. + +2. Grant of Rights + +(A) Copyright Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free copyright license to reproduce its +contribution, prepare derivative works of its contribution, and distribute its +contribution or any derivative works that you create. + +(B) Patent Grant- Subject to the terms of this license, including the license +conditions and limitations in section 3, each contributor grants you a +non-exclusive, worldwide, royalty-free license under its licensed patents to +make, have made, use, sell, offer for sale, import, and/or otherwise dispose of +its contribution in the software or derivative works of the contribution in the +software. + +3. Conditions and Limitations + +(A) No Trademark License- This license does not grant you rights to use any +contributors' name, logo, or trademarks. + +(B) If you bring a patent claim against any contributor over patents that you +claim are infringed by the software, your patent license from such contributor +to the software ends automatically. + +(C) If you distribute any portion of the software, you must retain all +copyright, patent, trademark, and attribution notices that are present in the +software. + +(D) If you distribute any portion of the software in source code form, you may +do so only under this license by including a complete copy of this license with +your distribution. If you distribute any portion of the software in compiled or +object code form, you may only do so under a license that complies with this +license. + +(E) The software is licensed "as-is." You bear the risk of using it. The +contributors give no express warranties, guarantees or conditions. You may have +additional consumer rights under your local laws which this license cannot +change. To the extent permitted under your local laws, the contributors exclude +the implied warranties of merchantability, fitness for a particular purpose and +non-infringement. \ No newline at end of file diff --git a/WiimoteCS/WiimoteLib/docs/readme.txt b/WiimoteCS/WiimoteLib/docs/readme.txt new file mode 100644 index 0000000..276b8d1 --- /dev/null +++ b/WiimoteCS/WiimoteLib/docs/readme.txt @@ -0,0 +1,140 @@ +Managed Library for Nintendo's Wiimote +v1.7.0.0 +by Brian Peek (http://www.brianpeek.com/) + +For more information, please visit the associated article for this project at: + +http://msdn.microsoft.com/coding4fun/hardware/article.aspx?articleid=1879033 + +There you will find documentation on how all of this works. + +If all else fails, please contact me at the address above. Enjoy! + +Changes +======= + +v1.7.0.0 +-------- + o Writing registers is now properly waiting for the Wiimote to reply + before continuing...this removes all of the Thread.Sleep() calls and + should *greatly* improve performance when setting LEDs and rumble + (Serial Nightmare & wwibrew.org) + o Guitar Hero: World Tour Guitar and Drums now properly recognized and + used (wiibrew.org, tested by Tyler Tolley and Mauro Milazzo) + o Guitar whammy bar is now a 5-bit value instead of 4 (wiibrew.org) + o Position of 4 IRs now properly reported in Basic reporting mode + (Dan Carter) + o Found1/2 now properly reported in MSRS (reported by akka243) + o MSRS project updated to Microsoft Robotics Developer Studio 2008 + +v1.6.0.0 +-------- + o Added "center of gravity" calculation to the Wii Fit Balance Board + (thanks to Steven Battersby) + o Structs are now marked [Serializable] (suggested by Caio) + o Battery property is now a float containing the calculated percentage + of battery remaining + o BatteryRaw is the byte value that used to be stored in the Battery + property + o WiimoteTest app now reads extensions properly when inserted at startup + o Exposed HID device path in new HIDDevicePath property on Wiimote object + o Changed the time delay on writes to 50ms from 100ms...this should + improve responsiveness of setting LEDs and rumble + +v1.5.2.0 +-------- + o Ok, Balance Board support is *really* fixed this time + (thanks to Manuel Schroeder, Eduard Kujit and Alex Wilkinson for testing) + o LED checkboxes are properly set on the WiimoteTest tabs + +v1.5.1.0 +-------- + o Oops...a last minute change broke the one thing I was adding: Balance + Board support. Should be working now...(identified by Manuel Schroeder) + +v1.5.0.0 +-------- + o Wii Fit Balance Board support + o The GetStatus() method now waits for a response from the Wiimote before + continuing + o Bug fix for ButtonsExtension report type (0x34) + +v1.4.0.0 +-------- + o Multiple Wiimotes supported! + o Slight change to ExtensionType enum for better extension detection + o Decided I didn't like the dependency on System.Drawing for the 2D point + so am now using my own Point structs. Sorry... + o WiimoteTest app updated to show multiple Wiimotes working + +v1.3.0.0 +-------- + o SetReportType contains an overload taking a new IRSensitivity parameter + which will set the IR camera sensitivity when using an IR report type + o Created new WiimoteException type which is now thrown by the library + o Moved InputReport enum to namespace level + o Events now using the generic EventHandler class instead of custom + delegates + o Refactored the state structures to use Point/PointF and my own + Point3/Point3F + o Refactored IR sensors to be an array + o Added support for the Guitar Hero controller + (tested by Matthias Shapiro, Evan Jacovier) + o Test app will run without Wiimote connected (Andrea Leganza) + o ReadData now returns the proper amount of data for requests of more than + 16 bytes (reported by David Hawley) + o Test application updated with above changes + o Lots of breaking changes, but the survey on my site said most didn't care + about backwards compatibility... :) + +v1.2.1.0 +-------- + o Added support for IR 3 and 4 (Johnny Lee) + +v1.2.0.0 +-------- + o Moved to CodePlex! (http://www.codeplex.com/WiimoteLib) + o New license! Please read the included license.txt/copyright.txt for more + info. This likely doesn't change anything for anyone, but at least now + it's official. + o AltWriteMethod deprecated. Connect will now determine which write method + to use at runtime. It remains in case someone needs to override the + write method for some reason. (gl.tter) + o WiimoteState.LEDState is now filled with proper values. + (identified by gl.tter/Leif902) + o Extensions that are attached at startup are now recognized properly. + (identified by Will Pressly) + o "Partially inserted" extensions now handled properly (Michael Dorman) + o SetRumble method now does this via the SetLEDs method instead of using the + status report to avoid a needless response from the Wiimote. (Michael Dorman) + o IRState now contains RawMidX/Y and MidX/Y containing the value of the + midpoint between the IR points. + o Async reads now begin after the data parsing and event has been raised. + This should lead to non-overlapping events. + o Updated the test application with the above changes and cleaned up the UI + updates by using delegates a bit more effeciently. + + Breaking Changes (may not be a complete list) + ---------------------------------------------- + o LEDs renamed to LEDState + o GetBatteryLevel renamed to GetStatus + o OnWiimoteChanged renamed to WiimoteChanged + o OnWiimoteExtensionChanged renamed to WiimoteExtensionChanged + o CalibrationInfo renamed to AccelCalibrationInfo + o Event handlers renamed to WiimoteChangedEventHandler and + WiimoteExtensionChangedEventHandler + +v1.1.0.0 +-------- + o Support for XP and Vista x64 (Paul Miller) + o VB fix in ParseExtension (Evan Merz) + o New "AltWriteMethod" property which will try a secondary approach to writing + to the Wiimote. If you get an error when connecting, set this property and + try again to see if it fixes the issue. + o Microsoft Robotics Studio project + Open the WiimoteMSRS directory and start the Wiimote.sln solution to take a + look! (David Lee) + +v1.0.1.0 +-------- + o Calibration copy/paste error (James Darpinian) \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/AssemblyInfo.cs b/WiimoteCS/WiimoteMSRS/AssemblyInfo.cs new file mode 100644 index 0000000..8fb1a43 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/AssemblyInfo.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// AssemblyInfo.cs +// +// This code was generated by the DssNewService tool. +// +//------------------------------------------------------------------------------ +using Microsoft.Dss.Core.Attributes; +using System; +using System.Collections.Generic; +using interopservices = System.Runtime.InteropServices; +using System.Reflection; +using System.Runtime.CompilerServices; + +[assembly: ServiceDeclaration(DssServiceDeclaration.ServiceBehavior)] +[assembly: interopservices.ComVisible(false)] + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WiimoteMSRS")] +[assembly: AssemblyDescription("Microsoft Robotics Studio Service for the Nintendo Wiimote")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyProduct("WiimoteMSRS")] +[assembly: AssemblyCopyright("Copyright © 2008 Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +[assembly: AssemblyVersion("1.5.2.0")] +[assembly: AssemblyFileVersion("1.5.2.0")] diff --git a/WiimoteCS/WiimoteMSRS/Proxy/AssemblyInfo.cs b/WiimoteCS/WiimoteMSRS/Proxy/AssemblyInfo.cs new file mode 100644 index 0000000..be98dfb --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/AssemblyInfo.cs @@ -0,0 +1,33 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3053 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using Microsoft.Dss.Core.Attributes; +using Microsoft.Dss.ServiceModel.Dssp; +using System; +using System.Collections.Generic; +using interopservices = System.Runtime.InteropServices; +#if NET_CF20 + + +[assembly: ServiceDeclaration(DssServiceDeclaration.Proxy, SourceAssemblyKey="cf.wiimote.y2007.m06, version=1.5.2.0, culture=neutral, publickeytoken=d17cbbb304dbb" + + "b71")] + +#else + + +[assembly: ServiceDeclaration(DssServiceDeclaration.Proxy, SourceAssemblyKey="wiimote.y2007.m06, version=1.5.2.0, culture=neutral, publickeytoken=d17cbbb304dbb" + + "b71")] + +#endif +[assembly: System.Security.SecurityTransparentAttribute()] +[assembly: System.Security.AllowPartiallyTrustedCallersAttribute()] +[assembly: interopservices.ComVisible(true)] + + diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Microsoft.Resources.DssModel.dss b/WiimoteCS/WiimoteMSRS/Proxy/Microsoft.Resources.DssModel.dss new file mode 100644 index 0000000..cfd3ba1 Binary files /dev/null and b/WiimoteCS/WiimoteMSRS/Proxy/Microsoft.Resources.DssModel.dss differ diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.Designer.cs b/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.Designer.cs new file mode 100644 index 0000000..64d6440 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.Designer.cs @@ -0,0 +1,74 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.42 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WiimoteLib.Properties { + using System; + + + ///

+ /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] +#if !URT_MINCLR + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] +#endif + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WiimoteLib.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a resource file similar to DssModel. + /// + internal static string DssModel { + get { + return ResourceManager.GetString("DssModel", resourceCulture); + } + } + } +} \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.resx b/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.resx new file mode 100644 index 0000000..4ea949c --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Properties/Resources.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\DssModel.dss;System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Resources/DssModel.dss b/WiimoteCS/WiimoteMSRS/Proxy/Resources/DssModel.dss new file mode 100644 index 0000000..401ad4a Binary files /dev/null and b/WiimoteCS/WiimoteMSRS/Proxy/Resources/DssModel.dss differ diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Proxy.cs b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Proxy.cs new file mode 100644 index 0000000..a1e1251 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Proxy.cs @@ -0,0 +1,3465 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3521 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::System.Reflection.AssemblyVersionAttribute("1.5.2.0")] +[assembly: global::System.Reflection.AssemblyCopyrightAttribute("Copyright © 2008 Brian Peek (www.brianpeek.com)")] +[assembly: global::System.Reflection.AssemblyCompanyAttribute("Brian Peek (www.brianpeek.com)")] +[assembly: global::System.Reflection.AssemblyProductAttribute("WiimoteMSRS")] +[assembly: global::System.Reflection.AssemblyTitleAttribute("WiimoteMSRS")] +[assembly: global::System.Reflection.AssemblyDescriptionAttribute("Microsoft Robotics Studio Service for the Nintendo Wiimote")] +[assembly: global::Microsoft.Dss.Core.Attributes.ServiceDeclarationAttribute(global::Microsoft.Dss.Core.Attributes.DssServiceDeclaration.Proxy, SourceAssemblyKey="Wiimote.Y2007.M06, Version=1.5.2.0, Culture=neutral, PublicKeyToken=21bd729cd9834" + + "f06")] +[assembly: global::System.Security.SecurityTransparentAttribute()] +[assembly: global::System.Security.AllowPartiallyTrustedCallersAttribute()] + +namespace WiimoteLib.Proxy { + + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="WiimoteState")] + public class WiimoteState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + public WiimoteState() { + } + + private global::WiimoteLib.Proxy.AccelCalibrationInfo _AccelCalibrationInfo; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.AccelCalibrationInfo AccelCalibrationInfo { + get { + return this._AccelCalibrationInfo; + } + set { + this._AccelCalibrationInfo = value; + } + } + + private global::WiimoteLib.Proxy.AccelState _AccelState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.AccelState AccelState { + get { + return this._AccelState; + } + set { + this._AccelState = value; + } + } + + private global::WiimoteLib.Proxy.ButtonState _ButtonState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.ButtonState ButtonState { + get { + return this._ButtonState; + } + set { + this._ButtonState = value; + } + } + + private global::WiimoteLib.Proxy.IRState _IRState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.IRState IRState { + get { + return this._IRState; + } + set { + this._IRState = value; + } + } + + private byte _BatteryRaw; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte BatteryRaw { + get { + return this._BatteryRaw; + } + set { + this._BatteryRaw = value; + } + } + + private float _Battery; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float Battery { + get { + return this._Battery; + } + set { + this._Battery = value; + } + } + + private bool _Rumble; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Rumble { + get { + return this._Rumble; + } + set { + this._Rumble = value; + } + } + + private bool _Extension; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Extension { + get { + return this._Extension; + } + set { + this._Extension = value; + } + } + + private global::WiimoteLib.Proxy.ExtensionType _ExtensionType; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.ExtensionType ExtensionType { + get { + return this._ExtensionType; + } + set { + this._ExtensionType = value; + } + } + + private global::WiimoteLib.Proxy.NunchukState _NunchukState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.NunchukState NunchukState { + get { + return this._NunchukState; + } + set { + this._NunchukState = value; + } + } + + private global::WiimoteLib.Proxy.ClassicControllerState _ClassicControllerState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.ClassicControllerState ClassicControllerState { + get { + return this._ClassicControllerState; + } + set { + this._ClassicControllerState = value; + } + } + + private global::WiimoteLib.Proxy.GuitarState _GuitarState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.GuitarState GuitarState { + get { + return this._GuitarState; + } + set { + this._GuitarState = value; + } + } + + private global::WiimoteLib.Proxy.DrumsState _DrumsState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.DrumsState DrumsState { + get { + return this._DrumsState; + } + set { + this._DrumsState = value; + } + } + + private global::WiimoteLib.Proxy.LEDState _LEDState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.LEDState LEDState { + get { + return this._LEDState; + } + set { + this._LEDState = value; + } + } + + /// + ///Copies the data member values of the current WiimoteState to the specified target object + /// + ///target object (must be an instance of) + public virtual void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + global::WiimoteLib.Proxy.WiimoteState typedTarget = ((global::WiimoteLib.Proxy.WiimoteState)(target)); + typedTarget._AccelCalibrationInfo = this._AccelCalibrationInfo; + typedTarget._AccelState = this._AccelState; + typedTarget._ButtonState = this._ButtonState; + typedTarget._IRState = this._IRState; + typedTarget._BatteryRaw = this._BatteryRaw; + typedTarget._Battery = this._Battery; + typedTarget._Rumble = this._Rumble; + typedTarget._Extension = this._Extension; + typedTarget._ExtensionType = this._ExtensionType; + typedTarget._NunchukState = this._NunchukState; + typedTarget._ClassicControllerState = this._ClassicControllerState; + typedTarget._GuitarState = this._GuitarState; + typedTarget._DrumsState = this._DrumsState; + typedTarget._LEDState = this._LEDState; + } + + /// + ///Clones WiimoteState + /// + ///cloned value + public virtual object Clone() { + global::WiimoteLib.Proxy.WiimoteState target0 = new global::WiimoteLib.Proxy.WiimoteState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current WiimoteState to the specified writer + /// + ///the writer to which to serialize + public virtual void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._AccelCalibrationInfo)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._AccelState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._ButtonState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._IRState)).Serialize(writer); + writer.Write(this._BatteryRaw); + writer.Write(this._Battery); + writer.Write(this._Rumble); + writer.Write(this._Extension); + writer.Write(((long)(this._ExtensionType))); + ((Microsoft.Dss.Core.IDssSerializable)(this._NunchukState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._ClassicControllerState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._GuitarState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._DrumsState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._LEDState)).Serialize(writer); + } + + /// + ///Deserializes WiimoteState + /// + ///the reader from which to deserialize + ///deserialized WiimoteState + public virtual object Deserialize(System.IO.BinaryReader reader) { + this._AccelCalibrationInfo = ((global::WiimoteLib.Proxy.AccelCalibrationInfo)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.AccelCalibrationInfo())).Deserialize(reader))); + this._AccelState = ((global::WiimoteLib.Proxy.AccelState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.AccelState())).Deserialize(reader))); + this._ButtonState = ((global::WiimoteLib.Proxy.ButtonState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.ButtonState())).Deserialize(reader))); + this._IRState = ((global::WiimoteLib.Proxy.IRState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.IRState())).Deserialize(reader))); + this._BatteryRaw = reader.ReadByte(); + this._Battery = reader.ReadSingle(); + this._Rumble = reader.ReadBoolean(); + this._Extension = reader.ReadBoolean(); + this._ExtensionType = ((global::WiimoteLib.Proxy.ExtensionType)(reader.ReadInt64())); + this._NunchukState = ((global::WiimoteLib.Proxy.NunchukState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.NunchukState())).Deserialize(reader))); + this._ClassicControllerState = ((global::WiimoteLib.Proxy.ClassicControllerState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.ClassicControllerState())).Deserialize(reader))); + this._GuitarState = ((global::WiimoteLib.Proxy.GuitarState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.GuitarState())).Deserialize(reader))); + this._DrumsState = ((global::WiimoteLib.Proxy.DrumsState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.DrumsState())).Deserialize(reader))); + this._LEDState = ((global::WiimoteLib.Proxy.LEDState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.LEDState())).Deserialize(reader))); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="AccelCalibrationInfo")] + public struct AccelCalibrationInfo : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private byte _X0; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte X0 { + get { + return this._X0; + } + set { + this._X0 = value; + } + } + + private byte _Y0; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte Y0 { + get { + return this._Y0; + } + set { + this._Y0 = value; + } + } + + private byte _Z0; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte Z0 { + get { + return this._Z0; + } + set { + this._Z0 = value; + } + } + + private byte _XG; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte XG { + get { + return this._XG; + } + set { + this._XG = value; + } + } + + private byte _YG; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte YG { + get { + return this._YG; + } + set { + this._YG = value; + } + } + + private byte _ZG; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte ZG { + get { + return this._ZG; + } + set { + this._ZG = value; + } + } + + /// + ///Copies the data member values of the current AccelCalibrationInfo to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones AccelCalibrationInfo + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.AccelCalibrationInfo target0 = new global::WiimoteLib.Proxy.AccelCalibrationInfo(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current AccelCalibrationInfo to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._X0); + writer.Write(this._Y0); + writer.Write(this._Z0); + writer.Write(this._XG); + writer.Write(this._YG); + writer.Write(this._ZG); + } + + /// + ///Deserializes AccelCalibrationInfo + /// + ///the reader from which to deserialize + ///deserialized AccelCalibrationInfo + public object Deserialize(System.IO.BinaryReader reader) { + this._X0 = reader.ReadByte(); + this._Y0 = reader.ReadByte(); + this._Z0 = reader.ReadByte(); + this._XG = reader.ReadByte(); + this._YG = reader.ReadByte(); + this._ZG = reader.ReadByte(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="AccelState")] + public struct AccelState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.Point3 _RawValues; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point3 RawValues { + get { + return this._RawValues; + } + set { + this._RawValues = value; + } + } + + private global::WiimoteLib.Proxy.Point3F _Values; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point3F Values { + get { + return this._Values; + } + set { + this._Values = value; + } + } + + /// + ///Copies the data member values of the current AccelState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones AccelState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.AccelState target0 = new global::WiimoteLib.Proxy.AccelState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current AccelState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._RawValues)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Values)).Serialize(writer); + } + + /// + ///Deserializes AccelState + /// + ///the reader from which to deserialize + ///deserialized AccelState + public object Deserialize(System.IO.BinaryReader reader) { + this._RawValues = ((global::WiimoteLib.Proxy.Point3)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point3())).Deserialize(reader))); + this._Values = ((global::WiimoteLib.Proxy.Point3F)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point3F())).Deserialize(reader))); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="Point3")] + public struct Point3 : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private int _X; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int X { + get { + return this._X; + } + set { + this._X = value; + } + } + + private int _Y; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int Y { + get { + return this._Y; + } + set { + this._Y = value; + } + } + + private int _Z; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int Z { + get { + return this._Z; + } + set { + this._Z = value; + } + } + + /// + ///Copies the data member values of the current Point3 to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones Point3 + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.Point3 target0 = new global::WiimoteLib.Proxy.Point3(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current Point3 to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._X); + writer.Write(this._Y); + writer.Write(this._Z); + } + + /// + ///Deserializes Point3 + /// + ///the reader from which to deserialize + ///deserialized Point3 + public object Deserialize(System.IO.BinaryReader reader) { + this._X = reader.ReadInt32(); + this._Y = reader.ReadInt32(); + this._Z = reader.ReadInt32(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="Point3F")] + public struct Point3F : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private float _X; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float X { + get { + return this._X; + } + set { + this._X = value; + } + } + + private float _Y; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float Y { + get { + return this._Y; + } + set { + this._Y = value; + } + } + + private float _Z; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float Z { + get { + return this._Z; + } + set { + this._Z = value; + } + } + + /// + ///Copies the data member values of the current Point3F to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones Point3F + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.Point3F target0 = new global::WiimoteLib.Proxy.Point3F(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current Point3F to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._X); + writer.Write(this._Y); + writer.Write(this._Z); + } + + /// + ///Deserializes Point3F + /// + ///the reader from which to deserialize + ///deserialized Point3F + public object Deserialize(System.IO.BinaryReader reader) { + this._X = reader.ReadSingle(); + this._Y = reader.ReadSingle(); + this._Z = reader.ReadSingle(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="ButtonState")] + public struct ButtonState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _A; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool A { + get { + return this._A; + } + set { + this._A = value; + } + } + + private bool _B; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool B { + get { + return this._B; + } + set { + this._B = value; + } + } + + private bool _Plus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Plus { + get { + return this._Plus; + } + set { + this._Plus = value; + } + } + + private bool _Home; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Home { + get { + return this._Home; + } + set { + this._Home = value; + } + } + + private bool _Minus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Minus { + get { + return this._Minus; + } + set { + this._Minus = value; + } + } + + private bool _One; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool One { + get { + return this._One; + } + set { + this._One = value; + } + } + + private bool _Two; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Two { + get { + return this._Two; + } + set { + this._Two = value; + } + } + + private bool _Up; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Up { + get { + return this._Up; + } + set { + this._Up = value; + } + } + + private bool _Down; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Down { + get { + return this._Down; + } + set { + this._Down = value; + } + } + + private bool _Left; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Left { + get { + return this._Left; + } + set { + this._Left = value; + } + } + + private bool _Right; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Right { + get { + return this._Right; + } + set { + this._Right = value; + } + } + + /// + ///Copies the data member values of the current ButtonState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones ButtonState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.ButtonState target0 = new global::WiimoteLib.Proxy.ButtonState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current ButtonState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._A); + writer.Write(this._B); + writer.Write(this._Plus); + writer.Write(this._Home); + writer.Write(this._Minus); + writer.Write(this._One); + writer.Write(this._Two); + writer.Write(this._Up); + writer.Write(this._Down); + writer.Write(this._Left); + writer.Write(this._Right); + } + + /// + ///Deserializes ButtonState + /// + ///the reader from which to deserialize + ///deserialized ButtonState + public object Deserialize(System.IO.BinaryReader reader) { + this._A = reader.ReadBoolean(); + this._B = reader.ReadBoolean(); + this._Plus = reader.ReadBoolean(); + this._Home = reader.ReadBoolean(); + this._Minus = reader.ReadBoolean(); + this._One = reader.ReadBoolean(); + this._Two = reader.ReadBoolean(); + this._Up = reader.ReadBoolean(); + this._Down = reader.ReadBoolean(); + this._Left = reader.ReadBoolean(); + this._Right = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="IRState")] + public struct IRState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.IRMode _Mode; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.IRMode Mode { + get { + return this._Mode; + } + set { + this._Mode = value; + } + } + + private WiimoteLib.Proxy.IRSensor[] _IRSensors; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public WiimoteLib.Proxy.IRSensor[] IRSensors { + get { + return this._IRSensors; + } + set { + this._IRSensors = value; + } + } + + private global::WiimoteLib.Proxy.Point _RawMidpoint; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawMidpoint { + get { + return this._RawMidpoint; + } + set { + this._RawMidpoint = value; + } + } + + private global::WiimoteLib.Proxy.PointF _Midpoint; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF Midpoint { + get { + return this._Midpoint; + } + set { + this._Midpoint = value; + } + } + + /// + ///Copies the data member values of the current IRState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones IRState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.IRState target0 = new global::WiimoteLib.Proxy.IRState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current IRState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(((byte)(this._Mode))); + if ((this._IRSensors == null)) { + writer.Write(((byte)(0))); + } + else { + writer.Write(((byte)(1))); + writer.Write(1); + writer.Write(this._IRSensors.Length); + for (int indexIRSensors = 0; (indexIRSensors < this._IRSensors.Length); indexIRSensors = (indexIRSensors + 1)) { + ((Microsoft.Dss.Core.IDssSerializable)(this._IRSensors[indexIRSensors])).Serialize(writer); + } + } + ((Microsoft.Dss.Core.IDssSerializable)(this._RawMidpoint)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Midpoint)).Serialize(writer); + } + + /// + ///Deserializes IRState + /// + ///the reader from which to deserialize + ///deserialized IRState + public object Deserialize(System.IO.BinaryReader reader) { + this._Mode = ((global::WiimoteLib.Proxy.IRMode)(reader.ReadByte())); + if ((reader.ReadByte() != 0)) { + int tmp = reader.ReadInt32(); + int count = reader.ReadInt32(); + this._IRSensors = new global::WiimoteLib.Proxy.IRSensor[count]; + for (int index = 0; (index < count); index = (index + 1)) { + this._IRSensors[index] = ((global::WiimoteLib.Proxy.IRSensor)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.IRSensor())).Deserialize(reader))); + } + } + this._RawMidpoint = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._Midpoint = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="IRSensor")] + public struct IRSensor : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.Point _RawPosition; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawPosition { + get { + return this._RawPosition; + } + set { + this._RawPosition = value; + } + } + + private global::WiimoteLib.Proxy.PointF _Position; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF Position { + get { + return this._Position; + } + set { + this._Position = value; + } + } + + private int _Size; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int Size { + get { + return this._Size; + } + set { + this._Size = value; + } + } + + private bool _Found; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Found { + get { + return this._Found; + } + set { + this._Found = value; + } + } + + /// + ///Copies the data member values of the current IRSensor to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones IRSensor + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.IRSensor target0 = new global::WiimoteLib.Proxy.IRSensor(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current IRSensor to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._RawPosition)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Position)).Serialize(writer); + writer.Write(this._Size); + writer.Write(this._Found); + } + + /// + ///Deserializes IRSensor + /// + ///the reader from which to deserialize + ///deserialized IRSensor + public object Deserialize(System.IO.BinaryReader reader) { + this._RawPosition = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._Position = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + this._Size = reader.ReadInt32(); + this._Found = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="Point")] + public struct Point : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private int _X; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int X { + get { + return this._X; + } + set { + this._X = value; + } + } + + private int _Y; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public int Y { + get { + return this._Y; + } + set { + this._Y = value; + } + } + + /// + ///Copies the data member values of the current Point to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones Point + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.Point target0 = new global::WiimoteLib.Proxy.Point(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current Point to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._X); + writer.Write(this._Y); + } + + /// + ///Deserializes Point + /// + ///the reader from which to deserialize + ///deserialized Point + public object Deserialize(System.IO.BinaryReader reader) { + this._X = reader.ReadInt32(); + this._Y = reader.ReadInt32(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="PointF")] + public struct PointF : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private float _X; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float X { + get { + return this._X; + } + set { + this._X = value; + } + } + + private float _Y; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float Y { + get { + return this._Y; + } + set { + this._Y = value; + } + } + + /// + ///Copies the data member values of the current PointF to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones PointF + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.PointF target0 = new global::WiimoteLib.Proxy.PointF(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current PointF to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._X); + writer.Write(this._Y); + } + + /// + ///Deserializes PointF + /// + ///the reader from which to deserialize + ///deserialized PointF + public object Deserialize(System.IO.BinaryReader reader) { + this._X = reader.ReadSingle(); + this._Y = reader.ReadSingle(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="NunchukState")] + public struct NunchukState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.NunchukCalibrationInfo _CalibrationInfo; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.NunchukCalibrationInfo CalibrationInfo { + get { + return this._CalibrationInfo; + } + set { + this._CalibrationInfo = value; + } + } + + private global::WiimoteLib.Proxy.AccelState _AccelState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.AccelState AccelState { + get { + return this._AccelState; + } + set { + this._AccelState = value; + } + } + + private global::WiimoteLib.Proxy.Point _RawJoystick; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawJoystick { + get { + return this._RawJoystick; + } + set { + this._RawJoystick = value; + } + } + + private global::WiimoteLib.Proxy.PointF _Joystick; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF Joystick { + get { + return this._Joystick; + } + set { + this._Joystick = value; + } + } + + private bool _C; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool C { + get { + return this._C; + } + set { + this._C = value; + } + } + + private bool _Z; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Z { + get { + return this._Z; + } + set { + this._Z = value; + } + } + + /// + ///Copies the data member values of the current NunchukState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones NunchukState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.NunchukState target0 = new global::WiimoteLib.Proxy.NunchukState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current NunchukState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._CalibrationInfo)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._AccelState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._RawJoystick)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Joystick)).Serialize(writer); + writer.Write(this._C); + writer.Write(this._Z); + } + + /// + ///Deserializes NunchukState + /// + ///the reader from which to deserialize + ///deserialized NunchukState + public object Deserialize(System.IO.BinaryReader reader) { + this._CalibrationInfo = ((global::WiimoteLib.Proxy.NunchukCalibrationInfo)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.NunchukCalibrationInfo())).Deserialize(reader))); + this._AccelState = ((global::WiimoteLib.Proxy.AccelState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.AccelState())).Deserialize(reader))); + this._RawJoystick = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._Joystick = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + this._C = reader.ReadBoolean(); + this._Z = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="NunchukCalibrationInfo")] + public struct NunchukCalibrationInfo : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private byte _MinX; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinX { + get { + return this._MinX; + } + set { + this._MinX = value; + } + } + + private byte _MidX; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidX { + get { + return this._MidX; + } + set { + this._MidX = value; + } + } + + private byte _MaxX; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxX { + get { + return this._MaxX; + } + set { + this._MaxX = value; + } + } + + private byte _MinY; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinY { + get { + return this._MinY; + } + set { + this._MinY = value; + } + } + + private byte _MidY; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidY { + get { + return this._MidY; + } + set { + this._MidY = value; + } + } + + private byte _MaxY; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxY { + get { + return this._MaxY; + } + set { + this._MaxY = value; + } + } + + /// + ///Copies the data member values of the current NunchukCalibrationInfo to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones NunchukCalibrationInfo + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.NunchukCalibrationInfo target0 = new global::WiimoteLib.Proxy.NunchukCalibrationInfo(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current NunchukCalibrationInfo to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._MinX); + writer.Write(this._MidX); + writer.Write(this._MaxX); + writer.Write(this._MinY); + writer.Write(this._MidY); + writer.Write(this._MaxY); + } + + /// + ///Deserializes NunchukCalibrationInfo + /// + ///the reader from which to deserialize + ///deserialized NunchukCalibrationInfo + public object Deserialize(System.IO.BinaryReader reader) { + this._MinX = reader.ReadByte(); + this._MidX = reader.ReadByte(); + this._MaxX = reader.ReadByte(); + this._MinY = reader.ReadByte(); + this._MidY = reader.ReadByte(); + this._MaxY = reader.ReadByte(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="ClassicControllerState")] + public struct ClassicControllerState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo _CalibrationInfo; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo CalibrationInfo { + get { + return this._CalibrationInfo; + } + set { + this._CalibrationInfo = value; + } + } + + private global::WiimoteLib.Proxy.ClassicControllerButtonState _ButtonState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.ClassicControllerButtonState ButtonState { + get { + return this._ButtonState; + } + set { + this._ButtonState = value; + } + } + + private global::WiimoteLib.Proxy.Point _RawJoystickL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawJoystickL { + get { + return this._RawJoystickL; + } + set { + this._RawJoystickL = value; + } + } + + private global::WiimoteLib.Proxy.Point _RawJoystickR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawJoystickR { + get { + return this._RawJoystickR; + } + set { + this._RawJoystickR = value; + } + } + + private global::WiimoteLib.Proxy.PointF _JoystickL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF JoystickL { + get { + return this._JoystickL; + } + set { + this._JoystickL = value; + } + } + + private global::WiimoteLib.Proxy.PointF _JoystickR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF JoystickR { + get { + return this._JoystickR; + } + set { + this._JoystickR = value; + } + } + + private byte _RawTriggerL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte RawTriggerL { + get { + return this._RawTriggerL; + } + set { + this._RawTriggerL = value; + } + } + + private byte _RawTriggerR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte RawTriggerR { + get { + return this._RawTriggerR; + } + set { + this._RawTriggerR = value; + } + } + + private float _TriggerL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float TriggerL { + get { + return this._TriggerL; + } + set { + this._TriggerL = value; + } + } + + private float _TriggerR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float TriggerR { + get { + return this._TriggerR; + } + set { + this._TriggerR = value; + } + } + + /// + ///Copies the data member values of the current ClassicControllerState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones ClassicControllerState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.ClassicControllerState target0 = new global::WiimoteLib.Proxy.ClassicControllerState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current ClassicControllerState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._CalibrationInfo)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._ButtonState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._RawJoystickL)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._RawJoystickR)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._JoystickL)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._JoystickR)).Serialize(writer); + writer.Write(this._RawTriggerL); + writer.Write(this._RawTriggerR); + writer.Write(this._TriggerL); + writer.Write(this._TriggerR); + } + + /// + ///Deserializes ClassicControllerState + /// + ///the reader from which to deserialize + ///deserialized ClassicControllerState + public object Deserialize(System.IO.BinaryReader reader) { + this._CalibrationInfo = ((global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo())).Deserialize(reader))); + this._ButtonState = ((global::WiimoteLib.Proxy.ClassicControllerButtonState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.ClassicControllerButtonState())).Deserialize(reader))); + this._RawJoystickL = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._RawJoystickR = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._JoystickL = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + this._JoystickR = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + this._RawTriggerL = reader.ReadByte(); + this._RawTriggerR = reader.ReadByte(); + this._TriggerL = reader.ReadSingle(); + this._TriggerR = reader.ReadSingle(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="ClassicControllerCalibrationInfo")] + public struct ClassicControllerCalibrationInfo : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private byte _MinXL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinXL { + get { + return this._MinXL; + } + set { + this._MinXL = value; + } + } + + private byte _MidXL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidXL { + get { + return this._MidXL; + } + set { + this._MidXL = value; + } + } + + private byte _MaxXL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxXL { + get { + return this._MaxXL; + } + set { + this._MaxXL = value; + } + } + + private byte _MinYL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinYL { + get { + return this._MinYL; + } + set { + this._MinYL = value; + } + } + + private byte _MidYL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidYL { + get { + return this._MidYL; + } + set { + this._MidYL = value; + } + } + + private byte _MaxYL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxYL { + get { + return this._MaxYL; + } + set { + this._MaxYL = value; + } + } + + private byte _MinXR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinXR { + get { + return this._MinXR; + } + set { + this._MinXR = value; + } + } + + private byte _MidXR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidXR { + get { + return this._MidXR; + } + set { + this._MidXR = value; + } + } + + private byte _MaxXR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxXR { + get { + return this._MaxXR; + } + set { + this._MaxXR = value; + } + } + + private byte _MinYR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinYR { + get { + return this._MinYR; + } + set { + this._MinYR = value; + } + } + + private byte _MidYR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MidYR { + get { + return this._MidYR; + } + set { + this._MidYR = value; + } + } + + private byte _MaxYR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxYR { + get { + return this._MaxYR; + } + set { + this._MaxYR = value; + } + } + + private byte _MinTriggerL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinTriggerL { + get { + return this._MinTriggerL; + } + set { + this._MinTriggerL = value; + } + } + + private byte _MaxTriggerL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxTriggerL { + get { + return this._MaxTriggerL; + } + set { + this._MaxTriggerL = value; + } + } + + private byte _MinTriggerR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MinTriggerR { + get { + return this._MinTriggerR; + } + set { + this._MinTriggerR = value; + } + } + + private byte _MaxTriggerR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte MaxTriggerR { + get { + return this._MaxTriggerR; + } + set { + this._MaxTriggerR = value; + } + } + + /// + ///Copies the data member values of the current ClassicControllerCalibrationInfo to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones ClassicControllerCalibrationInfo + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo target0 = new global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current ClassicControllerCalibrationInfo to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._MinXL); + writer.Write(this._MidXL); + writer.Write(this._MaxXL); + writer.Write(this._MinYL); + writer.Write(this._MidYL); + writer.Write(this._MaxYL); + writer.Write(this._MinXR); + writer.Write(this._MidXR); + writer.Write(this._MaxXR); + writer.Write(this._MinYR); + writer.Write(this._MidYR); + writer.Write(this._MaxYR); + writer.Write(this._MinTriggerL); + writer.Write(this._MaxTriggerL); + writer.Write(this._MinTriggerR); + writer.Write(this._MaxTriggerR); + } + + /// + ///Deserializes ClassicControllerCalibrationInfo + /// + ///the reader from which to deserialize + ///deserialized ClassicControllerCalibrationInfo + public object Deserialize(System.IO.BinaryReader reader) { + this._MinXL = reader.ReadByte(); + this._MidXL = reader.ReadByte(); + this._MaxXL = reader.ReadByte(); + this._MinYL = reader.ReadByte(); + this._MidYL = reader.ReadByte(); + this._MaxYL = reader.ReadByte(); + this._MinXR = reader.ReadByte(); + this._MidXR = reader.ReadByte(); + this._MaxXR = reader.ReadByte(); + this._MinYR = reader.ReadByte(); + this._MidYR = reader.ReadByte(); + this._MaxYR = reader.ReadByte(); + this._MinTriggerL = reader.ReadByte(); + this._MaxTriggerL = reader.ReadByte(); + this._MinTriggerR = reader.ReadByte(); + this._MaxTriggerR = reader.ReadByte(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="ClassicControllerButtonState")] + public struct ClassicControllerButtonState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _A; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool A { + get { + return this._A; + } + set { + this._A = value; + } + } + + private bool _B; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool B { + get { + return this._B; + } + set { + this._B = value; + } + } + + private bool _Plus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Plus { + get { + return this._Plus; + } + set { + this._Plus = value; + } + } + + private bool _Home; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Home { + get { + return this._Home; + } + set { + this._Home = value; + } + } + + private bool _Minus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Minus { + get { + return this._Minus; + } + set { + this._Minus = value; + } + } + + private bool _Up; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Up { + get { + return this._Up; + } + set { + this._Up = value; + } + } + + private bool _Down; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Down { + get { + return this._Down; + } + set { + this._Down = value; + } + } + + private bool _Left; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Left { + get { + return this._Left; + } + set { + this._Left = value; + } + } + + private bool _Right; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Right { + get { + return this._Right; + } + set { + this._Right = value; + } + } + + private bool _X; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool X { + get { + return this._X; + } + set { + this._X = value; + } + } + + private bool _Y; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Y { + get { + return this._Y; + } + set { + this._Y = value; + } + } + + private bool _ZL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool ZL { + get { + return this._ZL; + } + set { + this._ZL = value; + } + } + + private bool _ZR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool ZR { + get { + return this._ZR; + } + set { + this._ZR = value; + } + } + + private bool _TriggerL; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool TriggerL { + get { + return this._TriggerL; + } + set { + this._TriggerL = value; + } + } + + private bool _TriggerR; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool TriggerR { + get { + return this._TriggerR; + } + set { + this._TriggerR = value; + } + } + + /// + ///Copies the data member values of the current ClassicControllerButtonState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones ClassicControllerButtonState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.ClassicControllerButtonState target0 = new global::WiimoteLib.Proxy.ClassicControllerButtonState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current ClassicControllerButtonState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._A); + writer.Write(this._B); + writer.Write(this._Plus); + writer.Write(this._Home); + writer.Write(this._Minus); + writer.Write(this._Up); + writer.Write(this._Down); + writer.Write(this._Left); + writer.Write(this._Right); + writer.Write(this._X); + writer.Write(this._Y); + writer.Write(this._ZL); + writer.Write(this._ZR); + writer.Write(this._TriggerL); + writer.Write(this._TriggerR); + } + + /// + ///Deserializes ClassicControllerButtonState + /// + ///the reader from which to deserialize + ///deserialized ClassicControllerButtonState + public object Deserialize(System.IO.BinaryReader reader) { + this._A = reader.ReadBoolean(); + this._B = reader.ReadBoolean(); + this._Plus = reader.ReadBoolean(); + this._Home = reader.ReadBoolean(); + this._Minus = reader.ReadBoolean(); + this._Up = reader.ReadBoolean(); + this._Down = reader.ReadBoolean(); + this._Left = reader.ReadBoolean(); + this._Right = reader.ReadBoolean(); + this._X = reader.ReadBoolean(); + this._Y = reader.ReadBoolean(); + this._ZL = reader.ReadBoolean(); + this._ZR = reader.ReadBoolean(); + this._TriggerL = reader.ReadBoolean(); + this._TriggerR = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="GuitarState")] + public struct GuitarState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.GuitarType _GuitarType; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.GuitarType GuitarType { + get { + return this._GuitarType; + } + set { + this._GuitarType = value; + } + } + + private global::WiimoteLib.Proxy.GuitarButtonState _ButtonState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.GuitarButtonState ButtonState { + get { + return this._ButtonState; + } + set { + this._ButtonState = value; + } + } + + private global::WiimoteLib.Proxy.GuitarFretButtonState _FretButtonState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.GuitarFretButtonState FretButtonState { + get { + return this._FretButtonState; + } + set { + this._FretButtonState = value; + } + } + + private global::WiimoteLib.Proxy.GuitarFretButtonState _TouchbarState; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.GuitarFretButtonState TouchbarState { + get { + return this._TouchbarState; + } + set { + this._TouchbarState = value; + } + } + + private global::WiimoteLib.Proxy.Point _RawJoystick; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.Point RawJoystick { + get { + return this._RawJoystick; + } + set { + this._RawJoystick = value; + } + } + + private global::WiimoteLib.Proxy.PointF _Joystick; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF Joystick { + get { + return this._Joystick; + } + set { + this._Joystick = value; + } + } + + private byte _RawWhammyBar; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public byte RawWhammyBar { + get { + return this._RawWhammyBar; + } + set { + this._RawWhammyBar = value; + } + } + + private float _WhammyBar; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float WhammyBar { + get { + return this._WhammyBar; + } + set { + this._WhammyBar = value; + } + } + + /// + ///Copies the data member values of the current GuitarState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones GuitarState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.GuitarState target0 = new global::WiimoteLib.Proxy.GuitarState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current GuitarState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(((int)(this._GuitarType))); + ((Microsoft.Dss.Core.IDssSerializable)(this._ButtonState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._FretButtonState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._TouchbarState)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._RawJoystick)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Joystick)).Serialize(writer); + writer.Write(this._RawWhammyBar); + writer.Write(this._WhammyBar); + } + + /// + ///Deserializes GuitarState + /// + ///the reader from which to deserialize + ///deserialized GuitarState + public object Deserialize(System.IO.BinaryReader reader) { + this._GuitarType = ((global::WiimoteLib.Proxy.GuitarType)(reader.ReadInt32())); + this._ButtonState = ((global::WiimoteLib.Proxy.GuitarButtonState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.GuitarButtonState())).Deserialize(reader))); + this._FretButtonState = ((global::WiimoteLib.Proxy.GuitarFretButtonState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.GuitarFretButtonState())).Deserialize(reader))); + this._TouchbarState = ((global::WiimoteLib.Proxy.GuitarFretButtonState)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.GuitarFretButtonState())).Deserialize(reader))); + this._RawJoystick = ((global::WiimoteLib.Proxy.Point)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.Point())).Deserialize(reader))); + this._Joystick = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + this._RawWhammyBar = reader.ReadByte(); + this._WhammyBar = reader.ReadSingle(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="GuitarButtonState")] + public struct GuitarButtonState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _StrumUp; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool StrumUp { + get { + return this._StrumUp; + } + set { + this._StrumUp = value; + } + } + + private bool _StrumDown; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool StrumDown { + get { + return this._StrumDown; + } + set { + this._StrumDown = value; + } + } + + private bool _Minus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Minus { + get { + return this._Minus; + } + set { + this._Minus = value; + } + } + + private bool _Plus; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Plus { + get { + return this._Plus; + } + set { + this._Plus = value; + } + } + + /// + ///Copies the data member values of the current GuitarButtonState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones GuitarButtonState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.GuitarButtonState target0 = new global::WiimoteLib.Proxy.GuitarButtonState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current GuitarButtonState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._StrumUp); + writer.Write(this._StrumDown); + writer.Write(this._Minus); + writer.Write(this._Plus); + } + + /// + ///Deserializes GuitarButtonState + /// + ///the reader from which to deserialize + ///deserialized GuitarButtonState + public object Deserialize(System.IO.BinaryReader reader) { + this._StrumUp = reader.ReadBoolean(); + this._StrumDown = reader.ReadBoolean(); + this._Minus = reader.ReadBoolean(); + this._Plus = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="GuitarFretButtonState")] + public struct GuitarFretButtonState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _Green; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Green { + get { + return this._Green; + } + set { + this._Green = value; + } + } + + private bool _Red; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Red { + get { + return this._Red; + } + set { + this._Red = value; + } + } + + private bool _Yellow; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Yellow { + get { + return this._Yellow; + } + set { + this._Yellow = value; + } + } + + private bool _Blue; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Blue { + get { + return this._Blue; + } + set { + this._Blue = value; + } + } + + private bool _Orange; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Orange { + get { + return this._Orange; + } + set { + this._Orange = value; + } + } + + /// + ///Copies the data member values of the current GuitarFretButtonState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones GuitarFretButtonState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.GuitarFretButtonState target0 = new global::WiimoteLib.Proxy.GuitarFretButtonState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current GuitarFretButtonState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._Green); + writer.Write(this._Red); + writer.Write(this._Yellow); + writer.Write(this._Blue); + writer.Write(this._Orange); + } + + /// + ///Deserializes GuitarFretButtonState + /// + ///the reader from which to deserialize + ///deserialized GuitarFretButtonState + public object Deserialize(System.IO.BinaryReader reader) { + this._Green = reader.ReadBoolean(); + this._Red = reader.ReadBoolean(); + this._Yellow = reader.ReadBoolean(); + this._Blue = reader.ReadBoolean(); + this._Orange = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="DrumsState")] + public struct DrumsState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + /// + ///Copies the data member values of the current DrumsState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones DrumsState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.DrumsState target0 = new global::WiimoteLib.Proxy.DrumsState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current DrumsState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + } + + /// + ///Deserializes DrumsState + /// + ///the reader from which to deserialize + ///deserialized DrumsState + public object Deserialize(System.IO.BinaryReader reader) { + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="LEDState")] + public struct LEDState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _LED1; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool LED1 { + get { + return this._LED1; + } + set { + this._LED1 = value; + } + } + + private bool _LED2; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool LED2 { + get { + return this._LED2; + } + set { + this._LED2 = value; + } + } + + private bool _LED3; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool LED3 { + get { + return this._LED3; + } + set { + this._LED3 = value; + } + } + + private bool _LED4; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool LED4 { + get { + return this._LED4; + } + set { + this._LED4 = value; + } + } + + /// + ///Copies the data member values of the current LEDState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones LEDState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.LEDState target0 = new global::WiimoteLib.Proxy.LEDState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current LEDState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._LED1); + writer.Write(this._LED2); + writer.Write(this._LED3); + writer.Write(this._LED4); + } + + /// + ///Deserializes LEDState + /// + ///the reader from which to deserialize + ///deserialized LEDState + public object Deserialize(System.IO.BinaryReader reader) { + this._LED1 = reader.ReadBoolean(); + this._LED2 = reader.ReadBoolean(); + this._LED3 = reader.ReadBoolean(); + this._LED4 = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="RumbleRequest")] + public struct RumbleRequest : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private bool _Rumble; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public bool Rumble { + get { + return this._Rumble; + } + set { + this._Rumble = value; + } + } + + /// + ///Copies the data member values of the current RumbleRequest to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones RumbleRequest + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.RumbleRequest target0 = new global::WiimoteLib.Proxy.RumbleRequest(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current RumbleRequest to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._Rumble); + } + + /// + ///Deserializes RumbleRequest + /// + ///the reader from which to deserialize + ///deserialized RumbleRequest + public object Deserialize(System.IO.BinaryReader reader) { + this._Rumble = reader.ReadBoolean(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="BalanceBoardState")] + public struct BalanceBoardState : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo _CalibrationInfo; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo CalibrationInfo { + get { + return this._CalibrationInfo; + } + set { + this._CalibrationInfo = value; + } + } + + private global::WiimoteLib.Proxy.BalanceBoardSensors _SensorValuesRaw; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensors SensorValuesRaw { + get { + return this._SensorValuesRaw; + } + set { + this._SensorValuesRaw = value; + } + } + + private global::WiimoteLib.Proxy.BalanceBoardSensorsF _SensorValuesKg; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensorsF SensorValuesKg { + get { + return this._SensorValuesKg; + } + set { + this._SensorValuesKg = value; + } + } + + private global::WiimoteLib.Proxy.BalanceBoardSensorsF _SensorValuesLb; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensorsF SensorValuesLb { + get { + return this._SensorValuesLb; + } + set { + this._SensorValuesLb = value; + } + } + + private float _WeightKg; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float WeightKg { + get { + return this._WeightKg; + } + set { + this._WeightKg = value; + } + } + + private float _WeightLb; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float WeightLb { + get { + return this._WeightLb; + } + set { + this._WeightLb = value; + } + } + + private global::WiimoteLib.Proxy.PointF _CenterOfGravity; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.PointF CenterOfGravity { + get { + return this._CenterOfGravity; + } + set { + this._CenterOfGravity = value; + } + } + + /// + ///Copies the data member values of the current BalanceBoardState to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones BalanceBoardState + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.BalanceBoardState target0 = new global::WiimoteLib.Proxy.BalanceBoardState(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current BalanceBoardState to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._CalibrationInfo)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._SensorValuesRaw)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._SensorValuesKg)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._SensorValuesLb)).Serialize(writer); + writer.Write(this._WeightKg); + writer.Write(this._WeightLb); + ((Microsoft.Dss.Core.IDssSerializable)(this._CenterOfGravity)).Serialize(writer); + } + + /// + ///Deserializes BalanceBoardState + /// + ///the reader from which to deserialize + ///deserialized BalanceBoardState + public object Deserialize(System.IO.BinaryReader reader) { + this._CalibrationInfo = ((global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo())).Deserialize(reader))); + this._SensorValuesRaw = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensors())).Deserialize(reader))); + this._SensorValuesKg = ((global::WiimoteLib.Proxy.BalanceBoardSensorsF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensorsF())).Deserialize(reader))); + this._SensorValuesLb = ((global::WiimoteLib.Proxy.BalanceBoardSensorsF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensorsF())).Deserialize(reader))); + this._WeightKg = reader.ReadSingle(); + this._WeightLb = reader.ReadSingle(); + this._CenterOfGravity = ((global::WiimoteLib.Proxy.PointF)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.PointF())).Deserialize(reader))); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="BalanceBoardCalibrationInfo")] + public struct BalanceBoardCalibrationInfo : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private global::WiimoteLib.Proxy.BalanceBoardSensors _Kg0; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensors Kg0 { + get { + return this._Kg0; + } + set { + this._Kg0 = value; + } + } + + private global::WiimoteLib.Proxy.BalanceBoardSensors _Kg17; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensors Kg17 { + get { + return this._Kg17; + } + set { + this._Kg17 = value; + } + } + + private global::WiimoteLib.Proxy.BalanceBoardSensors _Kg34; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public global::WiimoteLib.Proxy.BalanceBoardSensors Kg34 { + get { + return this._Kg34; + } + set { + this._Kg34 = value; + } + } + + /// + ///Copies the data member values of the current BalanceBoardCalibrationInfo to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones BalanceBoardCalibrationInfo + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo target0 = new global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current BalanceBoardCalibrationInfo to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + ((Microsoft.Dss.Core.IDssSerializable)(this._Kg0)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Kg17)).Serialize(writer); + ((Microsoft.Dss.Core.IDssSerializable)(this._Kg34)).Serialize(writer); + } + + /// + ///Deserializes BalanceBoardCalibrationInfo + /// + ///the reader from which to deserialize + ///deserialized BalanceBoardCalibrationInfo + public object Deserialize(System.IO.BinaryReader reader) { + this._Kg0 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensors())).Deserialize(reader))); + this._Kg17 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensors())).Deserialize(reader))); + this._Kg34 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(((Microsoft.Dss.Core.IDssSerializable)(new global::WiimoteLib.Proxy.BalanceBoardSensors())).Deserialize(reader))); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="BalanceBoardSensors")] + public struct BalanceBoardSensors : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private short _TopRight; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public short TopRight { + get { + return this._TopRight; + } + set { + this._TopRight = value; + } + } + + private short _TopLeft; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public short TopLeft { + get { + return this._TopLeft; + } + set { + this._TopLeft = value; + } + } + + private short _BottomRight; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public short BottomRight { + get { + return this._BottomRight; + } + set { + this._BottomRight = value; + } + } + + private short _BottomLeft; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public short BottomLeft { + get { + return this._BottomLeft; + } + set { + this._BottomLeft = value; + } + } + + /// + ///Copies the data member values of the current BalanceBoardSensors to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones BalanceBoardSensors + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.BalanceBoardSensors target0 = new global::WiimoteLib.Proxy.BalanceBoardSensors(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current BalanceBoardSensors to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._TopRight); + writer.Write(this._TopLeft); + writer.Write(this._BottomRight); + writer.Write(this._BottomLeft); + } + + /// + ///Deserializes BalanceBoardSensors + /// + ///the reader from which to deserialize + ///deserialized BalanceBoardSensors + public object Deserialize(System.IO.BinaryReader reader) { + this._TopRight = reader.ReadInt16(); + this._TopLeft = reader.ReadInt16(); + this._BottomRight = reader.ReadInt16(); + this._BottomLeft = reader.ReadInt16(); + return this; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="BalanceBoardSensorsF")] + public struct BalanceBoardSensorsF : global::Microsoft.Dss.Core.IDssSerializable, global::System.ICloneable { + + private float _TopRight; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float TopRight { + get { + return this._TopRight; + } + set { + this._TopRight = value; + } + } + + private float _TopLeft; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float TopLeft { + get { + return this._TopLeft; + } + set { + this._TopLeft = value; + } + } + + private float _BottomRight; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float BottomRight { + get { + return this._BottomRight; + } + set { + this._BottomRight = value; + } + } + + private float _BottomLeft; + + [global::Microsoft.Dss.Core.Attributes.DataMemberAttribute(Order=-1)] + public float BottomLeft { + get { + return this._BottomLeft; + } + set { + this._BottomLeft = value; + } + } + + /// + ///Copies the data member values of the current BalanceBoardSensorsF to the specified target object + /// + ///target object (must be an instance of) + public void CopyTo(Microsoft.Dss.Core.IDssSerializable target) { + throw new System.InvalidOperationException("CopyTo() is not valid for structs!"); + } + + /// + ///Clones BalanceBoardSensorsF + /// + ///cloned value + public object Clone() { + global::WiimoteLib.Proxy.BalanceBoardSensorsF target0 = new global::WiimoteLib.Proxy.BalanceBoardSensorsF(); + this.CopyTo(target0); + return target0; + } + + /// + ///Serializes the data member values of the current BalanceBoardSensorsF to the specified writer + /// + ///the writer to which to serialize + public void Serialize(System.IO.BinaryWriter writer) { + writer.Write(this._TopRight); + writer.Write(this._TopLeft); + writer.Write(this._BottomRight); + writer.Write(this._BottomLeft); + } + + /// + ///Deserializes BalanceBoardSensorsF + /// + ///the reader from which to deserialize + ///deserialized BalanceBoardSensorsF + public object Deserialize(System.IO.BinaryReader reader) { + this._TopRight = reader.ReadSingle(); + this._TopLeft = reader.ReadSingle(); + this._BottomRight = reader.ReadSingle(); + this._BottomLeft = reader.ReadSingle(); + return this; + } + } + + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class Get : global::Microsoft.Dss.ServiceModel.Dssp.Get> { + + public Get() { + } + + public Get(global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body) : + base(body) { + } + + public Get(global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body, global::Microsoft.Ccr.Core.PortSet responsePort) : + base(body, responsePort) { + } + } + + [global::System.ComponentModel.DisplayNameAttribute("Subscribe")] + [global::System.ComponentModel.DescriptionAttribute("Subscribe to Wiimote service notifications.")] + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class Subscribe : global::Microsoft.Dss.ServiceModel.Dssp.Subscribe> { + + public Subscribe() { + } + + public Subscribe(global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body) : + base(body) { + } + + public Subscribe(global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body, global::Microsoft.Ccr.Core.PortSet responsePort) : + base(body, responsePort) { + } + } + + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class WiimoteChanged : global::Microsoft.Dss.ServiceModel.Dssp.Update> { + + public WiimoteChanged() { + } + + public WiimoteChanged(global::WiimoteLib.Proxy.WiimoteState body) : + base(body) { + } + + public WiimoteChanged(global::WiimoteLib.Proxy.WiimoteState body, global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) { + } + } + + [global::System.ComponentModel.DisplayNameAttribute("Set Wiimote Leds")] + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class SetLEDs : global::Microsoft.Dss.ServiceModel.Dssp.Update> { + + public SetLEDs() { + } + + public SetLEDs(global::WiimoteLib.Proxy.LEDState body) : + base(body) { + } + + public SetLEDs(global::WiimoteLib.Proxy.LEDState body, global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) { + } + } + + [global::System.ComponentModel.DisplayNameAttribute("Set Wiimote Rumble")] + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class SetRumble : global::Microsoft.Dss.ServiceModel.Dssp.Update> { + + public SetRumble() { + } + + public SetRumble(global::WiimoteLib.Proxy.RumbleRequest body) : + base(body) { + } + + public SetRumble(global::WiimoteLib.Proxy.RumbleRequest body, global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) { + } + } + + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + public class WiimoteOperations : global::Microsoft.Ccr.Core.PortSet { + + public WiimoteOperations() { + } + + public virtual global::Microsoft.Ccr.Core.PortSet DsspDefaultLookup() { + global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice DsspDefaultLookup(out global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup operation) { + global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet DsspDefaultLookup(global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + } + global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice DsspDefaultLookup(global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body, out global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup operation) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + } + operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet DsspDefaultDrop() { + global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice DsspDefaultDrop(out global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop operation) { + global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet DsspDefaultDrop(global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType body) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + } + global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice DsspDefaultDrop(global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType body, out global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop operation) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + } + operation = new global::Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet Get() { + global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + global::WiimoteLib.Proxy.Get operation = new global::WiimoteLib.Proxy.Get(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice Get(out global::WiimoteLib.Proxy.Get operation) { + global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + operation = new global::WiimoteLib.Proxy.Get(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet Get(global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + } + global::WiimoteLib.Proxy.Get operation = new global::WiimoteLib.Proxy.Get(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice Get(global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType body, out global::WiimoteLib.Proxy.Get operation) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + } + operation = new global::WiimoteLib.Proxy.Get(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet Subscribe(global::Microsoft.Ccr.Core.IPort notificationPort, params System.Type[] types) { + global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + global::WiimoteLib.Proxy.Subscribe operation = new global::WiimoteLib.Proxy.Subscribe(body); + operation.NotificationPort = notificationPort; + if ((types != null)) { + body.TypeFilter = new string[types.Length]; + for (int index = 0; (index < types.Length); index = (index + 1)) { + body.TypeFilter[index] = global::Microsoft.Dss.ServiceModel.DsspServiceBase.DsspServiceBase.GetTypeFilterDescription(types[index]); + } + } + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice Subscribe(global::Microsoft.Ccr.Core.IPort notificationPort, out global::WiimoteLib.Proxy.Subscribe operation, params System.Type[] types) { + global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body = new global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + operation = new global::WiimoteLib.Proxy.Subscribe(body); + operation.NotificationPort = notificationPort; + if ((types != null)) { + body.TypeFilter = new string[types.Length]; + for (int index = 0; (index < types.Length); index = (index + 1)) { + body.TypeFilter[index] = global::Microsoft.Dss.ServiceModel.DsspServiceBase.DsspServiceBase.GetTypeFilterDescription(types[index]); + } + } + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.PortSet Subscribe(global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body, global::Microsoft.Ccr.Core.IPort notificationPort, params System.Type[] types) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + } + global::WiimoteLib.Proxy.Subscribe operation = new global::WiimoteLib.Proxy.Subscribe(body); + operation.NotificationPort = notificationPort; + if ((types != null)) { + body.TypeFilter = new string[types.Length]; + for (int index = 0; (index < types.Length); index = (index + 1)) { + body.TypeFilter[index] = global::Microsoft.Dss.ServiceModel.DsspServiceBase.DsspServiceBase.GetTypeFilterDescription(types[index]); + } + } + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice Subscribe(global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body, global::Microsoft.Ccr.Core.IPort notificationPort, out global::WiimoteLib.Proxy.Subscribe operation, params System.Type[] types) { + if ((body == null)) { + body = new global::Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + } + operation = new global::WiimoteLib.Proxy.Subscribe(body); + operation.NotificationPort = notificationPort; + if ((types != null)) { + body.TypeFilter = new string[types.Length]; + for (int index = 0; (index < types.Length); index = (index + 1)) { + body.TypeFilter[index] = global::Microsoft.Dss.ServiceModel.DsspServiceBase.DsspServiceBase.GetTypeFilterDescription(types[index]); + } + } + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort WiimoteChanged() { + global::WiimoteLib.Proxy.WiimoteState body = new global::WiimoteLib.Proxy.WiimoteState(); + global::WiimoteLib.Proxy.WiimoteChanged operation = new global::WiimoteLib.Proxy.WiimoteChanged(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice WiimoteChanged(out global::WiimoteLib.Proxy.WiimoteChanged operation) { + global::WiimoteLib.Proxy.WiimoteState body = new global::WiimoteLib.Proxy.WiimoteState(); + operation = new global::WiimoteLib.Proxy.WiimoteChanged(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort WiimoteChanged(global::WiimoteLib.Proxy.WiimoteState body) { + if ((body == null)) { + body = new global::WiimoteLib.Proxy.WiimoteState(); + } + global::WiimoteLib.Proxy.WiimoteChanged operation = new global::WiimoteLib.Proxy.WiimoteChanged(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice WiimoteChanged(global::WiimoteLib.Proxy.WiimoteState body, out global::WiimoteLib.Proxy.WiimoteChanged operation) { + if ((body == null)) { + body = new global::WiimoteLib.Proxy.WiimoteState(); + } + operation = new global::WiimoteLib.Proxy.WiimoteChanged(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetLEDs() { + global::WiimoteLib.Proxy.LEDState body = new global::WiimoteLib.Proxy.LEDState(); + global::WiimoteLib.Proxy.SetLEDs operation = new global::WiimoteLib.Proxy.SetLEDs(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice SetLEDs(out global::WiimoteLib.Proxy.SetLEDs operation) { + global::WiimoteLib.Proxy.LEDState body = new global::WiimoteLib.Proxy.LEDState(); + operation = new global::WiimoteLib.Proxy.SetLEDs(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetLEDs(global::WiimoteLib.Proxy.LEDState body) { + global::WiimoteLib.Proxy.SetLEDs operation = new global::WiimoteLib.Proxy.SetLEDs(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice SetLEDs(global::WiimoteLib.Proxy.LEDState body, out global::WiimoteLib.Proxy.SetLEDs operation) { + operation = new global::WiimoteLib.Proxy.SetLEDs(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetRumble() { + global::WiimoteLib.Proxy.RumbleRequest body = new global::WiimoteLib.Proxy.RumbleRequest(); + global::WiimoteLib.Proxy.SetRumble operation = new global::WiimoteLib.Proxy.SetRumble(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice SetRumble(out global::WiimoteLib.Proxy.SetRumble operation) { + global::WiimoteLib.Proxy.RumbleRequest body = new global::WiimoteLib.Proxy.RumbleRequest(); + operation = new global::WiimoteLib.Proxy.SetRumble(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetRumble(global::WiimoteLib.Proxy.RumbleRequest body) { + global::WiimoteLib.Proxy.SetRumble operation = new global::WiimoteLib.Proxy.SetRumble(body); + this.Post(operation); + return operation.ResponsePort; + } + + public virtual global::Microsoft.Ccr.Core.Choice SetRumble(global::WiimoteLib.Proxy.RumbleRequest body, out global::WiimoteLib.Proxy.SetRumble operation) { + operation = new global::WiimoteLib.Proxy.SetRumble(body); + this.Post(operation); + return operation.ResponsePort; + } + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="IRMode")] + public enum IRMode : byte { + + Off = 0, + + Basic = 1, + + Extended = 3, + + Full = 5, + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="ExtensionType")] + public enum ExtensionType : long { + + None = 0, + + Nunchuk = 2753560576, + + ClassicController = 2753560833, + + Guitar = 2753560835, + + Drums = 1102265188611, + + BalanceBoard = 2753561602, + + ParitallyInserted = 281474976710655, + } + + [global::Microsoft.Dss.Core.Attributes.DataContractAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + [global::System.Xml.Serialization.XmlRootAttribute(Namespace="http://schemas.tempuri.org/2007/06/wiimote.html", ElementName="GuitarType")] + public enum GuitarType : int { + + GuitarHero3 = 0, + + GuitarHeroWorldTour = 1, + } + + [global::System.Xml.Serialization.XmlTypeAttribute(IncludeInSchema=false)] + [global::System.ComponentModel.DescriptionAttribute("The Wiimote Service")] + [global::System.ComponentModel.DisplayNameAttribute("Wiimote")] + public class Contract { + + public const string Identifier = "http://schemas.tempuri.org/2007/06/wiimote.html"; + + /// Creates a new instance of the service. + /// Service constructor port + /// service path + /// the partners of the service instance + /// create service response port + public static global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort CreateService(global::Microsoft.Dss.Services.Constructor.ConstructorPort constructorServicePort, string service, params Microsoft.Dss.ServiceModel.Dssp.PartnerType[] partners) { + global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort result = new global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort(); + global::Microsoft.Dss.ServiceModel.Dssp.ServiceInfoType serviceInfo = new global::Microsoft.Dss.ServiceModel.Dssp.ServiceInfoType("http://schemas.tempuri.org/2007/06/wiimote.html", service); + if ((partners != null)) { + serviceInfo.PartnerList = new System.Collections.Generic.List(partners); + } + global::Microsoft.Dss.Services.Constructor.Create create = new global::Microsoft.Dss.Services.Constructor.Create(serviceInfo, result); + constructorServicePort.Post(create); + return result; + } + + /// Creates a new instance of the service. + /// Service constructor port + /// the partners of the service instance + /// create service response port + public static global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort CreateService(global::Microsoft.Dss.Services.Constructor.ConstructorPort constructorServicePort, params Microsoft.Dss.ServiceModel.Dssp.PartnerType[] partners) { + global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort result = new global::Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort(); + global::Microsoft.Dss.ServiceModel.Dssp.ServiceInfoType serviceInfo = new global::Microsoft.Dss.ServiceModel.Dssp.ServiceInfoType("http://schemas.tempuri.org/2007/06/wiimote.html", null); + if ((partners != null)) { + serviceInfo.PartnerList = new System.Collections.Generic.List(partners); + } + global::Microsoft.Dss.Services.Constructor.Create create = new global::Microsoft.Dss.Services.Constructor.Create(serviceInfo, result); + constructorServicePort.Post(create); + return result; + } + } + + public class CombinedOperationsPort : global::Microsoft.Dss.Core.DssCombinedOperationsPort { + + public CombinedOperationsPort() { + this.WiimoteOperations = new global::WiimoteLib.Proxy.WiimoteOperations(); + base.Initialize(new global::Microsoft.Dss.Core.DssOperationsPortMetadata(this.WiimoteOperations, "http://schemas.tempuri.org/2007/06/wiimote.html", "WiimoteOperations", "")); + } + + public global::WiimoteLib.Proxy.WiimoteOperations WiimoteOperations; + } +} diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Transform.cs b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Transform.cs new file mode 100644 index 0000000..47fdb43 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.Transform.cs @@ -0,0 +1,733 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3521 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +[assembly: global::System.Reflection.AssemblyVersionAttribute("1.5.2.0")] +[assembly: global::System.Reflection.AssemblyCopyrightAttribute("Copyright © 2008 Brian Peek (www.brianpeek.com)")] +[assembly: global::System.Reflection.AssemblyCompanyAttribute("Brian Peek (www.brianpeek.com)")] +[assembly: global::System.Reflection.AssemblyProductAttribute("WiimoteMSRS")] +[assembly: global::System.Reflection.AssemblyTitleAttribute("WiimoteMSRS")] +[assembly: global::System.Reflection.AssemblyDescriptionAttribute("Microsoft Robotics Studio Service for the Nintendo Wiimote")] +[assembly: global::Microsoft.Dss.Core.Attributes.ServiceDeclarationAttribute(global::Microsoft.Dss.Core.Attributes.DssServiceDeclaration.Transform, SourceAssemblyKey="Wiimote.Y2007.M06, Version=1.5.2.0, Culture=neutral, PublicKeyToken=21bd729cd9834" + + "f06")] +[assembly: global::System.Security.SecurityTransparentAttribute()] +[assembly: global::System.Security.AllowPartiallyTrustedCallersAttribute()] + +namespace Dss.Transforms.TransformWiimote { + + + public class Transforms : global::Microsoft.Dss.Core.Transforms.TransformBase { + + static Transforms() { + Register(); + } + + public static void Register() { + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.WiimoteState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_WiimoteState_TO_WiimoteLib_WiimoteState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.WiimoteState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_WiimoteState_TO_WiimoteLib_Proxy_WiimoteState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.AccelCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.AccelCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.AccelState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.AccelState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.Point3), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.Point3), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.Point3F), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.Point3F), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.ButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.ButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.IRState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.IRState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.IRSensor), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.IRSensor), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.Point), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.Point), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.PointF), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.PointF), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.NunchukState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.NunchukState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.NunchukCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.NunchukCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.ClassicControllerState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.ClassicControllerState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.ClassicControllerCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.ClassicControllerButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.ClassicControllerButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.GuitarState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.GuitarState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.GuitarButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.GuitarButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.GuitarFretButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_GuitarFretButtonState_TO_WiimoteLib_GuitarFretButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.GuitarFretButtonState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_GuitarFretButtonState_TO_WiimoteLib_Proxy_GuitarFretButtonState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.DrumsState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_DrumsState_TO_WiimoteLib_DrumsState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.DrumsState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_DrumsState_TO_WiimoteLib_Proxy_DrumsState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.LEDState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.LEDState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.RumbleRequest), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_RumbleRequest_TO_WiimoteLib_RumbleRequest)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.RumbleRequest), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_RumbleRequest_TO_WiimoteLib_Proxy_RumbleRequest)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.BalanceBoardState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_BalanceBoardState_TO_WiimoteLib_BalanceBoardState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.BalanceBoardState), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_BalanceBoardState_TO_WiimoteLib_Proxy_BalanceBoardState)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.BalanceBoardCalibrationInfo), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.BalanceBoardSensors), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.BalanceBoardSensors), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddProxyTransform(typeof(global::WiimoteLib.Proxy.BalanceBoardSensorsF), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF)); + global::Microsoft.Dss.Core.Transforms.TransformBase.AddSourceTransform(typeof(global::WiimoteLib.BalanceBoardSensorsF), new global::Microsoft.Dss.Core.Attributes.Transform(WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF)); + } + + public static object WiimoteLib_Proxy_WiimoteState_TO_WiimoteLib_WiimoteState(object transformFrom) { + global::WiimoteLib.WiimoteState target = new global::WiimoteLib.WiimoteState(); + global::WiimoteLib.Proxy.WiimoteState from = ((global::WiimoteLib.Proxy.WiimoteState)(transformFrom)); + target.AccelCalibrationInfo = ((global::WiimoteLib.AccelCalibrationInfo)(WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo(from.AccelCalibrationInfo))); + target.AccelState = ((global::WiimoteLib.AccelState)(WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(from.AccelState))); + target.ButtonState = ((global::WiimoteLib.ButtonState)(WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState(from.ButtonState))); + target.IRState = ((global::WiimoteLib.IRState)(WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState(from.IRState))); + target.BatteryRaw = from.BatteryRaw; + target.Battery = from.Battery; + target.Rumble = from.Rumble; + target.Extension = from.Extension; + target.ExtensionType = ((global::WiimoteLib.ExtensionType)(((long)(from.ExtensionType)))); + target.NunchukState = ((global::WiimoteLib.NunchukState)(WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState(from.NunchukState))); + target.ClassicControllerState = ((global::WiimoteLib.ClassicControllerState)(WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState(from.ClassicControllerState))); + target.GuitarState = ((global::WiimoteLib.GuitarState)(WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState(from.GuitarState))); + target.DrumsState = ((global::WiimoteLib.DrumsState)(WiimoteLib_Proxy_DrumsState_TO_WiimoteLib_DrumsState(from.DrumsState))); + target.LEDState = ((global::WiimoteLib.LEDState)(WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState(from.LEDState))); + return target; + } + + public static object WiimoteLib_WiimoteState_TO_WiimoteLib_Proxy_WiimoteState(object transformFrom) { + global::WiimoteLib.Proxy.WiimoteState target = new global::WiimoteLib.Proxy.WiimoteState(); + global::WiimoteLib.WiimoteState from = ((global::WiimoteLib.WiimoteState)(transformFrom)); + global::WiimoteLib.AccelCalibrationInfo tmp = from.AccelCalibrationInfo; + target.AccelCalibrationInfo = ((global::WiimoteLib.Proxy.AccelCalibrationInfo)(WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo(tmp))); + global::WiimoteLib.AccelState tmp0 = from.AccelState; + target.AccelState = ((global::WiimoteLib.Proxy.AccelState)(WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(tmp0))); + global::WiimoteLib.ButtonState tmp1 = from.ButtonState; + target.ButtonState = ((global::WiimoteLib.Proxy.ButtonState)(WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState(tmp1))); + global::WiimoteLib.IRState tmp2 = from.IRState; + target.IRState = ((global::WiimoteLib.Proxy.IRState)(WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState(tmp2))); + target.BatteryRaw = from.BatteryRaw; + target.Battery = from.Battery; + target.Rumble = from.Rumble; + target.Extension = from.Extension; + target.ExtensionType = ((global::WiimoteLib.Proxy.ExtensionType)(((long)(from.ExtensionType)))); + global::WiimoteLib.NunchukState tmp3 = from.NunchukState; + target.NunchukState = ((global::WiimoteLib.Proxy.NunchukState)(WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState(tmp3))); + global::WiimoteLib.ClassicControllerState tmp4 = from.ClassicControllerState; + target.ClassicControllerState = ((global::WiimoteLib.Proxy.ClassicControllerState)(WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState(tmp4))); + global::WiimoteLib.GuitarState tmp5 = from.GuitarState; + target.GuitarState = ((global::WiimoteLib.Proxy.GuitarState)(WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState(tmp5))); + global::WiimoteLib.DrumsState tmp6 = from.DrumsState; + target.DrumsState = ((global::WiimoteLib.Proxy.DrumsState)(WiimoteLib_DrumsState_TO_WiimoteLib_Proxy_DrumsState(tmp6))); + global::WiimoteLib.LEDState tmp7 = from.LEDState; + target.LEDState = ((global::WiimoteLib.Proxy.LEDState)(WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState(tmp7))); + return target; + } + + public static object WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo(object transformFrom) { + global::WiimoteLib.AccelCalibrationInfo target = new global::WiimoteLib.AccelCalibrationInfo(); + global::WiimoteLib.Proxy.AccelCalibrationInfo from = ((global::WiimoteLib.Proxy.AccelCalibrationInfo)(transformFrom)); + target.X0 = from.X0; + target.Y0 = from.Y0; + target.Z0 = from.Z0; + target.XG = from.XG; + target.YG = from.YG; + target.ZG = from.ZG; + return target; + } + + public static object WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo(object transformFrom) { + global::WiimoteLib.Proxy.AccelCalibrationInfo target = new global::WiimoteLib.Proxy.AccelCalibrationInfo(); + global::WiimoteLib.AccelCalibrationInfo from = ((global::WiimoteLib.AccelCalibrationInfo)(transformFrom)); + target.X0 = from.X0; + target.Y0 = from.Y0; + target.Z0 = from.Z0; + target.XG = from.XG; + target.YG = from.YG; + target.ZG = from.ZG; + return target; + } + + public static object WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(object transformFrom) { + global::WiimoteLib.AccelState target = new global::WiimoteLib.AccelState(); + global::WiimoteLib.Proxy.AccelState from = ((global::WiimoteLib.Proxy.AccelState)(transformFrom)); + target.RawValues = ((global::WiimoteLib.Point3)(WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3(from.RawValues))); + target.Values = ((global::WiimoteLib.Point3F)(WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F(from.Values))); + return target; + } + + public static object WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(object transformFrom) { + global::WiimoteLib.Proxy.AccelState target = new global::WiimoteLib.Proxy.AccelState(); + global::WiimoteLib.AccelState from = ((global::WiimoteLib.AccelState)(transformFrom)); + global::WiimoteLib.Point3 tmp = from.RawValues; + target.RawValues = ((global::WiimoteLib.Proxy.Point3)(WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3(tmp))); + global::WiimoteLib.Point3F tmp0 = from.Values; + target.Values = ((global::WiimoteLib.Proxy.Point3F)(WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F(tmp0))); + return target; + } + + public static object WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3(object transformFrom) { + global::WiimoteLib.Point3 target = new global::WiimoteLib.Point3(); + global::WiimoteLib.Proxy.Point3 from = ((global::WiimoteLib.Proxy.Point3)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3(object transformFrom) { + global::WiimoteLib.Proxy.Point3 target = new global::WiimoteLib.Proxy.Point3(); + global::WiimoteLib.Point3 from = ((global::WiimoteLib.Point3)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F(object transformFrom) { + global::WiimoteLib.Point3F target = new global::WiimoteLib.Point3F(); + global::WiimoteLib.Proxy.Point3F from = ((global::WiimoteLib.Proxy.Point3F)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F(object transformFrom) { + global::WiimoteLib.Proxy.Point3F target = new global::WiimoteLib.Proxy.Point3F(); + global::WiimoteLib.Point3F from = ((global::WiimoteLib.Point3F)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState(object transformFrom) { + global::WiimoteLib.ButtonState target = new global::WiimoteLib.ButtonState(); + global::WiimoteLib.Proxy.ButtonState from = ((global::WiimoteLib.Proxy.ButtonState)(transformFrom)); + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.One = from.One; + target.Two = from.Two; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + return target; + } + + public static object WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState(object transformFrom) { + global::WiimoteLib.Proxy.ButtonState target = new global::WiimoteLib.Proxy.ButtonState(); + global::WiimoteLib.ButtonState from = ((global::WiimoteLib.ButtonState)(transformFrom)); + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.One = from.One; + target.Two = from.Two; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + return target; + } + + public static object WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState(object transformFrom) { + global::WiimoteLib.IRState target = new global::WiimoteLib.IRState(); + global::WiimoteLib.Proxy.IRState from = ((global::WiimoteLib.Proxy.IRState)(transformFrom)); + target.Mode = ((global::WiimoteLib.IRMode)(((byte)(from.Mode)))); + if ((from.IRSensors != null)) { + int count = from.IRSensors.Length; + global::WiimoteLib.IRSensor[] tmp = new global::WiimoteLib.IRSensor[count]; + for (int index = 0; (index < count); index = (index + 1)) { + global::WiimoteLib.IRSensor tmp0 = default(global::WiimoteLib.IRSensor); + tmp0 = ((global::WiimoteLib.IRSensor)(WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor(from.IRSensors[index]))); + tmp[index] = tmp0; + } + target.IRSensors = tmp; + } + else { + target.IRSensors = null; + } + target.RawMidpoint = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawMidpoint))); + target.Midpoint = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Midpoint))); + return target; + } + + public static object WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState(object transformFrom) { + global::WiimoteLib.Proxy.IRState target = new global::WiimoteLib.Proxy.IRState(); + global::WiimoteLib.IRState from = ((global::WiimoteLib.IRState)(transformFrom)); + target.Mode = ((global::WiimoteLib.Proxy.IRMode)(((byte)(from.Mode)))); + WiimoteLib.IRSensor[] tmp = from.IRSensors; + if ((tmp != null)) { + int count = tmp.Length; + global::WiimoteLib.Proxy.IRSensor[] tmp0 = new global::WiimoteLib.Proxy.IRSensor[count]; + for (int index = 0; (index < count); index = (index + 1)) { + global::WiimoteLib.Proxy.IRSensor tmp1 = default(global::WiimoteLib.Proxy.IRSensor); + global::WiimoteLib.IRSensor tmp2 = tmp[index]; + tmp1 = ((global::WiimoteLib.Proxy.IRSensor)(WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor(tmp2))); + tmp0[index] = tmp1; + } + target.IRSensors = tmp0; + } + global::WiimoteLib.Point tmp3 = from.RawMidpoint; + target.RawMidpoint = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp3))); + global::WiimoteLib.PointF tmp4 = from.Midpoint; + target.Midpoint = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp4))); + return target; + } + + public static object WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor(object transformFrom) { + global::WiimoteLib.IRSensor target = new global::WiimoteLib.IRSensor(); + global::WiimoteLib.Proxy.IRSensor from = ((global::WiimoteLib.Proxy.IRSensor)(transformFrom)); + target.RawPosition = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawPosition))); + target.Position = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Position))); + target.Size = from.Size; + target.Found = from.Found; + return target; + } + + public static object WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor(object transformFrom) { + global::WiimoteLib.Proxy.IRSensor target = new global::WiimoteLib.Proxy.IRSensor(); + global::WiimoteLib.IRSensor from = ((global::WiimoteLib.IRSensor)(transformFrom)); + global::WiimoteLib.Point tmp = from.RawPosition; + target.RawPosition = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp))); + global::WiimoteLib.PointF tmp0 = from.Position; + target.Position = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp0))); + target.Size = from.Size; + target.Found = from.Found; + return target; + } + + public static object WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(object transformFrom) { + global::WiimoteLib.Point target = new global::WiimoteLib.Point(); + global::WiimoteLib.Proxy.Point from = ((global::WiimoteLib.Proxy.Point)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + return target; + } + + public static object WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(object transformFrom) { + global::WiimoteLib.Proxy.Point target = new global::WiimoteLib.Proxy.Point(); + global::WiimoteLib.Point from = ((global::WiimoteLib.Point)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + return target; + } + + public static object WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(object transformFrom) { + global::WiimoteLib.PointF target = new global::WiimoteLib.PointF(); + global::WiimoteLib.Proxy.PointF from = ((global::WiimoteLib.Proxy.PointF)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + return target; + } + + public static object WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(object transformFrom) { + global::WiimoteLib.Proxy.PointF target = new global::WiimoteLib.Proxy.PointF(); + global::WiimoteLib.PointF from = ((global::WiimoteLib.PointF)(transformFrom)); + target.X = from.X; + target.Y = from.Y; + return target; + } + + public static object WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState(object transformFrom) { + global::WiimoteLib.NunchukState target = new global::WiimoteLib.NunchukState(); + global::WiimoteLib.Proxy.NunchukState from = ((global::WiimoteLib.Proxy.NunchukState)(transformFrom)); + target.CalibrationInfo = ((global::WiimoteLib.NunchukCalibrationInfo)(WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo(from.CalibrationInfo))); + target.AccelState = ((global::WiimoteLib.AccelState)(WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(from.AccelState))); + target.RawJoystick = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystick))); + target.Joystick = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Joystick))); + target.C = from.C; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState(object transformFrom) { + global::WiimoteLib.Proxy.NunchukState target = new global::WiimoteLib.Proxy.NunchukState(); + global::WiimoteLib.NunchukState from = ((global::WiimoteLib.NunchukState)(transformFrom)); + global::WiimoteLib.NunchukCalibrationInfo tmp = from.CalibrationInfo; + target.CalibrationInfo = ((global::WiimoteLib.Proxy.NunchukCalibrationInfo)(WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo(tmp))); + global::WiimoteLib.AccelState tmp0 = from.AccelState; + target.AccelState = ((global::WiimoteLib.Proxy.AccelState)(WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(tmp0))); + global::WiimoteLib.Point tmp1 = from.RawJoystick; + target.RawJoystick = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp1))); + global::WiimoteLib.PointF tmp2 = from.Joystick; + target.Joystick = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp2))); + target.C = from.C; + target.Z = from.Z; + return target; + } + + public static object WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo(object transformFrom) { + global::WiimoteLib.NunchukCalibrationInfo target = new global::WiimoteLib.NunchukCalibrationInfo(); + global::WiimoteLib.Proxy.NunchukCalibrationInfo from = ((global::WiimoteLib.Proxy.NunchukCalibrationInfo)(transformFrom)); + target.MinX = from.MinX; + target.MidX = from.MidX; + target.MaxX = from.MaxX; + target.MinY = from.MinY; + target.MidY = from.MidY; + target.MaxY = from.MaxY; + return target; + } + + public static object WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo(object transformFrom) { + global::WiimoteLib.Proxy.NunchukCalibrationInfo target = new global::WiimoteLib.Proxy.NunchukCalibrationInfo(); + global::WiimoteLib.NunchukCalibrationInfo from = ((global::WiimoteLib.NunchukCalibrationInfo)(transformFrom)); + target.MinX = from.MinX; + target.MidX = from.MidX; + target.MaxX = from.MaxX; + target.MinY = from.MinY; + target.MidY = from.MidY; + target.MaxY = from.MaxY; + return target; + } + + public static object WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState(object transformFrom) { + global::WiimoteLib.ClassicControllerState target = new global::WiimoteLib.ClassicControllerState(); + global::WiimoteLib.Proxy.ClassicControllerState from = ((global::WiimoteLib.Proxy.ClassicControllerState)(transformFrom)); + target.CalibrationInfo = ((global::WiimoteLib.ClassicControllerCalibrationInfo)(WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo(from.CalibrationInfo))); + target.ButtonState = ((global::WiimoteLib.ClassicControllerButtonState)(WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState(from.ButtonState))); + target.RawJoystickL = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystickL))); + target.RawJoystickR = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystickR))); + target.JoystickL = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.JoystickL))); + target.JoystickR = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.JoystickR))); + target.RawTriggerL = from.RawTriggerL; + target.RawTriggerR = from.RawTriggerR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + public static object WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState(object transformFrom) { + global::WiimoteLib.Proxy.ClassicControllerState target = new global::WiimoteLib.Proxy.ClassicControllerState(); + global::WiimoteLib.ClassicControllerState from = ((global::WiimoteLib.ClassicControllerState)(transformFrom)); + global::WiimoteLib.ClassicControllerCalibrationInfo tmp = from.CalibrationInfo; + target.CalibrationInfo = ((global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo)(WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo(tmp))); + global::WiimoteLib.ClassicControllerButtonState tmp0 = from.ButtonState; + target.ButtonState = ((global::WiimoteLib.Proxy.ClassicControllerButtonState)(WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState(tmp0))); + global::WiimoteLib.Point tmp1 = from.RawJoystickL; + target.RawJoystickL = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp1))); + global::WiimoteLib.Point tmp2 = from.RawJoystickR; + target.RawJoystickR = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp2))); + global::WiimoteLib.PointF tmp3 = from.JoystickL; + target.JoystickL = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp3))); + global::WiimoteLib.PointF tmp4 = from.JoystickR; + target.JoystickR = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp4))); + target.RawTriggerL = from.RawTriggerL; + target.RawTriggerR = from.RawTriggerR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + public static object WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo(object transformFrom) { + global::WiimoteLib.ClassicControllerCalibrationInfo target = new global::WiimoteLib.ClassicControllerCalibrationInfo(); + global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo from = ((global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo)(transformFrom)); + target.MinXL = from.MinXL; + target.MidXL = from.MidXL; + target.MaxXL = from.MaxXL; + target.MinYL = from.MinYL; + target.MidYL = from.MidYL; + target.MaxYL = from.MaxYL; + target.MinXR = from.MinXR; + target.MidXR = from.MidXR; + target.MaxXR = from.MaxXR; + target.MinYR = from.MinYR; + target.MidYR = from.MidYR; + target.MaxYR = from.MaxYR; + target.MinTriggerL = from.MinTriggerL; + target.MaxTriggerL = from.MaxTriggerL; + target.MinTriggerR = from.MinTriggerR; + target.MaxTriggerR = from.MaxTriggerR; + return target; + } + + public static object WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo(object transformFrom) { + global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo target = new global::WiimoteLib.Proxy.ClassicControllerCalibrationInfo(); + global::WiimoteLib.ClassicControllerCalibrationInfo from = ((global::WiimoteLib.ClassicControllerCalibrationInfo)(transformFrom)); + target.MinXL = from.MinXL; + target.MidXL = from.MidXL; + target.MaxXL = from.MaxXL; + target.MinYL = from.MinYL; + target.MidYL = from.MidYL; + target.MaxYL = from.MaxYL; + target.MinXR = from.MinXR; + target.MidXR = from.MidXR; + target.MaxXR = from.MaxXR; + target.MinYR = from.MinYR; + target.MidYR = from.MidYR; + target.MaxYR = from.MaxYR; + target.MinTriggerL = from.MinTriggerL; + target.MaxTriggerL = from.MaxTriggerL; + target.MinTriggerR = from.MinTriggerR; + target.MaxTriggerR = from.MaxTriggerR; + return target; + } + + public static object WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState(object transformFrom) { + global::WiimoteLib.ClassicControllerButtonState target = new global::WiimoteLib.ClassicControllerButtonState(); + global::WiimoteLib.Proxy.ClassicControllerButtonState from = ((global::WiimoteLib.Proxy.ClassicControllerButtonState)(transformFrom)); + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + target.X = from.X; + target.Y = from.Y; + target.ZL = from.ZL; + target.ZR = from.ZR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + public static object WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState(object transformFrom) { + global::WiimoteLib.Proxy.ClassicControllerButtonState target = new global::WiimoteLib.Proxy.ClassicControllerButtonState(); + global::WiimoteLib.ClassicControllerButtonState from = ((global::WiimoteLib.ClassicControllerButtonState)(transformFrom)); + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + target.X = from.X; + target.Y = from.Y; + target.ZL = from.ZL; + target.ZR = from.ZR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + public static object WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState(object transformFrom) { + global::WiimoteLib.GuitarState target = new global::WiimoteLib.GuitarState(); + global::WiimoteLib.Proxy.GuitarState from = ((global::WiimoteLib.Proxy.GuitarState)(transformFrom)); + target.GuitarType = ((global::WiimoteLib.GuitarType)(((int)(from.GuitarType)))); + target.ButtonState = ((global::WiimoteLib.GuitarButtonState)(WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState(from.ButtonState))); + target.FretButtonState = ((global::WiimoteLib.GuitarFretButtonState)(WiimoteLib_Proxy_GuitarFretButtonState_TO_WiimoteLib_GuitarFretButtonState(from.FretButtonState))); + target.TouchbarState = ((global::WiimoteLib.GuitarFretButtonState)(WiimoteLib_Proxy_GuitarFretButtonState_TO_WiimoteLib_GuitarFretButtonState(from.TouchbarState))); + target.RawJoystick = ((global::WiimoteLib.Point)(WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystick))); + target.Joystick = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Joystick))); + target.RawWhammyBar = from.RawWhammyBar; + target.WhammyBar = from.WhammyBar; + return target; + } + + public static object WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState(object transformFrom) { + global::WiimoteLib.Proxy.GuitarState target = new global::WiimoteLib.Proxy.GuitarState(); + global::WiimoteLib.GuitarState from = ((global::WiimoteLib.GuitarState)(transformFrom)); + target.GuitarType = ((global::WiimoteLib.Proxy.GuitarType)(((int)(from.GuitarType)))); + global::WiimoteLib.GuitarButtonState tmp = from.ButtonState; + target.ButtonState = ((global::WiimoteLib.Proxy.GuitarButtonState)(WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState(tmp))); + global::WiimoteLib.GuitarFretButtonState tmp0 = from.FretButtonState; + target.FretButtonState = ((global::WiimoteLib.Proxy.GuitarFretButtonState)(WiimoteLib_GuitarFretButtonState_TO_WiimoteLib_Proxy_GuitarFretButtonState(tmp0))); + global::WiimoteLib.GuitarFretButtonState tmp1 = from.TouchbarState; + target.TouchbarState = ((global::WiimoteLib.Proxy.GuitarFretButtonState)(WiimoteLib_GuitarFretButtonState_TO_WiimoteLib_Proxy_GuitarFretButtonState(tmp1))); + global::WiimoteLib.Point tmp2 = from.RawJoystick; + target.RawJoystick = ((global::WiimoteLib.Proxy.Point)(WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(tmp2))); + global::WiimoteLib.PointF tmp3 = from.Joystick; + target.Joystick = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp3))); + target.RawWhammyBar = from.RawWhammyBar; + target.WhammyBar = from.WhammyBar; + return target; + } + + public static object WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState(object transformFrom) { + global::WiimoteLib.GuitarButtonState target = new global::WiimoteLib.GuitarButtonState(); + global::WiimoteLib.Proxy.GuitarButtonState from = ((global::WiimoteLib.Proxy.GuitarButtonState)(transformFrom)); + target.StrumUp = from.StrumUp; + target.StrumDown = from.StrumDown; + target.Minus = from.Minus; + target.Plus = from.Plus; + return target; + } + + public static object WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState(object transformFrom) { + global::WiimoteLib.Proxy.GuitarButtonState target = new global::WiimoteLib.Proxy.GuitarButtonState(); + global::WiimoteLib.GuitarButtonState from = ((global::WiimoteLib.GuitarButtonState)(transformFrom)); + target.StrumUp = from.StrumUp; + target.StrumDown = from.StrumDown; + target.Minus = from.Minus; + target.Plus = from.Plus; + return target; + } + + public static object WiimoteLib_Proxy_GuitarFretButtonState_TO_WiimoteLib_GuitarFretButtonState(object transformFrom) { + global::WiimoteLib.GuitarFretButtonState target = new global::WiimoteLib.GuitarFretButtonState(); + global::WiimoteLib.Proxy.GuitarFretButtonState from = ((global::WiimoteLib.Proxy.GuitarFretButtonState)(transformFrom)); + target.Green = from.Green; + target.Red = from.Red; + target.Yellow = from.Yellow; + target.Blue = from.Blue; + target.Orange = from.Orange; + return target; + } + + public static object WiimoteLib_GuitarFretButtonState_TO_WiimoteLib_Proxy_GuitarFretButtonState(object transformFrom) { + global::WiimoteLib.Proxy.GuitarFretButtonState target = new global::WiimoteLib.Proxy.GuitarFretButtonState(); + global::WiimoteLib.GuitarFretButtonState from = ((global::WiimoteLib.GuitarFretButtonState)(transformFrom)); + target.Green = from.Green; + target.Red = from.Red; + target.Yellow = from.Yellow; + target.Blue = from.Blue; + target.Orange = from.Orange; + return target; + } + + private static global::WiimoteLib.Proxy.DrumsState _cachedInstance0 = new global::WiimoteLib.Proxy.DrumsState(); + + private static global::WiimoteLib.DrumsState _cachedInstance = new global::WiimoteLib.DrumsState(); + + public static object WiimoteLib_Proxy_DrumsState_TO_WiimoteLib_DrumsState(object transformFrom) { + return _cachedInstance; + } + + public static object WiimoteLib_DrumsState_TO_WiimoteLib_Proxy_DrumsState(object transformFrom) { + return _cachedInstance0; + } + + public static object WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState(object transformFrom) { + global::WiimoteLib.LEDState target = new global::WiimoteLib.LEDState(); + global::WiimoteLib.Proxy.LEDState from = ((global::WiimoteLib.Proxy.LEDState)(transformFrom)); + target.LED1 = from.LED1; + target.LED2 = from.LED2; + target.LED3 = from.LED3; + target.LED4 = from.LED4; + return target; + } + + public static object WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState(object transformFrom) { + global::WiimoteLib.Proxy.LEDState target = new global::WiimoteLib.Proxy.LEDState(); + global::WiimoteLib.LEDState from = ((global::WiimoteLib.LEDState)(transformFrom)); + target.LED1 = from.LED1; + target.LED2 = from.LED2; + target.LED3 = from.LED3; + target.LED4 = from.LED4; + return target; + } + + public static object WiimoteLib_Proxy_RumbleRequest_TO_WiimoteLib_RumbleRequest(object transformFrom) { + global::WiimoteLib.RumbleRequest target = new global::WiimoteLib.RumbleRequest(); + global::WiimoteLib.Proxy.RumbleRequest from = ((global::WiimoteLib.Proxy.RumbleRequest)(transformFrom)); + target.Rumble = from.Rumble; + return target; + } + + public static object WiimoteLib_RumbleRequest_TO_WiimoteLib_Proxy_RumbleRequest(object transformFrom) { + global::WiimoteLib.Proxy.RumbleRequest target = new global::WiimoteLib.Proxy.RumbleRequest(); + global::WiimoteLib.RumbleRequest from = ((global::WiimoteLib.RumbleRequest)(transformFrom)); + target.Rumble = from.Rumble; + return target; + } + + public static object WiimoteLib_Proxy_BalanceBoardState_TO_WiimoteLib_BalanceBoardState(object transformFrom) { + global::WiimoteLib.BalanceBoardState target = new global::WiimoteLib.BalanceBoardState(); + global::WiimoteLib.Proxy.BalanceBoardState from = ((global::WiimoteLib.Proxy.BalanceBoardState)(transformFrom)); + target.CalibrationInfo = ((global::WiimoteLib.BalanceBoardCalibrationInfo)(WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo(from.CalibrationInfo))); + target.SensorValuesRaw = ((global::WiimoteLib.BalanceBoardSensors)(WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.SensorValuesRaw))); + target.SensorValuesKg = ((global::WiimoteLib.BalanceBoardSensorsF)(WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(from.SensorValuesKg))); + target.SensorValuesLb = ((global::WiimoteLib.BalanceBoardSensorsF)(WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(from.SensorValuesLb))); + target.WeightKg = from.WeightKg; + target.WeightLb = from.WeightLb; + target.CenterOfGravity = ((global::WiimoteLib.PointF)(WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.CenterOfGravity))); + return target; + } + + public static object WiimoteLib_BalanceBoardState_TO_WiimoteLib_Proxy_BalanceBoardState(object transformFrom) { + global::WiimoteLib.Proxy.BalanceBoardState target = new global::WiimoteLib.Proxy.BalanceBoardState(); + global::WiimoteLib.BalanceBoardState from = ((global::WiimoteLib.BalanceBoardState)(transformFrom)); + global::WiimoteLib.BalanceBoardCalibrationInfo tmp = from.CalibrationInfo; + target.CalibrationInfo = ((global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo)(WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo(tmp))); + global::WiimoteLib.BalanceBoardSensors tmp0 = from.SensorValuesRaw; + target.SensorValuesRaw = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(tmp0))); + global::WiimoteLib.BalanceBoardSensorsF tmp1 = from.SensorValuesKg; + target.SensorValuesKg = ((global::WiimoteLib.Proxy.BalanceBoardSensorsF)(WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(tmp1))); + global::WiimoteLib.BalanceBoardSensorsF tmp2 = from.SensorValuesLb; + target.SensorValuesLb = ((global::WiimoteLib.Proxy.BalanceBoardSensorsF)(WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(tmp2))); + target.WeightKg = from.WeightKg; + target.WeightLb = from.WeightLb; + global::WiimoteLib.PointF tmp3 = from.CenterOfGravity; + target.CenterOfGravity = ((global::WiimoteLib.Proxy.PointF)(WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(tmp3))); + return target; + } + + public static object WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo(object transformFrom) { + global::WiimoteLib.BalanceBoardCalibrationInfo target = new global::WiimoteLib.BalanceBoardCalibrationInfo(); + global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo from = ((global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo)(transformFrom)); + target.Kg0 = ((global::WiimoteLib.BalanceBoardSensors)(WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg0))); + target.Kg17 = ((global::WiimoteLib.BalanceBoardSensors)(WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg17))); + target.Kg34 = ((global::WiimoteLib.BalanceBoardSensors)(WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg34))); + return target; + } + + public static object WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo(object transformFrom) { + global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo target = new global::WiimoteLib.Proxy.BalanceBoardCalibrationInfo(); + global::WiimoteLib.BalanceBoardCalibrationInfo from = ((global::WiimoteLib.BalanceBoardCalibrationInfo)(transformFrom)); + global::WiimoteLib.BalanceBoardSensors tmp = from.Kg0; + target.Kg0 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(tmp))); + global::WiimoteLib.BalanceBoardSensors tmp0 = from.Kg17; + target.Kg17 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(tmp0))); + global::WiimoteLib.BalanceBoardSensors tmp1 = from.Kg34; + target.Kg34 = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(tmp1))); + return target; + } + + public static object WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(object transformFrom) { + global::WiimoteLib.BalanceBoardSensors target = new global::WiimoteLib.BalanceBoardSensors(); + global::WiimoteLib.Proxy.BalanceBoardSensors from = ((global::WiimoteLib.Proxy.BalanceBoardSensors)(transformFrom)); + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + public static object WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(object transformFrom) { + global::WiimoteLib.Proxy.BalanceBoardSensors target = new global::WiimoteLib.Proxy.BalanceBoardSensors(); + global::WiimoteLib.BalanceBoardSensors from = ((global::WiimoteLib.BalanceBoardSensors)(transformFrom)); + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + public static object WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(object transformFrom) { + global::WiimoteLib.BalanceBoardSensorsF target = new global::WiimoteLib.BalanceBoardSensorsF(); + global::WiimoteLib.Proxy.BalanceBoardSensorsF from = ((global::WiimoteLib.Proxy.BalanceBoardSensorsF)(transformFrom)); + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + public static object WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(object transformFrom) { + global::WiimoteLib.Proxy.BalanceBoardSensorsF target = new global::WiimoteLib.Proxy.BalanceBoardSensorsF(); + global::WiimoteLib.BalanceBoardSensorsF from = ((global::WiimoteLib.BalanceBoardSensorsF)(transformFrom)); + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + } +} diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj new file mode 100644 index 0000000..ed78d90 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj @@ -0,0 +1,128 @@ + + + Local + 8.0.50215 + 2.0 + {EA7D1898-1576-4BFE-80BD-13BA28B0654B} + Debug + AnyCPU + + + + + Wiimote.Y2007.M06.Proxy + WiimoteLib + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\samples\mrisamples.snk + JScript + Grid + IE50 + false + true + Library + OnBuildSuccess + + + + + + + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\ + false + 285212672 + false + + + DEBUG;TRACE;INSTRUMENTED;DSSPROXY + Wiimote.Y2007.M06.proxy.xml + true + 4096 + false + 3003 + false + false + false + false + 1 + + + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\ + false + 285212672 + false + + + TRACE;INSTRUMENTED;DSSPROXY + Wiimote.Y2007.M06.proxy.xml + true + pdbonly + 4096 + false + 3003 + false + false + false + false + 1 + + + + False + False + + + True + False + + + True + False + + + True + False + + + True + False + + + False + False + + + False + False + + + + + + + + True + True + Resources.resx + + + + + + + + + Designer + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + /delaysign+ + + + + + "C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\DssProxy.exe" /dll:"$(TargetPath)" /proxyprojectpath:"$(ProjectDir)Proxy " /keyfile:"$(AssemblyOriginatorKeyFile)" $(ProxyDelaySign) $(CompactFrameworkProxyGen) /binpath:". " @(ReferencePath->'/referencepath:"%(RootDir)%(Directory) "', ' ') + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.bak b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.bak new file mode 100644 index 0000000..054a46d --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.bak @@ -0,0 +1,128 @@ + + + Local + 8.0.50215 + 2.0 + {EA7D1898-1576-4BFE-80BD-13BA28B0654B} + Debug + AnyCPU + + + + + Wiimote.Y2007.M06.Proxy + WiimoteLib + C:\Microsoft Robotics Studio (1.5)\samples\mrisamples.snk + JScript + Grid + IE50 + false + true + Library + OnBuildSuccess + + + + + + + C:\Microsoft Robotics Studio (1.5)\bin\ + false + 285212672 + false + + + DEBUG;TRACE;INSTRUMENTED;DSSPROXY + Wiimote.Y2007.M06.proxy.xml + true + 4096 + false + 3003 + false + false + false + false + 1 + + + C:\Microsoft Robotics Studio (1.5)\bin\ + false + 285212672 + false + + + TRACE;INSTRUMENTED;DSSPROXY + Wiimote.Y2007.M06.proxy.xml + true + pdbonly + 4096 + false + 3003 + false + false + false + false + 1 + + + + False + False + + + False + False + + + False + False + + + False + False + + + False + False + + + False + False + + + False + False + + + + + + + + True + True + Resources.resx + + + + + + + + + Designer + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + /delaysign+ + + + + + + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.user.bak b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.user.bak new file mode 100644 index 0000000..c0befaa --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.csproj.user.bak @@ -0,0 +1,17 @@ + + + c:\microsoft robotics studio (1.5)\bin;c:\windows\microsoft.net\framework64\v2.0.50727;c:\windows\microsoft.net\framework\v2.0.50727 + + + c:\microsoft robotics studio (1.5) + Program + c:\microsoft robotics studio (1.5)\bin\dsshost.exe + -port:50000 -tcpport:50001 -manifest:"../Projects/Personal/Wiimote/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.manifest.xml" + + + c:\microsoft robotics studio (1.5) + Program + c:\microsoft robotics studio (1.5)\bin\dsshost.exe + -port:50000 -tcpport:50001 -manifest:"../Projects/Personal/Wiimote/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.manifest.xml" + + diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.sln b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.sln new file mode 100644 index 0000000..48d6482 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wiimote.Y2007.M06.proxy", "Wiimote.Y2007.M06.proxy.csproj", "{EA7D1898-1576-4BFE-80BD-13BA28B0654B}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA7D1898-1576-4BFE-80BD-13BA28B0654B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA7D1898-1576-4BFE-80BD-13BA28B0654B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA7D1898-1576-4BFE-80BD-13BA28B0654B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA7D1898-1576-4BFE-80BD-13BA28B0654B}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.xml b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.xml new file mode 100644 index 0000000..eb4f031 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/Wiimote.Y2007.M06.proxy.xml @@ -0,0 +1,1565 @@ + + + + Wiimote.Y2007.M06.Proxy + + + + + Wiimote Contract + + + + The Unique Contract Identifier for the Wiimote service + + + The Dss Service dssModel Contract(s) + + + + Creates an instance of the service associated with this contract + + Contractor Service that will create the instance + Optional list of service partners for new service instance + Result PortSet for retrieving service creation response + + + + Creates an instance of the service associated with this contract + + Contractor Service that will create the instance + Result PortSet for retrieving service creation response + + + + Wiimote State + + + + + Copy To Wiimote State + + + + + Clone Wiimote State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Accel Calibration Info + + + + + Accel State + + + + + Button State + + + + + IR State + + + + + Battery Raw + + + + + Battery + + + + + Rumble + + + + + Extension + + + + + Extension Type + + + + + Nunchuk State + + + + + Classic Controller State + + + + + Guitar State + + + + + LED State + + + + + LED State + + + + + Copy To LED State + + + + + Clone LED State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + LED1 + + + + + LED2 + + + + + LED3 + + + + + LED4 + + + + + Rumble Request + + + + + Copy To Rumble Request + + + + + Clone Rumble Request + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Rumble + + + + + Extension Type + + + + + None + + + + + Nunchuk + + + + + Classic Controller + + + + + Guitar + + + + + Balance Board + + + + + Paritally Inserted + + + + + PointF + + + + + Copy To PointF + + + + + Clone PointF + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + X + + + + + Y + + + + + Point + + + + + Copy To Point + + + + + Clone Point + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + X + + + + + Y + + + + + Point3F + + + + + Copy To Point3F + + + + + Clone Point3F + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + X + + + + + Y + + + + + Z + + + + + Point3 + + + + + Copy To Point3 + + + + + Clone Point3 + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + X + + + + + Y + + + + + Z + + + + + Accel Calibration Info + + + + + Copy To Accel Calibration Info + + + + + Clone Accel Calibration Info + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + X0 + + + + + Y0 + + + + + Z0 + + + + + XG + + + + + YG + + + + + ZG + + + + + Accel State + + + + + Copy To Accel State + + + + + Clone Accel State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Raw Values + + + + + Values + + + + + Button State + + + + + Copy To Button State + + + + + Clone Button State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + A + + + + + B + + + + + Plus + + + + + Home + + + + + Minus + + + + + One + + + + + Two + + + + + Up + + + + + Down + + + + + Left + + + + + Right + + + + + IR State + + + + + Copy To IR State + + + + + Clone IR State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Mode + + + + + IR Sensors + + + + + Raw Midpoint + + + + + Midpoint + + + + + IR Mode + + + + + Off + + + + + Basic + + + + + Extended + + + + + Full + + + + + IR Sensor + + + + + Copy To IR Sensor + + + + + Clone IR Sensor + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Raw Position + + + + + Position + + + + + Size + + + + + Found + + + + + Nunchuk State + + + + + Copy To Nunchuk State + + + + + Clone Nunchuk State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Calibration Info + + + + + Accel State + + + + + Raw Joystick + + + + + Joystick + + + + + C + + + + + Z + + + + + Nunchuk Calibration Info + + + + + Copy To Nunchuk Calibration Info + + + + + Clone Nunchuk Calibration Info + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + MinX + + + + + MidX + + + + + MaxX + + + + + MinY + + + + + MidY + + + + + MaxY + + + + + Classic Controller State + + + + + Copy To Classic Controller State + + + + + Clone Classic Controller State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Calibration Info + + + + + Button State + + + + + Raw JoystickL + + + + + Raw JoystickR + + + + + JoystickL + + + + + JoystickR + + + + + Raw TriggerL + + + + + Raw TriggerR + + + + + TriggerL + + + + + TriggerR + + + + + Classic Controller Calibration Info + + + + + Copy To Classic Controller Calibration Info + + + + + Clone Classic Controller Calibration Info + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + MinXL + + + + + MidXL + + + + + MaxXL + + + + + MinYL + + + + + MidYL + + + + + MaxYL + + + + + MinXR + + + + + MidXR + + + + + MaxXR + + + + + MinYR + + + + + MidYR + + + + + MaxYR + + + + + Min TriggerL + + + + + Max TriggerL + + + + + Min TriggerR + + + + + Max TriggerR + + + + + Classic Controller Button State + + + + + Copy To Classic Controller Button State + + + + + Clone Classic Controller Button State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + A + + + + + B + + + + + Plus + + + + + Home + + + + + Minus + + + + + Up + + + + + Down + + + + + Left + + + + + Right + + + + + X + + + + + Y + + + + + ZL + + + + + ZR + + + + + TriggerL + + + + + TriggerR + + + + + Guitar State + + + + + Copy To Guitar State + + + + + Clone Guitar State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Button State + + + + + Raw Joystick + + + + + Joystick + + + + + Raw Whammy Bar + + + + + Whammy Bar + + + + + Guitar Button State + + + + + Copy To Guitar Button State + + + + + Clone Guitar Button State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Strum Up + + + + + Strum Down + + + + + Green + + + + + Red + + + + + Yellow + + + + + Blue + + + + + Orange + + + + + Minus + + + + + Plus + + + + + Balance Board State + + + + + Copy To Balance Board State + + + + + Clone Balance Board State + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Calibration Info + + + + + Sensor Values Raw + + + + + Sensor Values Kg + + + + + Sensor Values Lb + + + + + Weight Kg + + + + + Weight Lb + + + + + Center Of Gravity + + + + + Balance Board Calibration Info + + + + + Copy To Balance Board Calibration Info + + + + + Clone Balance Board Calibration Info + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Kg0 + + + + + Kg17 + + + + + Kg34 + + + + + Balance Board Sensors + + + + + Copy To Balance Board Sensors + + + + + Clone Balance Board Sensors + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Top Right + + + + + Top Left + + + + + Bottom Right + + + + + Bottom Left + + + + + Balance Board SensorsF + + + + + Copy To Balance Board SensorsF + + + + + Clone Balance Board SensorsF + + + + + Serialize Serialize + + + + + Deserialize Deserialize + + + + + Top Right + + + + + Top Left + + + + + Bottom Right + + + + + Bottom Left + + + + + Wiimote Operations + + + + + Required Lookup request body type + + + + + Post Dssp Default Lookup and return the response port. + + + + + A request to drop the service. + + + + + Post Dssp Default Drop and return the response port. + + + + + Required Get body type + + + + + Post Get and return the response port. + + + + + Post Subscribe and return the response port. + + + + + Post Subscribe and return the response port. + + + + + Wiimote State + + + + + Post Wiimote Changed and return the response port. + + + + + LED State + + + + + Post SetLE Ds and return the response port. + + + + + Rumble Request + + + + + Post Set Rumble and return the response port. + + + + + Get + + + + + Get + + + + + Get + + + + + Get + + + + + Subscribe to Wiimote service notifications. + + + + + Subscribe to Wiimote service notifications. + + + + + Subscribe to Wiimote service notifications. + + + + + Subscribe to Wiimote service notifications. + + + + + Wiimote Changed + + + + + Wiimote Changed + + + + + Wiimote Changed + + + + + Wiimote Changed + + + + + Set Wiimote Leds + + + + + Set Wiimote Leds + + + + + Set Wiimote Leds + + + + + Set Wiimote Leds + + + + + Set Wiimote Rumble + + + + + Set Wiimote Rumble + + + + + Set Wiimote Rumble + + + + + Set Wiimote Rumble + + + + + A strongly-typed resource class, for looking up localized strings, etc. + + + + + Returns the cached ResourceManager instance used by this class. + + + + + Overrides the current thread's CurrentUICulture property for all + resource lookups using this strongly typed resource class. + + + + + Looks up a resource file similar to DssModel. + + + + diff --git a/WiimoteCS/WiimoteMSRS/Proxy/WiimoteLib.Proxy.WiimoteTypes.cs b/WiimoteCS/WiimoteMSRS/Proxy/WiimoteLib.Proxy.WiimoteTypes.cs new file mode 100644 index 0000000..745b664 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/WiimoteLib.Proxy.WiimoteTypes.cs @@ -0,0 +1,4775 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.3053 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using Microsoft.Ccr.Core; +using Microsoft.Dss.Core; +using Microsoft.Dss.Core.Attributes; +using Microsoft.Dss.ServiceModel.Dssp; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Xml.Serialization; +using W3C.Soap; +using compression = System.IO.Compression; +using constructor = Microsoft.Dss.Services.Constructor; +using contractmanager = Microsoft.Dss.Services.ContractManager; +using contractmodel = Microsoft.Dss.Services.ContractModel; +using io = System.IO; +using reflection = System.Reflection; +using wiimotelib = WiimoteLib.Proxy; + + +namespace WiimoteLib.Proxy +{ + + + /// + /// Wiimote Contract + /// + [XmlTypeAttribute(IncludeInSchema=false)] + public sealed class Contract + { + + /// The Unique Contract Identifier for the Wiimote service + public const String Identifier = "http://schemas.tempuri.org/2007/06/wiimote.html"; + + /// The Dss Service dssModel Contract(s) + public static List ServiceModel() + { + contractmanager.ServiceSummaryLoader loader = new contractmanager.ServiceSummaryLoader(); + return loader.GetServiceSummaries(typeof(Contract).Assembly); + + } + + /// + /// Creates an instance of the service associated with this contract + /// + /// Contractor Service that will create the instance + /// Optional list of service partners for new service instance + /// Result PortSet for retrieving service creation response + public static DsspResponsePort CreateService(constructor.ConstructorPort contructorServicePort, params PartnerType[] partners) + { + DsspResponsePort result = new DsspResponsePort(); + ServiceInfoType si = new ServiceInfoType(Contract.Identifier, null); + if (partners != null) + { + si.PartnerList = new List(partners); + } + Microsoft.Dss.Services.Constructor.Create create = + new Microsoft.Dss.Services.Constructor.Create(si, result); + contructorServicePort.Post(create); + return result; + + } + + /// + /// Creates an instance of the service associated with this contract + /// + /// Contractor Service that will create the instance + /// Result PortSet for retrieving service creation response + public static DsspResponsePort CreateService(constructor.ConstructorPort contructorServicePort) + { + return Contract.CreateService(contructorServicePort, null); + } + } + + /// + /// Wiimote State + /// + [DataContract()] + [XmlRootAttribute("WiimoteState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public class WiimoteState : ICloneable, IDssSerializable + { + + private AccelCalibrationInfo _accelCalibrationInfo; + + private AccelState _accelState; + + private ButtonState _buttonState; + + private IRState _iRState; + + private Byte _batteryRaw; + + private Single _battery; + + private Boolean _rumble; + + private Boolean _extension; + + private ExtensionType _extensionType; + + private NunchukState _nunchukState; + + private ClassicControllerState _classicControllerState; + + private GuitarState _guitarState; + + private LEDState _lEDState; + + /// + /// Accel Calibration Info + /// + [DataMember()] + public AccelCalibrationInfo AccelCalibrationInfo + { + get + { + return this._accelCalibrationInfo; + } + set + { + this._accelCalibrationInfo = value; + } + } + + /// + /// Accel State + /// + [DataMember()] + public AccelState AccelState + { + get + { + return this._accelState; + } + set + { + this._accelState = value; + } + } + + /// + /// Button State + /// + [DataMember()] + public ButtonState ButtonState + { + get + { + return this._buttonState; + } + set + { + this._buttonState = value; + } + } + + /// + /// IR State + /// + [DataMember()] + public IRState IRState + { + get + { + return this._iRState; + } + set + { + this._iRState = value; + } + } + + /// + /// Battery Raw + /// + [DataMember()] + public Byte BatteryRaw + { + get + { + return this._batteryRaw; + } + set + { + this._batteryRaw = value; + } + } + + /// + /// Battery + /// + [DataMember()] + public Single Battery + { + get + { + return this._battery; + } + set + { + this._battery = value; + } + } + + /// + /// Rumble + /// + [DataMember()] + public Boolean Rumble + { + get + { + return this._rumble; + } + set + { + this._rumble = value; + } + } + + /// + /// Extension + /// + [DataMember()] + public Boolean Extension + { + get + { + return this._extension; + } + set + { + this._extension = value; + } + } + + /// + /// Extension Type + /// + [DataMember()] + public ExtensionType ExtensionType + { + get + { + return this._extensionType; + } + set + { + this._extensionType = value; + } + } + + /// + /// Nunchuk State + /// + [DataMember()] + public NunchukState NunchukState + { + get + { + return this._nunchukState; + } + set + { + this._nunchukState = value; + } + } + + /// + /// Classic Controller State + /// + [DataMember()] + public ClassicControllerState ClassicControllerState + { + get + { + return this._classicControllerState; + } + set + { + this._classicControllerState = value; + } + } + + /// + /// Guitar State + /// + [DataMember()] + public GuitarState GuitarState + { + get + { + return this._guitarState; + } + set + { + this._guitarState = value; + } + } + + /// + /// LED State + /// + [DataMember()] + public LEDState LEDState + { + get + { + return this._lEDState; + } + set + { + this._lEDState = value; + } + } + + /// + /// Copy To Wiimote State + /// + public virtual void CopyTo(IDssSerializable target) + { + WiimoteState typedTarget = target as WiimoteState; + + if (typedTarget == null) + throw new ArgumentException("CopyTo({0}) requires type {0}", this.GetType().FullName); + typedTarget.AccelCalibrationInfo = this.AccelCalibrationInfo; + typedTarget.AccelState = this.AccelState; + typedTarget.ButtonState = this.ButtonState; + typedTarget.IRState = this.IRState; + typedTarget.BatteryRaw = this.BatteryRaw; + typedTarget.Battery = this.Battery; + typedTarget.Rumble = this.Rumble; + typedTarget.Extension = this.Extension; + typedTarget.ExtensionType = this.ExtensionType; + typedTarget.NunchukState = this.NunchukState; + typedTarget.ClassicControllerState = this.ClassicControllerState; + typedTarget.GuitarState = this.GuitarState; + typedTarget.LEDState = this.LEDState; + } + + /// + /// Clone Wiimote State + /// + public virtual object Clone() + { + WiimoteState target = new WiimoteState(); + + target.AccelCalibrationInfo = this.AccelCalibrationInfo; + target.AccelState = this.AccelState; + target.ButtonState = this.ButtonState; + target.IRState = this.IRState; + target.BatteryRaw = this.BatteryRaw; + target.Battery = this.Battery; + target.Rumble = this.Rumble; + target.Extension = this.Extension; + target.ExtensionType = this.ExtensionType; + target.NunchukState = this.NunchukState; + target.ClassicControllerState = this.ClassicControllerState; + target.GuitarState = this.GuitarState; + target.LEDState = this.LEDState; + return target; + + } + + /// + /// Serialize Serialize + /// + public virtual void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)AccelCalibrationInfo).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)AccelState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)ButtonState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)IRState).Serialize(writer); + + writer.Write(BatteryRaw); + + writer.Write(Battery); + + writer.Write(Rumble); + + writer.Write(Extension); + + writer.Write((System.Int32)ExtensionType); + + ((Microsoft.Dss.Core.IDssSerializable)NunchukState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)ClassicControllerState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)GuitarState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)LEDState).Serialize(writer); + + } + + /// + /// Deserialize Deserialize + /// + public virtual object Deserialize(System.IO.BinaryReader reader) + { + AccelCalibrationInfo = (AccelCalibrationInfo)((Microsoft.Dss.Core.IDssSerializable)new AccelCalibrationInfo()).Deserialize(reader); + + AccelState = (AccelState)((Microsoft.Dss.Core.IDssSerializable)new AccelState()).Deserialize(reader); + + ButtonState = (ButtonState)((Microsoft.Dss.Core.IDssSerializable)new ButtonState()).Deserialize(reader); + + IRState = (IRState)((Microsoft.Dss.Core.IDssSerializable)new IRState()).Deserialize(reader); + + BatteryRaw = reader.ReadByte(); + + Battery = reader.ReadSingle(); + + Rumble = reader.ReadBoolean(); + + Extension = reader.ReadBoolean(); + + ExtensionType = (ExtensionType)reader.ReadInt32(); + + NunchukState = (NunchukState)((Microsoft.Dss.Core.IDssSerializable)new NunchukState()).Deserialize(reader); + + ClassicControllerState = (ClassicControllerState)((Microsoft.Dss.Core.IDssSerializable)new ClassicControllerState()).Deserialize(reader); + + GuitarState = (GuitarState)((Microsoft.Dss.Core.IDssSerializable)new GuitarState()).Deserialize(reader); + + LEDState = (LEDState)((Microsoft.Dss.Core.IDssSerializable)new LEDState()).Deserialize(reader); + + return this; + + } + } + + /// + /// LED State + /// + [DataContract()] + [XmlRootAttribute("LEDState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct LEDState : ICloneable, IDssSerializable + { + + private Boolean _lED1; + + private Boolean _lED2; + + private Boolean _lED3; + + private Boolean _lED4; + + /// + /// LED1 + /// + [DataMember()] + public Boolean LED1 + { + get + { + return this._lED1; + } + set + { + this._lED1 = value; + } + } + + /// + /// LED2 + /// + [DataMember()] + public Boolean LED2 + { + get + { + return this._lED2; + } + set + { + this._lED2 = value; + } + } + + /// + /// LED3 + /// + [DataMember()] + public Boolean LED3 + { + get + { + return this._lED3; + } + set + { + this._lED3 = value; + } + } + + /// + /// LED4 + /// + [DataMember()] + public Boolean LED4 + { + get + { + return this._lED4; + } + set + { + this._lED4 = value; + } + } + + /// + /// Copy To LED State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone LED State + /// + public object Clone() + { + LEDState target = new LEDState(); + + target.LED1 = this.LED1; + target.LED2 = this.LED2; + target.LED3 = this.LED3; + target.LED4 = this.LED4; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(LED1); + + writer.Write(LED2); + + writer.Write(LED3); + + writer.Write(LED4); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + LED1 = reader.ReadBoolean(); + + LED2 = reader.ReadBoolean(); + + LED3 = reader.ReadBoolean(); + + LED4 = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Rumble Request + /// + [DataContract()] + [XmlRootAttribute("RumbleRequest", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct RumbleRequest : ICloneable, IDssSerializable + { + + private Boolean _rumble; + + /// + /// Rumble + /// + [DataMember()] + public Boolean Rumble + { + get + { + return this._rumble; + } + set + { + this._rumble = value; + } + } + + /// + /// Copy To Rumble Request + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Rumble Request + /// + public object Clone() + { + RumbleRequest target = new RumbleRequest(); + + target.Rumble = this.Rumble; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(Rumble); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + Rumble = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Extension Type + /// + [DataContract()] + [XmlRootAttribute("ExtensionType", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public enum ExtensionType + { + + /// + /// None + /// + None = 0, + + /// + /// Nunchuk + /// + Nunchuk = 65278, + + /// + /// Classic Controller + /// + ClassicController = 65021, + + /// + /// Guitar + /// + Guitar = 65019, + + /// + /// Balance Board + /// + BalanceBoard = 1026, + + /// + /// Paritally Inserted + /// + ParitallyInserted = 65535, + } + + /// + /// PointF + /// + [DataContract()] + [XmlRootAttribute("PointF", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct PointF : ICloneable, IDssSerializable + { + + private Single _x; + + private Single _y; + + /// + /// X + /// + [DataMember()] + public Single X + { + get + { + return this._x; + } + set + { + this._x = value; + } + } + + /// + /// Y + /// + [DataMember()] + public Single Y + { + get + { + return this._y; + } + set + { + this._y = value; + } + } + + /// + /// Copy To PointF + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone PointF + /// + public object Clone() + { + PointF target = new PointF(); + + target.X = this.X; + target.Y = this.Y; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(X); + + writer.Write(Y); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + X = reader.ReadSingle(); + + Y = reader.ReadSingle(); + + return this; + + } + } + + /// + /// Point + /// + [DataContract()] + [XmlRootAttribute("Point", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct Point : ICloneable, IDssSerializable + { + + private Int32 _x; + + private Int32 _y; + + /// + /// X + /// + [DataMember()] + public Int32 X + { + get + { + return this._x; + } + set + { + this._x = value; + } + } + + /// + /// Y + /// + [DataMember()] + public Int32 Y + { + get + { + return this._y; + } + set + { + this._y = value; + } + } + + /// + /// Copy To Point + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Point + /// + public object Clone() + { + Point target = new Point(); + + target.X = this.X; + target.Y = this.Y; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(X); + + writer.Write(Y); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + X = reader.ReadInt32(); + + Y = reader.ReadInt32(); + + return this; + + } + } + + /// + /// Point3F + /// + [DataContract()] + [XmlRootAttribute("Point3F", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct Point3F : ICloneable, IDssSerializable + { + + private Single _x; + + private Single _y; + + private Single _z; + + /// + /// X + /// + [DataMember()] + public Single X + { + get + { + return this._x; + } + set + { + this._x = value; + } + } + + /// + /// Y + /// + [DataMember()] + public Single Y + { + get + { + return this._y; + } + set + { + this._y = value; + } + } + + /// + /// Z + /// + [DataMember()] + public Single Z + { + get + { + return this._z; + } + set + { + this._z = value; + } + } + + /// + /// Copy To Point3F + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Point3F + /// + public object Clone() + { + Point3F target = new Point3F(); + + target.X = this.X; + target.Y = this.Y; + target.Z = this.Z; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(X); + + writer.Write(Y); + + writer.Write(Z); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + X = reader.ReadSingle(); + + Y = reader.ReadSingle(); + + Z = reader.ReadSingle(); + + return this; + + } + } + + /// + /// Point3 + /// + [DataContract()] + [XmlRootAttribute("Point3", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct Point3 : ICloneable, IDssSerializable + { + + private Int32 _x; + + private Int32 _y; + + private Int32 _z; + + /// + /// X + /// + [DataMember()] + public Int32 X + { + get + { + return this._x; + } + set + { + this._x = value; + } + } + + /// + /// Y + /// + [DataMember()] + public Int32 Y + { + get + { + return this._y; + } + set + { + this._y = value; + } + } + + /// + /// Z + /// + [DataMember()] + public Int32 Z + { + get + { + return this._z; + } + set + { + this._z = value; + } + } + + /// + /// Copy To Point3 + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Point3 + /// + public object Clone() + { + Point3 target = new Point3(); + + target.X = this.X; + target.Y = this.Y; + target.Z = this.Z; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(X); + + writer.Write(Y); + + writer.Write(Z); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + X = reader.ReadInt32(); + + Y = reader.ReadInt32(); + + Z = reader.ReadInt32(); + + return this; + + } + } + + /// + /// Accel Calibration Info + /// + [DataContract()] + [XmlRootAttribute("AccelCalibrationInfo", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct AccelCalibrationInfo : ICloneable, IDssSerializable + { + + private Byte _x0; + + private Byte _y0; + + private Byte _z0; + + private Byte _xG; + + private Byte _yG; + + private Byte _zG; + + /// + /// X0 + /// + [DataMember()] + public Byte X0 + { + get + { + return this._x0; + } + set + { + this._x0 = value; + } + } + + /// + /// Y0 + /// + [DataMember()] + public Byte Y0 + { + get + { + return this._y0; + } + set + { + this._y0 = value; + } + } + + /// + /// Z0 + /// + [DataMember()] + public Byte Z0 + { + get + { + return this._z0; + } + set + { + this._z0 = value; + } + } + + /// + /// XG + /// + [DataMember()] + public Byte XG + { + get + { + return this._xG; + } + set + { + this._xG = value; + } + } + + /// + /// YG + /// + [DataMember()] + public Byte YG + { + get + { + return this._yG; + } + set + { + this._yG = value; + } + } + + /// + /// ZG + /// + [DataMember()] + public Byte ZG + { + get + { + return this._zG; + } + set + { + this._zG = value; + } + } + + /// + /// Copy To Accel Calibration Info + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Accel Calibration Info + /// + public object Clone() + { + AccelCalibrationInfo target = new AccelCalibrationInfo(); + + target.X0 = this.X0; + target.Y0 = this.Y0; + target.Z0 = this.Z0; + target.XG = this.XG; + target.YG = this.YG; + target.ZG = this.ZG; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(X0); + + writer.Write(Y0); + + writer.Write(Z0); + + writer.Write(XG); + + writer.Write(YG); + + writer.Write(ZG); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + X0 = reader.ReadByte(); + + Y0 = reader.ReadByte(); + + Z0 = reader.ReadByte(); + + XG = reader.ReadByte(); + + YG = reader.ReadByte(); + + ZG = reader.ReadByte(); + + return this; + + } + } + + /// + /// Accel State + /// + [DataContract()] + [XmlRootAttribute("AccelState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct AccelState : ICloneable, IDssSerializable + { + + private Point3 _rawValues; + + private Point3F _values; + + /// + /// Raw Values + /// + [DataMember()] + public Point3 RawValues + { + get + { + return this._rawValues; + } + set + { + this._rawValues = value; + } + } + + /// + /// Values + /// + [DataMember()] + public Point3F Values + { + get + { + return this._values; + } + set + { + this._values = value; + } + } + + /// + /// Copy To Accel State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Accel State + /// + public object Clone() + { + AccelState target = new AccelState(); + + target.RawValues = this.RawValues; + target.Values = this.Values; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)RawValues).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Values).Serialize(writer); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + RawValues = (Point3)((Microsoft.Dss.Core.IDssSerializable)new Point3()).Deserialize(reader); + + Values = (Point3F)((Microsoft.Dss.Core.IDssSerializable)new Point3F()).Deserialize(reader); + + return this; + + } + } + + /// + /// Button State + /// + [DataContract()] + [XmlRootAttribute("ButtonState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct ButtonState : ICloneable, IDssSerializable + { + + private Boolean _a; + + private Boolean _b; + + private Boolean _plus; + + private Boolean _home; + + private Boolean _minus; + + private Boolean _one; + + private Boolean _two; + + private Boolean _up; + + private Boolean _down; + + private Boolean _left; + + private Boolean _right; + + /// + /// A + /// + [DataMember()] + public Boolean A + { + get + { + return this._a; + } + set + { + this._a = value; + } + } + + /// + /// B + /// + [DataMember()] + public Boolean B + { + get + { + return this._b; + } + set + { + this._b = value; + } + } + + /// + /// Plus + /// + [DataMember()] + public Boolean Plus + { + get + { + return this._plus; + } + set + { + this._plus = value; + } + } + + /// + /// Home + /// + [DataMember()] + public Boolean Home + { + get + { + return this._home; + } + set + { + this._home = value; + } + } + + /// + /// Minus + /// + [DataMember()] + public Boolean Minus + { + get + { + return this._minus; + } + set + { + this._minus = value; + } + } + + /// + /// One + /// + [DataMember()] + public Boolean One + { + get + { + return this._one; + } + set + { + this._one = value; + } + } + + /// + /// Two + /// + [DataMember()] + public Boolean Two + { + get + { + return this._two; + } + set + { + this._two = value; + } + } + + /// + /// Up + /// + [DataMember()] + public Boolean Up + { + get + { + return this._up; + } + set + { + this._up = value; + } + } + + /// + /// Down + /// + [DataMember()] + public Boolean Down + { + get + { + return this._down; + } + set + { + this._down = value; + } + } + + /// + /// Left + /// + [DataMember()] + public Boolean Left + { + get + { + return this._left; + } + set + { + this._left = value; + } + } + + /// + /// Right + /// + [DataMember()] + public Boolean Right + { + get + { + return this._right; + } + set + { + this._right = value; + } + } + + /// + /// Copy To Button State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Button State + /// + public object Clone() + { + ButtonState target = new ButtonState(); + + target.A = this.A; + target.B = this.B; + target.Plus = this.Plus; + target.Home = this.Home; + target.Minus = this.Minus; + target.One = this.One; + target.Two = this.Two; + target.Up = this.Up; + target.Down = this.Down; + target.Left = this.Left; + target.Right = this.Right; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(A); + + writer.Write(B); + + writer.Write(Plus); + + writer.Write(Home); + + writer.Write(Minus); + + writer.Write(One); + + writer.Write(Two); + + writer.Write(Up); + + writer.Write(Down); + + writer.Write(Left); + + writer.Write(Right); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + A = reader.ReadBoolean(); + + B = reader.ReadBoolean(); + + Plus = reader.ReadBoolean(); + + Home = reader.ReadBoolean(); + + Minus = reader.ReadBoolean(); + + One = reader.ReadBoolean(); + + Two = reader.ReadBoolean(); + + Up = reader.ReadBoolean(); + + Down = reader.ReadBoolean(); + + Left = reader.ReadBoolean(); + + Right = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// IR State + /// + [DataContract()] + [XmlRootAttribute("IRState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct IRState : ICloneable, IDssSerializable + { + + private IRMode _mode; + + private IRSensor[] _iRSensors; + + private Point _rawMidpoint; + + private PointF _midpoint; + + /// + /// Mode + /// + [DataMember()] + public IRMode Mode + { + get + { + return this._mode; + } + set + { + this._mode = value; + } + } + + /// + /// IR Sensors + /// + [DataMember()] + public IRSensor[] IRSensors + { + get + { + return this._iRSensors; + } + set + { + this._iRSensors = value; + } + } + + /// + /// Raw Midpoint + /// + [DataMember()] + public Point RawMidpoint + { + get + { + return this._rawMidpoint; + } + set + { + this._rawMidpoint = value; + } + } + + /// + /// Midpoint + /// + [DataMember()] + public PointF Midpoint + { + get + { + return this._midpoint; + } + set + { + this._midpoint = value; + } + } + + /// + /// Copy To IR State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone IR State + /// + public object Clone() + { + IRState target = new IRState(); + + target.Mode = this.Mode; + + // copy IRSensor[] IRSensors + if (this.IRSensors != null) + { + target.IRSensors = new IRSensor[this.IRSensors.GetLength(0)]; + for (int d0 = 0; d0 < this.IRSensors.GetLength(0); d0++) + target.IRSensors[d0] = (IRSensor)((Microsoft.Dss.Core.IDssSerializable)this.IRSensors[d0]).Clone(); + } + target.RawMidpoint = this.RawMidpoint; + target.Midpoint = this.Midpoint; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write((System.Byte)Mode); + + if (IRSensors == null) writer.Write((byte)0); + else + { + // null flag + writer.Write((byte)1); + + // Dimensions + writer.Write(1); + + // Elements per dimension + writer.Write(this.IRSensors.GetLength(0)); + + for(int d0 = 0; d0 < this.IRSensors.GetLength(0); d0++) + { + ((Microsoft.Dss.Core.IDssSerializable)IRSensors[d0]).Serialize(writer); + } + } + + ((Microsoft.Dss.Core.IDssSerializable)RawMidpoint).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Midpoint).Serialize(writer); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + Mode = (IRMode)reader.ReadByte(); + + if (reader.ReadByte() == 0) {} + else + { + // Dimensions + int dims_count2734026764 = reader.ReadInt32(); + + // Elements per dimension + int[] count2734026764 = new int[dims_count2734026764]; + for(int ix = 0; ix < dims_count2734026764; ix++) + count2734026764[ix] = reader.ReadInt32(); + + IRSensors = new IRSensor[count2734026764[0]]; + for(int d0 = 0; d0 < count2734026764[0]; d0++) + { + IRSensors[d0] = (IRSensor)((Microsoft.Dss.Core.IDssSerializable)new IRSensor()).Deserialize(reader); + } + } //nullable + + RawMidpoint = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + Midpoint = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + return this; + + } + } + + /// + /// IR Mode + /// + [DataContract()] + [XmlRootAttribute("IRMode", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public enum IRMode + { + + /// + /// Off + /// + Off = 0, + + /// + /// Basic + /// + Basic = 1, + + /// + /// Extended + /// + Extended = 3, + + /// + /// Full + /// + Full = 5, + } + + /// + /// IR Sensor + /// + [DataContract()] + [XmlRootAttribute("IRSensor", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct IRSensor : ICloneable, IDssSerializable + { + + private Point _rawPosition; + + private PointF _position; + + private Int32 _size; + + private Boolean _found; + + /// + /// Raw Position + /// + [DataMember()] + public Point RawPosition + { + get + { + return this._rawPosition; + } + set + { + this._rawPosition = value; + } + } + + /// + /// Position + /// + [DataMember()] + public PointF Position + { + get + { + return this._position; + } + set + { + this._position = value; + } + } + + /// + /// Size + /// + [DataMember()] + public Int32 Size + { + get + { + return this._size; + } + set + { + this._size = value; + } + } + + /// + /// Found + /// + [DataMember()] + public Boolean Found + { + get + { + return this._found; + } + set + { + this._found = value; + } + } + + /// + /// Copy To IR Sensor + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone IR Sensor + /// + public object Clone() + { + IRSensor target = new IRSensor(); + + target.RawPosition = this.RawPosition; + target.Position = this.Position; + target.Size = this.Size; + target.Found = this.Found; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)RawPosition).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Position).Serialize(writer); + + writer.Write(Size); + + writer.Write(Found); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + RawPosition = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + Position = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + Size = reader.ReadInt32(); + + Found = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Nunchuk State + /// + [DataContract()] + [XmlRootAttribute("NunchukState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct NunchukState : ICloneable, IDssSerializable + { + + private NunchukCalibrationInfo _calibrationInfo; + + private AccelState _accelState; + + private Point _rawJoystick; + + private PointF _joystick; + + private Boolean _c; + + private Boolean _z; + + /// + /// Calibration Info + /// + [DataMember()] + public NunchukCalibrationInfo CalibrationInfo + { + get + { + return this._calibrationInfo; + } + set + { + this._calibrationInfo = value; + } + } + + /// + /// Accel State + /// + [DataMember()] + public AccelState AccelState + { + get + { + return this._accelState; + } + set + { + this._accelState = value; + } + } + + /// + /// Raw Joystick + /// + [DataMember()] + public Point RawJoystick + { + get + { + return this._rawJoystick; + } + set + { + this._rawJoystick = value; + } + } + + /// + /// Joystick + /// + [DataMember()] + public PointF Joystick + { + get + { + return this._joystick; + } + set + { + this._joystick = value; + } + } + + /// + /// C + /// + [DataMember()] + public Boolean C + { + get + { + return this._c; + } + set + { + this._c = value; + } + } + + /// + /// Z + /// + [DataMember()] + public Boolean Z + { + get + { + return this._z; + } + set + { + this._z = value; + } + } + + /// + /// Copy To Nunchuk State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Nunchuk State + /// + public object Clone() + { + NunchukState target = new NunchukState(); + + target.CalibrationInfo = this.CalibrationInfo; + target.AccelState = this.AccelState; + target.RawJoystick = this.RawJoystick; + target.Joystick = this.Joystick; + target.C = this.C; + target.Z = this.Z; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)CalibrationInfo).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)AccelState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)RawJoystick).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Joystick).Serialize(writer); + + writer.Write(C); + + writer.Write(Z); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + CalibrationInfo = (NunchukCalibrationInfo)((Microsoft.Dss.Core.IDssSerializable)new NunchukCalibrationInfo()).Deserialize(reader); + + AccelState = (AccelState)((Microsoft.Dss.Core.IDssSerializable)new AccelState()).Deserialize(reader); + + RawJoystick = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + Joystick = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + C = reader.ReadBoolean(); + + Z = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Nunchuk Calibration Info + /// + [DataContract()] + [XmlRootAttribute("NunchukCalibrationInfo", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct NunchukCalibrationInfo : ICloneable, IDssSerializable + { + + private Byte _minX; + + private Byte _midX; + + private Byte _maxX; + + private Byte _minY; + + private Byte _midY; + + private Byte _maxY; + + /// + /// MinX + /// + [DataMember()] + public Byte MinX + { + get + { + return this._minX; + } + set + { + this._minX = value; + } + } + + /// + /// MidX + /// + [DataMember()] + public Byte MidX + { + get + { + return this._midX; + } + set + { + this._midX = value; + } + } + + /// + /// MaxX + /// + [DataMember()] + public Byte MaxX + { + get + { + return this._maxX; + } + set + { + this._maxX = value; + } + } + + /// + /// MinY + /// + [DataMember()] + public Byte MinY + { + get + { + return this._minY; + } + set + { + this._minY = value; + } + } + + /// + /// MidY + /// + [DataMember()] + public Byte MidY + { + get + { + return this._midY; + } + set + { + this._midY = value; + } + } + + /// + /// MaxY + /// + [DataMember()] + public Byte MaxY + { + get + { + return this._maxY; + } + set + { + this._maxY = value; + } + } + + /// + /// Copy To Nunchuk Calibration Info + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Nunchuk Calibration Info + /// + public object Clone() + { + NunchukCalibrationInfo target = new NunchukCalibrationInfo(); + + target.MinX = this.MinX; + target.MidX = this.MidX; + target.MaxX = this.MaxX; + target.MinY = this.MinY; + target.MidY = this.MidY; + target.MaxY = this.MaxY; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(MinX); + + writer.Write(MidX); + + writer.Write(MaxX); + + writer.Write(MinY); + + writer.Write(MidY); + + writer.Write(MaxY); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + MinX = reader.ReadByte(); + + MidX = reader.ReadByte(); + + MaxX = reader.ReadByte(); + + MinY = reader.ReadByte(); + + MidY = reader.ReadByte(); + + MaxY = reader.ReadByte(); + + return this; + + } + } + + /// + /// Classic Controller State + /// + [DataContract()] + [XmlRootAttribute("ClassicControllerState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct ClassicControllerState : ICloneable, IDssSerializable + { + + private ClassicControllerCalibrationInfo _calibrationInfo; + + private ClassicControllerButtonState _buttonState; + + private Point _rawJoystickL; + + private Point _rawJoystickR; + + private PointF _joystickL; + + private PointF _joystickR; + + private Byte _rawTriggerL; + + private Byte _rawTriggerR; + + private Single _triggerL; + + private Single _triggerR; + + /// + /// Calibration Info + /// + [DataMember()] + public ClassicControllerCalibrationInfo CalibrationInfo + { + get + { + return this._calibrationInfo; + } + set + { + this._calibrationInfo = value; + } + } + + /// + /// Button State + /// + [DataMember()] + public ClassicControllerButtonState ButtonState + { + get + { + return this._buttonState; + } + set + { + this._buttonState = value; + } + } + + /// + /// Raw JoystickL + /// + [DataMember()] + public Point RawJoystickL + { + get + { + return this._rawJoystickL; + } + set + { + this._rawJoystickL = value; + } + } + + /// + /// Raw JoystickR + /// + [DataMember()] + public Point RawJoystickR + { + get + { + return this._rawJoystickR; + } + set + { + this._rawJoystickR = value; + } + } + + /// + /// JoystickL + /// + [DataMember()] + public PointF JoystickL + { + get + { + return this._joystickL; + } + set + { + this._joystickL = value; + } + } + + /// + /// JoystickR + /// + [DataMember()] + public PointF JoystickR + { + get + { + return this._joystickR; + } + set + { + this._joystickR = value; + } + } + + /// + /// Raw TriggerL + /// + [DataMember()] + public Byte RawTriggerL + { + get + { + return this._rawTriggerL; + } + set + { + this._rawTriggerL = value; + } + } + + /// + /// Raw TriggerR + /// + [DataMember()] + public Byte RawTriggerR + { + get + { + return this._rawTriggerR; + } + set + { + this._rawTriggerR = value; + } + } + + /// + /// TriggerL + /// + [DataMember()] + public Single TriggerL + { + get + { + return this._triggerL; + } + set + { + this._triggerL = value; + } + } + + /// + /// TriggerR + /// + [DataMember()] + public Single TriggerR + { + get + { + return this._triggerR; + } + set + { + this._triggerR = value; + } + } + + /// + /// Copy To Classic Controller State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Classic Controller State + /// + public object Clone() + { + ClassicControllerState target = new ClassicControllerState(); + + target.CalibrationInfo = this.CalibrationInfo; + target.ButtonState = this.ButtonState; + target.RawJoystickL = this.RawJoystickL; + target.RawJoystickR = this.RawJoystickR; + target.JoystickL = this.JoystickL; + target.JoystickR = this.JoystickR; + target.RawTriggerL = this.RawTriggerL; + target.RawTriggerR = this.RawTriggerR; + target.TriggerL = this.TriggerL; + target.TriggerR = this.TriggerR; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)CalibrationInfo).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)ButtonState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)RawJoystickL).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)RawJoystickR).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)JoystickL).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)JoystickR).Serialize(writer); + + writer.Write(RawTriggerL); + + writer.Write(RawTriggerR); + + writer.Write(TriggerL); + + writer.Write(TriggerR); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + CalibrationInfo = (ClassicControllerCalibrationInfo)((Microsoft.Dss.Core.IDssSerializable)new ClassicControllerCalibrationInfo()).Deserialize(reader); + + ButtonState = (ClassicControllerButtonState)((Microsoft.Dss.Core.IDssSerializable)new ClassicControllerButtonState()).Deserialize(reader); + + RawJoystickL = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + RawJoystickR = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + JoystickL = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + JoystickR = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + RawTriggerL = reader.ReadByte(); + + RawTriggerR = reader.ReadByte(); + + TriggerL = reader.ReadSingle(); + + TriggerR = reader.ReadSingle(); + + return this; + + } + } + + /// + /// Classic Controller Calibration Info + /// + [DataContract()] + [XmlRootAttribute("ClassicControllerCalibrationInfo", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct ClassicControllerCalibrationInfo : ICloneable, IDssSerializable + { + + private Byte _minXL; + + private Byte _midXL; + + private Byte _maxXL; + + private Byte _minYL; + + private Byte _midYL; + + private Byte _maxYL; + + private Byte _minXR; + + private Byte _midXR; + + private Byte _maxXR; + + private Byte _minYR; + + private Byte _midYR; + + private Byte _maxYR; + + private Byte _minTriggerL; + + private Byte _maxTriggerL; + + private Byte _minTriggerR; + + private Byte _maxTriggerR; + + /// + /// MinXL + /// + [DataMember()] + public Byte MinXL + { + get + { + return this._minXL; + } + set + { + this._minXL = value; + } + } + + /// + /// MidXL + /// + [DataMember()] + public Byte MidXL + { + get + { + return this._midXL; + } + set + { + this._midXL = value; + } + } + + /// + /// MaxXL + /// + [DataMember()] + public Byte MaxXL + { + get + { + return this._maxXL; + } + set + { + this._maxXL = value; + } + } + + /// + /// MinYL + /// + [DataMember()] + public Byte MinYL + { + get + { + return this._minYL; + } + set + { + this._minYL = value; + } + } + + /// + /// MidYL + /// + [DataMember()] + public Byte MidYL + { + get + { + return this._midYL; + } + set + { + this._midYL = value; + } + } + + /// + /// MaxYL + /// + [DataMember()] + public Byte MaxYL + { + get + { + return this._maxYL; + } + set + { + this._maxYL = value; + } + } + + /// + /// MinXR + /// + [DataMember()] + public Byte MinXR + { + get + { + return this._minXR; + } + set + { + this._minXR = value; + } + } + + /// + /// MidXR + /// + [DataMember()] + public Byte MidXR + { + get + { + return this._midXR; + } + set + { + this._midXR = value; + } + } + + /// + /// MaxXR + /// + [DataMember()] + public Byte MaxXR + { + get + { + return this._maxXR; + } + set + { + this._maxXR = value; + } + } + + /// + /// MinYR + /// + [DataMember()] + public Byte MinYR + { + get + { + return this._minYR; + } + set + { + this._minYR = value; + } + } + + /// + /// MidYR + /// + [DataMember()] + public Byte MidYR + { + get + { + return this._midYR; + } + set + { + this._midYR = value; + } + } + + /// + /// MaxYR + /// + [DataMember()] + public Byte MaxYR + { + get + { + return this._maxYR; + } + set + { + this._maxYR = value; + } + } + + /// + /// Min TriggerL + /// + [DataMember()] + public Byte MinTriggerL + { + get + { + return this._minTriggerL; + } + set + { + this._minTriggerL = value; + } + } + + /// + /// Max TriggerL + /// + [DataMember()] + public Byte MaxTriggerL + { + get + { + return this._maxTriggerL; + } + set + { + this._maxTriggerL = value; + } + } + + /// + /// Min TriggerR + /// + [DataMember()] + public Byte MinTriggerR + { + get + { + return this._minTriggerR; + } + set + { + this._minTriggerR = value; + } + } + + /// + /// Max TriggerR + /// + [DataMember()] + public Byte MaxTriggerR + { + get + { + return this._maxTriggerR; + } + set + { + this._maxTriggerR = value; + } + } + + /// + /// Copy To Classic Controller Calibration Info + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Classic Controller Calibration Info + /// + public object Clone() + { + ClassicControllerCalibrationInfo target = new ClassicControllerCalibrationInfo(); + + target.MinXL = this.MinXL; + target.MidXL = this.MidXL; + target.MaxXL = this.MaxXL; + target.MinYL = this.MinYL; + target.MidYL = this.MidYL; + target.MaxYL = this.MaxYL; + target.MinXR = this.MinXR; + target.MidXR = this.MidXR; + target.MaxXR = this.MaxXR; + target.MinYR = this.MinYR; + target.MidYR = this.MidYR; + target.MaxYR = this.MaxYR; + target.MinTriggerL = this.MinTriggerL; + target.MaxTriggerL = this.MaxTriggerL; + target.MinTriggerR = this.MinTriggerR; + target.MaxTriggerR = this.MaxTriggerR; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(MinXL); + + writer.Write(MidXL); + + writer.Write(MaxXL); + + writer.Write(MinYL); + + writer.Write(MidYL); + + writer.Write(MaxYL); + + writer.Write(MinXR); + + writer.Write(MidXR); + + writer.Write(MaxXR); + + writer.Write(MinYR); + + writer.Write(MidYR); + + writer.Write(MaxYR); + + writer.Write(MinTriggerL); + + writer.Write(MaxTriggerL); + + writer.Write(MinTriggerR); + + writer.Write(MaxTriggerR); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + MinXL = reader.ReadByte(); + + MidXL = reader.ReadByte(); + + MaxXL = reader.ReadByte(); + + MinYL = reader.ReadByte(); + + MidYL = reader.ReadByte(); + + MaxYL = reader.ReadByte(); + + MinXR = reader.ReadByte(); + + MidXR = reader.ReadByte(); + + MaxXR = reader.ReadByte(); + + MinYR = reader.ReadByte(); + + MidYR = reader.ReadByte(); + + MaxYR = reader.ReadByte(); + + MinTriggerL = reader.ReadByte(); + + MaxTriggerL = reader.ReadByte(); + + MinTriggerR = reader.ReadByte(); + + MaxTriggerR = reader.ReadByte(); + + return this; + + } + } + + /// + /// Classic Controller Button State + /// + [DataContract()] + [XmlRootAttribute("ClassicControllerButtonState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct ClassicControllerButtonState : ICloneable, IDssSerializable + { + + private Boolean _a; + + private Boolean _b; + + private Boolean _plus; + + private Boolean _home; + + private Boolean _minus; + + private Boolean _up; + + private Boolean _down; + + private Boolean _left; + + private Boolean _right; + + private Boolean _x; + + private Boolean _y; + + private Boolean _zL; + + private Boolean _zR; + + private Boolean _triggerL; + + private Boolean _triggerR; + + /// + /// A + /// + [DataMember()] + public Boolean A + { + get + { + return this._a; + } + set + { + this._a = value; + } + } + + /// + /// B + /// + [DataMember()] + public Boolean B + { + get + { + return this._b; + } + set + { + this._b = value; + } + } + + /// + /// Plus + /// + [DataMember()] + public Boolean Plus + { + get + { + return this._plus; + } + set + { + this._plus = value; + } + } + + /// + /// Home + /// + [DataMember()] + public Boolean Home + { + get + { + return this._home; + } + set + { + this._home = value; + } + } + + /// + /// Minus + /// + [DataMember()] + public Boolean Minus + { + get + { + return this._minus; + } + set + { + this._minus = value; + } + } + + /// + /// Up + /// + [DataMember()] + public Boolean Up + { + get + { + return this._up; + } + set + { + this._up = value; + } + } + + /// + /// Down + /// + [DataMember()] + public Boolean Down + { + get + { + return this._down; + } + set + { + this._down = value; + } + } + + /// + /// Left + /// + [DataMember()] + public Boolean Left + { + get + { + return this._left; + } + set + { + this._left = value; + } + } + + /// + /// Right + /// + [DataMember()] + public Boolean Right + { + get + { + return this._right; + } + set + { + this._right = value; + } + } + + /// + /// X + /// + [DataMember()] + public Boolean X + { + get + { + return this._x; + } + set + { + this._x = value; + } + } + + /// + /// Y + /// + [DataMember()] + public Boolean Y + { + get + { + return this._y; + } + set + { + this._y = value; + } + } + + /// + /// ZL + /// + [DataMember()] + public Boolean ZL + { + get + { + return this._zL; + } + set + { + this._zL = value; + } + } + + /// + /// ZR + /// + [DataMember()] + public Boolean ZR + { + get + { + return this._zR; + } + set + { + this._zR = value; + } + } + + /// + /// TriggerL + /// + [DataMember()] + public Boolean TriggerL + { + get + { + return this._triggerL; + } + set + { + this._triggerL = value; + } + } + + /// + /// TriggerR + /// + [DataMember()] + public Boolean TriggerR + { + get + { + return this._triggerR; + } + set + { + this._triggerR = value; + } + } + + /// + /// Copy To Classic Controller Button State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Classic Controller Button State + /// + public object Clone() + { + ClassicControllerButtonState target = new ClassicControllerButtonState(); + + target.A = this.A; + target.B = this.B; + target.Plus = this.Plus; + target.Home = this.Home; + target.Minus = this.Minus; + target.Up = this.Up; + target.Down = this.Down; + target.Left = this.Left; + target.Right = this.Right; + target.X = this.X; + target.Y = this.Y; + target.ZL = this.ZL; + target.ZR = this.ZR; + target.TriggerL = this.TriggerL; + target.TriggerR = this.TriggerR; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(A); + + writer.Write(B); + + writer.Write(Plus); + + writer.Write(Home); + + writer.Write(Minus); + + writer.Write(Up); + + writer.Write(Down); + + writer.Write(Left); + + writer.Write(Right); + + writer.Write(X); + + writer.Write(Y); + + writer.Write(ZL); + + writer.Write(ZR); + + writer.Write(TriggerL); + + writer.Write(TriggerR); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + A = reader.ReadBoolean(); + + B = reader.ReadBoolean(); + + Plus = reader.ReadBoolean(); + + Home = reader.ReadBoolean(); + + Minus = reader.ReadBoolean(); + + Up = reader.ReadBoolean(); + + Down = reader.ReadBoolean(); + + Left = reader.ReadBoolean(); + + Right = reader.ReadBoolean(); + + X = reader.ReadBoolean(); + + Y = reader.ReadBoolean(); + + ZL = reader.ReadBoolean(); + + ZR = reader.ReadBoolean(); + + TriggerL = reader.ReadBoolean(); + + TriggerR = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Guitar State + /// + [DataContract()] + [XmlRootAttribute("GuitarState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct GuitarState : ICloneable, IDssSerializable + { + + private GuitarButtonState _buttonState; + + private Point _rawJoystick; + + private PointF _joystick; + + private Byte _rawWhammyBar; + + private Single _whammyBar; + + /// + /// Button State + /// + [DataMember()] + public GuitarButtonState ButtonState + { + get + { + return this._buttonState; + } + set + { + this._buttonState = value; + } + } + + /// + /// Raw Joystick + /// + [DataMember()] + public Point RawJoystick + { + get + { + return this._rawJoystick; + } + set + { + this._rawJoystick = value; + } + } + + /// + /// Joystick + /// + [DataMember()] + public PointF Joystick + { + get + { + return this._joystick; + } + set + { + this._joystick = value; + } + } + + /// + /// Raw Whammy Bar + /// + [DataMember()] + public Byte RawWhammyBar + { + get + { + return this._rawWhammyBar; + } + set + { + this._rawWhammyBar = value; + } + } + + /// + /// Whammy Bar + /// + [DataMember()] + public Single WhammyBar + { + get + { + return this._whammyBar; + } + set + { + this._whammyBar = value; + } + } + + /// + /// Copy To Guitar State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Guitar State + /// + public object Clone() + { + GuitarState target = new GuitarState(); + + target.ButtonState = this.ButtonState; + target.RawJoystick = this.RawJoystick; + target.Joystick = this.Joystick; + target.RawWhammyBar = this.RawWhammyBar; + target.WhammyBar = this.WhammyBar; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)ButtonState).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)RawJoystick).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Joystick).Serialize(writer); + + writer.Write(RawWhammyBar); + + writer.Write(WhammyBar); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + ButtonState = (GuitarButtonState)((Microsoft.Dss.Core.IDssSerializable)new GuitarButtonState()).Deserialize(reader); + + RawJoystick = (Point)((Microsoft.Dss.Core.IDssSerializable)new Point()).Deserialize(reader); + + Joystick = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + RawWhammyBar = reader.ReadByte(); + + WhammyBar = reader.ReadSingle(); + + return this; + + } + } + + /// + /// Guitar Button State + /// + [DataContract()] + [XmlRootAttribute("GuitarButtonState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct GuitarButtonState : ICloneable, IDssSerializable + { + + private Boolean _strumUp; + + private Boolean _strumDown; + + private Boolean _green; + + private Boolean _red; + + private Boolean _yellow; + + private Boolean _blue; + + private Boolean _orange; + + private Boolean _minus; + + private Boolean _plus; + + /// + /// Strum Up + /// + [DataMember()] + public Boolean StrumUp + { + get + { + return this._strumUp; + } + set + { + this._strumUp = value; + } + } + + /// + /// Strum Down + /// + [DataMember()] + public Boolean StrumDown + { + get + { + return this._strumDown; + } + set + { + this._strumDown = value; + } + } + + /// + /// Green + /// + [DataMember()] + public Boolean Green + { + get + { + return this._green; + } + set + { + this._green = value; + } + } + + /// + /// Red + /// + [DataMember()] + public Boolean Red + { + get + { + return this._red; + } + set + { + this._red = value; + } + } + + /// + /// Yellow + /// + [DataMember()] + public Boolean Yellow + { + get + { + return this._yellow; + } + set + { + this._yellow = value; + } + } + + /// + /// Blue + /// + [DataMember()] + public Boolean Blue + { + get + { + return this._blue; + } + set + { + this._blue = value; + } + } + + /// + /// Orange + /// + [DataMember()] + public Boolean Orange + { + get + { + return this._orange; + } + set + { + this._orange = value; + } + } + + /// + /// Minus + /// + [DataMember()] + public Boolean Minus + { + get + { + return this._minus; + } + set + { + this._minus = value; + } + } + + /// + /// Plus + /// + [DataMember()] + public Boolean Plus + { + get + { + return this._plus; + } + set + { + this._plus = value; + } + } + + /// + /// Copy To Guitar Button State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Guitar Button State + /// + public object Clone() + { + GuitarButtonState target = new GuitarButtonState(); + + target.StrumUp = this.StrumUp; + target.StrumDown = this.StrumDown; + target.Green = this.Green; + target.Red = this.Red; + target.Yellow = this.Yellow; + target.Blue = this.Blue; + target.Orange = this.Orange; + target.Minus = this.Minus; + target.Plus = this.Plus; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(StrumUp); + + writer.Write(StrumDown); + + writer.Write(Green); + + writer.Write(Red); + + writer.Write(Yellow); + + writer.Write(Blue); + + writer.Write(Orange); + + writer.Write(Minus); + + writer.Write(Plus); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + StrumUp = reader.ReadBoolean(); + + StrumDown = reader.ReadBoolean(); + + Green = reader.ReadBoolean(); + + Red = reader.ReadBoolean(); + + Yellow = reader.ReadBoolean(); + + Blue = reader.ReadBoolean(); + + Orange = reader.ReadBoolean(); + + Minus = reader.ReadBoolean(); + + Plus = reader.ReadBoolean(); + + return this; + + } + } + + /// + /// Balance Board State + /// + [DataContract()] + [XmlRootAttribute("BalanceBoardState", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct BalanceBoardState : ICloneable, IDssSerializable + { + + private BalanceBoardCalibrationInfo _calibrationInfo; + + private BalanceBoardSensors _sensorValuesRaw; + + private BalanceBoardSensorsF _sensorValuesKg; + + private BalanceBoardSensorsF _sensorValuesLb; + + private Single _weightKg; + + private Single _weightLb; + + private PointF _centerOfGravity; + + /// + /// Calibration Info + /// + [DataMember()] + public BalanceBoardCalibrationInfo CalibrationInfo + { + get + { + return this._calibrationInfo; + } + set + { + this._calibrationInfo = value; + } + } + + /// + /// Sensor Values Raw + /// + [DataMember()] + public BalanceBoardSensors SensorValuesRaw + { + get + { + return this._sensorValuesRaw; + } + set + { + this._sensorValuesRaw = value; + } + } + + /// + /// Sensor Values Kg + /// + [DataMember()] + public BalanceBoardSensorsF SensorValuesKg + { + get + { + return this._sensorValuesKg; + } + set + { + this._sensorValuesKg = value; + } + } + + /// + /// Sensor Values Lb + /// + [DataMember()] + public BalanceBoardSensorsF SensorValuesLb + { + get + { + return this._sensorValuesLb; + } + set + { + this._sensorValuesLb = value; + } + } + + /// + /// Weight Kg + /// + [DataMember()] + public Single WeightKg + { + get + { + return this._weightKg; + } + set + { + this._weightKg = value; + } + } + + /// + /// Weight Lb + /// + [DataMember()] + public Single WeightLb + { + get + { + return this._weightLb; + } + set + { + this._weightLb = value; + } + } + + /// + /// Center Of Gravity + /// + [DataMember()] + public PointF CenterOfGravity + { + get + { + return this._centerOfGravity; + } + set + { + this._centerOfGravity = value; + } + } + + /// + /// Copy To Balance Board State + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Balance Board State + /// + public object Clone() + { + BalanceBoardState target = new BalanceBoardState(); + + target.CalibrationInfo = this.CalibrationInfo; + target.SensorValuesRaw = this.SensorValuesRaw; + target.SensorValuesKg = this.SensorValuesKg; + target.SensorValuesLb = this.SensorValuesLb; + target.WeightKg = this.WeightKg; + target.WeightLb = this.WeightLb; + target.CenterOfGravity = this.CenterOfGravity; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)CalibrationInfo).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)SensorValuesRaw).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)SensorValuesKg).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)SensorValuesLb).Serialize(writer); + + writer.Write(WeightKg); + + writer.Write(WeightLb); + + ((Microsoft.Dss.Core.IDssSerializable)CenterOfGravity).Serialize(writer); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + CalibrationInfo = (BalanceBoardCalibrationInfo)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardCalibrationInfo()).Deserialize(reader); + + SensorValuesRaw = (BalanceBoardSensors)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensors()).Deserialize(reader); + + SensorValuesKg = (BalanceBoardSensorsF)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensorsF()).Deserialize(reader); + + SensorValuesLb = (BalanceBoardSensorsF)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensorsF()).Deserialize(reader); + + WeightKg = reader.ReadSingle(); + + WeightLb = reader.ReadSingle(); + + CenterOfGravity = (PointF)((Microsoft.Dss.Core.IDssSerializable)new PointF()).Deserialize(reader); + + return this; + + } + } + + /// + /// Balance Board Calibration Info + /// + [DataContract()] + [XmlRootAttribute("BalanceBoardCalibrationInfo", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct BalanceBoardCalibrationInfo : ICloneable, IDssSerializable + { + + private BalanceBoardSensors _kg0; + + private BalanceBoardSensors _kg17; + + private BalanceBoardSensors _kg34; + + /// + /// Kg0 + /// + [DataMember()] + public BalanceBoardSensors Kg0 + { + get + { + return this._kg0; + } + set + { + this._kg0 = value; + } + } + + /// + /// Kg17 + /// + [DataMember()] + public BalanceBoardSensors Kg17 + { + get + { + return this._kg17; + } + set + { + this._kg17 = value; + } + } + + /// + /// Kg34 + /// + [DataMember()] + public BalanceBoardSensors Kg34 + { + get + { + return this._kg34; + } + set + { + this._kg34 = value; + } + } + + /// + /// Copy To Balance Board Calibration Info + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Balance Board Calibration Info + /// + public object Clone() + { + BalanceBoardCalibrationInfo target = new BalanceBoardCalibrationInfo(); + + target.Kg0 = this.Kg0; + target.Kg17 = this.Kg17; + target.Kg34 = this.Kg34; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + ((Microsoft.Dss.Core.IDssSerializable)Kg0).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Kg17).Serialize(writer); + + ((Microsoft.Dss.Core.IDssSerializable)Kg34).Serialize(writer); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + Kg0 = (BalanceBoardSensors)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensors()).Deserialize(reader); + + Kg17 = (BalanceBoardSensors)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensors()).Deserialize(reader); + + Kg34 = (BalanceBoardSensors)((Microsoft.Dss.Core.IDssSerializable)new BalanceBoardSensors()).Deserialize(reader); + + return this; + + } + } + + /// + /// Balance Board Sensors + /// + [DataContract()] + [XmlRootAttribute("BalanceBoardSensors", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct BalanceBoardSensors : ICloneable, IDssSerializable + { + + private Int16 _topRight; + + private Int16 _topLeft; + + private Int16 _bottomRight; + + private Int16 _bottomLeft; + + /// + /// Top Right + /// + [DataMember()] + public Int16 TopRight + { + get + { + return this._topRight; + } + set + { + this._topRight = value; + } + } + + /// + /// Top Left + /// + [DataMember()] + public Int16 TopLeft + { + get + { + return this._topLeft; + } + set + { + this._topLeft = value; + } + } + + /// + /// Bottom Right + /// + [DataMember()] + public Int16 BottomRight + { + get + { + return this._bottomRight; + } + set + { + this._bottomRight = value; + } + } + + /// + /// Bottom Left + /// + [DataMember()] + public Int16 BottomLeft + { + get + { + return this._bottomLeft; + } + set + { + this._bottomLeft = value; + } + } + + /// + /// Copy To Balance Board Sensors + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Balance Board Sensors + /// + public object Clone() + { + BalanceBoardSensors target = new BalanceBoardSensors(); + + target.TopRight = this.TopRight; + target.TopLeft = this.TopLeft; + target.BottomRight = this.BottomRight; + target.BottomLeft = this.BottomLeft; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(TopRight); + + writer.Write(TopLeft); + + writer.Write(BottomRight); + + writer.Write(BottomLeft); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + TopRight = reader.ReadInt16(); + + TopLeft = reader.ReadInt16(); + + BottomRight = reader.ReadInt16(); + + BottomLeft = reader.ReadInt16(); + + return this; + + } + } + + /// + /// Balance Board SensorsF + /// + [DataContract()] + [XmlRootAttribute("BalanceBoardSensorsF", Namespace="http://schemas.tempuri.org/2007/06/wiimote.html")] + public struct BalanceBoardSensorsF : ICloneable, IDssSerializable + { + + private Single _topRight; + + private Single _topLeft; + + private Single _bottomRight; + + private Single _bottomLeft; + + /// + /// Top Right + /// + [DataMember()] + public Single TopRight + { + get + { + return this._topRight; + } + set + { + this._topRight = value; + } + } + + /// + /// Top Left + /// + [DataMember()] + public Single TopLeft + { + get + { + return this._topLeft; + } + set + { + this._topLeft = value; + } + } + + /// + /// Bottom Right + /// + [DataMember()] + public Single BottomRight + { + get + { + return this._bottomRight; + } + set + { + this._bottomRight = value; + } + } + + /// + /// Bottom Left + /// + [DataMember()] + public Single BottomLeft + { + get + { + return this._bottomLeft; + } + set + { + this._bottomLeft = value; + } + } + + /// + /// Copy To Balance Board SensorsF + /// + public void CopyTo(IDssSerializable target) + { + throw new ArgumentException("CopyTo() is not valid for structs!"); + } + + /// + /// Clone Balance Board SensorsF + /// + public object Clone() + { + BalanceBoardSensorsF target = new BalanceBoardSensorsF(); + + target.TopRight = this.TopRight; + target.TopLeft = this.TopLeft; + target.BottomRight = this.BottomRight; + target.BottomLeft = this.BottomLeft; + return target; + + } + + /// + /// Serialize Serialize + /// + public void Serialize(System.IO.BinaryWriter writer) + { + writer.Write(TopRight); + + writer.Write(TopLeft); + + writer.Write(BottomRight); + + writer.Write(BottomLeft); + + } + + /// + /// Deserialize Deserialize + /// + public object Deserialize(System.IO.BinaryReader reader) + { + TopRight = reader.ReadSingle(); + + TopLeft = reader.ReadSingle(); + + BottomRight = reader.ReadSingle(); + + BottomLeft = reader.ReadSingle(); + + return this; + + } + } + + /// + /// Wiimote Operations + /// + [ServicePort()] + [XmlTypeAttribute(IncludeInSchema=false)] + public class WiimoteOperations : PortSet + { + + /// + /// Required Lookup request body type + /// + public virtual PortSet DsspDefaultLookup() + { + Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body = new Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup op = new Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Dssp Default Lookup and return the response port. + /// + public virtual PortSet DsspDefaultLookup(Microsoft.Dss.ServiceModel.Dssp.LookupRequestType body) + { + Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup op = new Microsoft.Dss.ServiceModel.Dssp.DsspDefaultLookup(); + op.Body = body ?? new Microsoft.Dss.ServiceModel.Dssp.LookupRequestType(); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// A request to drop the service. + /// + public virtual PortSet DsspDefaultDrop() + { + Microsoft.Dss.ServiceModel.Dssp.DropRequestType body = new Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop op = new Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Dssp Default Drop and return the response port. + /// + public virtual PortSet DsspDefaultDrop(Microsoft.Dss.ServiceModel.Dssp.DropRequestType body) + { + Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop op = new Microsoft.Dss.ServiceModel.Dssp.DsspDefaultDrop(); + op.Body = body ?? new Microsoft.Dss.ServiceModel.Dssp.DropRequestType(); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Required Get body type + /// + public virtual PortSet Get() + { + Microsoft.Dss.ServiceModel.Dssp.GetRequestType body = new Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + Get op = new Get(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Get and return the response port. + /// + public virtual PortSet Get(Microsoft.Dss.ServiceModel.Dssp.GetRequestType body) + { + Get op = new Get(); + op.Body = body ?? new Microsoft.Dss.ServiceModel.Dssp.GetRequestType(); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Subscribe and return the response port. + /// + public virtual PortSet Subscribe(IPort notificationPort) + { + Subscribe op = new Subscribe(); + op.Body = new Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + op.NotificationPort = notificationPort; + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Subscribe and return the response port. + /// + public virtual PortSet Subscribe(Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body, IPort notificationPort) + { + Subscribe op = new Subscribe(); + op.Body = body ?? new Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType(); + op.NotificationPort = notificationPort; + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Wiimote State + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort WiimoteChanged() + { + WiimoteState body = new WiimoteState(); + WiimoteChanged op = new WiimoteChanged(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Wiimote Changed and return the response port. + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort WiimoteChanged(WiimoteState body) + { + WiimoteChanged op = new WiimoteChanged(); + op.Body = body ?? new WiimoteState(); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// LED State + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetLEDs() + { + LEDState body = new LEDState(); + SetLEDs op = new SetLEDs(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post SetLE Ds and return the response port. + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetLEDs(LEDState body) + { + SetLEDs op = new SetLEDs(); + op.Body = body; + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Rumble Request + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetRumble() + { + RumbleRequest body = new RumbleRequest(); + SetRumble op = new SetRumble(body); + this.Post(op); + return op.ResponsePort; + + } + + /// + /// Post Set Rumble and return the response port. + /// + public virtual Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort SetRumble(RumbleRequest body) + { + SetRumble op = new SetRumble(); + op.Body = body; + this.Post(op); + return op.ResponsePort; + + } + } + + /// + /// Get + /// + [XmlTypeAttribute(IncludeInSchema=false)] + public class Get : Microsoft.Dss.ServiceModel.Dssp.Get> + { + + /// + /// Get + /// + public Get() + { + } + + /// + /// Get + /// + public Get(Microsoft.Dss.ServiceModel.Dssp.GetRequestType body) : + base(body) + { + } + + /// + /// Get + /// + public Get(Microsoft.Dss.ServiceModel.Dssp.GetRequestType body, Microsoft.Ccr.Core.PortSet responsePort) : + base(body, responsePort) + { + } + } + + /// + /// Subscribe to Wiimote service notifications. + /// + [XmlTypeAttribute(IncludeInSchema=false)] + [DisplayName("Subscribe")] + [Description("Subscribe to Wiimote service notifications.")] + public class Subscribe : Microsoft.Dss.ServiceModel.Dssp.Subscribe> + { + + /// + /// Subscribe to Wiimote service notifications. + /// + public Subscribe() + { + } + + /// + /// Subscribe to Wiimote service notifications. + /// + public Subscribe(Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body) : + base(body) + { + } + + /// + /// Subscribe to Wiimote service notifications. + /// + public Subscribe(Microsoft.Dss.ServiceModel.Dssp.SubscribeRequestType body, Microsoft.Ccr.Core.PortSet responsePort) : + base(body, responsePort) + { + } + } + + /// + /// Wiimote Changed + /// + [XmlTypeAttribute(IncludeInSchema=false)] + public class WiimoteChanged : Microsoft.Dss.ServiceModel.Dssp.Update> + { + + /// + /// Wiimote Changed + /// + public WiimoteChanged() + { + } + + /// + /// Wiimote Changed + /// + public WiimoteChanged(WiimoteState body) : + base(body) + { + } + + /// + /// Wiimote Changed + /// + public WiimoteChanged(WiimoteState body, Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) + { + } + } + + /// + /// Set Wiimote Leds + /// + [XmlTypeAttribute(IncludeInSchema=false)] + [DisplayName("Set Wiimote Leds")] + public class SetLEDs : Microsoft.Dss.ServiceModel.Dssp.Update> + { + + /// + /// Set Wiimote Leds + /// + public SetLEDs() + { + } + + /// + /// Set Wiimote Leds + /// + public SetLEDs(LEDState body) : + base(body) + { + } + + /// + /// Set Wiimote Leds + /// + public SetLEDs(LEDState body, Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) + { + } + } + + /// + /// Set Wiimote Rumble + /// + [XmlTypeAttribute(IncludeInSchema=false)] + [DisplayName("Set Wiimote Rumble")] + public class SetRumble : Microsoft.Dss.ServiceModel.Dssp.Update> + { + + /// + /// Set Wiimote Rumble + /// + public SetRumble() + { + } + + /// + /// Set Wiimote Rumble + /// + public SetRumble(RumbleRequest body) : + base(body) + { + } + + /// + /// Set Wiimote Rumble + /// + public SetRumble(RumbleRequest body, Microsoft.Dss.ServiceModel.Dssp.DsspResponsePort responsePort) : + base(body, responsePort) + { + } + } +} diff --git a/WiimoteCS/WiimoteMSRS/Proxy/wiimote.source.transform.cs b/WiimoteCS/WiimoteMSRS/Proxy/wiimote.source.transform.cs new file mode 100644 index 0000000..a8e510e --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Proxy/wiimote.source.transform.cs @@ -0,0 +1,771 @@ +using System; +using Microsoft.Dss.Core.Attributes; +using Microsoft.Dss.Core.Transforms; + +#if NET_CF20 +[assembly: ServiceDeclaration(DssServiceDeclaration.Transform, SourceAssemblyKey = @"cf.wiimote.y2007.m06, version=1.5.2.0, culture=neutral, publickeytoken=d17cbbb304dbbb71")] +#else +[assembly: ServiceDeclaration(DssServiceDeclaration.Transform, SourceAssemblyKey = @"wiimote.y2007.m06, version=1.5.2.0, culture=neutral, publickeytoken=d17cbbb304dbbb71")] +#endif +#if !URT_MINCLR +[assembly: System.Security.SecurityTransparent] +[assembly: System.Security.AllowPartiallyTrustedCallers] +#endif + +namespace Dss.Transforms.TransformWiimote +{ + + public class Transforms: TransformBase + { + + public static object Transform_WiimoteLib_Proxy_WiimoteState_TO_WiimoteLib_WiimoteState(object transformFrom) + { + WiimoteLib.WiimoteState target = new WiimoteLib.WiimoteState(); + WiimoteLib.Proxy.WiimoteState from = transformFrom as WiimoteLib.Proxy.WiimoteState; + target.AccelCalibrationInfo = (WiimoteLib.AccelCalibrationInfo)Transform_WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo(from.AccelCalibrationInfo); + target.AccelState = (WiimoteLib.AccelState)Transform_WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(from.AccelState); + target.ButtonState = (WiimoteLib.ButtonState)Transform_WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState(from.ButtonState); + target.IRState = (WiimoteLib.IRState)Transform_WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState(from.IRState); + target.BatteryRaw = from.BatteryRaw; + target.Battery = from.Battery; + target.Rumble = from.Rumble; + target.Extension = from.Extension; + target.ExtensionType = (WiimoteLib.ExtensionType)((System.Int32)from.ExtensionType); + target.NunchukState = (WiimoteLib.NunchukState)Transform_WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState(from.NunchukState); + target.ClassicControllerState = (WiimoteLib.ClassicControllerState)Transform_WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState(from.ClassicControllerState); + target.GuitarState = (WiimoteLib.GuitarState)Transform_WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState(from.GuitarState); + target.LEDState = (WiimoteLib.LEDState)Transform_WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState(from.LEDState); + return target; + } + + + public static object Transform_WiimoteLib_WiimoteState_TO_WiimoteLib_Proxy_WiimoteState(object transformFrom) + { + WiimoteLib.Proxy.WiimoteState target = new WiimoteLib.Proxy.WiimoteState(); + WiimoteLib.WiimoteState from = transformFrom as WiimoteLib.WiimoteState; + target.AccelCalibrationInfo = (WiimoteLib.Proxy.AccelCalibrationInfo)Transform_WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo(from.AccelCalibrationInfo); + target.AccelState = (WiimoteLib.Proxy.AccelState)Transform_WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(from.AccelState); + target.ButtonState = (WiimoteLib.Proxy.ButtonState)Transform_WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState(from.ButtonState); + target.IRState = (WiimoteLib.Proxy.IRState)Transform_WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState(from.IRState); + target.BatteryRaw = from.BatteryRaw; + target.Battery = from.Battery; + target.Rumble = from.Rumble; + target.Extension = from.Extension; + target.ExtensionType = (WiimoteLib.Proxy.ExtensionType)((System.Int32)from.ExtensionType); + target.NunchukState = (WiimoteLib.Proxy.NunchukState)Transform_WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState(from.NunchukState); + target.ClassicControllerState = (WiimoteLib.Proxy.ClassicControllerState)Transform_WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState(from.ClassicControllerState); + target.GuitarState = (WiimoteLib.Proxy.GuitarState)Transform_WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState(from.GuitarState); + target.LEDState = (WiimoteLib.Proxy.LEDState)Transform_WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState(from.LEDState); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState(object transformFrom) + { + WiimoteLib.LEDState target = new WiimoteLib.LEDState(); + WiimoteLib.Proxy.LEDState from = (WiimoteLib.Proxy.LEDState)transformFrom; + target.LED1 = from.LED1; + target.LED2 = from.LED2; + target.LED3 = from.LED3; + target.LED4 = from.LED4; + return target; + } + + + public static object Transform_WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState(object transformFrom) + { + WiimoteLib.Proxy.LEDState target = new WiimoteLib.Proxy.LEDState(); + WiimoteLib.LEDState from = (WiimoteLib.LEDState)transformFrom; + target.LED1 = from.LED1; + target.LED2 = from.LED2; + target.LED3 = from.LED3; + target.LED4 = from.LED4; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_RumbleRequest_TO_WiimoteLib_RumbleRequest(object transformFrom) + { + WiimoteLib.RumbleRequest target = new WiimoteLib.RumbleRequest(); + WiimoteLib.Proxy.RumbleRequest from = (WiimoteLib.Proxy.RumbleRequest)transformFrom; + target.Rumble = from.Rumble; + return target; + } + + + public static object Transform_WiimoteLib_RumbleRequest_TO_WiimoteLib_Proxy_RumbleRequest(object transformFrom) + { + WiimoteLib.Proxy.RumbleRequest target = new WiimoteLib.Proxy.RumbleRequest(); + WiimoteLib.RumbleRequest from = (WiimoteLib.RumbleRequest)transformFrom; + target.Rumble = from.Rumble; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_ExtensionType_TO_WiimoteLib_ExtensionType(object transformFrom) + { + WiimoteLib.ExtensionType target = new WiimoteLib.ExtensionType(); + return target; + } + + + public static object Transform_WiimoteLib_ExtensionType_TO_WiimoteLib_Proxy_ExtensionType(object transformFrom) + { + WiimoteLib.Proxy.ExtensionType target = new WiimoteLib.Proxy.ExtensionType(); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(object transformFrom) + { + WiimoteLib.PointF target = new WiimoteLib.PointF(); + WiimoteLib.Proxy.PointF from = (WiimoteLib.Proxy.PointF)transformFrom; + target.X = from.X; + target.Y = from.Y; + return target; + } + + + public static object Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(object transformFrom) + { + WiimoteLib.Proxy.PointF target = new WiimoteLib.Proxy.PointF(); + WiimoteLib.PointF from = (WiimoteLib.PointF)transformFrom; + target.X = from.X; + target.Y = from.Y; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(object transformFrom) + { + WiimoteLib.Point target = new WiimoteLib.Point(); + WiimoteLib.Proxy.Point from = (WiimoteLib.Proxy.Point)transformFrom; + target.X = from.X; + target.Y = from.Y; + return target; + } + + + public static object Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(object transformFrom) + { + WiimoteLib.Proxy.Point target = new WiimoteLib.Proxy.Point(); + WiimoteLib.Point from = (WiimoteLib.Point)transformFrom; + target.X = from.X; + target.Y = from.Y; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F(object transformFrom) + { + WiimoteLib.Point3F target = new WiimoteLib.Point3F(); + WiimoteLib.Proxy.Point3F from = (WiimoteLib.Proxy.Point3F)transformFrom; + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F(object transformFrom) + { + WiimoteLib.Proxy.Point3F target = new WiimoteLib.Proxy.Point3F(); + WiimoteLib.Point3F from = (WiimoteLib.Point3F)transformFrom; + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3(object transformFrom) + { + WiimoteLib.Point3 target = new WiimoteLib.Point3(); + WiimoteLib.Proxy.Point3 from = (WiimoteLib.Proxy.Point3)transformFrom; + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3(object transformFrom) + { + WiimoteLib.Proxy.Point3 target = new WiimoteLib.Proxy.Point3(); + WiimoteLib.Point3 from = (WiimoteLib.Point3)transformFrom; + target.X = from.X; + target.Y = from.Y; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo(object transformFrom) + { + WiimoteLib.AccelCalibrationInfo target = new WiimoteLib.AccelCalibrationInfo(); + WiimoteLib.Proxy.AccelCalibrationInfo from = (WiimoteLib.Proxy.AccelCalibrationInfo)transformFrom; + target.X0 = from.X0; + target.Y0 = from.Y0; + target.Z0 = from.Z0; + target.XG = from.XG; + target.YG = from.YG; + target.ZG = from.ZG; + return target; + } + + + public static object Transform_WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo(object transformFrom) + { + WiimoteLib.Proxy.AccelCalibrationInfo target = new WiimoteLib.Proxy.AccelCalibrationInfo(); + WiimoteLib.AccelCalibrationInfo from = (WiimoteLib.AccelCalibrationInfo)transformFrom; + target.X0 = from.X0; + target.Y0 = from.Y0; + target.Z0 = from.Z0; + target.XG = from.XG; + target.YG = from.YG; + target.ZG = from.ZG; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(object transformFrom) + { + WiimoteLib.AccelState target = new WiimoteLib.AccelState(); + WiimoteLib.Proxy.AccelState from = (WiimoteLib.Proxy.AccelState)transformFrom; + target.RawValues = (WiimoteLib.Point3)Transform_WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3(from.RawValues); + target.Values = (WiimoteLib.Point3F)Transform_WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F(from.Values); + return target; + } + + + public static object Transform_WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(object transformFrom) + { + WiimoteLib.Proxy.AccelState target = new WiimoteLib.Proxy.AccelState(); + WiimoteLib.AccelState from = (WiimoteLib.AccelState)transformFrom; + target.RawValues = (WiimoteLib.Proxy.Point3)Transform_WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3(from.RawValues); + target.Values = (WiimoteLib.Proxy.Point3F)Transform_WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F(from.Values); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState(object transformFrom) + { + WiimoteLib.ButtonState target = new WiimoteLib.ButtonState(); + WiimoteLib.Proxy.ButtonState from = (WiimoteLib.Proxy.ButtonState)transformFrom; + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.One = from.One; + target.Two = from.Two; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + return target; + } + + + public static object Transform_WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState(object transformFrom) + { + WiimoteLib.Proxy.ButtonState target = new WiimoteLib.Proxy.ButtonState(); + WiimoteLib.ButtonState from = (WiimoteLib.ButtonState)transformFrom; + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.One = from.One; + target.Two = from.Two; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState(object transformFrom) + { + WiimoteLib.IRState target = new WiimoteLib.IRState(); + WiimoteLib.Proxy.IRState from = (WiimoteLib.Proxy.IRState)transformFrom; + target.Mode = (WiimoteLib.IRMode)((System.Byte)from.Mode); + + // copy WiimoteLib.IRSensor[] target.IRSensors = from.IRSensors + if (from.IRSensors != null) + { + target.IRSensors = new WiimoteLib.IRSensor[from.IRSensors.GetLength(0)]; + + for (int d0 = 0; d0 < from.IRSensors.GetLength(0); d0++) + target.IRSensors[d0] = (WiimoteLib.IRSensor)Transform_WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor(from.IRSensors[d0]); + } + target.RawMidpoint = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawMidpoint); + target.Midpoint = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Midpoint); + return target; + } + + + public static object Transform_WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState(object transformFrom) + { + WiimoteLib.Proxy.IRState target = new WiimoteLib.Proxy.IRState(); + WiimoteLib.IRState from = (WiimoteLib.IRState)transformFrom; + target.Mode = (WiimoteLib.Proxy.IRMode)((System.Byte)from.Mode); + + // copy WiimoteLib.Proxy.IRSensor[] target.IRSensors = from.IRSensors + if (from.IRSensors != null) + { + target.IRSensors = new WiimoteLib.Proxy.IRSensor[from.IRSensors.GetLength(0)]; + + for (int d0 = 0; d0 < from.IRSensors.GetLength(0); d0++) + target.IRSensors[d0] = (WiimoteLib.Proxy.IRSensor)Transform_WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor(from.IRSensors[d0]); + } + target.RawMidpoint = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawMidpoint); + target.Midpoint = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.Midpoint); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_IRMode_TO_WiimoteLib_IRMode(object transformFrom) + { + WiimoteLib.IRMode target = new WiimoteLib.IRMode(); + return target; + } + + + public static object Transform_WiimoteLib_IRMode_TO_WiimoteLib_Proxy_IRMode(object transformFrom) + { + WiimoteLib.Proxy.IRMode target = new WiimoteLib.Proxy.IRMode(); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor(object transformFrom) + { + WiimoteLib.IRSensor target = new WiimoteLib.IRSensor(); + WiimoteLib.Proxy.IRSensor from = (WiimoteLib.Proxy.IRSensor)transformFrom; + target.RawPosition = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawPosition); + target.Position = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Position); + target.Size = from.Size; + target.Found = from.Found; + return target; + } + + + public static object Transform_WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor(object transformFrom) + { + WiimoteLib.Proxy.IRSensor target = new WiimoteLib.Proxy.IRSensor(); + WiimoteLib.IRSensor from = (WiimoteLib.IRSensor)transformFrom; + target.RawPosition = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawPosition); + target.Position = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.Position); + target.Size = from.Size; + target.Found = from.Found; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState(object transformFrom) + { + WiimoteLib.NunchukState target = new WiimoteLib.NunchukState(); + WiimoteLib.Proxy.NunchukState from = (WiimoteLib.Proxy.NunchukState)transformFrom; + target.CalibrationInfo = (WiimoteLib.NunchukCalibrationInfo)Transform_WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo(from.CalibrationInfo); + target.AccelState = (WiimoteLib.AccelState)Transform_WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState(from.AccelState); + target.RawJoystick = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystick); + target.Joystick = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Joystick); + target.C = from.C; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState(object transformFrom) + { + WiimoteLib.Proxy.NunchukState target = new WiimoteLib.Proxy.NunchukState(); + WiimoteLib.NunchukState from = (WiimoteLib.NunchukState)transformFrom; + target.CalibrationInfo = (WiimoteLib.Proxy.NunchukCalibrationInfo)Transform_WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo(from.CalibrationInfo); + target.AccelState = (WiimoteLib.Proxy.AccelState)Transform_WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState(from.AccelState); + target.RawJoystick = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawJoystick); + target.Joystick = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.Joystick); + target.C = from.C; + target.Z = from.Z; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo(object transformFrom) + { + WiimoteLib.NunchukCalibrationInfo target = new WiimoteLib.NunchukCalibrationInfo(); + WiimoteLib.Proxy.NunchukCalibrationInfo from = (WiimoteLib.Proxy.NunchukCalibrationInfo)transformFrom; + target.MinX = from.MinX; + target.MidX = from.MidX; + target.MaxX = from.MaxX; + target.MinY = from.MinY; + target.MidY = from.MidY; + target.MaxY = from.MaxY; + return target; + } + + + public static object Transform_WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo(object transformFrom) + { + WiimoteLib.Proxy.NunchukCalibrationInfo target = new WiimoteLib.Proxy.NunchukCalibrationInfo(); + WiimoteLib.NunchukCalibrationInfo from = (WiimoteLib.NunchukCalibrationInfo)transformFrom; + target.MinX = from.MinX; + target.MidX = from.MidX; + target.MaxX = from.MaxX; + target.MinY = from.MinY; + target.MidY = from.MidY; + target.MaxY = from.MaxY; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState(object transformFrom) + { + WiimoteLib.ClassicControllerState target = new WiimoteLib.ClassicControllerState(); + WiimoteLib.Proxy.ClassicControllerState from = (WiimoteLib.Proxy.ClassicControllerState)transformFrom; + target.CalibrationInfo = (WiimoteLib.ClassicControllerCalibrationInfo)Transform_WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo(from.CalibrationInfo); + target.ButtonState = (WiimoteLib.ClassicControllerButtonState)Transform_WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState(from.ButtonState); + target.RawJoystickL = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystickL); + target.RawJoystickR = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystickR); + target.JoystickL = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.JoystickL); + target.JoystickR = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.JoystickR); + target.RawTriggerL = from.RawTriggerL; + target.RawTriggerR = from.RawTriggerR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + + public static object Transform_WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState(object transformFrom) + { + WiimoteLib.Proxy.ClassicControllerState target = new WiimoteLib.Proxy.ClassicControllerState(); + WiimoteLib.ClassicControllerState from = (WiimoteLib.ClassicControllerState)transformFrom; + target.CalibrationInfo = (WiimoteLib.Proxy.ClassicControllerCalibrationInfo)Transform_WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo(from.CalibrationInfo); + target.ButtonState = (WiimoteLib.Proxy.ClassicControllerButtonState)Transform_WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState(from.ButtonState); + target.RawJoystickL = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawJoystickL); + target.RawJoystickR = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawJoystickR); + target.JoystickL = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.JoystickL); + target.JoystickR = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.JoystickR); + target.RawTriggerL = from.RawTriggerL; + target.RawTriggerR = from.RawTriggerR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo(object transformFrom) + { + WiimoteLib.ClassicControllerCalibrationInfo target = new WiimoteLib.ClassicControllerCalibrationInfo(); + WiimoteLib.Proxy.ClassicControllerCalibrationInfo from = (WiimoteLib.Proxy.ClassicControllerCalibrationInfo)transformFrom; + target.MinXL = from.MinXL; + target.MidXL = from.MidXL; + target.MaxXL = from.MaxXL; + target.MinYL = from.MinYL; + target.MidYL = from.MidYL; + target.MaxYL = from.MaxYL; + target.MinXR = from.MinXR; + target.MidXR = from.MidXR; + target.MaxXR = from.MaxXR; + target.MinYR = from.MinYR; + target.MidYR = from.MidYR; + target.MaxYR = from.MaxYR; + target.MinTriggerL = from.MinTriggerL; + target.MaxTriggerL = from.MaxTriggerL; + target.MinTriggerR = from.MinTriggerR; + target.MaxTriggerR = from.MaxTriggerR; + return target; + } + + + public static object Transform_WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo(object transformFrom) + { + WiimoteLib.Proxy.ClassicControllerCalibrationInfo target = new WiimoteLib.Proxy.ClassicControllerCalibrationInfo(); + WiimoteLib.ClassicControllerCalibrationInfo from = (WiimoteLib.ClassicControllerCalibrationInfo)transformFrom; + target.MinXL = from.MinXL; + target.MidXL = from.MidXL; + target.MaxXL = from.MaxXL; + target.MinYL = from.MinYL; + target.MidYL = from.MidYL; + target.MaxYL = from.MaxYL; + target.MinXR = from.MinXR; + target.MidXR = from.MidXR; + target.MaxXR = from.MaxXR; + target.MinYR = from.MinYR; + target.MidYR = from.MidYR; + target.MaxYR = from.MaxYR; + target.MinTriggerL = from.MinTriggerL; + target.MaxTriggerL = from.MaxTriggerL; + target.MinTriggerR = from.MinTriggerR; + target.MaxTriggerR = from.MaxTriggerR; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState(object transformFrom) + { + WiimoteLib.ClassicControllerButtonState target = new WiimoteLib.ClassicControllerButtonState(); + WiimoteLib.Proxy.ClassicControllerButtonState from = (WiimoteLib.Proxy.ClassicControllerButtonState)transformFrom; + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + target.X = from.X; + target.Y = from.Y; + target.ZL = from.ZL; + target.ZR = from.ZR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + + public static object Transform_WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState(object transformFrom) + { + WiimoteLib.Proxy.ClassicControllerButtonState target = new WiimoteLib.Proxy.ClassicControllerButtonState(); + WiimoteLib.ClassicControllerButtonState from = (WiimoteLib.ClassicControllerButtonState)transformFrom; + target.A = from.A; + target.B = from.B; + target.Plus = from.Plus; + target.Home = from.Home; + target.Minus = from.Minus; + target.Up = from.Up; + target.Down = from.Down; + target.Left = from.Left; + target.Right = from.Right; + target.X = from.X; + target.Y = from.Y; + target.ZL = from.ZL; + target.ZR = from.ZR; + target.TriggerL = from.TriggerL; + target.TriggerR = from.TriggerR; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState(object transformFrom) + { + WiimoteLib.GuitarState target = new WiimoteLib.GuitarState(); + WiimoteLib.Proxy.GuitarState from = (WiimoteLib.Proxy.GuitarState)transformFrom; + target.ButtonState = (WiimoteLib.GuitarButtonState)Transform_WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState(from.ButtonState); + target.RawJoystick = (WiimoteLib.Point)Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point(from.RawJoystick); + target.Joystick = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.Joystick); + target.RawWhammyBar = from.RawWhammyBar; + target.WhammyBar = from.WhammyBar; + return target; + } + + + public static object Transform_WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState(object transformFrom) + { + WiimoteLib.Proxy.GuitarState target = new WiimoteLib.Proxy.GuitarState(); + WiimoteLib.GuitarState from = (WiimoteLib.GuitarState)transformFrom; + target.ButtonState = (WiimoteLib.Proxy.GuitarButtonState)Transform_WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState(from.ButtonState); + target.RawJoystick = (WiimoteLib.Proxy.Point)Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point(from.RawJoystick); + target.Joystick = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.Joystick); + target.RawWhammyBar = from.RawWhammyBar; + target.WhammyBar = from.WhammyBar; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState(object transformFrom) + { + WiimoteLib.GuitarButtonState target = new WiimoteLib.GuitarButtonState(); + WiimoteLib.Proxy.GuitarButtonState from = (WiimoteLib.Proxy.GuitarButtonState)transformFrom; + target.StrumUp = from.StrumUp; + target.StrumDown = from.StrumDown; + target.Green = from.Green; + target.Red = from.Red; + target.Yellow = from.Yellow; + target.Blue = from.Blue; + target.Orange = from.Orange; + target.Minus = from.Minus; + target.Plus = from.Plus; + return target; + } + + + public static object Transform_WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState(object transformFrom) + { + WiimoteLib.Proxy.GuitarButtonState target = new WiimoteLib.Proxy.GuitarButtonState(); + WiimoteLib.GuitarButtonState from = (WiimoteLib.GuitarButtonState)transformFrom; + target.StrumUp = from.StrumUp; + target.StrumDown = from.StrumDown; + target.Green = from.Green; + target.Red = from.Red; + target.Yellow = from.Yellow; + target.Blue = from.Blue; + target.Orange = from.Orange; + target.Minus = from.Minus; + target.Plus = from.Plus; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_BalanceBoardState_TO_WiimoteLib_BalanceBoardState(object transformFrom) + { + WiimoteLib.BalanceBoardState target = new WiimoteLib.BalanceBoardState(); + WiimoteLib.Proxy.BalanceBoardState from = (WiimoteLib.Proxy.BalanceBoardState)transformFrom; + target.CalibrationInfo = (WiimoteLib.BalanceBoardCalibrationInfo)Transform_WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo(from.CalibrationInfo); + target.SensorValuesRaw = (WiimoteLib.BalanceBoardSensors)Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.SensorValuesRaw); + target.SensorValuesKg = (WiimoteLib.BalanceBoardSensorsF)Transform_WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(from.SensorValuesKg); + target.SensorValuesLb = (WiimoteLib.BalanceBoardSensorsF)Transform_WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(from.SensorValuesLb); + target.WeightKg = from.WeightKg; + target.WeightLb = from.WeightLb; + target.CenterOfGravity = (WiimoteLib.PointF)Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF(from.CenterOfGravity); + return target; + } + + + public static object Transform_WiimoteLib_BalanceBoardState_TO_WiimoteLib_Proxy_BalanceBoardState(object transformFrom) + { + WiimoteLib.Proxy.BalanceBoardState target = new WiimoteLib.Proxy.BalanceBoardState(); + WiimoteLib.BalanceBoardState from = (WiimoteLib.BalanceBoardState)transformFrom; + target.CalibrationInfo = (WiimoteLib.Proxy.BalanceBoardCalibrationInfo)Transform_WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo(from.CalibrationInfo); + target.SensorValuesRaw = (WiimoteLib.Proxy.BalanceBoardSensors)Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(from.SensorValuesRaw); + target.SensorValuesKg = (WiimoteLib.Proxy.BalanceBoardSensorsF)Transform_WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(from.SensorValuesKg); + target.SensorValuesLb = (WiimoteLib.Proxy.BalanceBoardSensorsF)Transform_WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(from.SensorValuesLb); + target.WeightKg = from.WeightKg; + target.WeightLb = from.WeightLb; + target.CenterOfGravity = (WiimoteLib.Proxy.PointF)Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF(from.CenterOfGravity); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo(object transformFrom) + { + WiimoteLib.BalanceBoardCalibrationInfo target = new WiimoteLib.BalanceBoardCalibrationInfo(); + WiimoteLib.Proxy.BalanceBoardCalibrationInfo from = (WiimoteLib.Proxy.BalanceBoardCalibrationInfo)transformFrom; + target.Kg0 = (WiimoteLib.BalanceBoardSensors)Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg0); + target.Kg17 = (WiimoteLib.BalanceBoardSensors)Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg17); + target.Kg34 = (WiimoteLib.BalanceBoardSensors)Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(from.Kg34); + return target; + } + + + public static object Transform_WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo(object transformFrom) + { + WiimoteLib.Proxy.BalanceBoardCalibrationInfo target = new WiimoteLib.Proxy.BalanceBoardCalibrationInfo(); + WiimoteLib.BalanceBoardCalibrationInfo from = (WiimoteLib.BalanceBoardCalibrationInfo)transformFrom; + target.Kg0 = (WiimoteLib.Proxy.BalanceBoardSensors)Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(from.Kg0); + target.Kg17 = (WiimoteLib.Proxy.BalanceBoardSensors)Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(from.Kg17); + target.Kg34 = (WiimoteLib.Proxy.BalanceBoardSensors)Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(from.Kg34); + return target; + } + + + public static object Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors(object transformFrom) + { + WiimoteLib.BalanceBoardSensors target = new WiimoteLib.BalanceBoardSensors(); + WiimoteLib.Proxy.BalanceBoardSensors from = (WiimoteLib.Proxy.BalanceBoardSensors)transformFrom; + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + + public static object Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors(object transformFrom) + { + WiimoteLib.Proxy.BalanceBoardSensors target = new WiimoteLib.Proxy.BalanceBoardSensors(); + WiimoteLib.BalanceBoardSensors from = (WiimoteLib.BalanceBoardSensors)transformFrom; + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + + public static object Transform_WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF(object transformFrom) + { + WiimoteLib.BalanceBoardSensorsF target = new WiimoteLib.BalanceBoardSensorsF(); + WiimoteLib.Proxy.BalanceBoardSensorsF from = (WiimoteLib.Proxy.BalanceBoardSensorsF)transformFrom; + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + + public static object Transform_WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF(object transformFrom) + { + WiimoteLib.Proxy.BalanceBoardSensorsF target = new WiimoteLib.Proxy.BalanceBoardSensorsF(); + WiimoteLib.BalanceBoardSensorsF from = (WiimoteLib.BalanceBoardSensorsF)transformFrom; + target.TopRight = from.TopRight; + target.TopLeft = from.TopLeft; + target.BottomRight = from.BottomRight; + target.BottomLeft = from.BottomLeft; + return target; + } + + static Transforms() + { + Register(); + } + public static void Register() + { + AddProxyTransform(typeof(WiimoteLib.Proxy.WiimoteState), Transform_WiimoteLib_Proxy_WiimoteState_TO_WiimoteLib_WiimoteState); + AddSourceTransform(typeof(WiimoteLib.WiimoteState), Transform_WiimoteLib_WiimoteState_TO_WiimoteLib_Proxy_WiimoteState); + AddProxyTransform(typeof(WiimoteLib.Proxy.LEDState), Transform_WiimoteLib_Proxy_LEDState_TO_WiimoteLib_LEDState); + AddSourceTransform(typeof(WiimoteLib.LEDState), Transform_WiimoteLib_LEDState_TO_WiimoteLib_Proxy_LEDState); + AddProxyTransform(typeof(WiimoteLib.Proxy.RumbleRequest), Transform_WiimoteLib_Proxy_RumbleRequest_TO_WiimoteLib_RumbleRequest); + AddSourceTransform(typeof(WiimoteLib.RumbleRequest), Transform_WiimoteLib_RumbleRequest_TO_WiimoteLib_Proxy_RumbleRequest); + AddProxyTransform(typeof(WiimoteLib.Proxy.ExtensionType), Transform_WiimoteLib_Proxy_ExtensionType_TO_WiimoteLib_ExtensionType); + AddSourceTransform(typeof(WiimoteLib.ExtensionType), Transform_WiimoteLib_ExtensionType_TO_WiimoteLib_Proxy_ExtensionType); + AddProxyTransform(typeof(WiimoteLib.Proxy.PointF), Transform_WiimoteLib_Proxy_PointF_TO_WiimoteLib_PointF); + AddSourceTransform(typeof(WiimoteLib.PointF), Transform_WiimoteLib_PointF_TO_WiimoteLib_Proxy_PointF); + AddProxyTransform(typeof(WiimoteLib.Proxy.Point), Transform_WiimoteLib_Proxy_Point_TO_WiimoteLib_Point); + AddSourceTransform(typeof(WiimoteLib.Point), Transform_WiimoteLib_Point_TO_WiimoteLib_Proxy_Point); + AddProxyTransform(typeof(WiimoteLib.Proxy.Point3F), Transform_WiimoteLib_Proxy_Point3F_TO_WiimoteLib_Point3F); + AddSourceTransform(typeof(WiimoteLib.Point3F), Transform_WiimoteLib_Point3F_TO_WiimoteLib_Proxy_Point3F); + AddProxyTransform(typeof(WiimoteLib.Proxy.Point3), Transform_WiimoteLib_Proxy_Point3_TO_WiimoteLib_Point3); + AddSourceTransform(typeof(WiimoteLib.Point3), Transform_WiimoteLib_Point3_TO_WiimoteLib_Proxy_Point3); + AddProxyTransform(typeof(WiimoteLib.Proxy.AccelCalibrationInfo), Transform_WiimoteLib_Proxy_AccelCalibrationInfo_TO_WiimoteLib_AccelCalibrationInfo); + AddSourceTransform(typeof(WiimoteLib.AccelCalibrationInfo), Transform_WiimoteLib_AccelCalibrationInfo_TO_WiimoteLib_Proxy_AccelCalibrationInfo); + AddProxyTransform(typeof(WiimoteLib.Proxy.AccelState), Transform_WiimoteLib_Proxy_AccelState_TO_WiimoteLib_AccelState); + AddSourceTransform(typeof(WiimoteLib.AccelState), Transform_WiimoteLib_AccelState_TO_WiimoteLib_Proxy_AccelState); + AddProxyTransform(typeof(WiimoteLib.Proxy.ButtonState), Transform_WiimoteLib_Proxy_ButtonState_TO_WiimoteLib_ButtonState); + AddSourceTransform(typeof(WiimoteLib.ButtonState), Transform_WiimoteLib_ButtonState_TO_WiimoteLib_Proxy_ButtonState); + AddProxyTransform(typeof(WiimoteLib.Proxy.IRState), Transform_WiimoteLib_Proxy_IRState_TO_WiimoteLib_IRState); + AddSourceTransform(typeof(WiimoteLib.IRState), Transform_WiimoteLib_IRState_TO_WiimoteLib_Proxy_IRState); + AddProxyTransform(typeof(WiimoteLib.Proxy.IRMode), Transform_WiimoteLib_Proxy_IRMode_TO_WiimoteLib_IRMode); + AddSourceTransform(typeof(WiimoteLib.IRMode), Transform_WiimoteLib_IRMode_TO_WiimoteLib_Proxy_IRMode); + AddProxyTransform(typeof(WiimoteLib.Proxy.IRSensor), Transform_WiimoteLib_Proxy_IRSensor_TO_WiimoteLib_IRSensor); + AddSourceTransform(typeof(WiimoteLib.IRSensor), Transform_WiimoteLib_IRSensor_TO_WiimoteLib_Proxy_IRSensor); + AddProxyTransform(typeof(WiimoteLib.Proxy.NunchukState), Transform_WiimoteLib_Proxy_NunchukState_TO_WiimoteLib_NunchukState); + AddSourceTransform(typeof(WiimoteLib.NunchukState), Transform_WiimoteLib_NunchukState_TO_WiimoteLib_Proxy_NunchukState); + AddProxyTransform(typeof(WiimoteLib.Proxy.NunchukCalibrationInfo), Transform_WiimoteLib_Proxy_NunchukCalibrationInfo_TO_WiimoteLib_NunchukCalibrationInfo); + AddSourceTransform(typeof(WiimoteLib.NunchukCalibrationInfo), Transform_WiimoteLib_NunchukCalibrationInfo_TO_WiimoteLib_Proxy_NunchukCalibrationInfo); + AddProxyTransform(typeof(WiimoteLib.Proxy.ClassicControllerState), Transform_WiimoteLib_Proxy_ClassicControllerState_TO_WiimoteLib_ClassicControllerState); + AddSourceTransform(typeof(WiimoteLib.ClassicControllerState), Transform_WiimoteLib_ClassicControllerState_TO_WiimoteLib_Proxy_ClassicControllerState); + AddProxyTransform(typeof(WiimoteLib.Proxy.ClassicControllerCalibrationInfo), Transform_WiimoteLib_Proxy_ClassicControllerCalibrationInfo_TO_WiimoteLib_ClassicControllerCalibrationInfo); + AddSourceTransform(typeof(WiimoteLib.ClassicControllerCalibrationInfo), Transform_WiimoteLib_ClassicControllerCalibrationInfo_TO_WiimoteLib_Proxy_ClassicControllerCalibrationInfo); + AddProxyTransform(typeof(WiimoteLib.Proxy.ClassicControllerButtonState), Transform_WiimoteLib_Proxy_ClassicControllerButtonState_TO_WiimoteLib_ClassicControllerButtonState); + AddSourceTransform(typeof(WiimoteLib.ClassicControllerButtonState), Transform_WiimoteLib_ClassicControllerButtonState_TO_WiimoteLib_Proxy_ClassicControllerButtonState); + AddProxyTransform(typeof(WiimoteLib.Proxy.GuitarState), Transform_WiimoteLib_Proxy_GuitarState_TO_WiimoteLib_GuitarState); + AddSourceTransform(typeof(WiimoteLib.GuitarState), Transform_WiimoteLib_GuitarState_TO_WiimoteLib_Proxy_GuitarState); + AddProxyTransform(typeof(WiimoteLib.Proxy.GuitarButtonState), Transform_WiimoteLib_Proxy_GuitarButtonState_TO_WiimoteLib_GuitarButtonState); + AddSourceTransform(typeof(WiimoteLib.GuitarButtonState), Transform_WiimoteLib_GuitarButtonState_TO_WiimoteLib_Proxy_GuitarButtonState); + AddProxyTransform(typeof(WiimoteLib.Proxy.BalanceBoardState), Transform_WiimoteLib_Proxy_BalanceBoardState_TO_WiimoteLib_BalanceBoardState); + AddSourceTransform(typeof(WiimoteLib.BalanceBoardState), Transform_WiimoteLib_BalanceBoardState_TO_WiimoteLib_Proxy_BalanceBoardState); + AddProxyTransform(typeof(WiimoteLib.Proxy.BalanceBoardCalibrationInfo), Transform_WiimoteLib_Proxy_BalanceBoardCalibrationInfo_TO_WiimoteLib_BalanceBoardCalibrationInfo); + AddSourceTransform(typeof(WiimoteLib.BalanceBoardCalibrationInfo), Transform_WiimoteLib_BalanceBoardCalibrationInfo_TO_WiimoteLib_Proxy_BalanceBoardCalibrationInfo); + AddProxyTransform(typeof(WiimoteLib.Proxy.BalanceBoardSensors), Transform_WiimoteLib_Proxy_BalanceBoardSensors_TO_WiimoteLib_BalanceBoardSensors); + AddSourceTransform(typeof(WiimoteLib.BalanceBoardSensors), Transform_WiimoteLib_BalanceBoardSensors_TO_WiimoteLib_Proxy_BalanceBoardSensors); + AddProxyTransform(typeof(WiimoteLib.Proxy.BalanceBoardSensorsF), Transform_WiimoteLib_Proxy_BalanceBoardSensorsF_TO_WiimoteLib_BalanceBoardSensorsF); + AddSourceTransform(typeof(WiimoteLib.BalanceBoardSensorsF), Transform_WiimoteLib_BalanceBoardSensorsF_TO_WiimoteLib_Proxy_BalanceBoardSensorsF); + } + } +} + diff --git a/WiimoteCS/WiimoteMSRS/Wiimote.csproj b/WiimoteCS/WiimoteMSRS/Wiimote.csproj new file mode 100644 index 0000000..0782050 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Wiimote.csproj @@ -0,0 +1,164 @@ + + + Local + 9.0.21022 + 2.0 + {257D62B4-A234-47FF-BFA6-FC4DE1039F15} + Debug + AnyCPU + + + + + Wiimote.Y2007.M06 + WiimoteLib + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\samples\mrisamples.snk + JScript + Grid + IE50 + false + true + Library + OnBuildSuccess + + + + + 2.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\ + false + 285212672 + false + + + TRACE;DEBUG;INSTRUMENTED;MSRS + + + true + 4096 + false + + + false + false + false + false + 1 + + + C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\ + false + 285212672 + false + + + TRACE;INSTRUMENTED + + + true + pdbonly + TRACE;MSRS + 4096 + false + + + false + false + false + false + 1 + + + + True + False + + + False + False + + + True + False + + + True + False + + + False + False + + + + False + False + + + + + DataTypes.cs + + + Events.cs + + + HIDImports.cs + + + Wiimote.cs + + + + + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + + + + + + + + "C:\Program Files (x86)\Microsoft Robotics Dev Studio 2008 Express\bin\DssProxy.exe" /dll:"$(TargetPath)" /proxyprojectpath:"$(ProjectDir)Proxy " /keyfile:"$(AssemblyOriginatorKeyFile)" $(ProxyDelaySign) $(CompactFrameworkProxyGen) /binpath:". " @(ReferencePath->'/referencepath:"%(RootDir)%(Directory) "', ' ') + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Wiimote.csproj.bak b/WiimoteCS/WiimoteMSRS/Wiimote.csproj.bak new file mode 100644 index 0000000..87088a9 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Wiimote.csproj.bak @@ -0,0 +1,168 @@ + + + Local + 9.0.21022 + 2.0 + {257D62B4-A234-47FF-BFA6-FC4DE1039F15} + Debug + AnyCPU + + + + + Wiimote.Y2007.M06 + WiimoteLib + C:\Microsoft Robotics Studio (1.5)\samples\mrisamples.snk + JScript + Grid + IE50 + false + true + Library + OnBuildSuccess + + + + + Wiimote + 3~fbcaea64-807b-4669-86c0-1931aeffccda + http://vault.brianpeek.com/VaultService + SourceGear Vault Visual Studio 2005 Client:{1EA47954-8515-402d-82D9-B5C332120A8D} + 2.0 + + + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + C:\Microsoft Robotics Studio (1.5)\bin\ + false + 285212672 + false + + + TRACE;DEBUG;INSTRUMENTED;MSRS + + + true + 4096 + false + + + false + false + false + false + 1 + + + C:\Microsoft Robotics Studio (1.5)\bin\ + false + 285212672 + false + + + TRACE;INSTRUMENTED + + + true + pdbonly + TRACE;MSRS + 4096 + false + + + false + false + false + false + 1 + + + + False + False + + + False + False + + + False + False + + + False + False + + + False + False + + + + False + False + + + + + DataTypes.cs + + + Events.cs + + + HIDImports.cs + + + Wiimote.cs + + + + + + + + + + + + False + .NET Framework 2.0 %28x86%29 + true + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + false + + + + + + + + + + "C:\Microsoft Robotics Studio (1.5)\bin\DssProxy.exe" /dll:"$(TargetPath)" /proxyprojectpath:"$(ProjectDir)Proxy " /keyfile:"$(AssemblyOriginatorKeyFile)" $(ProxyDelaySign) $(CompactFrameworkProxyGen) /binpath:". " @(ReferencePath->'/referencepath:"%(RootDir)%(Directory) "', ' ') + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/Wiimote.manifest.xml b/WiimoteCS/WiimoteMSRS/Wiimote.manifest.xml new file mode 100644 index 0000000..80e944e --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/Wiimote.manifest.xml @@ -0,0 +1,11 @@ + + + + + http://schemas.tempuri.org/2007/06/wiimote.html + + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteMSRS/WiimoteMSRS.sln b/WiimoteCS/WiimoteMSRS/WiimoteMSRS.sln new file mode 100644 index 0000000..9462ceb --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/WiimoteMSRS.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wiimote", "Wiimote.csproj", "{257D62B4-A234-47FF-BFA6-FC4DE1039F15}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {257D62B4-A234-47FF-BFA6-FC4DE1039F15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {257D62B4-A234-47FF-BFA6-FC4DE1039F15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {257D62B4-A234-47FF-BFA6-FC4DE1039F15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {257D62B4-A234-47FF-BFA6-FC4DE1039F15}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WiimoteCS/WiimoteMSRS/WiimoteService.cs b/WiimoteCS/WiimoteMSRS/WiimoteService.cs new file mode 100644 index 0000000..e453f40 --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/WiimoteService.cs @@ -0,0 +1,163 @@ +//------------------------------------------------------------------------------ +// Wiimote.cs +// +// This code was generated by the DssNewService tool. +// +//------------------------------------------------------------------------------ +using Microsoft.Ccr.Core; +using Microsoft.Dss.Core; +using Microsoft.Dss.Core.Attributes; +using Microsoft.Dss.ServiceModel.Dssp; +using Microsoft.Dss.ServiceModel.DsspServiceBase; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Xml; +using wiimotelib = WiimoteLib; +using submgr = Microsoft.Dss.Services.SubscriptionManager; +using dflt = Microsoft.Dss.Services.DefaultTarget; + +namespace WiimoteLib +{ + + /// + /// The Wiimote Service + /// + [DisplayName("Wiimote")] + [Description("The Wiimote Service")] + [Contract(Contract.Identifier)] + public class WiimoteService : DsspServiceBase + { + /// + /// _state + /// + private WiimoteState _state = new WiimoteState(); + /// + /// _main Port + /// + [ServicePort("/wiimote", AllowMultipleInstances=false)] + private WiimoteOperations _mainPort = new WiimoteOperations(); + + // internal port to post changes from the wiimote library's event + private Port _internalStateChangedPort = new Port(); + + // instance of the wiimote library + private Wiimote _wm = new Wiimote(); + + // Subscription manager partner + [Partner(Partners.SubscriptionManagerString, + Contract = submgr.Contract.Identifier, + CreationPolicy = PartnerCreationPolicy.CreateAlways)] + submgr.SubscriptionManagerPort _subMgrPort = new submgr.SubscriptionManagerPort(); + + /// + /// Default Service Constructor + /// + public WiimoteService(DsspServiceCreationPort creationPort) : + base(creationPort) + { + } + /// + /// Service Start + /// + protected override void Start() + { + base.Start(); + + // setup internal notifications when we receive a OnWiimoteChanged event + Activate(Arbiter.Receive(true, _internalStateChangedPort, InternalWiimoteChangedHandler)); + + // hookup event handlers + _wm.WiimoteChanged += new EventHandler(_wm_WiimoteChanged); + _wm.WiimoteExtensionChanged += new EventHandler(_wm_WiimoteExtensionChanged); + + // connect to wiimote and setup standard params + _wm.Connect(); + _wm.SetReportType(InputReport.IRAccel, true); + _wm.SetLEDs(false, true, false, true); + } + + void _wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args) + { + // when we get an update from the lib, post a msg to our internal update port + _internalStateChangedPort.Post(new WiimoteChanged(args.WiimoteState)); + } + + void _wm_WiimoteExtensionChanged(object sender, WiimoteExtensionChangedEventArgs args) + { + // when an extension is plugged in, change the report type (not that any of them are actually + // working right now with this service + if (args.Inserted) + _wm.SetReportType(InputReport.IRExtensionAccel, true); + else + _wm.SetReportType(InputReport.IRAccel, true); + } + + public void InternalWiimoteChangedHandler(WiimoteChanged update) + { + _state = update.Body; + + // send a msg to our subscribers that the wiimote changed + SendNotification(_subMgrPort, update); + + update.ResponsePort.Post(DefaultUpdateResponseType.Instance); + } + + [ServiceHandler(ServiceHandlerBehavior.Exclusive)] + public void SetLEDsHandler(SetLEDs update) + { + // handle setting LEDs from the outside world + _wm.SetLEDs(update.Body.LED1, update.Body.LED2, update.Body.LED3, update.Body.LED4); + _state.LEDState = update.Body; + update.ResponsePort.Post(DefaultUpdateResponseType.Instance); + } + + [ServiceHandler(ServiceHandlerBehavior.Exclusive)] + public void SetRumbleHandler(SetRumble update) + { + // handle setting rumble state from outside world + _state.Rumble = update.Body.Rumble; + _wm.SetRumble(update.Body.Rumble); + update.ResponsePort.Post(DefaultUpdateResponseType.Instance); + } + + [ServiceHandler(ServiceHandlerBehavior.Exclusive)] + public virtual IEnumerator SubscribeHandler(Subscribe subscribe) + { + // handle subscriptions from other services + yield return Arbiter.Choice( + base.SubscribeHelper(_subMgrPort, subscribe.Body, subscribe.ResponsePort), + delegate(SuccessResult success) + { + SendNotification(_subMgrPort, subscribe.Body.Subscriber, new WiimoteChanged(_state)); + }, + delegate(Exception fault) + { + LogError(fault); + } + ); + + yield break; + } + + [ServiceHandler(ServiceHandlerBehavior.Teardown)] + public virtual IEnumerator DropHandler(dflt.Drop drop) + { + // drop the connection to the Wiimote + _wm.Disconnect(); + yield break; + } + + /// + /// Get Handler + /// + /// + /// + [ServiceHandler(ServiceHandlerBehavior.Concurrent)] + public virtual IEnumerator GetHandler(Get get) + { + get.ResponsePort.Post(_state); + yield break; + } + } +} diff --git a/WiimoteCS/WiimoteMSRS/WiimoteTypes.cs b/WiimoteCS/WiimoteMSRS/WiimoteTypes.cs new file mode 100644 index 0000000..6c0f77d --- /dev/null +++ b/WiimoteCS/WiimoteMSRS/WiimoteTypes.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// WiimoteTypes.cs +// +// This code was generated by the DssNewService tool. +// +//------------------------------------------------------------------------------ +using Microsoft.Ccr.Core; +using Microsoft.Dss.Core.Attributes; +using Microsoft.Dss.ServiceModel.Dssp; +using System; +using System.Collections.Generic; +using W3C.Soap; +using wiimotelib = WiimoteLib; +using System.ComponentModel; + +namespace WiimoteLib +{ + + /// + /// Wiimote Contract + /// + public sealed class Contract + { + /// The Unique Contract Identifier for the Wiimote service + public const String Identifier = "http://schemas.tempuri.org/2007/06/wiimote.html"; + } + + /// + /// Wiimote Operations + /// + public class WiimoteOperations : PortSet + { + } + /// + /// Get + /// + public class Get : Get> + { + } + + [DisplayName("Subscribe")] + [Description("Subscribe to Wiimote service notifications.")] + public class Subscribe : Subscribe> + { + /// + /// Subscribe to Wiimote + /// + public Subscribe() { this.Body = new SubscribeRequestType(); } + } + + public class WiimoteChanged : Update> + { + /// + /// Indicates an update to the Wiimote sensors + /// + public WiimoteChanged() + { + if (this.Body == null) + this.Body = new WiimoteState(); + } + + /// + /// Indicates an update to the Wiimote sensors + /// + /// + public WiimoteChanged(WiimoteState state) + { + this.Body = state ?? new WiimoteState(); + } + } + + [DisplayName("Set Wiimote Leds")] + public class SetLEDs : Update> + { + } + + [DisplayName("Set Wiimote Rumble")] + public class SetRumble : Update> + { + } +} diff --git a/WiimoteCS/WiimoteTest/MultipleWiimoteForm.Designer.cs b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.Designer.cs new file mode 100644 index 0000000..946f0e9 --- /dev/null +++ b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.Designer.cs @@ -0,0 +1,64 @@ +namespace WiimoteTest +{ + partial class MultipleWiimoteForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tabWiimotes = new System.Windows.Forms.TabControl(); + this.SuspendLayout(); + // + // tabWiimotes + // + this.tabWiimotes.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabWiimotes.Location = new System.Drawing.Point(0, 0); + this.tabWiimotes.Name = "tabWiimotes"; + this.tabWiimotes.SelectedIndex = 0; + this.tabWiimotes.Size = new System.Drawing.Size(710, 484); + this.tabWiimotes.TabIndex = 0; + // + // MultipleWiimoteForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(710, 484); + this.Controls.Add(this.tabWiimotes); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "MultipleWiimoteForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Multiple Wiimote Tester"; + this.Load += new System.EventHandler(this.MultipleWiimoteForm_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MultipleWiimoteForm_FormClosing); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabWiimotes; + } +} \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/MultipleWiimoteForm.cs b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.cs new file mode 100644 index 0000000..5fffe06 --- /dev/null +++ b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.cs @@ -0,0 +1,91 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; +using WiimoteLib; + +namespace WiimoteTest +{ + public partial class MultipleWiimoteForm : Form + { + // map a wiimote to a specific state user control dealie + Dictionary mWiimoteMap = new Dictionary(); + WiimoteCollection mWC; + + public MultipleWiimoteForm() + { + InitializeComponent(); + } + + private void MultipleWiimoteForm_Load(object sender, EventArgs e) + { + // find all wiimotes connected to the system + mWC = new WiimoteCollection(); + int index = 1; + + try + { + mWC.FindAllWiimotes(); + } + catch(WiimoteNotFoundException ex) + { + MessageBox.Show(ex.Message, "Wiimote not found error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch(WiimoteException ex) + { + MessageBox.Show(ex.Message, "Wiimote error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + catch(Exception ex) + { + MessageBox.Show(ex.Message, "Unknown error", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + + foreach(Wiimote wm in mWC) + { + // create a new tab + TabPage tp = new TabPage("Wiimote " + index); + tabWiimotes.TabPages.Add(tp); + + // create a new user control + WiimoteInfo wi = new WiimoteInfo(wm); + tp.Controls.Add(wi); + + // setup the map from this wiimote's ID to that control + mWiimoteMap[wm.ID] = wi; + + // connect it and set it up as always + wm.WiimoteChanged += wm_WiimoteChanged; + wm.WiimoteExtensionChanged += wm_WiimoteExtensionChanged; + + wm.Connect(); + if(wm.WiimoteState.ExtensionType != ExtensionType.BalanceBoard) + wm.SetReportType(InputReport.IRExtensionAccel, IRSensitivity.Maximum, true); + + wm.SetLEDs(index++); + } + } + + void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs e) + { + WiimoteInfo wi = mWiimoteMap[((Wiimote)sender).ID]; + wi.UpdateState(e); + } + + void wm_WiimoteExtensionChanged(object sender, WiimoteExtensionChangedEventArgs e) + { + // find the control for this Wiimote + WiimoteInfo wi = mWiimoteMap[((Wiimote)sender).ID]; + wi.UpdateExtension(e); + + if(e.Inserted) + ((Wiimote)sender).SetReportType(InputReport.IRExtensionAccel, true); + else + ((Wiimote)sender).SetReportType(InputReport.IRAccel, true); + } + + private void MultipleWiimoteForm_FormClosing(object sender, FormClosingEventArgs e) + { + foreach(Wiimote wm in mWC) + wm.Disconnect(); + } + } +} diff --git a/WiimoteCS/WiimoteTest/MultipleWiimoteForm.resx b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteCS/WiimoteTest/MultipleWiimoteForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/Program.cs b/WiimoteCS/WiimoteTest/Program.cs new file mode 100644 index 0000000..5fde884 --- /dev/null +++ b/WiimoteCS/WiimoteTest/Program.cs @@ -0,0 +1,19 @@ +using System; +using System.Windows.Forms; + +namespace WiimoteTest +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new MultipleWiimoteForm()); + } + } +} \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/Properties/AssemblyInfo.cs b/WiimoteCS/WiimoteTest/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..c7db01a --- /dev/null +++ b/WiimoteCS/WiimoteTest/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WiimoteTest")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyProduct("WiimoteTest")] +[assembly: AssemblyCopyright("Copyright © 2008 Brian Peek (www.brianpeek.com)")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("31da7adf-7372-4d09-a1be-528aea858e3c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +[assembly: AssemblyVersion("1.5.2.0")] +[assembly: AssemblyFileVersion("1.5.2.0")] diff --git a/WiimoteCS/WiimoteTest/Properties/Resources.Designer.cs b/WiimoteCS/WiimoteTest/Properties/Resources.Designer.cs new file mode 100644 index 0000000..bbfbfca --- /dev/null +++ b/WiimoteCS/WiimoteTest/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.312 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WiimoteTest.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WiimoteTest.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/WiimoteCS/WiimoteTest/Properties/Resources.resx b/WiimoteCS/WiimoteTest/Properties/Resources.resx new file mode 100644 index 0000000..25a6121 --- /dev/null +++ b/WiimoteCS/WiimoteTest/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/Properties/Settings.Designer.cs b/WiimoteCS/WiimoteTest/Properties/Settings.Designer.cs new file mode 100644 index 0000000..71eaec6 --- /dev/null +++ b/WiimoteCS/WiimoteTest/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:2.0.50727.312 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WiimoteTest.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/WiimoteCS/WiimoteTest/Properties/Settings.settings b/WiimoteCS/WiimoteTest/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/WiimoteCS/WiimoteTest/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WiimoteCS/WiimoteTest/SingleWiimoteForm.Designer.cs b/WiimoteCS/WiimoteTest/SingleWiimoteForm.Designer.cs new file mode 100644 index 0000000..bdd15ab --- /dev/null +++ b/WiimoteCS/WiimoteTest/SingleWiimoteForm.Designer.cs @@ -0,0 +1,65 @@ +namespace WiimoteTest +{ + partial class SingleWiimoteForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.wiimoteInfo1 = new WiimoteTest.WiimoteInfo(); + this.SuspendLayout(); + // + // wiimoteInfo1 + // + this.wiimoteInfo1.Dock = System.Windows.Forms.DockStyle.Fill; + this.wiimoteInfo1.Location = new System.Drawing.Point(0, 0); + this.wiimoteInfo1.Name = "wiimoteInfo1"; + this.wiimoteInfo1.Size = new System.Drawing.Size(698, 453); + this.wiimoteInfo1.TabIndex = 0; + // + // SingleWiimoteForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(698, 453); + this.Controls.Add(this.wiimoteInfo1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.Name = "SingleWiimoteForm"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Wiimote Tester"; + this.Load += new System.EventHandler(this.Form1_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); + this.ResumeLayout(false); + + } + + #endregion + + private WiimoteInfo wiimoteInfo1; + + } +} + diff --git a/WiimoteCS/WiimoteTest/SingleWiimoteForm.cs b/WiimoteCS/WiimoteTest/SingleWiimoteForm.cs new file mode 100644 index 0000000..bcb22b8 --- /dev/null +++ b/WiimoteCS/WiimoteTest/SingleWiimoteForm.cs @@ -0,0 +1,57 @@ +////////////////////////////////////////////////////////////////////////////////// +// SingleWiimoteForm.cs +// Managed Wiimote Library Tester +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; +using System.Windows.Forms; +using WiimoteLib; + +namespace WiimoteTest +{ + public partial class SingleWiimoteForm : Form + { + Wiimote wm = new Wiimote(); + + public SingleWiimoteForm() + { + InitializeComponent(); + } + + private void Form1_Load(object sender, EventArgs e) + { + wiimoteInfo1.Wiimote = wm; + + wm.WiimoteChanged += wm_WiimoteChanged; + wm.WiimoteExtensionChanged += wm_WiimoteExtensionChanged; + wm.Connect(); + wm.SetReportType(InputReport.IRAccel, true); + wm.SetLEDs(false, true, true, false); + } + + private void wm_WiimoteChanged(object sender, WiimoteChangedEventArgs args) + { + wiimoteInfo1.UpdateState(args); + } + + private void wm_WiimoteExtensionChanged(object sender, WiimoteExtensionChangedEventArgs args) + { + wiimoteInfo1.UpdateExtension(args); + + if(args.Inserted) + wm.SetReportType(InputReport.IRExtensionAccel, true); + else + wm.SetReportType(InputReport.IRAccel, true); + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + wm.Disconnect(); + } + } +} diff --git a/WiimoteCS/WiimoteTest/SingleWiimoteForm.resx b/WiimoteCS/WiimoteTest/SingleWiimoteForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteCS/WiimoteTest/SingleWiimoteForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/WiimoteInfo.Designer.cs b/WiimoteCS/WiimoteTest/WiimoteInfo.Designer.cs new file mode 100644 index 0000000..9454590 --- /dev/null +++ b/WiimoteCS/WiimoteTest/WiimoteInfo.Designer.cs @@ -0,0 +1,830 @@ +namespace WiimoteTest +{ + partial class WiimoteInfo + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.groupBox8 = new System.Windows.Forms.GroupBox(); + this.clbButtons = new System.Windows.Forms.CheckedListBox(); + this.lblTriggerR = new System.Windows.Forms.Label(); + this.lblTriggerL = new System.Windows.Forms.Label(); + this.lblIR3 = new System.Windows.Forms.Label(); + this.lblIR4 = new System.Windows.Forms.Label(); + this.lblCCJoy2 = new System.Windows.Forms.Label(); + this.lblCCJoy1 = new System.Windows.Forms.Label(); + this.groupBox5 = new System.Windows.Forms.GroupBox(); + this.lblIR3Raw = new System.Windows.Forms.Label(); + this.lblIR1Raw = new System.Windows.Forms.Label(); + this.lblIR4Raw = new System.Windows.Forms.Label(); + this.lblIR2Raw = new System.Windows.Forms.Label(); + this.lblIR1 = new System.Windows.Forms.Label(); + this.lblIR2 = new System.Windows.Forms.Label(); + this.chkFound3 = new System.Windows.Forms.CheckBox(); + this.chkFound4 = new System.Windows.Forms.CheckBox(); + this.chkFound1 = new System.Windows.Forms.CheckBox(); + this.chkFound2 = new System.Windows.Forms.CheckBox(); + this.pbIR = new System.Windows.Forms.PictureBox(); + this.lblGuitarWhammy = new System.Windows.Forms.Label(); + this.groupBox7 = new System.Windows.Forms.GroupBox(); + this.clbTouchbar = new System.Windows.Forms.CheckedListBox(); + this.lblGuitarType = new System.Windows.Forms.Label(); + this.lblGuitarJoy = new System.Windows.Forms.Label(); + this.clbGuitarButtons = new System.Windows.Forms.CheckedListBox(); + this.groupBox6 = new System.Windows.Forms.GroupBox(); + this.clbCCButtons = new System.Windows.Forms.CheckedListBox(); + this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.pbBattery = new System.Windows.Forms.ProgressBar(); + this.lblBattery = new System.Windows.Forms.Label(); + this.groupBox3 = new System.Windows.Forms.GroupBox(); + this.chkLED2 = new System.Windows.Forms.CheckBox(); + this.chkLED4 = new System.Windows.Forms.CheckBox(); + this.chkLED3 = new System.Windows.Forms.CheckBox(); + this.chkLED1 = new System.Windows.Forms.CheckBox(); + this.chkRumble = new System.Windows.Forms.CheckBox(); + this.chkZ = new System.Windows.Forms.CheckBox(); + this.chkC = new System.Windows.Forms.CheckBox(); + this.lblChuk = new System.Windows.Forms.Label(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.lblChukJoy = new System.Windows.Forms.Label(); + this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.lblAccel = new System.Windows.Forms.Label(); + this.chkExtension = new System.Windows.Forms.CheckBox(); + this.groupBox9 = new System.Windows.Forms.GroupBox(); + this.lblCOG = new System.Windows.Forms.Label(); + this.chkLbs = new System.Windows.Forms.CheckBox(); + this.lblBBBR = new System.Windows.Forms.Label(); + this.lblBBTR = new System.Windows.Forms.Label(); + this.lblBBBL = new System.Windows.Forms.Label(); + this.lblBBTotal = new System.Windows.Forms.Label(); + this.lblBBTL = new System.Windows.Forms.Label(); + this.lblDevicePath = new System.Windows.Forms.Label(); + this.groupBox10 = new System.Windows.Forms.GroupBox(); + this.lbDrumVelocity = new System.Windows.Forms.ListBox(); + this.lblDrumJoy = new System.Windows.Forms.Label(); + this.clbDrums = new System.Windows.Forms.CheckedListBox(); + this.groupBox8.SuspendLayout(); + this.groupBox5.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbIR)).BeginInit(); + this.groupBox7.SuspendLayout(); + this.groupBox6.SuspendLayout(); + this.groupBox4.SuspendLayout(); + this.groupBox3.SuspendLayout(); + this.groupBox2.SuspendLayout(); + this.groupBox1.SuspendLayout(); + this.groupBox9.SuspendLayout(); + this.groupBox10.SuspendLayout(); + this.SuspendLayout(); + // + // groupBox8 + // + this.groupBox8.Controls.Add(this.clbButtons); + this.groupBox8.Location = new System.Drawing.Point(0, 0); + this.groupBox8.Name = "groupBox8"; + this.groupBox8.Size = new System.Drawing.Size(72, 220); + this.groupBox8.TabIndex = 37; + this.groupBox8.TabStop = false; + this.groupBox8.Text = "Wiimote"; + // + // clbButtons + // + this.clbButtons.FormattingEnabled = true; + this.clbButtons.Items.AddRange(new object[] { + "A", + "B", + "-", + "Home", + "+", + "1", + "2", + "Up", + "Down", + "Left", + "Right"}); + this.clbButtons.Location = new System.Drawing.Point(8, 16); + this.clbButtons.Name = "clbButtons"; + this.clbButtons.Size = new System.Drawing.Size(56, 184); + this.clbButtons.TabIndex = 1; + // + // lblTriggerR + // + this.lblTriggerR.AutoSize = true; + this.lblTriggerR.Location = new System.Drawing.Point(76, 104); + this.lblTriggerR.Name = "lblTriggerR"; + this.lblTriggerR.Size = new System.Drawing.Size(51, 13); + this.lblTriggerR.TabIndex = 25; + this.lblTriggerR.Text = "Trigger R"; + // + // lblTriggerL + // + this.lblTriggerL.AutoSize = true; + this.lblTriggerL.Location = new System.Drawing.Point(76, 88); + this.lblTriggerL.Name = "lblTriggerL"; + this.lblTriggerL.Size = new System.Drawing.Size(49, 13); + this.lblTriggerL.TabIndex = 24; + this.lblTriggerL.Text = "Trigger L"; + // + // lblIR3 + // + this.lblIR3.AutoSize = true; + this.lblIR3.Location = new System.Drawing.Point(8, 48); + this.lblIR3.Name = "lblIR3"; + this.lblIR3.Size = new System.Drawing.Size(24, 13); + this.lblIR3.TabIndex = 7; + this.lblIR3.Text = "IR3"; + // + // lblIR4 + // + this.lblIR4.AutoSize = true; + this.lblIR4.Location = new System.Drawing.Point(8, 64); + this.lblIR4.Name = "lblIR4"; + this.lblIR4.Size = new System.Drawing.Size(24, 13); + this.lblIR4.TabIndex = 7; + this.lblIR4.Text = "IR4"; + // + // lblCCJoy2 + // + this.lblCCJoy2.Location = new System.Drawing.Point(76, 52); + this.lblCCJoy2.Name = "lblCCJoy2"; + this.lblCCJoy2.Size = new System.Drawing.Size(108, 32); + this.lblCCJoy2.TabIndex = 24; + this.lblCCJoy2.Text = "Right Joystick"; + // + // lblCCJoy1 + // + this.lblCCJoy1.Location = new System.Drawing.Point(76, 16); + this.lblCCJoy1.Name = "lblCCJoy1"; + this.lblCCJoy1.Size = new System.Drawing.Size(108, 32); + this.lblCCJoy1.TabIndex = 24; + this.lblCCJoy1.Text = "Left Joystick"; + // + // groupBox5 + // + this.groupBox5.Controls.Add(this.lblIR3Raw); + this.groupBox5.Controls.Add(this.lblIR1Raw); + this.groupBox5.Controls.Add(this.lblIR4Raw); + this.groupBox5.Controls.Add(this.lblIR2Raw); + this.groupBox5.Controls.Add(this.lblIR3); + this.groupBox5.Controls.Add(this.lblIR1); + this.groupBox5.Controls.Add(this.lblIR4); + this.groupBox5.Controls.Add(this.lblIR2); + this.groupBox5.Controls.Add(this.chkFound3); + this.groupBox5.Controls.Add(this.chkFound4); + this.groupBox5.Controls.Add(this.chkFound1); + this.groupBox5.Controls.Add(this.chkFound2); + this.groupBox5.Location = new System.Drawing.Point(184, 0); + this.groupBox5.Name = "groupBox5"; + this.groupBox5.Size = new System.Drawing.Size(176, 188); + this.groupBox5.TabIndex = 34; + this.groupBox5.TabStop = false; + this.groupBox5.Text = "IR"; + // + // lblIR3Raw + // + this.lblIR3Raw.AutoSize = true; + this.lblIR3Raw.Location = new System.Drawing.Point(8, 112); + this.lblIR3Raw.Name = "lblIR3Raw"; + this.lblIR3Raw.Size = new System.Drawing.Size(46, 13); + this.lblIR3Raw.TabIndex = 10; + this.lblIR3Raw.Text = "IR3Raw"; + // + // lblIR1Raw + // + this.lblIR1Raw.AutoSize = true; + this.lblIR1Raw.Location = new System.Drawing.Point(8, 80); + this.lblIR1Raw.Name = "lblIR1Raw"; + this.lblIR1Raw.Size = new System.Drawing.Size(46, 13); + this.lblIR1Raw.TabIndex = 10; + this.lblIR1Raw.Text = "IR1Raw"; + // + // lblIR4Raw + // + this.lblIR4Raw.AutoSize = true; + this.lblIR4Raw.Location = new System.Drawing.Point(8, 128); + this.lblIR4Raw.Name = "lblIR4Raw"; + this.lblIR4Raw.Size = new System.Drawing.Size(46, 13); + this.lblIR4Raw.TabIndex = 9; + this.lblIR4Raw.Text = "IR4Raw"; + // + // lblIR2Raw + // + this.lblIR2Raw.AutoSize = true; + this.lblIR2Raw.Location = new System.Drawing.Point(8, 96); + this.lblIR2Raw.Name = "lblIR2Raw"; + this.lblIR2Raw.Size = new System.Drawing.Size(46, 13); + this.lblIR2Raw.TabIndex = 9; + this.lblIR2Raw.Text = "IR2Raw"; + // + // lblIR1 + // + this.lblIR1.AutoSize = true; + this.lblIR1.Location = new System.Drawing.Point(8, 16); + this.lblIR1.Name = "lblIR1"; + this.lblIR1.Size = new System.Drawing.Size(24, 13); + this.lblIR1.TabIndex = 7; + this.lblIR1.Text = "IR1"; + // + // lblIR2 + // + this.lblIR2.AutoSize = true; + this.lblIR2.Location = new System.Drawing.Point(8, 32); + this.lblIR2.Name = "lblIR2"; + this.lblIR2.Size = new System.Drawing.Size(24, 13); + this.lblIR2.TabIndex = 7; + this.lblIR2.Text = "IR2"; + // + // chkFound3 + // + this.chkFound3.AutoSize = true; + this.chkFound3.Location = new System.Drawing.Point(60, 148); + this.chkFound3.Name = "chkFound3"; + this.chkFound3.Size = new System.Drawing.Size(46, 17); + this.chkFound3.TabIndex = 8; + this.chkFound3.Text = "IR 3"; + this.chkFound3.UseVisualStyleBackColor = true; + // + // chkFound4 + // + this.chkFound4.AutoSize = true; + this.chkFound4.Location = new System.Drawing.Point(60, 164); + this.chkFound4.Name = "chkFound4"; + this.chkFound4.Size = new System.Drawing.Size(46, 17); + this.chkFound4.TabIndex = 8; + this.chkFound4.Text = "IR 4"; + this.chkFound4.UseVisualStyleBackColor = true; + // + // chkFound1 + // + this.chkFound1.AutoSize = true; + this.chkFound1.Location = new System.Drawing.Point(8, 148); + this.chkFound1.Name = "chkFound1"; + this.chkFound1.Size = new System.Drawing.Size(46, 17); + this.chkFound1.TabIndex = 8; + this.chkFound1.Text = "IR 1"; + this.chkFound1.UseVisualStyleBackColor = true; + // + // chkFound2 + // + this.chkFound2.AutoSize = true; + this.chkFound2.Location = new System.Drawing.Point(8, 164); + this.chkFound2.Name = "chkFound2"; + this.chkFound2.Size = new System.Drawing.Size(46, 17); + this.chkFound2.TabIndex = 8; + this.chkFound2.Text = "IR 2"; + this.chkFound2.UseVisualStyleBackColor = true; + // + // pbIR + // + this.pbIR.Location = new System.Drawing.Point(4, 248); + this.pbIR.Name = "pbIR"; + this.pbIR.Size = new System.Drawing.Size(256, 192); + this.pbIR.TabIndex = 28; + this.pbIR.TabStop = false; + // + // lblGuitarWhammy + // + this.lblGuitarWhammy.AutoSize = true; + this.lblGuitarWhammy.Location = new System.Drawing.Point(92, 140); + this.lblGuitarWhammy.Name = "lblGuitarWhammy"; + this.lblGuitarWhammy.Size = new System.Drawing.Size(51, 13); + this.lblGuitarWhammy.TabIndex = 24; + this.lblGuitarWhammy.Text = "Whammy"; + // + // groupBox7 + // + this.groupBox7.Controls.Add(this.clbTouchbar); + this.groupBox7.Controls.Add(this.lblGuitarType); + this.groupBox7.Controls.Add(this.lblGuitarWhammy); + this.groupBox7.Controls.Add(this.lblGuitarJoy); + this.groupBox7.Controls.Add(this.clbGuitarButtons); + this.groupBox7.Location = new System.Drawing.Point(364, 272); + this.groupBox7.Name = "groupBox7"; + this.groupBox7.Size = new System.Drawing.Size(188, 176); + this.groupBox7.TabIndex = 36; + this.groupBox7.TabStop = false; + this.groupBox7.Text = "Guitar"; + // + // clbTouchbar + // + this.clbTouchbar.FormattingEnabled = true; + this.clbTouchbar.Items.AddRange(new object[] { + "Green", + "Red", + "Yellow", + "Blue", + "Orange"}); + this.clbTouchbar.Location = new System.Drawing.Point(88, 16); + this.clbTouchbar.Name = "clbTouchbar"; + this.clbTouchbar.Size = new System.Drawing.Size(80, 79); + this.clbTouchbar.TabIndex = 25; + // + // lblGuitarType + // + this.lblGuitarType.AutoSize = true; + this.lblGuitarType.Location = new System.Drawing.Point(4, 156); + this.lblGuitarType.Name = "lblGuitarType"; + this.lblGuitarType.Size = new System.Drawing.Size(31, 13); + this.lblGuitarType.TabIndex = 24; + this.lblGuitarType.Text = "Type"; + // + // lblGuitarJoy + // + this.lblGuitarJoy.Location = new System.Drawing.Point(92, 104); + this.lblGuitarJoy.Name = "lblGuitarJoy"; + this.lblGuitarJoy.Size = new System.Drawing.Size(92, 32); + this.lblGuitarJoy.TabIndex = 24; + this.lblGuitarJoy.Text = "Joystick Values"; + // + // clbGuitarButtons + // + this.clbGuitarButtons.FormattingEnabled = true; + this.clbGuitarButtons.Items.AddRange(new object[] { + "Green", + "Red", + "Yellow", + "Blue", + "Orange", + "-", + "+", + "StrumUp", + "StrumDown"}); + this.clbGuitarButtons.Location = new System.Drawing.Point(4, 16); + this.clbGuitarButtons.Name = "clbGuitarButtons"; + this.clbGuitarButtons.Size = new System.Drawing.Size(80, 139); + this.clbGuitarButtons.TabIndex = 23; + // + // groupBox6 + // + this.groupBox6.Controls.Add(this.lblTriggerR); + this.groupBox6.Controls.Add(this.lblTriggerL); + this.groupBox6.Controls.Add(this.lblCCJoy2); + this.groupBox6.Controls.Add(this.lblCCJoy1); + this.groupBox6.Controls.Add(this.clbCCButtons); + this.groupBox6.Location = new System.Drawing.Point(364, 0); + this.groupBox6.Name = "groupBox6"; + this.groupBox6.Size = new System.Drawing.Size(188, 268); + this.groupBox6.TabIndex = 35; + this.groupBox6.TabStop = false; + this.groupBox6.Text = "Classic Controller"; + // + // clbCCButtons + // + this.clbCCButtons.FormattingEnabled = true; + this.clbCCButtons.Items.AddRange(new object[] { + "A", + "B", + "X", + "Y", + "-", + "Home", + "+", + "Up", + "Down", + "Left", + "Right", + "ZL", + "ZR", + "LTrigger", + "RTrigger"}); + this.clbCCButtons.Location = new System.Drawing.Point(4, 16); + this.clbCCButtons.Name = "clbCCButtons"; + this.clbCCButtons.Size = new System.Drawing.Size(68, 244); + this.clbCCButtons.TabIndex = 23; + // + // groupBox4 + // + this.groupBox4.Controls.Add(this.pbBattery); + this.groupBox4.Controls.Add(this.lblBattery); + this.groupBox4.Location = new System.Drawing.Point(184, 188); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(176, 52); + this.groupBox4.TabIndex = 33; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Battery"; + // + // pbBattery + // + this.pbBattery.Location = new System.Drawing.Point(8, 20); + this.pbBattery.Maximum = 200; + this.pbBattery.Name = "pbBattery"; + this.pbBattery.Size = new System.Drawing.Size(128, 23); + this.pbBattery.Step = 1; + this.pbBattery.TabIndex = 6; + // + // lblBattery + // + this.lblBattery.AutoSize = true; + this.lblBattery.Location = new System.Drawing.Point(140, 24); + this.lblBattery.Name = "lblBattery"; + this.lblBattery.Size = new System.Drawing.Size(35, 13); + this.lblBattery.TabIndex = 9; + this.lblBattery.Text = "label1"; + // + // groupBox3 + // + this.groupBox3.Controls.Add(this.chkLED2); + this.groupBox3.Controls.Add(this.chkLED4); + this.groupBox3.Controls.Add(this.chkLED3); + this.groupBox3.Controls.Add(this.chkLED1); + this.groupBox3.Controls.Add(this.chkRumble); + this.groupBox3.Location = new System.Drawing.Point(264, 248); + this.groupBox3.Name = "groupBox3"; + this.groupBox3.Size = new System.Drawing.Size(96, 120); + this.groupBox3.TabIndex = 32; + this.groupBox3.TabStop = false; + this.groupBox3.Text = "Outputs"; + // + // chkLED2 + // + this.chkLED2.AutoSize = true; + this.chkLED2.Location = new System.Drawing.Point(8, 36); + this.chkLED2.Name = "chkLED2"; + this.chkLED2.Size = new System.Drawing.Size(53, 17); + this.chkLED2.TabIndex = 3; + this.chkLED2.Text = "LED2"; + this.chkLED2.UseVisualStyleBackColor = true; + this.chkLED2.CheckedChanged += new System.EventHandler(this.chkLED_CheckedChanged); + // + // chkLED4 + // + this.chkLED4.AutoSize = true; + this.chkLED4.Location = new System.Drawing.Point(8, 76); + this.chkLED4.Name = "chkLED4"; + this.chkLED4.Size = new System.Drawing.Size(53, 17); + this.chkLED4.TabIndex = 3; + this.chkLED4.Text = "LED4"; + this.chkLED4.UseVisualStyleBackColor = true; + this.chkLED4.CheckedChanged += new System.EventHandler(this.chkLED_CheckedChanged); + // + // chkLED3 + // + this.chkLED3.AutoSize = true; + this.chkLED3.Location = new System.Drawing.Point(8, 56); + this.chkLED3.Name = "chkLED3"; + this.chkLED3.Size = new System.Drawing.Size(53, 17); + this.chkLED3.TabIndex = 3; + this.chkLED3.Text = "LED3"; + this.chkLED3.UseVisualStyleBackColor = true; + this.chkLED3.CheckedChanged += new System.EventHandler(this.chkLED_CheckedChanged); + // + // chkLED1 + // + this.chkLED1.AutoSize = true; + this.chkLED1.Location = new System.Drawing.Point(8, 16); + this.chkLED1.Name = "chkLED1"; + this.chkLED1.Size = new System.Drawing.Size(53, 17); + this.chkLED1.TabIndex = 3; + this.chkLED1.Text = "LED1"; + this.chkLED1.UseVisualStyleBackColor = true; + this.chkLED1.CheckedChanged += new System.EventHandler(this.chkLED_CheckedChanged); + // + // chkRumble + // + this.chkRumble.AutoSize = true; + this.chkRumble.Location = new System.Drawing.Point(8, 96); + this.chkRumble.Name = "chkRumble"; + this.chkRumble.Size = new System.Drawing.Size(62, 17); + this.chkRumble.TabIndex = 4; + this.chkRumble.Text = "Rumble"; + this.chkRumble.UseVisualStyleBackColor = true; + this.chkRumble.CheckedChanged += new System.EventHandler(this.chkRumble_CheckedChanged); + // + // chkZ + // + this.chkZ.AutoSize = true; + this.chkZ.Location = new System.Drawing.Point(8, 112); + this.chkZ.Name = "chkZ"; + this.chkZ.Size = new System.Drawing.Size(33, 17); + this.chkZ.TabIndex = 17; + this.chkZ.Text = "Z"; + this.chkZ.UseVisualStyleBackColor = true; + // + // chkC + // + this.chkC.AutoSize = true; + this.chkC.Location = new System.Drawing.Point(8, 92); + this.chkC.Name = "chkC"; + this.chkC.Size = new System.Drawing.Size(33, 17); + this.chkC.TabIndex = 17; + this.chkC.Text = "C"; + this.chkC.UseVisualStyleBackColor = true; + // + // lblChuk + // + this.lblChuk.Location = new System.Drawing.Point(8, 20); + this.lblChuk.Name = "lblChuk"; + this.lblChuk.Size = new System.Drawing.Size(92, 40); + this.lblChuk.TabIndex = 13; + this.lblChuk.Text = "Accel Values"; + // + // groupBox2 + // + this.groupBox2.Controls.Add(this.chkZ); + this.groupBox2.Controls.Add(this.chkC); + this.groupBox2.Controls.Add(this.lblChuk); + this.groupBox2.Controls.Add(this.lblChukJoy); + this.groupBox2.Location = new System.Drawing.Point(76, 76); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(104, 136); + this.groupBox2.TabIndex = 31; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Nunchuk"; + // + // lblChukJoy + // + this.lblChukJoy.Location = new System.Drawing.Point(8, 64); + this.lblChukJoy.Name = "lblChukJoy"; + this.lblChukJoy.Size = new System.Drawing.Size(92, 28); + this.lblChukJoy.TabIndex = 16; + this.lblChukJoy.Text = "Joystick Values"; + // + // groupBox1 + // + this.groupBox1.Controls.Add(this.lblAccel); + this.groupBox1.Location = new System.Drawing.Point(76, 0); + this.groupBox1.Name = "groupBox1"; + this.groupBox1.Size = new System.Drawing.Size(104, 72); + this.groupBox1.TabIndex = 30; + this.groupBox1.TabStop = false; + this.groupBox1.Text = "Wiimote Accel"; + // + // lblAccel + // + this.lblAccel.Location = new System.Drawing.Point(8, 20); + this.lblAccel.Name = "lblAccel"; + this.lblAccel.Size = new System.Drawing.Size(88, 48); + this.lblAccel.TabIndex = 2; + this.lblAccel.Text = "Accel Values"; + // + // chkExtension + // + this.chkExtension.AutoSize = true; + this.chkExtension.Location = new System.Drawing.Point(4, 224); + this.chkExtension.Name = "chkExtension"; + this.chkExtension.Size = new System.Drawing.Size(52, 17); + this.chkExtension.TabIndex = 29; + this.chkExtension.Text = "None"; + this.chkExtension.UseVisualStyleBackColor = true; + // + // groupBox9 + // + this.groupBox9.Controls.Add(this.lblCOG); + this.groupBox9.Controls.Add(this.chkLbs); + this.groupBox9.Controls.Add(this.lblBBBR); + this.groupBox9.Controls.Add(this.lblBBTR); + this.groupBox9.Controls.Add(this.lblBBBL); + this.groupBox9.Controls.Add(this.lblBBTotal); + this.groupBox9.Controls.Add(this.lblBBTL); + this.groupBox9.Location = new System.Drawing.Point(556, 0); + this.groupBox9.Name = "groupBox9"; + this.groupBox9.Size = new System.Drawing.Size(136, 112); + this.groupBox9.TabIndex = 38; + this.groupBox9.TabStop = false; + this.groupBox9.Text = "Balance Board"; + // + // lblCOG + // + this.lblCOG.AutoSize = true; + this.lblCOG.Location = new System.Drawing.Point(8, 92); + this.lblCOG.Name = "lblCOG"; + this.lblCOG.Size = new System.Drawing.Size(30, 13); + this.lblCOG.TabIndex = 2; + this.lblCOG.Text = "COG"; + // + // chkLbs + // + this.chkLbs.AutoSize = true; + this.chkLbs.Location = new System.Drawing.Point(28, 68); + this.chkLbs.Name = "chkLbs"; + this.chkLbs.Size = new System.Drawing.Size(62, 17); + this.chkLbs.TabIndex = 1; + this.chkLbs.Text = "Pounds"; + this.chkLbs.UseVisualStyleBackColor = true; + // + // lblBBBR + // + this.lblBBBR.AutoSize = true; + this.lblBBBR.Location = new System.Drawing.Point(76, 48); + this.lblBBBR.Name = "lblBBBR"; + this.lblBBBR.Size = new System.Drawing.Size(22, 13); + this.lblBBBR.TabIndex = 0; + this.lblBBBR.Text = "BR"; + // + // lblBBTR + // + this.lblBBTR.AutoSize = true; + this.lblBBTR.Location = new System.Drawing.Point(76, 16); + this.lblBBTR.Name = "lblBBTR"; + this.lblBBTR.Size = new System.Drawing.Size(22, 13); + this.lblBBTR.TabIndex = 0; + this.lblBBTR.Text = "TR"; + // + // lblBBBL + // + this.lblBBBL.AutoSize = true; + this.lblBBBL.Location = new System.Drawing.Point(8, 48); + this.lblBBBL.Name = "lblBBBL"; + this.lblBBBL.Size = new System.Drawing.Size(20, 13); + this.lblBBBL.TabIndex = 0; + this.lblBBBL.Text = "BL"; + // + // lblBBTotal + // + this.lblBBTotal.AutoSize = true; + this.lblBBTotal.Location = new System.Drawing.Point(36, 32); + this.lblBBTotal.Name = "lblBBTotal"; + this.lblBBTotal.Size = new System.Drawing.Size(31, 13); + this.lblBBTotal.TabIndex = 0; + this.lblBBTotal.Text = "Total"; + // + // lblBBTL + // + this.lblBBTL.AutoSize = true; + this.lblBBTL.Location = new System.Drawing.Point(8, 16); + this.lblBBTL.Name = "lblBBTL"; + this.lblBBTL.Size = new System.Drawing.Size(20, 13); + this.lblBBTL.TabIndex = 0; + this.lblBBTL.Text = "TL"; + // + // lblDevicePath + // + this.lblDevicePath.AutoSize = true; + this.lblDevicePath.Location = new System.Drawing.Point(8, 444); + this.lblDevicePath.Name = "lblDevicePath"; + this.lblDevicePath.Size = new System.Drawing.Size(63, 13); + this.lblDevicePath.TabIndex = 39; + this.lblDevicePath.Text = "DevicePath"; + // + // groupBox10 + // + this.groupBox10.Controls.Add(this.lbDrumVelocity); + this.groupBox10.Controls.Add(this.lblDrumJoy); + this.groupBox10.Controls.Add(this.clbDrums); + this.groupBox10.Location = new System.Drawing.Point(556, 112); + this.groupBox10.Name = "groupBox10"; + this.groupBox10.Size = new System.Drawing.Size(136, 180); + this.groupBox10.TabIndex = 40; + this.groupBox10.TabStop = false; + this.groupBox10.Text = "Drums"; + // + // lbDrumVelocity + // + this.lbDrumVelocity.FormattingEnabled = true; + this.lbDrumVelocity.Location = new System.Drawing.Point(68, 16); + this.lbDrumVelocity.Name = "lbDrumVelocity"; + this.lbDrumVelocity.Size = new System.Drawing.Size(56, 121); + this.lbDrumVelocity.TabIndex = 41; + // + // lblDrumJoy + // + this.lblDrumJoy.Location = new System.Drawing.Point(8, 144); + this.lblDrumJoy.Name = "lblDrumJoy"; + this.lblDrumJoy.Size = new System.Drawing.Size(92, 32); + this.lblDrumJoy.TabIndex = 27; + this.lblDrumJoy.Text = "Joystick Values"; + // + // clbDrums + // + this.clbDrums.FormattingEnabled = true; + this.clbDrums.Items.AddRange(new object[] { + "Red", + "Blue", + "Green", + "Yellow", + "Orange", + "Pedal", + "-", + "+"}); + this.clbDrums.Location = new System.Drawing.Point(4, 16); + this.clbDrums.Name = "clbDrums"; + this.clbDrums.Size = new System.Drawing.Size(60, 124); + this.clbDrums.TabIndex = 26; + // + // WiimoteInfo + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.groupBox10); + this.Controls.Add(this.lblDevicePath); + this.Controls.Add(this.groupBox9); + this.Controls.Add(this.groupBox8); + this.Controls.Add(this.groupBox5); + this.Controls.Add(this.pbIR); + this.Controls.Add(this.groupBox7); + this.Controls.Add(this.groupBox6); + this.Controls.Add(this.groupBox4); + this.Controls.Add(this.groupBox3); + this.Controls.Add(this.groupBox2); + this.Controls.Add(this.groupBox1); + this.Controls.Add(this.chkExtension); + this.Name = "WiimoteInfo"; + this.Size = new System.Drawing.Size(696, 464); + this.groupBox8.ResumeLayout(false); + this.groupBox5.ResumeLayout(false); + this.groupBox5.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbIR)).EndInit(); + this.groupBox7.ResumeLayout(false); + this.groupBox7.PerformLayout(); + this.groupBox6.ResumeLayout(false); + this.groupBox6.PerformLayout(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); + this.groupBox3.ResumeLayout(false); + this.groupBox3.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); + this.groupBox1.ResumeLayout(false); + this.groupBox9.ResumeLayout(false); + this.groupBox9.PerformLayout(); + this.groupBox10.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + public System.Windows.Forms.GroupBox groupBox8; + public System.Windows.Forms.CheckedListBox clbButtons; + public System.Windows.Forms.Label lblTriggerR; + public System.Windows.Forms.Label lblTriggerL; + public System.Windows.Forms.Label lblIR3; + public System.Windows.Forms.Label lblIR4; + public System.Windows.Forms.Label lblCCJoy2; + public System.Windows.Forms.Label lblCCJoy1; + public System.Windows.Forms.GroupBox groupBox5; + public System.Windows.Forms.Label lblIR3Raw; + public System.Windows.Forms.Label lblIR1Raw; + public System.Windows.Forms.Label lblIR4Raw; + public System.Windows.Forms.Label lblIR2Raw; + public System.Windows.Forms.Label lblIR1; + public System.Windows.Forms.Label lblIR2; + public System.Windows.Forms.CheckBox chkFound3; + public System.Windows.Forms.CheckBox chkFound4; + public System.Windows.Forms.CheckBox chkFound1; + public System.Windows.Forms.CheckBox chkFound2; + public System.Windows.Forms.PictureBox pbIR; + public System.Windows.Forms.Label lblGuitarWhammy; + public System.Windows.Forms.GroupBox groupBox7; + public System.Windows.Forms.Label lblGuitarJoy; + public System.Windows.Forms.CheckedListBox clbGuitarButtons; + public System.Windows.Forms.GroupBox groupBox6; + public System.Windows.Forms.CheckedListBox clbCCButtons; + public System.Windows.Forms.GroupBox groupBox4; + public System.Windows.Forms.ProgressBar pbBattery; + public System.Windows.Forms.Label lblBattery; + public System.Windows.Forms.GroupBox groupBox3; + public System.Windows.Forms.CheckBox chkLED2; + public System.Windows.Forms.CheckBox chkLED4; + public System.Windows.Forms.CheckBox chkLED3; + public System.Windows.Forms.CheckBox chkLED1; + public System.Windows.Forms.CheckBox chkRumble; + public System.Windows.Forms.CheckBox chkZ; + public System.Windows.Forms.CheckBox chkC; + public System.Windows.Forms.Label lblChuk; + public System.Windows.Forms.GroupBox groupBox2; + public System.Windows.Forms.Label lblChukJoy; + public System.Windows.Forms.GroupBox groupBox1; + public System.Windows.Forms.Label lblAccel; + public System.Windows.Forms.CheckBox chkExtension; + private System.Windows.Forms.GroupBox groupBox9; + private System.Windows.Forms.CheckBox chkLbs; + private System.Windows.Forms.Label lblBBBR; + private System.Windows.Forms.Label lblBBTR; + private System.Windows.Forms.Label lblBBBL; + private System.Windows.Forms.Label lblBBTotal; + private System.Windows.Forms.Label lblBBTL; + private System.Windows.Forms.Label lblCOG; + private System.Windows.Forms.Label lblDevicePath; + public System.Windows.Forms.CheckedListBox clbTouchbar; + public System.Windows.Forms.Label lblGuitarType; + private System.Windows.Forms.GroupBox groupBox10; + public System.Windows.Forms.CheckedListBox clbDrums; + public System.Windows.Forms.Label lblDrumJoy; + private System.Windows.Forms.ListBox lbDrumVelocity; + + } +} diff --git a/WiimoteCS/WiimoteTest/WiimoteInfo.cs b/WiimoteCS/WiimoteTest/WiimoteInfo.cs new file mode 100644 index 0000000..f2b6ae2 --- /dev/null +++ b/WiimoteCS/WiimoteTest/WiimoteInfo.cs @@ -0,0 +1,220 @@ +////////////////////////////////////////////////////////////////////////////////// +// MultipleWiimoteForm.cs +// Managed Wiimote Library Tester +// Written by Brian Peek (http://www.brianpeek.com/) +// for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +// Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +// and http://www.codeplex.com/WiimoteLib +// for more information +////////////////////////////////////////////////////////////////////////////////// + +using System; +using System.Drawing; +using System.Drawing.Imaging; +using System.Windows.Forms; +using WiimoteLib; + +namespace WiimoteTest +{ + public partial class WiimoteInfo : UserControl + { + private delegate void UpdateWiimoteStateDelegate(WiimoteChangedEventArgs args); + private delegate void UpdateExtensionChangedDelegate(WiimoteExtensionChangedEventArgs args); + + private Bitmap b = new Bitmap(256, 192, PixelFormat.Format24bppRgb); + private Graphics g; + private Wiimote mWiimote; + + public WiimoteInfo() + { + InitializeComponent(); + g = Graphics.FromImage(b); + } + + public WiimoteInfo(Wiimote wm) : this() + { + mWiimote = wm; + } + + public void UpdateState(WiimoteChangedEventArgs args) + { + BeginInvoke(new UpdateWiimoteStateDelegate(UpdateWiimoteChanged), args); + } + + public void UpdateExtension(WiimoteExtensionChangedEventArgs args) + { + BeginInvoke(new UpdateExtensionChangedDelegate(UpdateExtensionChanged), args); + } + + private void chkLED_CheckedChanged(object sender, EventArgs e) + { + mWiimote.SetLEDs(chkLED1.Checked, chkLED2.Checked, chkLED3.Checked, chkLED4.Checked); + } + + private void chkRumble_CheckedChanged(object sender, EventArgs e) + { + mWiimote.SetRumble(chkRumble.Checked); + } + + private void UpdateWiimoteChanged(WiimoteChangedEventArgs args) + { + WiimoteState ws = args.WiimoteState; + + clbButtons.SetItemChecked(0, ws.ButtonState.A); + clbButtons.SetItemChecked(1, ws.ButtonState.B); + clbButtons.SetItemChecked(2, ws.ButtonState.Minus); + clbButtons.SetItemChecked(3, ws.ButtonState.Home); + clbButtons.SetItemChecked(4, ws.ButtonState.Plus); + clbButtons.SetItemChecked(5, ws.ButtonState.One); + clbButtons.SetItemChecked(6, ws.ButtonState.Two); + clbButtons.SetItemChecked(7, ws.ButtonState.Up); + clbButtons.SetItemChecked(8, ws.ButtonState.Down); + clbButtons.SetItemChecked(9, ws.ButtonState.Left); + clbButtons.SetItemChecked(10, ws.ButtonState.Right); + + lblAccel.Text = ws.AccelState.Values.ToString(); + + chkLED1.Checked = ws.LEDState.LED1; + chkLED2.Checked = ws.LEDState.LED2; + chkLED3.Checked = ws.LEDState.LED3; + chkLED4.Checked = ws.LEDState.LED4; + + switch(ws.ExtensionType) + { + case ExtensionType.Nunchuk: + lblChuk.Text = ws.NunchukState.AccelState.Values.ToString(); + lblChukJoy.Text = ws.NunchukState.Joystick.ToString(); + chkC.Checked = ws.NunchukState.C; + chkZ.Checked = ws.NunchukState.Z; + break; + + case ExtensionType.ClassicController: + clbCCButtons.SetItemChecked(0, ws.ClassicControllerState.ButtonState.A); + clbCCButtons.SetItemChecked(1, ws.ClassicControllerState.ButtonState.B); + clbCCButtons.SetItemChecked(2, ws.ClassicControllerState.ButtonState.X); + clbCCButtons.SetItemChecked(3, ws.ClassicControllerState.ButtonState.Y); + clbCCButtons.SetItemChecked(4, ws.ClassicControllerState.ButtonState.Minus); + clbCCButtons.SetItemChecked(5, ws.ClassicControllerState.ButtonState.Home); + clbCCButtons.SetItemChecked(6, ws.ClassicControllerState.ButtonState.Plus); + clbCCButtons.SetItemChecked(7, ws.ClassicControllerState.ButtonState.Up); + clbCCButtons.SetItemChecked(8, ws.ClassicControllerState.ButtonState.Down); + clbCCButtons.SetItemChecked(9, ws.ClassicControllerState.ButtonState.Left); + clbCCButtons.SetItemChecked(10, ws.ClassicControllerState.ButtonState.Right); + clbCCButtons.SetItemChecked(11, ws.ClassicControllerState.ButtonState.ZL); + clbCCButtons.SetItemChecked(12, ws.ClassicControllerState.ButtonState.ZR); + clbCCButtons.SetItemChecked(13, ws.ClassicControllerState.ButtonState.TriggerL); + clbCCButtons.SetItemChecked(14, ws.ClassicControllerState.ButtonState.TriggerR); + + lblCCJoy1.Text = ws.ClassicControllerState.JoystickL.ToString(); + lblCCJoy2.Text = ws.ClassicControllerState.JoystickR.ToString(); + + lblTriggerL.Text = ws.ClassicControllerState.TriggerL.ToString(); + lblTriggerR.Text = ws.ClassicControllerState.TriggerR.ToString(); + break; + + case ExtensionType.Guitar: + clbGuitarButtons.SetItemChecked(0, ws.GuitarState.FretButtonState.Green); + clbGuitarButtons.SetItemChecked(1, ws.GuitarState.FretButtonState.Red); + clbGuitarButtons.SetItemChecked(2, ws.GuitarState.FretButtonState.Yellow); + clbGuitarButtons.SetItemChecked(3, ws.GuitarState.FretButtonState.Blue); + clbGuitarButtons.SetItemChecked(4, ws.GuitarState.FretButtonState.Orange); + clbGuitarButtons.SetItemChecked(5, ws.GuitarState.ButtonState.Minus); + clbGuitarButtons.SetItemChecked(6, ws.GuitarState.ButtonState.Plus); + clbGuitarButtons.SetItemChecked(7, ws.GuitarState.ButtonState.StrumUp); + clbGuitarButtons.SetItemChecked(8, ws.GuitarState.ButtonState.StrumDown); + + clbTouchbar.SetItemChecked(0, ws.GuitarState.TouchbarState.Green); + clbTouchbar.SetItemChecked(1, ws.GuitarState.TouchbarState.Red); + clbTouchbar.SetItemChecked(2, ws.GuitarState.TouchbarState.Yellow); + clbTouchbar.SetItemChecked(3, ws.GuitarState.TouchbarState.Blue); + clbTouchbar.SetItemChecked(4, ws.GuitarState.TouchbarState.Orange); + + lblGuitarJoy.Text = ws.GuitarState.Joystick.ToString(); + lblGuitarWhammy.Text = ws.GuitarState.WhammyBar.ToString(); + lblGuitarType.Text = ws.GuitarState.GuitarType.ToString(); + break; + + case ExtensionType.Drums: + clbDrums.SetItemChecked(0, ws.DrumsState.Red); + clbDrums.SetItemChecked(1, ws.DrumsState.Blue); + clbDrums.SetItemChecked(2, ws.DrumsState.Green); + clbDrums.SetItemChecked(3, ws.DrumsState.Yellow); + clbDrums.SetItemChecked(4, ws.DrumsState.Orange); + clbDrums.SetItemChecked(5, ws.DrumsState.Pedal); + clbDrums.SetItemChecked(6, ws.DrumsState.Minus); + clbDrums.SetItemChecked(7, ws.DrumsState.Plus); + + lbDrumVelocity.Items.Clear(); + lbDrumVelocity.Items.Add(ws.DrumsState.RedVelocity); + lbDrumVelocity.Items.Add(ws.DrumsState.BlueVelocity); + lbDrumVelocity.Items.Add(ws.DrumsState.GreenVelocity); + lbDrumVelocity.Items.Add(ws.DrumsState.YellowVelocity); + lbDrumVelocity.Items.Add(ws.DrumsState.OrangeVelocity); + lbDrumVelocity.Items.Add(ws.DrumsState.PedalVelocity); + + lblDrumJoy.Text = ws.DrumsState.Joystick.ToString(); + break; + + case ExtensionType.BalanceBoard: + if(chkLbs.Checked) + { + lblBBTL.Text = ws.BalanceBoardState.SensorValuesLb.TopLeft.ToString(); + lblBBTR.Text = ws.BalanceBoardState.SensorValuesLb.TopRight.ToString(); + lblBBBL.Text = ws.BalanceBoardState.SensorValuesLb.BottomLeft.ToString(); + lblBBBR.Text = ws.BalanceBoardState.SensorValuesLb.BottomRight.ToString(); + lblBBTotal.Text = ws.BalanceBoardState.WeightLb.ToString(); + } + else + { + lblBBTL.Text = ws.BalanceBoardState.SensorValuesKg.TopLeft.ToString(); + lblBBTR.Text = ws.BalanceBoardState.SensorValuesKg.TopRight.ToString(); + lblBBBL.Text = ws.BalanceBoardState.SensorValuesKg.BottomLeft.ToString(); + lblBBBR.Text = ws.BalanceBoardState.SensorValuesKg.BottomRight.ToString(); + lblBBTotal.Text = ws.BalanceBoardState.WeightKg.ToString(); + } + lblCOG.Text = ws.BalanceBoardState.CenterOfGravity.ToString(); + break; + } + + g.Clear(Color.Black); + + UpdateIR(ws.IRState.IRSensors[0], lblIR1, lblIR1Raw, chkFound1, Color.Red); + UpdateIR(ws.IRState.IRSensors[1], lblIR2, lblIR2Raw, chkFound2, Color.Blue); + UpdateIR(ws.IRState.IRSensors[2], lblIR3, lblIR3Raw, chkFound3, Color.Yellow); + UpdateIR(ws.IRState.IRSensors[3], lblIR4, lblIR4Raw, chkFound4, Color.Orange); + + if(ws.IRState.IRSensors[0].Found && ws.IRState.IRSensors[1].Found) + g.DrawEllipse(new Pen(Color.Green), (int)(ws.IRState.RawMidpoint.X / 4), (int)(ws.IRState.RawMidpoint.Y / 4), 2, 2); + + pbIR.Image = b; + + pbBattery.Value = (ws.Battery > 0xc8 ? 0xc8 : (int)ws.Battery); + lblBattery.Text = ws.Battery.ToString(); + lblDevicePath.Text = "Device Path: " + mWiimote.HIDDevicePath; + } + + private void UpdateIR(IRSensor irSensor, Label lblNorm, Label lblRaw, CheckBox chkFound, Color color) + { + chkFound.Checked = irSensor.Found; + + if(irSensor.Found) + { + lblNorm.Text = irSensor.Position.ToString() + ", " + irSensor.Size; + lblRaw.Text = irSensor.RawPosition.ToString(); + g.DrawEllipse(new Pen(color), (int)(irSensor.RawPosition.X / 4), (int)(irSensor.RawPosition.Y / 4), + irSensor.Size+1, irSensor.Size+1); + } + } + + private void UpdateExtensionChanged(WiimoteExtensionChangedEventArgs args) + { + chkExtension.Text = args.ExtensionType.ToString(); + chkExtension.Checked = args.Inserted; + } + + public Wiimote Wiimote + { + set { mWiimote = value; } + } + } +} diff --git a/WiimoteCS/WiimoteTest/WiimoteInfo.resx b/WiimoteCS/WiimoteTest/WiimoteInfo.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteCS/WiimoteTest/WiimoteInfo.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteCS/WiimoteTest/WiimoteTest.csproj b/WiimoteCS/WiimoteTest/WiimoteTest.csproj new file mode 100644 index 0000000..490d484 --- /dev/null +++ b/WiimoteCS/WiimoteTest/WiimoteTest.csproj @@ -0,0 +1,108 @@ + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {48223EAB-B2E0-4A64-9074-4444662EB693} + WinExe + Properties + WiimoteTest + WiimoteTest + + + 2.0 + + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + Form + + + SingleWiimoteForm.cs + + + Form + + + MultipleWiimoteForm.cs + + + + + Designer + SingleWiimoteForm.cs + + + MultipleWiimoteForm.cs + Designer + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + WiimoteInfo.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + UserControl + + + WiimoteInfo.cs + + + + + {37A555DF-7012-4B99-8A47-1C922A361E52} + WiimoteLib + + + + + \ No newline at end of file diff --git a/WiimoteVB/Wiimote.sln b/WiimoteVB/Wiimote.sln new file mode 100644 index 0000000..d4bd168 --- /dev/null +++ b/WiimoteVB/Wiimote.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WiimoteTest", "WiimoteTest\WiimoteTest.vbproj", "{48223EAB-B2E0-4A64-9074-4444662EB693}" +EndProject +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WiimoteLib", "WiimoteLib\WiimoteLib.vbproj", "{37A555DF-7012-4B99-8A47-1C922A361E52}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {48223EAB-B2E0-4A64-9074-4444662EB693}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48223EAB-B2E0-4A64-9074-4444662EB693}.Release|Any CPU.Build.0 = Release|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {37A555DF-7012-4B99-8A47-1C922A361E52}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/WiimoteVB/WiimoteLib/DataTypes.vb b/WiimoteVB/WiimoteLib/DataTypes.vb new file mode 100644 index 0000000..c64fba3 --- /dev/null +++ b/WiimoteVB/WiimoteLib/DataTypes.vb @@ -0,0 +1,848 @@ +'//////////////////////////////////////////////////////////////////////////////// +' DataTypes.cs +' Managed Wiimote Library +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System + +' if we're building the MSRS version, we need to bring in the MSRS Attributes +' if we're not doing the MSRS build then define some fake attribute classes for DataMember/DataContract +#If MSRS Then + Imports Microsoft.Dss.Core.Attributes +#Else + Friend NotInheritable Class DataContract + Inherits Attribute + End Class + + Friend NotInheritable Class DataMember + Inherits Attribute + End Class +#End If + +Namespace WiimoteLib +#If MSRS Then + _ + Public Structure RumbleRequest + _ + Public Rumble As Boolean + End Structure +#End If + + ''' + ''' Point structure for floating point 2D positions (X, Y) + ''' + _ + Public Structure PointF + ''' + ''' X, Y coordinates of this point + ''' + _ + Public X, Y As Single + + ''' + ''' Convert to human-readable string + ''' + ''' A string that represents the point + Public Overrides Function ToString() As String + Return String.Format("{{X={0}, Y={1}}}", X, Y) + End Function + + End Structure + + ''' + ''' Point structure for int 2D positions (X, Y) + ''' + _ + Public Structure Point + ''' + ''' X, Y coordinates of this point + ''' + _ + Public X, Y As Integer + + ''' + ''' Convert to human-readable string + ''' + ''' A string that represents the point. + Public Overrides Function ToString() As String + Return String.Format("{{X={0}, Y={1}}}", X, Y) + End Function + End Structure + + ''' + ''' Point structure for floating point 3D positions (X, Y, Z) + ''' + _ + Public Structure Point3F + ''' + ''' X, Y, Z coordinates of this point + ''' + _ + Public X, Y, Z As Single + + ''' + ''' Convert to human-readable string + ''' + ''' A string that represents the point + Public Overrides Function ToString() As String + Return String.Format("{{X={0}, Y={1}, Z={2}}}", X, Y, Z) + End Function + + End Structure + + ''' + ''' Point structure for int 3D positions (X, Y, Z) + ''' + _ + Public Structure Point3 + ''' + ''' X, Y, Z coordinates of this point + ''' + _ + Public X, Y, Z As Integer + + ''' + ''' Convert to human-readable string + ''' + ''' A string that represents the point. + Public Overrides Function ToString() As String + Return String.Format("{{X={0}, Y={1}, Z={2}}}", X, Y, Z) + End Function + End Structure + + ''' + ''' Current overall state of the Wiimote and all attachments + ''' + _ + Public Class WiimoteState + ''' + ''' Current calibration information + ''' + _ + Public AccelCalibrationInfo As AccelCalibrationInfo + ''' + ''' Current state of accelerometers + ''' + _ + Public AccelState As AccelState + ''' + ''' Current state of buttons + ''' + _ + Public ButtonState As ButtonState + ''' + ''' Current state of IR sensors + ''' + _ + Public IRState As IRState + ''' + ''' Raw byte value of current battery level + ''' + _ + Public BatteryRaw As Byte + ''' + ''' Calculated current battery level + ''' + _ + Public Battery As Single + ''' + ''' Current state of rumble + ''' + _ + Public Rumble As Boolean + ''' + ''' Is an extension controller inserted? + ''' + _ + Public Extension As Boolean + ''' + ''' Extension controller currently inserted, if any + ''' + _ + Public ExtensionType As ExtensionType + ''' + ''' Current state of Nunchuk extension + ''' + _ + Public NunchukState As NunchukState + ''' + ''' Current state of Classic Controller extension + ''' + _ + Public ClassicControllerState As ClassicControllerState + ''' + ''' Current state of Guitar extension + ''' + _ + Public GuitarState As GuitarState + ''' + ''' Current state of Drums extension + ''' + _ + Public DrumsState As DrumsState + ''' + ''' Current state of the Wii Fit Balance Board + ''' + Public BalanceBoardState As BalanceBoardState + ''' + ''' Current state of LEDs + ''' + _ + Public LEDState As LEDState + + ''' + ''' Constructor for WiimoteState class + ''' + Public Sub New() + IRState.IRSensors = New IRSensor(3){} + End Sub + End Class + + ''' + ''' Current state of LEDs + ''' + _ + Public Structure LEDState + ''' + ''' LED on the Wiimote + ''' + _ + Public LED1, LED2, LED3, LED4 As Boolean + End Structure + + ''' + ''' Calibration information stored on the Nunchuk + ''' + _ + Public Structure NunchukCalibrationInfo + ''' + ''' Accelerometer calibration data + ''' + Public AccelCalibration As AccelCalibrationInfo + ''' + ''' Joystick X-axis calibration + ''' + _ + Public MinX, MidX, MaxX As Byte + ''' + ''' Joystick Y-axis calibration + ''' + _ + Public MinY, MidY, MaxY As Byte + End Structure + + ''' + ''' Calibration information stored on the Classic Controller + ''' + _ + Public Structure ClassicControllerCalibrationInfo + ''' + ''' Left joystick X-axis + ''' + _ + Public MinXL, MidXL, MaxXL As Byte + ''' + ''' Left joystick Y-axis + ''' + _ + Public MinYL, MidYL, MaxYL As Byte + ''' + ''' Right joystick X-axis + ''' + _ + Public MinXR, MidXR, MaxXR As Byte + ''' + ''' Right joystick Y-axis + ''' + _ + Public MinYR, MidYR, MaxYR As Byte + ''' + ''' Left analog trigger + ''' + _ + Public MinTriggerL, MaxTriggerL As Byte + ''' + ''' Right analog trigger + ''' + _ + Public MinTriggerR, MaxTriggerR As Byte + End Structure + + ''' + ''' Current state of the Nunchuk extension + ''' + _ + Public Structure NunchukState + ''' + ''' Calibration data for Nunchuk extension + ''' + _ + Public CalibrationInfo As NunchukCalibrationInfo + ''' + ''' State of accelerometers + ''' + _ + Public AccelState As AccelState + ''' + ''' Raw joystick position before normalization. Values range between 0 and 255. + ''' + _ + Public RawJoystick As Point + ''' + ''' Normalized joystick position. Values range between -0.5 and 0.5 + ''' + _ + Public Joystick As PointF + ''' + ''' Digital button on Nunchuk extension + ''' + _ + Public C, Z As Boolean + End Structure + + ''' + ''' Curernt button state of the Classic Controller + ''' + _ + Public Structure ClassicControllerButtonState + ''' + ''' Digital button on the Classic Controller extension + ''' + _ + Public A, B, Plus, Home, Minus, Up, Down, Left, Right, X, Y, ZL, ZR As Boolean + ''' + ''' Analog trigger - false if released, true for any pressure applied + ''' + _ + Public TriggerL, TriggerR As Boolean + End Structure + + ''' + ''' Current state of the Classic Controller + ''' + _ + Public Structure ClassicControllerState + ''' + ''' Calibration data for Classic Controller extension + ''' + _ + Public CalibrationInfo As ClassicControllerCalibrationInfo + ''' + ''' Current button state + ''' + _ + Public ButtonState As ClassicControllerButtonState + ''' + ''' Raw value of left joystick. Values range between 0 - 255. + ''' + _ + Public RawJoystickL As Point + ''' + ''' Raw value of right joystick. Values range between 0 - 255. + ''' + _ + Public RawJoystickR As Point + ''' + ''' Normalized value of left joystick. Values range between -0.5 - 0.5 + ''' + _ + Public JoystickL As PointF + ''' + ''' Normalized value of right joystick. Values range between -0.5 - 0.5 + ''' + _ + Public JoystickR As PointF + ''' + ''' Raw value of analog trigger. Values range between 0 - 255. + ''' + _ + Public RawTriggerL, RawTriggerR As Byte + ''' + ''' Normalized value of analog trigger. Values range between 0.0 - 1.0. + ''' + _ + Public TriggerL, TriggerR As Single + End Structure + + ''' + ''' Current state of the Guitar controller + ''' + _ + Public Structure GuitarState + ''' + ''' Guitar type + ''' + _ + Public GuitarType As GuitarType + ''' + ''' Current button state of the Guitar + ''' + _ + Public ButtonState As GuitarButtonState + ''' + ''' Current fret button state of the Guitar + ''' + _ + Public FretButtonState As GuitarFretButtonState + ''' + ''' Current touchbar state of the Guitar + ''' + _ + Public TouchbarState As GuitarFretButtonState + ''' + ''' Raw joystick position. Values range between 0 - 63. + ''' + _ + Public RawJoystick As Point + ''' + ''' Normalized value of joystick position. Values range between 0.0 - 1.0. + ''' + _ + Public Joystick As PointF + ''' + ''' Raw whammy bar position. Values range between 0 - 10. + ''' + _ + Public RawWhammyBar As Byte + ''' + ''' Normalized value of whammy bar position. Values range between 0.0 - 1.0. + ''' + _ + Public WhammyBar As Single + End Structure + + ''' + ''' Current fret button state of the Guitar controller + ''' + _ + Public Structure GuitarFretButtonState + ''' + ''' Fret buttons + ''' + _ + Public Green, Red, Yellow, Blue, Orange As Boolean + End Structure + + + ''' + ''' Current button state of the Guitar controller + ''' + _ + Public Structure GuitarButtonState + ''' + ''' Strum bar + ''' + _ + Public StrumUp, StrumDown As Boolean + ''' + ''' Other buttons + ''' + _ + Public Minus, Plus As Boolean + End Structure + + ''' + ''' Current state of the Drums controller + ''' + _ + Public Structure DrumsState + ''' + ''' Drum pads + ''' + Public Red, Green, Blue, Orange, Yellow, Pedal As Boolean + ''' + ''' Speed at which the pad is hit. Values range from 0 (very hard) to 6 (very soft) + ''' + Public RedVelocity, GreenVelocity, BlueVelocity, OrangeVelocity, YellowVelocity, PedalVelocity As Integer + ''' + ''' Other buttons + ''' + Public Plus, Minus As Boolean + ''' + ''' Raw value of analong joystick. Values range from 0 - 15 + ''' + Public RawJoystick As Point + ''' + ''' Normalized value of analog joystick. Values range from 0.0 - 1.0 + ''' + Public Joystick As PointF + End Structure + + ''' + ''' Current state of the Wii Fit Balance Board controller + ''' + _ + Public Structure BalanceBoardState + ''' + ''' Calibration information for the Balance Board + ''' + _ + Public CalibrationInfo As BalanceBoardCalibrationInfo + ''' + ''' Raw values of each sensor + ''' + _ + Public SensorValuesRaw As BalanceBoardSensors + ''' + ''' Kilograms per sensor + ''' + _ + Public SensorValuesKg As BalanceBoardSensorsF + ''' + ''' Pounds per sensor + ''' + _ + Public SensorValuesLb As BalanceBoardSensorsF + ''' + ''' Total kilograms on the Balance Board + ''' + _ + Public WeightKg As Single + ''' + ''' Total pounds on the Balance Board + ''' + _ + Public WeightLb As Single + ''' + ''' Center of gravity of Balance Board user + ''' + _ + Public CenterOfGravity As PointF + End Structure + + ''' + ''' Calibration information + ''' + _ + Public Structure BalanceBoardCalibrationInfo + ''' + ''' Calibration information at 0kg + ''' + _ + Public Kg0 As BalanceBoardSensors + ''' + ''' Calibration information at 17kg + ''' + _ + Public Kg17 As BalanceBoardSensors + ''' + ''' Calibration information at 34kg + ''' + _ + Public Kg34 As BalanceBoardSensors + End Structure + + ''' + ''' The 4 sensors on the Balance Board (short values) + ''' + _ + Public Structure BalanceBoardSensors + ''' + ''' Sensor at top right + ''' + _ + Public TopRight As Short + ''' + ''' Sensor at top left + ''' + _ + Public TopLeft As Short + ''' + ''' Sensor at bottom right + ''' + _ + Public BottomRight As Short + ''' + ''' Sensor at bottom left + ''' + _ + Public BottomLeft As Short + End Structure + + ''' + ''' The 4 sensors on the Balance Board (float values) + ''' + _ + Public Structure BalanceBoardSensorsF + ''' + ''' Sensor at top right + ''' + _ + Public TopRight As Single + ''' + ''' Sensor at top left + ''' + _ + Public TopLeft As Single + ''' + ''' Sensor at bottom right + ''' + _ + Public BottomRight As Single + ''' + ''' Sensor at bottom left + ''' + _ + Public BottomLeft As Single + End Structure + + ''' + ''' Current state of a single IR sensor + ''' + _ + Public Structure IRSensor + ''' + ''' Raw values of individual sensor. Values range between 0 - 1023 on the X axis and 0 - 767 on the Y axis. + ''' + _ + Public RawPosition As Point + ''' + ''' Normalized values of the sensor position. Values range between 0.0 - 1.0. + ''' + _ + Public Position As PointF + ''' + ''' Size of IR Sensor. Values range from 0 - 15 + ''' + _ + Public Size As Integer + ''' + ''' IR sensor seen + ''' + _ + Public Found As Boolean + ''' + ''' Convert to human-readable string + ''' + ''' A string that represents the point. + Public Overrides Function ToString() As String + Return String.Format("{{{0}, Size={1}, Found={2}}}", Position, Size, Found) + End Function + End Structure + + ''' + ''' Current state of the IR camera + ''' + _ + Public Structure IRState + ''' + ''' Current mode of IR sensor data + ''' + _ + Public Mode As IRMode + ''' + ''' Current state of IR sensors + ''' + _ + Public IRSensors() As IRSensor + ''' + ''' Raw midpoint of IR sensors 1 and 2 only. Values range between 0 - 1023, 0 - 767 + ''' + _ + Public RawMidpoint As Point + ''' + ''' Normalized midpoint of IR sensors 1 and 2 only. Values range between 0.0 - 1.0 + ''' + _ + Public Midpoint As PointF + End Structure + + ''' + ''' Current state of the accelerometers + ''' + _ + Public Structure AccelState + ''' + ''' Raw accelerometer data. + ''' Values range between 0 - 255 + ''' + _ + Public RawValues As Point3 + ''' + ''' Normalized accelerometer data. Values range between 0 - ?, but values > 3 and < -3 are inaccurate. + ''' + _ + Public Values As Point3F + End Structure + + ''' + ''' Accelerometer calibration information + ''' + _ + Public Structure AccelCalibrationInfo + ''' + ''' Zero point of accelerometer + ''' + _ + Public X0, Y0, Z0 As Byte + ''' + ''' Gravity at rest of accelerometer + ''' + _ + Public XG, YG, ZG As Byte + End Structure + + ''' + ''' Current button state + ''' + _ + Public Structure ButtonState + ''' + ''' Digital button on the Wiimote + ''' + _ + Public A, B, Plus, Home, Minus, One, Two, Up, Down, Left, Right As Boolean + End Structure + + ''' + ''' The extension plugged into the Wiimote + ''' + _ + Public Enum ExtensionType As Long + ''' + ''' No extension + ''' + None = &H000000000000 + ''' + ''' Nunchuk extension + ''' + Nunchuk = &H0000a4200000 + ''' + ''' Classic Controller extension + ''' + ClassicController = &H0000a4200101 + ''' + ''' Guitar controller from Guitar Hero 3/WorldTour + ''' + Guitar = &H0000a4200103 + ''' + ''' Drum controller from Guitar Hero: World Tour + ''' + Drums = &H0100a4200103 + ''' + ''' Wii Fit Balance Board controller + ''' + BalanceBoard = &H0000a4200402 + ''' + ''' Partially inserted extension. This is an error condition. + ''' + ParitallyInserted = &Hffffffffffff + End Enum + + ''' + ''' The mode of data reported for the IR sensor + ''' + _ + Public Enum IRMode As Byte + ''' + ''' IR sensor off + ''' + [Off] = &H00 + ''' + ''' Basic mode + ''' + Basic = &H01 ' 10 bytes + ''' + ''' Extended mode + ''' + Extended = &H03 ' 12 bytes + ''' + ''' Full mode (unsupported) + ''' + Full = &H05 ' 16 bytes * 2 (format unknown) + End Enum + + ''' + ''' The report format in which the Wiimote should return data + ''' + Public Enum InputReport As Byte + ''' + ''' Status report + ''' + Status = &H20 + ''' + ''' Read data from memory location + ''' + ReadData = &H21 + ''' + ''' Register write complete + ''' + OutputReportAck = &H22 + ''' + ''' Button data only + ''' + Buttons = &H30 + ''' + ''' Button and accelerometer data + ''' + ButtonsAccel = &H31 + ''' + ''' IR sensor and accelerometer data + ''' + IRAccel = &H33 + ''' + ''' Button and extension controller data + ''' + ButtonsExtension = &H34 + ''' + ''' Extension and accelerometer data + ''' + ExtensionAccel = &H35 + ''' + ''' IR sensor, extension controller and accelerometer data + ''' + IRExtensionAccel = &H37 + End Enum + + ''' + ''' Sensitivity of the IR camera on the Wiimote + ''' + + Public Enum IRSensitivity + ''' + ''' Equivalent to level 1 on the Wii console + ''' + WiiLevel1 + ''' + ''' Equivalent to level 2 on the Wii console + ''' + WiiLevel2 + ''' + ''' Equivalent to level 3 on the Wii console (default) + ''' + WiiLevel3 + ''' + ''' Equivalent to level 4 on the Wii console + ''' + WiiLevel4 + ''' + ''' Equivalent to level 5 on the Wii console + ''' + WiiLevel5 + ''' + ''' Maximum sensitivity + ''' + Maximum + End Enum + + ''' + ''' Type of guitar extension: Guitar Hero 3 or Guitar Hero World Tour + ''' + Public Enum GuitarType + ''' + ''' Guitar Hero 3 guitar controller + ''' + GuitarHero3 + ''' + ''' Guitar Hero: World Tour guitar controller + ''' + GuitarHeroWorldTour + End Enum +End Namespace diff --git a/WiimoteVB/WiimoteLib/Events.vb b/WiimoteVB/WiimoteLib/Events.vb new file mode 100644 index 0000000..f879072 --- /dev/null +++ b/WiimoteVB/WiimoteLib/Events.vb @@ -0,0 +1,59 @@ +'//////////////////////////////////////////////////////////////////////////////// +' Events.cs +' Managed Wiimote Library +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System + +Namespace WiimoteLib + ''' + ''' Argument sent through the WiimoteExtensionChangedEvent + ''' + Public Class WiimoteExtensionChangedEventArgs + Inherits EventArgs + ''' + ''' The extenstion type inserted or removed + ''' + Public ExtensionType As ExtensionType + ''' + ''' Whether the extension was inserted or removed + ''' + Public Inserted As Boolean + + ''' + ''' Constructor + ''' + ''' The extension type inserted or removed + ''' Whether the extension was inserted or removed + Public Sub New(ByVal type As ExtensionType, ByVal inserted As Boolean) + ExtensionType = type + Me.Inserted = inserted + End Sub + End Class + + ''' + ''' Argument sent through the WiimoteChangedEvent + ''' + Public Class WiimoteChangedEventArgs + Inherits EventArgs + ''' + ''' The current state of the Wiimote and extension controllers + ''' + Public WiimoteState As WiimoteState + + ''' + ''' Constructor + ''' + ''' Wiimote state + Public Sub New(ByVal ws As WiimoteState) + WiimoteState = ws + End Sub + End Class +End Namespace diff --git a/WiimoteVB/WiimoteLib/HIDImports.vb b/WiimoteVB/WiimoteLib/HIDImports.vb new file mode 100644 index 0000000..80f9494 --- /dev/null +++ b/WiimoteVB/WiimoteLib/HIDImports.vb @@ -0,0 +1,134 @@ +'//////////////////////////////////////////////////////////////////////////////// +' HIDImports.cs +' Managed Wiimote Library +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System +Imports System.Runtime.InteropServices +Imports System.IO +Imports Microsoft.Win32.SafeHandles + +Namespace WiimoteLib + ''' + ''' Win32 import information for use with the Wiimote library + ''' + Friend Class HIDImports + ' + ' Flags controlling what is included in the device information set built + ' by SetupDiGetClassDevs + ' + Public Const DIGCF_DEFAULT As Integer = &H00000001 ' only valid with DIGCF_DEVICEINTERFACE + Public Const DIGCF_PRESENT As Integer = &H00000002 + Public Const DIGCF_ALLCLASSES As Integer = &H00000004 + Public Const DIGCF_PROFILE As Integer = &H00000008 + Public Const DIGCF_DEVICEINTERFACE As Integer = &H00000010 + + _ + Public Enum EFileAttributes As UInteger + [Readonly] = &H00000001 + Hidden = &H00000002 + System = &H00000004 + Directory = &H00000010 + Archive = &H00000020 + Device = &H00000040 + Normal = &H00000080 + Temporary = &H00000100 + SparseFile = &H00000200 + ReparsePoint = &H00000400 + Compressed = &H00000800 + Offline = &H00001000 + NotContentIndexed= &H00002000 + Encrypted = &H00004000 + Write_Through = &H80000000L + Overlapped = &H40000000 + NoBuffering = &H20000000 + RandomAccess = &H10000000 + SequentialScan = &H08000000 + DeleteOnClose = &H04000000 + BackupSemantics = &H02000000 + PosixSemantics = &H01000000 + OpenReparsePoint = &H00200000 + OpenNoRecall = &H00100000 + FirstPipeInstance= &H00080000 + End Enum + + _ + Public Structure SP_DEVINFO_DATA + Public cbSize As UInteger + Public ClassGuid As Guid + Public DevInst As UInteger + Public Reserved As IntPtr + End Structure + + _ + Public Structure SP_DEVICE_INTERFACE_DATA + Public cbSize As Integer + Public InterfaceClassGuid As Guid + Public Flags As Integer + Public RESERVED As IntPtr + End Structure + + _ + Public Structure SP_DEVICE_INTERFACE_DETAIL_DATA + Public cbSize As UInt32 + _ + Public DevicePath As String + End Structure + + _ + Public Structure HIDD_ATTRIBUTES + Public Size As Integer + Public VendorID As Short + Public ProductID As Short + Public VersionNumber As Short + End Structure + + _ + Public Shared Sub HidD_GetHidGuid( ByRef gHid As Guid) + End Sub + + _ + Public Shared Function HidD_GetAttributes(ByVal HidDeviceObject As IntPtr, ByRef Attributes As HIDD_ATTRIBUTES) As Boolean + End Function + + _ + Friend Shared Function HidD_SetOutputReport(ByVal HidDeviceObject As IntPtr, ByVal lpReportBuffer() As Byte, ByVal ReportBufferLength As UInteger) As Boolean + End Function + + _ + Public Shared Function SetupDiGetClassDevs(ByRef ClassGuid As Guid, ByVal Enumerator As String, ByVal hwndParent As IntPtr, ByVal Flags As UInt32) As IntPtr + End Function + + 'ref SP_DEVINFO_DATA devInfo, + _ + Public Shared Function SetupDiEnumDeviceInterfaces(ByVal hDevInfo As IntPtr, ByVal devInvo As IntPtr, ByRef interfaceClassGuid As Guid, ByVal memberIndex As Int32, ByRef deviceInterfaceData As SP_DEVICE_INTERFACE_DATA) As Boolean + End Function + + _ + Public Shared Function SetupDiGetDeviceInterfaceDetail(ByVal hDevInfo As IntPtr, ByRef deviceInterfaceData As SP_DEVICE_INTERFACE_DATA, ByVal deviceInterfaceDetailData As IntPtr, ByVal deviceInterfaceDetailDataSize As UInt32, ByRef requiredSize As UInt32, ByVal deviceInfoData As IntPtr) As Boolean + End Function + + _ + Public Shared Function SetupDiGetDeviceInterfaceDetail(ByVal hDevInfo As IntPtr, ByRef deviceInterfaceData As SP_DEVICE_INTERFACE_DATA, ByRef deviceInterfaceDetailData As SP_DEVICE_INTERFACE_DETAIL_DATA, ByVal deviceInterfaceDetailDataSize As UInt32, ByRef requiredSize As UInt32, ByVal deviceInfoData As IntPtr) As Boolean + End Function + + _ + Public Shared Function SetupDiDestroyDeviceInfoList(ByVal hDevInfo As IntPtr) As UInt16 + End Function + + _ + Public Shared Function CreateFile(ByVal fileName As String, ByVal fileAccess As FileAccess, ByVal fileShare As FileShare, ByVal securityAttributes As IntPtr, ByVal creationDisposition As FileMode, ByVal flags As EFileAttributes, ByVal template As IntPtr) As SafeFileHandle + End Function + + _ + Public Shared Function CloseHandle(ByVal hObject As IntPtr) As Boolean + End Function + End Class +End Namespace diff --git a/WiimoteVB/WiimoteLib/My Project/AssemblyInfo.vb b/WiimoteVB/WiimoteLib/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..7a9c98a --- /dev/null +++ b/WiimoteVB/WiimoteLib/My Project/AssemblyInfo.vb @@ -0,0 +1,36 @@ +Imports Microsoft.VisualBasic +Imports System.Reflection +Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + + +' The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Revision and Build Numbers +' by using the '*' as shown below: + + diff --git a/WiimoteVB/WiimoteLib/Properties/AssemblyInfo.vb b/WiimoteVB/WiimoteLib/Properties/AssemblyInfo.vb new file mode 100644 index 0000000..984c022 --- /dev/null +++ b/WiimoteVB/WiimoteLib/Properties/AssemblyInfo.vb @@ -0,0 +1,36 @@ +Imports Microsoft.VisualBasic +Imports System.Reflection +Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + + +' The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' +' You can specify all the values or you can default the Revision and Build Numbers +' by using the '*' as shown below: + + diff --git a/WiimoteVB/WiimoteLib/Wiimote.vb b/WiimoteVB/WiimoteLib/Wiimote.vb new file mode 100644 index 0000000..e05d577 --- /dev/null +++ b/WiimoteVB/WiimoteLib/Wiimote.vb @@ -0,0 +1,1379 @@ +'//////////////////////////////////////////////////////////////////////////////// +' Wiimote.cs +' Managed Wiimote Library +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System +Imports System.Runtime.InteropServices +Imports System.Diagnostics +Imports System.IO +Imports System.Runtime.Serialization +Imports Microsoft.Win32.SafeHandles +Imports System.Threading + +Namespace WiimoteLib + ''' + ''' Implementation of Wiimote + ''' + Public Class Wiimote + Implements IDisposable + ''' + ''' Event raised when Wiimote state is changed + ''' + Public Event WiimoteChanged As EventHandler(Of WiimoteChangedEventArgs) + + ''' + ''' Event raised when an extension is inserted or removed + ''' + Public Event WiimoteExtensionChanged As EventHandler(Of WiimoteExtensionChangedEventArgs) + + ' VID = Nintendo, PID = Wiimote + Private Const VID As Integer = &H057e + Private Const PID As Integer = &H0306 + + ' sure, we could find this out the hard way using HID, but trust me, it's 22 + Private Const REPORT_LENGTH As Integer = 22 + + ' Wiimote output commands + Private Enum OutputReport As Byte + LEDs = &H11 + Type = &H12 + IR = &H13 + Status = &H15 + WriteMemory = &H16 + ReadMemory = &H17 + IR2 = &H1a + End Enum + + ' Wiimote registers + Private Const REGISTER_IR As Integer = &H04b00030 + Private Const REGISTER_IR_SENSITIVITY_1 As Integer = &H04b00000 + Private Const REGISTER_IR_SENSITIVITY_2 As Integer = &H04b0001a + Private Const REGISTER_IR_MODE As Integer = &H04b00033 + + Private Const REGISTER_EXTENSION_INIT_1 As Integer = &H04a400f0 + Private Const REGISTER_EXTENSION_INIT_2 As Integer = &H04a400fb + Private Const REGISTER_EXTENSION_TYPE As Integer = &H04a400fa + Private Const REGISTER_EXTENSION_CALIBRATION As Integer = &H04a40020 + + ' length between board sensors + Private Const BSL As Integer = 43 + + ' width between board sensors + Private Const BSW As Integer = 24 + + ' read/write handle to the device + Private mHandle As SafeFileHandle + + ' a pretty .NET stream to read/write from/to + Private mStream As FileStream + + ' report buffer + Private ReadOnly mBuff(REPORT_LENGTH - 1) As Byte + + ' read data buffer + Private mReadBuff() As Byte + + ' address to read from + Private mAddress As Integer + + ' size of requested read + Private mSize As Short + + ' current state of controller + Private ReadOnly mWiimoteState As New WiimoteState() + + ' event for read data processing + Private ReadOnly mReadDone As New AutoResetEvent(False) + Private ReadOnly mWriteDone As New AutoResetEvent(False) + + ' event for status report + Private ReadOnly mStatusDone As New AutoResetEvent(False) + + ' use a different method to write reports + Private mAltWriteMethod As Boolean + + ' HID device path of this Wiimote + Private mDevicePath As String = String.Empty + + ' unique ID + Private ReadOnly mID As Guid = Guid.NewGuid() + + ' delegate used for enumerating found Wiimotes + Friend Delegate Function WiimoteFoundDelegate(ByVal devicePath As String) As Boolean + + ' kilograms to pounds + Private Const KG2LB As Single = 2.20462262f + + ''' + ''' Default constructor + ''' + Public Sub New() + End Sub + + Friend Sub New(ByVal devicePath As String) + mDevicePath = devicePath + End Sub + + ''' + ''' Connect to the first-found Wiimote + ''' + ''' Wiimote not found in HID device list + Public Sub Connect() + If String.IsNullOrEmpty(mDevicePath) Then + FindWiimote(AddressOf WiimoteFound) + Else + OpenWiimoteDeviceHandle(mDevicePath) + End If + End Sub + + Friend Shared Sub FindWiimote(ByVal wiimoteFound As WiimoteFoundDelegate) + Dim index As Integer = 0 + Dim found As Boolean = False + Dim guid As Guid + Dim mHandle As SafeFileHandle + + ' get the GUID of the HID class + HIDImports.HidD_GetHidGuid(guid) + + ' get a handle to all devices that are part of the HID class + ' Fun fact: DIGCF_PRESENT worked on my machine just fine. I reinstalled Vista, and now it no longer finds the Wiimote with that parameter enabled... + Dim hDevInfo As IntPtr = HIDImports.SetupDiGetClassDevs(guid, Nothing, IntPtr.Zero, HIDImports.DIGCF_DEVICEINTERFACE) ' | HIDImports.DIGCF_PRESENT); + + ' create a new interface data struct and initialize its size + Dim diData As New HIDImports.SP_DEVICE_INTERFACE_DATA() + diData.cbSize = Marshal.SizeOf(diData) + + ' get a device interface to a single device (enumerate all devices) + Do While HIDImports.SetupDiEnumDeviceInterfaces(hDevInfo, IntPtr.Zero, guid, index, diData) + Dim size As UInt32 + + ' get the buffer size for this device detail instance (returned in the size parameter) + HIDImports.SetupDiGetDeviceInterfaceDetail(hDevInfo, diData, IntPtr.Zero, 0, size, IntPtr.Zero) + + ' create a detail struct and set its size + Dim diDetail As New HIDImports.SP_DEVICE_INTERFACE_DETAIL_DATA() + + ' yeah, yeah...well, see, on Win x86, cbSize must be 5 for some reason. On x64, apparently 8 is what it wants. + ' someday I should figure this out. Thanks to Paul Miller on this... + If IntPtr.Size = 8 Then + diDetail.cbSize = CUInt(8) + Else + diDetail.cbSize = CUInt(5) + End If + + ' actually get the detail struct + If HIDImports.SetupDiGetDeviceInterfaceDetail(hDevInfo, diData, diDetail, size, size, IntPtr.Zero) Then + Debug.WriteLine(String.Format("{0}: {1} - {2}", index, diDetail.DevicePath, Marshal.GetLastWin32Error())) + + ' open a read/write handle to our device using the DevicePath returned + mHandle = HIDImports.CreateFile(diDetail.DevicePath, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, HIDImports.EFileAttributes.Overlapped, IntPtr.Zero) + + ' create an attributes struct and initialize the size + Dim attrib As New HIDImports.HIDD_ATTRIBUTES() + attrib.Size = Marshal.SizeOf(attrib) + + ' get the attributes of the current device + If HIDImports.HidD_GetAttributes(mHandle.DangerousGetHandle(), attrib) Then + ' if the vendor and product IDs match up + If attrib.VendorID = VID AndAlso attrib.ProductID = PID Then + ' it's a Wiimote + Debug.WriteLine("Found one!") + found = True + + ' fire the callback function...if the callee doesn't care about more Wiimotes, break out + If (Not wiimoteFound(diDetail.DevicePath)) Then + Exit Do + End If + End If + End If + mHandle.Close() + Else + ' failed to get the detail struct + Throw New WiimoteException("SetupDiGetDeviceInterfaceDetail failed on index " & index) + End If + + ' move to the next device + index += 1 + Loop + + ' clean up our list + HIDImports.SetupDiDestroyDeviceInfoList(hDevInfo) + + ' if we didn't find a Wiimote, throw an exception + If (Not found) Then + Throw New WiimoteNotFoundException("No Wiimotes found in HID device list.") + End If + End Sub + + Private Function WiimoteFound(ByVal devicePath As String) As Boolean + mDevicePath = devicePath + + ' if we didn't find a Wiimote, throw an exception + OpenWiimoteDeviceHandle(mDevicePath) + + Return False + End Function + + Private Sub OpenWiimoteDeviceHandle(ByVal devicePath As String) + ' open a read/write handle to our device using the DevicePath returned + mHandle = HIDImports.CreateFile(devicePath, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, HIDImports.EFileAttributes.Overlapped, IntPtr.Zero) + + ' create an attributes struct and initialize the size + Dim attrib As New HIDImports.HIDD_ATTRIBUTES() + attrib.Size = Marshal.SizeOf(attrib) + + ' get the attributes of the current device + If HIDImports.HidD_GetAttributes(mHandle.DangerousGetHandle(), attrib) Then + ' if the vendor and product IDs match up + If attrib.VendorID = VID AndAlso attrib.ProductID = PID Then + ' create a nice .NET FileStream wrapping the handle above + mStream = New FileStream(mHandle, FileAccess.ReadWrite, REPORT_LENGTH, True) + + ' start an async read operation on it + BeginAsyncRead() + + ' read the calibration info from the controller + Try + ReadWiimoteCalibration() + Catch + ' if we fail above, try the alternate HID writes + mAltWriteMethod = True + ReadWiimoteCalibration() + End Try + + ' force a status check to get the state of any extensions plugged in at startup + GetStatus() + Else + ' otherwise this isn't the controller, so close up the file handle + mHandle.Close() + Throw New WiimoteException("Attempted to open a non-Wiimote device.") + End If + End If + End Sub + + ''' + ''' Disconnect from the controller and stop reading data from it + ''' + Public Sub Disconnect() + ' close up the stream and handle + If mStream IsNot Nothing Then + mStream.Close() + End If + + If mHandle IsNot Nothing Then + mHandle.Close() + End If + End Sub + + ''' + ''' Start reading asynchronously from the controller + ''' + Private Sub BeginAsyncRead() + ' if the stream is valid and ready + If mStream IsNot Nothing AndAlso mStream.CanRead Then + ' setup the read and the callback + Dim buff(REPORT_LENGTH - 1) As Byte + mStream.BeginRead(buff, 0, REPORT_LENGTH, New AsyncCallback(AddressOf OnReadData), buff) + End If + End Sub + + ''' + ''' Callback when data is ready to be processed + ''' + ''' State information for the callback + Private Sub OnReadData(ByVal ar As IAsyncResult) + ' grab the byte buffer + Dim buff() As Byte = CType(ar.AsyncState, Byte()) + + Try + ' end the current read + mStream.EndRead(ar) + + ' parse it + If ParseInputReport(buff) Then + ' post an event + RaiseEvent WiimoteChanged(Me, New WiimoteChangedEventArgs(mWiimoteState)) + End If + + ' start reading again + BeginAsyncRead() + Catch e1 As OperationCanceledException + Debug.WriteLine("OperationCanceledException") + End Try + End Sub + + ''' + ''' Parse a report sent by the Wiimote + ''' + ''' Data buffer to parse + ''' Returns a boolean noting whether an event needs to be posted + Private Function ParseInputReport(ByVal buff() As Byte) As Boolean + Dim type As InputReport = CType(buff(0), InputReport) + + Select Case type + Case InputReport.Buttons + ParseButtons(buff) + Case InputReport.ButtonsAccel + ParseButtons(buff) + ParseAccel(buff) + Case InputReport.IRAccel + ParseButtons(buff) + ParseAccel(buff) + ParseIR(buff) + Case InputReport.ButtonsExtension + ParseButtons(buff) + ParseExtension(buff, 3) + Case InputReport.ExtensionAccel + ParseButtons(buff) + ParseAccel(buff) + ParseExtension(buff, 6) + Case InputReport.IRExtensionAccel + ParseButtons(buff) + ParseAccel(buff) + ParseIR(buff) + ParseExtension(buff, 16) + Case InputReport.Status + ParseButtons(buff) + mWiimoteState.BatteryRaw = buff(6) + mWiimoteState.Battery = (((100.0f * 48.0f * CSng(CInt(Fix(buff(6))) / 48.0f))) / 192.0f) + + ' get the real LED values in case the values from SetLEDs() somehow becomes out of sync, which really shouldn't be possible + mWiimoteState.LEDState.LED1 = (buff(3) And &H10) <> 0 + mWiimoteState.LEDState.LED2 = (buff(3) And &H20) <> 0 + mWiimoteState.LEDState.LED3 = (buff(3) And &H40) <> 0 + mWiimoteState.LEDState.LED4 = (buff(3) And &H80) <> 0 + + ' extension connected? + Dim extension As Boolean = (buff(3) And &H02) <> 0 + Debug.WriteLine("Extension: " & extension) + + If mWiimoteState.Extension <> extension Then + mWiimoteState.Extension = extension + + If extension Then + BeginAsyncRead() + InitializeExtension() + Else + mWiimoteState.ExtensionType = ExtensionType.None + End If + + ' only fire the extension changed event if we have a real extension (i.e. not a balance board) + If WiimoteExtensionChangedEvent IsNot Nothing AndAlso mWiimoteState.ExtensionType <> ExtensionType.BalanceBoard Then + RaiseEvent WiimoteExtensionChanged(Me, New WiimoteExtensionChangedEventArgs(mWiimoteState.ExtensionType, mWiimoteState.Extension)) + End If + End If + mStatusDone.Set() + Case InputReport.ReadData + ParseButtons(buff) + ParseReadData(buff) + Case InputReport.OutputReportAck + Debug.WriteLine("ack: " & buff(0) & " " & buff(1) & " " & buff(2) & " " & buff(3) & " " & buff(4)) + mWriteDone.Set() + Case Else + Debug.WriteLine("Unknown report type: " & type.ToString("x")) + Return False + End Select + + Return True + End Function + + ''' + ''' Handles setting up an extension when plugged in + ''' + Private Sub InitializeExtension() + WriteData(REGISTER_EXTENSION_INIT_1, &H55) + WriteData(REGISTER_EXTENSION_INIT_2, &H00) + + ' start reading again + BeginAsyncRead() + + Dim buff() As Byte = ReadData(REGISTER_EXTENSION_TYPE, 6) + Dim type As Long = (CLng(Fix(buff(0))) << 40) Or (CLng(Fix(buff(1))) << 32) Or (CLng(Fix(buff(2)))) << 24 Or (CLng(Fix(buff(3)))) << 16 Or (CLng(Fix(buff(4)))) << 8 Or buff(5) + + Select Case CType(type, ExtensionType) + Case ExtensionType.None, ExtensionType.ParitallyInserted + mWiimoteState.Extension = False + mWiimoteState.ExtensionType = ExtensionType.None + Return + Case ExtensionType.Nunchuk, ExtensionType.ClassicController, ExtensionType.Guitar, ExtensionType.BalanceBoard, ExtensionType.Drums + mWiimoteState.ExtensionType = CType(type, ExtensionType) + Me.SetReportType(InputReport.ButtonsExtension, True) + Case Else + Throw New WiimoteException("Unknown extension controller found: " & type.ToString("x")) + End Select + + Select Case mWiimoteState.ExtensionType + Case ExtensionType.Nunchuk + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 16) + + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0 = buff(0) + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0 = buff(1) + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0 = buff(2) + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.XG = buff(4) + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.YG = buff(5) + mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.ZG = buff(6) + mWiimoteState.NunchukState.CalibrationInfo.MaxX = buff(8) + mWiimoteState.NunchukState.CalibrationInfo.MinX = buff(9) + mWiimoteState.NunchukState.CalibrationInfo.MidX = buff(10) + mWiimoteState.NunchukState.CalibrationInfo.MaxY = buff(11) + mWiimoteState.NunchukState.CalibrationInfo.MinY = buff(12) + mWiimoteState.NunchukState.CalibrationInfo.MidY = buff(13) + Case ExtensionType.ClassicController + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 16) + + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL = CByte(buff(0) >> 2) + mWiimoteState.ClassicControllerState.CalibrationInfo.MinXL = CByte(buff(1) >> 2) + mWiimoteState.ClassicControllerState.CalibrationInfo.MidXL = CByte(buff(2) >> 2) + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL = CByte(buff(3) >> 2) + mWiimoteState.ClassicControllerState.CalibrationInfo.MinYL = CByte(buff(4) >> 2) + mWiimoteState.ClassicControllerState.CalibrationInfo.MidYL = CByte(buff(5) >> 2) + + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR = CByte(buff(6) >> 3) + mWiimoteState.ClassicControllerState.CalibrationInfo.MinXR = CByte(buff(7) >> 3) + mWiimoteState.ClassicControllerState.CalibrationInfo.MidXR = CByte(buff(8) >> 3) + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR = CByte(buff(9) >> 3) + mWiimoteState.ClassicControllerState.CalibrationInfo.MinYR = CByte(buff(10) >> 3) + mWiimoteState.ClassicControllerState.CalibrationInfo.MidYR = CByte(buff(11) >> 3) + + ' this doesn't seem right... +' mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MinTriggerL = (byte)(buff[12] >> 3); +' mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MaxTriggerL = (byte)(buff[14] >> 3); +' mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MinTriggerR = (byte)(buff[13] >> 3); +' mWiimoteState.ClassicControllerState.AccelCalibrationInfo.MaxTriggerR = (byte)(buff[15] >> 3); + mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerL = 0 + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL = 31 + mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerR = 0 + mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR = 31 + Case ExtensionType.Guitar, ExtensionType.Drums + ' there appears to be no calibration data returned by the guitar controller + Case ExtensionType.BalanceBoard + buff = ReadData(REGISTER_EXTENSION_CALIBRATION, 32) + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopRight = CShort(Fix(CShort(Fix(buff(4))) << 8 Or buff(5))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomRight = CShort(Fix(CShort(Fix(buff(6))) << 8 Or buff(7))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopLeft = CShort(Fix(CShort(Fix(buff(8))) << 8 Or buff(9))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomLeft = CShort(Fix(CShort(Fix(buff(10))) << 8 Or buff(11))) + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopRight = CShort(Fix(CShort(Fix(buff(12))) << 8 Or buff(13))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomRight = CShort(Fix(CShort(Fix(buff(14))) << 8 Or buff(15))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopLeft = CShort(Fix(CShort(Fix(buff(16))) << 8 Or buff(17))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomLeft = CShort(Fix(CShort(Fix(buff(18))) << 8 Or buff(19))) + + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopRight = CShort(Fix(CShort(Fix(buff(20))) << 8 Or buff(21))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomRight = CShort(Fix(CShort(Fix(buff(22))) << 8 Or buff(23))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopLeft = CShort(Fix(CShort(Fix(buff(24))) << 8 Or buff(25))) + mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomLeft = CShort(Fix(CShort(Fix(buff(26))) << 8 Or buff(27))) + End Select + End Sub + + ''' + ''' Decrypts data sent from the extension to the Wiimote + ''' + ''' Data buffer + ''' Byte array containing decoded data + Private Function DecryptBuffer(ByVal buff() As Byte) As Byte() + For i As Integer = 0 To buff.Length - 1 + buff(i) = CByte(((buff(i) Xor &H17) + &H17) And &Hff) + Next i + + Return buff + End Function + + ''' + ''' Parses a standard button report into the ButtonState struct + ''' + ''' Data buffer + Private Sub ParseButtons(ByVal buff() As Byte) + mWiimoteState.ButtonState.A = (buff(2) And &H08) <> 0 + mWiimoteState.ButtonState.B = (buff(2) And &H04) <> 0 + mWiimoteState.ButtonState.Minus = (buff(2) And &H10) <> 0 + mWiimoteState.ButtonState.Home = (buff(2) And &H80) <> 0 + mWiimoteState.ButtonState.Plus = (buff(1) And &H10) <> 0 + mWiimoteState.ButtonState.One = (buff(2) And &H02) <> 0 + mWiimoteState.ButtonState.Two = (buff(2) And &H01) <> 0 + mWiimoteState.ButtonState.Up = (buff(1) And &H08) <> 0 + mWiimoteState.ButtonState.Down = (buff(1) And &H04) <> 0 + mWiimoteState.ButtonState.Left = (buff(1) And &H01) <> 0 + mWiimoteState.ButtonState.Right = (buff(1) And &H02) <> 0 + End Sub + + ''' + ''' Parse accelerometer data + ''' + ''' Data buffer + Private Sub ParseAccel(ByVal buff() As Byte) + mWiimoteState.AccelState.RawValues.X = buff(3) + mWiimoteState.AccelState.RawValues.Y = buff(4) + mWiimoteState.AccelState.RawValues.Z = buff(5) + + mWiimoteState.AccelState.Values.X = CSng(CSng(mWiimoteState.AccelState.RawValues.X) - (CInt(Fix(mWiimoteState.AccelCalibrationInfo.X0)))) / (CSng(mWiimoteState.AccelCalibrationInfo.XG) - (CInt(Fix(mWiimoteState.AccelCalibrationInfo.X0)))) + mWiimoteState.AccelState.Values.Y = CSng(CSng(mWiimoteState.AccelState.RawValues.Y) - mWiimoteState.AccelCalibrationInfo.Y0) / (CSng(mWiimoteState.AccelCalibrationInfo.YG) - mWiimoteState.AccelCalibrationInfo.Y0) + mWiimoteState.AccelState.Values.Z = CSng(CSng(mWiimoteState.AccelState.RawValues.Z) - mWiimoteState.AccelCalibrationInfo.Z0) / (CSng(mWiimoteState.AccelCalibrationInfo.ZG) - mWiimoteState.AccelCalibrationInfo.Z0) + End Sub + + ''' + ''' Parse IR data from report + ''' + ''' Data buffer + Private Sub ParseIR(ByVal buff() As Byte) + mWiimoteState.IRState.IRSensors(0).RawPosition.X = buff(6) Or ((buff(8) >> 4) And &H03) << 8 + mWiimoteState.IRState.IRSensors(0).RawPosition.Y = buff(7) Or ((buff(8) >> 6) And &H03) << 8 + + Select Case mWiimoteState.IRState.Mode + Case IRMode.Basic + mWiimoteState.IRState.IRSensors(1).RawPosition.X = buff(9) Or ((buff(8) >> 0) And &H03) << 8 + mWiimoteState.IRState.IRSensors(1).RawPosition.Y = buff(10) Or ((buff(8) >> 2) And &H03) << 8 + + mWiimoteState.IRState.IRSensors(2).RawPosition.X = buff(11) Or ((buff(13) >> 4) And &H03) << 8 + mWiimoteState.IRState.IRSensors(2).RawPosition.Y = buff(12) Or ((buff(13) >> 6) And &H03) << 8 + + mWiimoteState.IRState.IRSensors(3).RawPosition.X = buff(14) Or ((buff(13) >> 0) And &H03) << 8 + mWiimoteState.IRState.IRSensors(3).RawPosition.Y = buff(15) Or ((buff(13) >> 2) And &H03) << 8 + + mWiimoteState.IRState.IRSensors(0).Size = &H00 + mWiimoteState.IRState.IRSensors(1).Size = &H00 + mWiimoteState.IRState.IRSensors(2).Size = &H00 + mWiimoteState.IRState.IRSensors(3).Size = &H00 + + mWiimoteState.IRState.IRSensors(0).Found = Not(buff(6) = &Hff AndAlso buff(7) = &Hff) + mWiimoteState.IRState.IRSensors(1).Found = Not(buff(9) = &Hff AndAlso buff(10) = &Hff) + mWiimoteState.IRState.IRSensors(2).Found = Not(buff(11) = &Hff AndAlso buff(12) = &Hff) + mWiimoteState.IRState.IRSensors(3).Found = Not(buff(14) = &Hff AndAlso buff(15) = &Hff) + Case IRMode.Extended + mWiimoteState.IRState.IRSensors(1).RawPosition.X = buff(9) Or ((buff(11) >> 4) And &H03) << 8 + mWiimoteState.IRState.IRSensors(1).RawPosition.Y = buff(10) Or ((buff(11) >> 6) And &H03) << 8 + mWiimoteState.IRState.IRSensors(2).RawPosition.X = buff(12) Or ((buff(14) >> 4) And &H03) << 8 + mWiimoteState.IRState.IRSensors(2).RawPosition.Y = buff(13) Or ((buff(14) >> 6) And &H03) << 8 + mWiimoteState.IRState.IRSensors(3).RawPosition.X = buff(15) Or ((buff(17) >> 4) And &H03) << 8 + mWiimoteState.IRState.IRSensors(3).RawPosition.Y = buff(16) Or ((buff(17) >> 6) And &H03) << 8 + + mWiimoteState.IRState.IRSensors(0).Size = buff(8) And &H0f + mWiimoteState.IRState.IRSensors(1).Size = buff(11) And &H0f + mWiimoteState.IRState.IRSensors(2).Size = buff(14) And &H0f + mWiimoteState.IRState.IRSensors(3).Size = buff(17) And &H0f + + mWiimoteState.IRState.IRSensors(0).Found = Not(buff(6) = &Hff AndAlso buff(7) = &Hff AndAlso buff(8) = &Hff) + mWiimoteState.IRState.IRSensors(1).Found = Not(buff(9) = &Hff AndAlso buff(10) = &Hff AndAlso buff(11) = &Hff) + mWiimoteState.IRState.IRSensors(2).Found = Not(buff(12) = &Hff AndAlso buff(13) = &Hff AndAlso buff(14) = &Hff) + mWiimoteState.IRState.IRSensors(3).Found = Not(buff(15) = &Hff AndAlso buff(16) = &Hff AndAlso buff(17) = &Hff) + End Select + + mWiimoteState.IRState.IRSensors(0).Position.X = CSng(mWiimoteState.IRState.IRSensors(0).RawPosition.X / 1023.5f) + mWiimoteState.IRState.IRSensors(1).Position.X = CSng(mWiimoteState.IRState.IRSensors(1).RawPosition.X / 1023.5f) + mWiimoteState.IRState.IRSensors(2).Position.X = CSng(mWiimoteState.IRState.IRSensors(2).RawPosition.X / 1023.5f) + mWiimoteState.IRState.IRSensors(3).Position.X = CSng(mWiimoteState.IRState.IRSensors(3).RawPosition.X / 1023.5f) + + mWiimoteState.IRState.IRSensors(0).Position.Y = CSng(mWiimoteState.IRState.IRSensors(0).RawPosition.Y / 767.5f) + mWiimoteState.IRState.IRSensors(1).Position.Y = CSng(mWiimoteState.IRState.IRSensors(1).RawPosition.Y / 767.5f) + mWiimoteState.IRState.IRSensors(2).Position.Y = CSng(mWiimoteState.IRState.IRSensors(2).RawPosition.Y / 767.5f) + mWiimoteState.IRState.IRSensors(3).Position.Y = CSng(mWiimoteState.IRState.IRSensors(3).RawPosition.Y / 767.5f) + + If mWiimoteState.IRState.IRSensors(0).Found AndAlso mWiimoteState.IRState.IRSensors(1).Found Then + mWiimoteState.IRState.RawMidpoint.X = (mWiimoteState.IRState.IRSensors(1).RawPosition.X + mWiimoteState.IRState.IRSensors(0).RawPosition.X) / 2 + mWiimoteState.IRState.RawMidpoint.Y = (mWiimoteState.IRState.IRSensors(1).RawPosition.Y + mWiimoteState.IRState.IRSensors(0).RawPosition.Y) / 2 + + mWiimoteState.IRState.Midpoint.X = (mWiimoteState.IRState.IRSensors(1).Position.X + mWiimoteState.IRState.IRSensors(0).Position.X) / 2.0f + mWiimoteState.IRState.Midpoint.Y = (mWiimoteState.IRState.IRSensors(1).Position.Y + mWiimoteState.IRState.IRSensors(0).Position.Y) / 2.0f + Else + mWiimoteState.IRState.Midpoint.Y = 0.0f + mWiimoteState.IRState.Midpoint.X = mWiimoteState.IRState.Midpoint.Y + End If + End Sub + + ''' + ''' Parse data from an extension controller + ''' + ''' Data buffer + ''' Offset into data buffer + Private Sub ParseExtension(ByVal buff() As Byte, ByVal offset As Integer) + Select Case mWiimoteState.ExtensionType + Case ExtensionType.Nunchuk + mWiimoteState.NunchukState.RawJoystick.X = buff(offset) + mWiimoteState.NunchukState.RawJoystick.Y = buff(offset + 1) + mWiimoteState.NunchukState.AccelState.RawValues.X = buff(offset + 2) + mWiimoteState.NunchukState.AccelState.RawValues.Y = buff(offset + 3) + mWiimoteState.NunchukState.AccelState.RawValues.Z = buff(offset + 4) + + mWiimoteState.NunchukState.C = (buff(offset + 5) And &H02) = 0 + mWiimoteState.NunchukState.Z = (buff(offset + 5) And &H01) = 0 + + mWiimoteState.NunchukState.AccelState.Values.X = CSng(CSng(mWiimoteState.NunchukState.AccelState.RawValues.X) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0) / (CSng(mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.XG) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.X0) + mWiimoteState.NunchukState.AccelState.Values.Y = CSng(CSng(mWiimoteState.NunchukState.AccelState.RawValues.Y) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0) / (CSng(mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.YG) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Y0) + mWiimoteState.NunchukState.AccelState.Values.Z = CSng(CSng(mWiimoteState.NunchukState.AccelState.RawValues.Z) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0) / (CSng(mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.ZG) - mWiimoteState.NunchukState.CalibrationInfo.AccelCalibration.Z0) + + If mWiimoteState.NunchukState.CalibrationInfo.MaxX <> &H00 Then + mWiimoteState.NunchukState.Joystick.X = CSng(CSng(mWiimoteState.NunchukState.RawJoystick.X) - mWiimoteState.NunchukState.CalibrationInfo.MidX) / (CSng(mWiimoteState.NunchukState.CalibrationInfo.MaxX) - mWiimoteState.NunchukState.CalibrationInfo.MinX) + End If + + If mWiimoteState.NunchukState.CalibrationInfo.MaxY <> &H00 Then + mWiimoteState.NunchukState.Joystick.Y = CSng(CSng(mWiimoteState.NunchukState.RawJoystick.Y) - mWiimoteState.NunchukState.CalibrationInfo.MidY) / (CSng(mWiimoteState.NunchukState.CalibrationInfo.MaxY) - mWiimoteState.NunchukState.CalibrationInfo.MinY) + End If + + + Case ExtensionType.ClassicController + mWiimoteState.ClassicControllerState.RawJoystickL.X = CByte(buff(offset) And &H3f) + mWiimoteState.ClassicControllerState.RawJoystickL.Y = CByte(buff(offset + 1) And &H3f) + mWiimoteState.ClassicControllerState.RawJoystickR.X = CByte((buff(offset + 2) >> 7) Or (buff(offset + 1) And &Hc0) >> 5 Or (buff(offset) And &Hc0) >> 3) + mWiimoteState.ClassicControllerState.RawJoystickR.Y = CByte(buff(offset + 2) And &H1f) + + mWiimoteState.ClassicControllerState.RawTriggerL = CByte(((buff(offset + 2) And &H60) >> 2) Or (buff(offset + 3) >> 5)) + mWiimoteState.ClassicControllerState.RawTriggerR = CByte(buff(offset + 3) And &H1f) + + mWiimoteState.ClassicControllerState.ButtonState.TriggerR = (buff(offset + 4) And &H02) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Plus = (buff(offset + 4) And &H04) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Home = (buff(offset + 4) And &H08) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Minus = (buff(offset + 4) And &H10) = 0 + mWiimoteState.ClassicControllerState.ButtonState.TriggerL = (buff(offset + 4) And &H20) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Down = (buff(offset + 4) And &H40) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Right = (buff(offset + 4) And &H80) = 0 + + mWiimoteState.ClassicControllerState.ButtonState.Up = (buff(offset + 5) And &H01) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Left = (buff(offset + 5) And &H02) = 0 + mWiimoteState.ClassicControllerState.ButtonState.ZR = (buff(offset + 5) And &H04) = 0 + mWiimoteState.ClassicControllerState.ButtonState.X = (buff(offset + 5) And &H08) = 0 + mWiimoteState.ClassicControllerState.ButtonState.A = (buff(offset + 5) And &H10) = 0 + mWiimoteState.ClassicControllerState.ButtonState.Y = (buff(offset + 5) And &H20) = 0 + mWiimoteState.ClassicControllerState.ButtonState.B = (buff(offset + 5) And &H40) = 0 + mWiimoteState.ClassicControllerState.ButtonState.ZL = (buff(offset + 5) And &H80) = 0 + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL <> &H00 Then + mWiimoteState.ClassicControllerState.JoystickL.X = CSng(CSng(mWiimoteState.ClassicControllerState.RawJoystickL.X) - mWiimoteState.ClassicControllerState.CalibrationInfo.MidXL) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinXL) + End If + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL <> &H00 Then + mWiimoteState.ClassicControllerState.JoystickL.Y = CSng(CSng(mWiimoteState.ClassicControllerState.RawJoystickL.Y) - mWiimoteState.ClassicControllerState.CalibrationInfo.MidYL) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinYL) + End If + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR <> &H00 Then + mWiimoteState.ClassicControllerState.JoystickR.X = CSng(CSng(mWiimoteState.ClassicControllerState.RawJoystickR.X) - mWiimoteState.ClassicControllerState.CalibrationInfo.MidXR) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxXR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinXR) + End If + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR <> &H00 Then + mWiimoteState.ClassicControllerState.JoystickR.Y = CSng(CSng(mWiimoteState.ClassicControllerState.RawJoystickR.Y) - mWiimoteState.ClassicControllerState.CalibrationInfo.MidYR) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxYR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinYR) + End If + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL <> &H00 Then + mWiimoteState.ClassicControllerState.TriggerL = (mWiimoteState.ClassicControllerState.RawTriggerL) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerL - mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerL) + End If + + If mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR <> &H00 Then + mWiimoteState.ClassicControllerState.TriggerR = (mWiimoteState.ClassicControllerState.RawTriggerR) / CSng(mWiimoteState.ClassicControllerState.CalibrationInfo.MaxTriggerR - mWiimoteState.ClassicControllerState.CalibrationInfo.MinTriggerR) + End If + + Case ExtensionType.Guitar + If ((buff(offset) And &H80) = 0) Then + mWiimoteState.GuitarState.GuitarType = GuitarType.GuitarHeroWorldTour + Else + mWiimoteState.GuitarState.GuitarType = GuitarType.GuitarHero3 + End If + + mWiimoteState.GuitarState.ButtonState.Plus = (buff(offset + 4) And &H04) = 0 + mWiimoteState.GuitarState.ButtonState.Minus = (buff(offset + 4) And &H10) = 0 + mWiimoteState.GuitarState.ButtonState.StrumDown = (buff(offset + 4) And &H40) = 0 + + mWiimoteState.GuitarState.ButtonState.StrumUp = (buff(offset + 5) And &H01) = 0 + mWiimoteState.GuitarState.FretButtonState.Yellow = (buff(offset + 5) And &H08) = 0 + mWiimoteState.GuitarState.FretButtonState.Green = (buff(offset + 5) And &H10) = 0 + mWiimoteState.GuitarState.FretButtonState.Blue = (buff(offset + 5) And &H20) = 0 + mWiimoteState.GuitarState.FretButtonState.Red = (buff(offset + 5) And &H40) = 0 + mWiimoteState.GuitarState.FretButtonState.Orange = (buff(offset + 5) And &H80) = 0 + + ' it appears the joystick values are only 6 bits + mWiimoteState.GuitarState.RawJoystick.X = (buff(offset + 0) And &H3f) + mWiimoteState.GuitarState.RawJoystick.Y = (buff(offset + 1) And &H3f) + + ' and the whammy bar is only 5 bits + mWiimoteState.GuitarState.RawWhammyBar = CByte(buff(offset + 3) And &H1f) + + mWiimoteState.GuitarState.Joystick.X = CSng(mWiimoteState.GuitarState.RawJoystick.X - &H1f) / &H3f ' not fully accurate, but close + mWiimoteState.GuitarState.Joystick.Y = CSng(mWiimoteState.GuitarState.RawJoystick.Y - &H1f) / &H3f ' not fully accurate, but close + mWiimoteState.GuitarState.WhammyBar = CSng(mWiimoteState.GuitarState.RawWhammyBar) / &H0a ' seems like there are 10 positions? + + mWiimoteState.GuitarState.TouchbarState.Yellow = False + mWiimoteState.GuitarState.TouchbarState.Green = False + mWiimoteState.GuitarState.TouchbarState.Blue = False + mWiimoteState.GuitarState.TouchbarState.Red = False + mWiimoteState.GuitarState.TouchbarState.Orange = False + + Select Case buff(offset + 2) And &H1f + Case &H04 + mWiimoteState.GuitarState.TouchbarState.Green = True + Case &H07 + mWiimoteState.GuitarState.TouchbarState.Green = True + mWiimoteState.GuitarState.TouchbarState.Red = True + Case &H0a + mWiimoteState.GuitarState.TouchbarState.Red = True + Case &H0c, &H0d + mWiimoteState.GuitarState.TouchbarState.Red = True + mWiimoteState.GuitarState.TouchbarState.Yellow = True + Case &H12, &H13 + mWiimoteState.GuitarState.TouchbarState.Yellow = True + Case &H14, &H15 + mWiimoteState.GuitarState.TouchbarState.Yellow = True + mWiimoteState.GuitarState.TouchbarState.Blue = True + Case &H17, &H18 + mWiimoteState.GuitarState.TouchbarState.Blue = True + Case &H1a + mWiimoteState.GuitarState.TouchbarState.Blue = True + mWiimoteState.GuitarState.TouchbarState.Orange = True + Case &H1f + mWiimoteState.GuitarState.TouchbarState.Orange = True + End Select + + Case ExtensionType.Drums + ' it appears the joystick values are only 6 bits + mWiimoteState.DrumsState.RawJoystick.X = (buff(offset + 0) And &H3f) + mWiimoteState.DrumsState.RawJoystick.Y = (buff(offset + 1) And &H3f) + + mWiimoteState.DrumsState.Plus = (buff(offset + 4) And &H04) = 0 + mWiimoteState.DrumsState.Minus = (buff(offset + 4) And &H10) = 0 + + mWiimoteState.DrumsState.Pedal = (buff(offset + 5) And &H04) = 0 + mWiimoteState.DrumsState.Blue = (buff(offset + 5) And &H08) = 0 + mWiimoteState.DrumsState.Green = (buff(offset + 5) And &H10) = 0 + mWiimoteState.DrumsState.Yellow = (buff(offset + 5) And &H20) = 0 + mWiimoteState.DrumsState.Red = (buff(offset + 5) And &H40) = 0 + mWiimoteState.DrumsState.Orange = (buff(offset + 5) And &H80) = 0 + + mWiimoteState.DrumsState.Joystick.X = CSng(mWiimoteState.DrumsState.RawJoystick.X - &H1f) / &H3f ' not fully accurate, but close + mWiimoteState.DrumsState.Joystick.Y = CSng(mWiimoteState.DrumsState.RawJoystick.Y - &H1f) / &H3f ' not fully accurate, but close + + If (buff(offset + 2) And &H40) = 0 Then + Dim pad As Integer = (buff(offset + 2) >> 1) And &H1f + Dim velocity As Integer = (buff(offset + 3) >> 5) + + If velocity <> 7 Then + Select Case pad + Case &H1b + mWiimoteState.DrumsState.PedalVelocity = velocity + Case &H19 + mWiimoteState.DrumsState.RedVelocity = velocity + Case &H11 + mWiimoteState.DrumsState.YellowVelocity = velocity + Case &H0f + mWiimoteState.DrumsState.BlueVelocity = velocity + Case &H0e + mWiimoteState.DrumsState.OrangeVelocity = velocity + Case &H12 + mWiimoteState.DrumsState.GreenVelocity = velocity + End Select + End If + End If + + + Case ExtensionType.BalanceBoard + mWiimoteState.BalanceBoardState.SensorValuesRaw.TopRight = CShort(Fix(CShort(Fix(buff(offset + 0))) << 8 Or buff(offset + 1))) + mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomRight = CShort(Fix(CShort(Fix(buff(offset + 2))) << 8 Or buff(offset + 3))) + mWiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft = CShort(Fix(CShort(Fix(buff(offset + 4))) << 8 Or buff(offset + 5))) + mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomLeft = CShort(Fix(CShort(Fix(buff(offset + 6))) << 8 Or buff(offset + 7))) + + mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopLeft) + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.TopRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.TopRight) + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomLeft, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomLeft) + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight = GetBalanceBoardSensorValue(mWiimoteState.BalanceBoardState.SensorValuesRaw.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg0.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg17.BottomRight, mWiimoteState.BalanceBoardState.CalibrationInfo.Kg34.BottomRight) + + mWiimoteState.BalanceBoardState.SensorValuesLb.TopLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft * KG2LB) + mWiimoteState.BalanceBoardState.SensorValuesLb.TopRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight * KG2LB) + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomLeft = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft * KG2LB) + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomRight = (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight * KG2LB) + + mWiimoteState.BalanceBoardState.WeightKg = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight) / 4.0f + mWiimoteState.BalanceBoardState.WeightLb = (mWiimoteState.BalanceBoardState.SensorValuesLb.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesLb.TopRight + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesLb.BottomRight) / 4.0f + + Dim Kx As Single = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft) / (mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight) + Dim Ky As Single = (mWiimoteState.BalanceBoardState.SensorValuesKg.TopLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.TopRight) / (mWiimoteState.BalanceBoardState.SensorValuesKg.BottomLeft + mWiimoteState.BalanceBoardState.SensorValuesKg.BottomRight) + + mWiimoteState.BalanceBoardState.CenterOfGravity.X = (CSng(Kx - 1) / CSng(Kx + 1)) * CSng(-BSL \ 2) + mWiimoteState.BalanceBoardState.CenterOfGravity.Y = (CSng(Ky - 1) / CSng(Ky + 1)) * CSng(-BSW \ 2) + End Select + End Sub + + Private Function GetBalanceBoardSensorValue(ByVal sensor As Short, ByVal min As Short, ByVal mid As Short, ByVal max As Short) As Single + If max = mid OrElse mid = min Then + Return 0 + End If + + If sensor < mid Then + Return 68.0f * (CSng(sensor - min) / (mid - min)) + Else + Return 68.0f * (CSng(sensor - mid) / (max - mid)) + 68.0f + End If + End Function + + + ''' + ''' Parse data returned from a read report + ''' + ''' Data buffer + Private Sub ParseReadData(ByVal buff() As Byte) + If (buff(3) And &H08) <> 0 Then + Throw New WiimoteException("Error reading data from Wiimote: Bytes do not exist.") + End If + + If (buff(3) And &H07) <> 0 Then + Throw New WiimoteException("Error reading data from Wiimote: Attempt to read from write-only registers.") + End If + + ' get our size and offset from the report + Dim size As Integer = (buff(3) >> 4) + 1 + Dim offset As Integer = (buff(4) << 8 Or buff(5)) + + ' add it to the buffer + Array.Copy(buff, 6, mReadBuff, offset - mAddress, size) + + ' if we've read it all, set the event + If mAddress + mSize = offset + size Then + mReadDone.Set() + End If + End Sub + + ''' + ''' Returns whether rumble is currently enabled. + ''' + ''' Byte indicating true (0x01) or false (0x00) + Private Function GetRumbleBit() As Byte + If mWiimoteState.Rumble Then + Return CByte(&H01) + Else + Return CByte(&H00) + End If + End Function + + ''' + ''' Read calibration information stored on Wiimote + ''' + Private Sub ReadWiimoteCalibration() + ' this appears to change the report type to 0x31 + Dim buff() As Byte = ReadData(&H0016, 7) + + mWiimoteState.AccelCalibrationInfo.X0 = buff(0) + mWiimoteState.AccelCalibrationInfo.Y0 = buff(1) + mWiimoteState.AccelCalibrationInfo.Z0 = buff(2) + mWiimoteState.AccelCalibrationInfo.XG = buff(4) + mWiimoteState.AccelCalibrationInfo.YG = buff(5) + mWiimoteState.AccelCalibrationInfo.ZG = buff(6) + End Sub + + ''' + ''' Set Wiimote reporting mode (if using an IR report type, IR sensitivity is set to WiiLevel3) + ''' + ''' Report type + ''' Continuous data + Public Sub SetReportType(ByVal type As InputReport, ByVal continuous As Boolean) + SetReportType(type, IRSensitivity.Maximum, continuous) + End Sub + + ''' + ''' Set Wiimote reporting mode + ''' + ''' Report type + ''' IR sensitivity + ''' Continuous data + Public Sub SetReportType(ByVal type As InputReport, ByVal irSensitivity As IRSensitivity, ByVal continuous As Boolean) + ' only 1 report type allowed for the BB + If mWiimoteState.ExtensionType = ExtensionType.BalanceBoard Then + type = InputReport.ButtonsExtension + End If + + Select Case type + Case InputReport.IRAccel + EnableIR(IRMode.Extended, irSensitivity) + Case InputReport.IRExtensionAccel + EnableIR(IRMode.Basic, irSensitivity) + Case Else + DisableIR() + End Select + + ClearReport() + mBuff(0) = CByte(OutputReport.Type) + If continuous Then + If mWiimoteState.Rumble Then + mBuff(1) = CByte((&H04) Or CByte(&H01)) + Else + mBuff(1) = CByte((&H04) Or CByte(&H00)) + End If + Else + If mWiimoteState.Rumble Then + mBuff(1) = CByte((&H00) Or CByte(&H01)) + Else + mBuff(1) = CByte((&H00) Or CByte(&H00)) + End If + End If + mBuff(2) = CByte(type) + + WriteReport() + End Sub + + ''' + ''' Set the LEDs on the Wiimote + ''' + ''' LED 1 + ''' LED 2 + ''' LED 3 + ''' LED 4 + Public Sub SetLEDs(ByVal led1 As Boolean, ByVal led2 As Boolean, ByVal led3 As Boolean, ByVal led4 As Boolean) + mWiimoteState.LEDState.LED1 = led1 + mWiimoteState.LEDState.LED2 = led2 + mWiimoteState.LEDState.LED3 = led3 + mWiimoteState.LEDState.LED4 = led4 + + ClearReport() + + mBuff(0) = CByte(OutputReport.LEDs) + If led1 Then + If led2 Then + If led3 Then + If led4 Then + mBuff(1) = CByte((&H10) Or (&H20) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H20) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If led4 Then + mBuff(1) = CByte((&H10) Or (&H20) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H20) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + Else + If led3 Then + If led4 Then + mBuff(1) = CByte((&H10) Or (&H00) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H00) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If led4 Then + mBuff(1) = CByte((&H10) Or (&H00) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H00) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + End If + Else + If led2 Then + If led3 Then + If led4 Then + mBuff(1) = CByte((&H00) Or (&H20) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H20) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If led4 Then + mBuff(1) = CByte((&H00) Or (&H20) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H20) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + Else + If led3 Then + If led4 Then + mBuff(1) = CByte((&H00) Or (&H00) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H00) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If led4 Then + mBuff(1) = CByte((&H00) Or (&H00) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H00) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + End If + End If + + WriteReport() + End Sub + + ''' + ''' Set the LEDs on the Wiimote + ''' + ''' The value to be lit up in base2 on the Wiimote + Public Sub SetLEDs(ByVal leds As Integer) + mWiimoteState.LEDState.LED1 = (leds And &H01) > 0 + mWiimoteState.LEDState.LED2 = (leds And &H02) > 0 + mWiimoteState.LEDState.LED3 = (leds And &H04) > 0 + mWiimoteState.LEDState.LED4 = (leds And &H08) > 0 + + ClearReport() + + mBuff(0) = CByte(OutputReport.LEDs) + If (leds And &H01) > 0 Then + If (leds And &H02) > 0 Then + If (leds And &H04) > 0 Then + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H10) Or (&H20) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H20) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H10) Or (&H20) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H20) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + Else + If (leds And &H04) > 0 Then + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H10) Or (&H00) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H00) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H10) Or (&H00) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H10) Or (&H00) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + End If + Else + If (leds And &H02) > 0 Then + If (leds And &H04) > 0 Then + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H00) Or (&H20) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H20) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H00) Or (&H20) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H20) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + Else + If (leds And &H04) > 0 Then + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H00) Or (&H00) Or (&H40) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H00) Or (&H40) Or (&H00) Or GetRumbleBit()) + End If + Else + If (leds And &H08) > 0 Then + mBuff(1) = CByte((&H00) Or (&H00) Or (&H00) Or (&H80) Or GetRumbleBit()) + Else + mBuff(1) = CByte((&H00) Or (&H00) Or (&H00) Or (&H00) Or GetRumbleBit()) + End If + End If + End If + End If + + WriteReport() + End Sub + + ''' + ''' Toggle rumble + ''' + ''' On or off + Public Sub SetRumble(ByVal [on] As Boolean) + mWiimoteState.Rumble = [on] + + ' the LED report also handles rumble + SetLEDs(mWiimoteState.LEDState.LED1, mWiimoteState.LEDState.LED2, mWiimoteState.LEDState.LED3, mWiimoteState.LEDState.LED4) + End Sub + + ''' + ''' Retrieve the current status of the Wiimote and extensions. Replaces GetBatteryLevel() since it was poorly named. + ''' + Public Sub GetStatus() + ClearReport() + + mBuff(0) = CByte(OutputReport.Status) + mBuff(1) = GetRumbleBit() + + WriteReport() + + ' signal the status report finished + If (Not mStatusDone.WaitOne(3000, False)) Then + Throw New WiimoteException("Timed out waiting for status report") + End If + End Sub + + ''' + ''' Turn on the IR sensor + ''' + ''' The data report mode + ''' IR sensitivity + Private Sub EnableIR(ByVal mode As IRMode, ByVal irSensitivity As IRSensitivity) + mWiimoteState.IRState.Mode = mode + + ClearReport() + mBuff(0) = CByte(OutputReport.IR) + mBuff(1) = CByte(&H04 Or GetRumbleBit()) + WriteReport() + + ClearReport() + mBuff(0) = CByte(OutputReport.IR2) + mBuff(1) = CByte(&H04 Or GetRumbleBit()) + WriteReport() + + WriteData(REGISTER_IR, &H08) + Select Case irSensitivity + Case IRSensitivity.WiiLevel1 + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H02, &H00, &H00, &H71, &H01, &H00, &H64, &H00, &Hfe}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&Hfd, &H05}) + Case IRSensitivity.WiiLevel2 + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H02, &H00, &H00, &H71, &H01, &H00, &H96, &H00, &Hb4}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&Hb3, &H04}) + Case IRSensitivity.WiiLevel3 + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H02, &H00, &H00, &H71, &H01, &H00, &Haa, &H00, &H64}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&H63, &H03}) + Case IRSensitivity.WiiLevel4 + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H02, &H00, &H00, &H71, &H01, &H00, &Hc8, &H00, &H36}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&H35, &H03}) + Case IRSensitivity.WiiLevel5 + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H07, &H00, &H00, &H71, &H01, &H00, &H72, &H00, &H20}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&H1, &H03}) + Case IRSensitivity.Maximum + WriteData(REGISTER_IR_SENSITIVITY_1, 9, New Byte() {&H02, &H00, &H00, &H71, &H01, &H00, &H90, &H00, &H41}) + WriteData(REGISTER_IR_SENSITIVITY_2, 2, New Byte() {&H40, &H00}) + Case Else + Throw New ArgumentOutOfRangeException("irSensitivity") + End Select + WriteData(REGISTER_IR_MODE, CByte(mode)) + WriteData(REGISTER_IR, &H08) + End Sub + + ''' + ''' Disable the IR sensor + ''' + Private Sub DisableIR() + mWiimoteState.IRState.Mode = IRMode.Off + + ClearReport() + mBuff(0) = CByte(OutputReport.IR) + mBuff(1) = GetRumbleBit() + WriteReport() + + ClearReport() + mBuff(0) = CByte(OutputReport.IR2) + mBuff(1) = GetRumbleBit() + WriteReport() + End Sub + + ''' + ''' Initialize the report data buffer + ''' + Private Sub ClearReport() + Array.Clear(mBuff, 0, REPORT_LENGTH) + End Sub + + ''' + ''' Write a report to the Wiimote + ''' + Private Sub WriteReport() + Debug.WriteLine("WriteReport: " & mBuff(0).ToString("x")) + If mAltWriteMethod Then + HIDImports.HidD_SetOutputReport(Me.mHandle.DangerousGetHandle(), mBuff, CUInt(mBuff.Length)) + ElseIf mStream IsNot Nothing Then + mStream.Write(mBuff, 0, REPORT_LENGTH) + End If + + If mBuff(0) = CByte(OutputReport.WriteMemory) Then + Debug.WriteLine("Wait") + If (Not mWriteDone.WaitOne(1000, False)) Then + Debug.WriteLine("Wait failed") + End If + 'throw new WiimoteException("Error writing data to Wiimote...is it connected?"); + End If + End Sub + + ''' + ''' Read data or register from Wiimote + ''' + ''' Address to read + ''' Length to read + ''' Data buffer + Public Function ReadData(ByVal address As Integer, ByVal size As Short) As Byte() + ClearReport() + + mReadBuff = New Byte(size - 1){} + mAddress = address And &Hffff + mSize = size + + mBuff(0) = CByte(OutputReport.ReadMemory) + mBuff(1) = CByte(((address And &Hff000000L) >> 24) Or GetRumbleBit()) + mBuff(2) = CByte((address And &H00ff0000) >> 16) + mBuff(3) = CByte((address And &H0000ff00) >> 8) + mBuff(4) = CByte(address And &H000000ff) + + mBuff(5) = CByte((size And &Hff00) >> 8) + mBuff(6) = CByte(size And &Hff) + + WriteReport() + + If (Not mReadDone.WaitOne(1000, False)) Then + Throw New WiimoteException("Error reading data from Wiimote...is it connected?") + End If + + Return mReadBuff + End Function + + ''' + ''' Write a single byte to the Wiimote + ''' + ''' Address to write + ''' Byte to write + Public Sub WriteData(ByVal address As Integer, ByVal data As Byte) + WriteData(address, 1, New Byte() { data }) + End Sub + + ''' + ''' Write a byte array to a specified address + ''' + ''' Address to write + ''' Length of buffer + ''' Data buffer + + Public Sub WriteData(ByVal address As Integer, ByVal size As Byte, ByVal buff() As Byte) + ClearReport() + + mBuff(0) = CByte(OutputReport.WriteMemory) + mBuff(1) = CByte(((address And &Hff000000L) >> 24) Or GetRumbleBit()) + mBuff(2) = CByte((address And &H00ff0000) >> 16) + mBuff(3) = CByte((address And &H0000ff00) >> 8) + mBuff(4) = CByte(address And &H000000ff) + mBuff(5) = size + Array.Copy(buff, 0, mBuff, 6, size) + + WriteReport() + End Sub + + ''' + ''' Current Wiimote state + ''' + Public ReadOnly Property WiimoteState() As WiimoteState + Get + Return mWiimoteState + End Get + End Property + + ''' + ''' Unique identifier for this Wiimote (not persisted across application instances) + ''' + Public ReadOnly Property ID() As Guid + Get + Return mID + End Get + End Property + + ''' + ''' HID device path for this Wiimote (valid until Wiimote is disconnected) + ''' + Public ReadOnly Property HIDDevicePath() As String + Get + Return mDevicePath + End Get + End Property + + #Region "IDisposable Members" + + ''' + ''' Dispose Wiimote + ''' + Public Sub Dispose() Implements IDisposable.Dispose + Dispose(True) + GC.SuppressFinalize(Me) + End Sub + + ''' + ''' Dispose wiimote + ''' + ''' Disposing? + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + ' close up our handles + If disposing Then + Disconnect() + End If + End Sub + #End Region + End Class + + ''' + ''' Thrown when no Wiimotes are found in the HID device list + ''' + _ + Public Class WiimoteNotFoundException + Inherits ApplicationException + ''' + ''' Default constructor + ''' + Public Sub New() + End Sub + + ''' + ''' Constructor + ''' + ''' Error message + Public Sub New(ByVal message As String) + MyBase.New(message) + End Sub + + ''' + ''' Constructor + ''' + ''' Error message + ''' Inner exception + Public Sub New(ByVal message As String, ByVal innerException As Exception) + MyBase.New(message, innerException) + End Sub + + ''' + ''' Constructor + ''' + ''' Serialization info + ''' Streaming context + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New(info, context) + End Sub + End Class + + ''' + ''' Represents errors that occur during the execution of the Wiimote library + ''' + _ + Public Class WiimoteException + Inherits ApplicationException + ''' + ''' Default constructor + ''' + Public Sub New() + End Sub + + ''' + ''' Constructor + ''' + ''' Error message + Public Sub New(ByVal message As String) + MyBase.New(message) + End Sub + + ''' + ''' Constructor + ''' + ''' Error message + ''' Inner exception + Public Sub New(ByVal message As String, ByVal innerException As Exception) + MyBase.New(message, innerException) + End Sub + + ''' + ''' Constructor + ''' + ''' Serialization info + ''' Streaming context + Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext) + MyBase.New(info, context) + End Sub + End Class +End Namespace \ No newline at end of file diff --git a/WiimoteVB/WiimoteLib/WiimoteCollection.vb b/WiimoteVB/WiimoteLib/WiimoteCollection.vb new file mode 100644 index 0000000..280785a --- /dev/null +++ b/WiimoteVB/WiimoteLib/WiimoteCollection.vb @@ -0,0 +1,32 @@ +'//////////////////////////////////////////////////////////////////////////////// +' WiimoteCollection.cs +' Managed Wiimote Library +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System.Collections.ObjectModel + +Namespace WiimoteLib + ''' + ''' Used to manage multiple Wiimotes + ''' + Public Class WiimoteCollection + Inherits Collection(Of Wiimote) + ''' + ''' Finds all Wiimotes connected to the system and adds them to the collection + ''' + Public Sub FindAllWiimotes() + Wiimote.FindWiimote(AddressOf WiimoteFound) + End Sub + + Private Function WiimoteFound(ByVal devicePath As String) As Boolean + Me.Add(New Wiimote(devicePath)) + Return True + End Function + End Class +End Namespace diff --git a/WiimoteVB/WiimoteLib/WiimoteLib.vbproj b/WiimoteVB/WiimoteLib/WiimoteLib.vbproj new file mode 100644 index 0000000..8e08094 --- /dev/null +++ b/WiimoteVB/WiimoteLib/WiimoteLib.vbproj @@ -0,0 +1,164 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {37A555DF-7012-4B99-8A47-1C922A361E52} + Library + + WiimoteLib + false + + + + + 2.0 + + + + + true + full + false + bin\Debug\ + true + true + prompt + bin\Debug\WiimoteLib.XML + + + pdbonly + true + bin\Release\ + false + true + prompt + + + + + true + bin\x86\Debug\ + true + true + full + x86 + true + GlobalSuppressions.vb + prompt + + + bin\x86\Release\ + false + true + true + pdbonly + x86 + true + GlobalSuppressions.vb + prompt + + + true + bin\MSRS Debug\ + true + true + full + AnyCPU + true + GlobalSuppressions.vb + prompt + + + true + bin\x86\MSRS Debug\ + true + true + full + x86 + true + GlobalSuppressions.vb + prompt + + + true + bin\Debug MSRS\ + true + true + MSRS=True + full + AnyCPU + true + GlobalSuppressions.vb + prompt + + + true + bin\x86\Debug MSRS\ + true + true + full + x86 + true + GlobalSuppressions.vb + prompt + + + bin\Release MSRS\ + false + true + true + pdbonly + AnyCPU + true + GlobalSuppressions.vb + prompt + + + bin\x86\Release MSRS\ + false + true + true + pdbonly + x86 + true + GlobalSuppressions.vb + prompt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/MainForm.Designer.vb b/WiimoteVB/WiimoteTest/MainForm.Designer.vb new file mode 100644 index 0000000..32c0f32 --- /dev/null +++ b/WiimoteVB/WiimoteTest/MainForm.Designer.vb @@ -0,0 +1,601 @@ +Imports Microsoft.VisualBasic +Imports System +Namespace WiimoteTest + Partial Public Class MainForm + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (components IsNot Nothing) Then + components.Dispose() + End If + MyBase.Dispose(disposing) + End Sub + + #Region "Windows Form Designer generated code" + + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.clbButtons = New System.Windows.Forms.CheckedListBox() + Me.lblAccel = New System.Windows.Forms.Label() + Me.chkLED4 = New System.Windows.Forms.CheckBox() + Me.chkLED3 = New System.Windows.Forms.CheckBox() + Me.chkLED2 = New System.Windows.Forms.CheckBox() + Me.chkLED1 = New System.Windows.Forms.CheckBox() + Me.chkRumble = New System.Windows.Forms.CheckBox() + Me.pbBattery = New System.Windows.Forms.ProgressBar() + Me.lblIR1 = New System.Windows.Forms.Label() + Me.lblIR2 = New System.Windows.Forms.Label() + Me.chkFound1 = New System.Windows.Forms.CheckBox() + Me.chkFound2 = New System.Windows.Forms.CheckBox() + Me.lblBattery = New System.Windows.Forms.Label() + Me.pbIR = New System.Windows.Forms.PictureBox() + Me.chkExtension = New System.Windows.Forms.CheckBox() + Me.lblChuk = New System.Windows.Forms.Label() + Me.lblChukJoy = New System.Windows.Forms.Label() + Me.groupBox1 = New System.Windows.Forms.GroupBox() + Me.groupBox2 = New System.Windows.Forms.GroupBox() + Me.groupBox3 = New System.Windows.Forms.GroupBox() + Me.groupBox4 = New System.Windows.Forms.GroupBox() + Me.groupBox5 = New System.Windows.Forms.GroupBox() + Me.lblIR3Raw = New System.Windows.Forms.Label() + Me.lblIR1Raw = New System.Windows.Forms.Label() + Me.lblIR4Raw = New System.Windows.Forms.Label() + Me.lblIR2Raw = New System.Windows.Forms.Label() + Me.lblIR3 = New System.Windows.Forms.Label() + Me.lblIR4 = New System.Windows.Forms.Label() + Me.chkFound3 = New System.Windows.Forms.CheckBox() + Me.chkFound4 = New System.Windows.Forms.CheckBox() + Me.clbCCButtons = New System.Windows.Forms.CheckedListBox() + Me.groupBox6 = New System.Windows.Forms.GroupBox() + Me.lblTriggerR = New System.Windows.Forms.Label() + Me.lblTriggerL = New System.Windows.Forms.Label() + Me.lblCCJoy2 = New System.Windows.Forms.Label() + Me.lblCCJoy1 = New System.Windows.Forms.Label() + Me.groupBox7 = New System.Windows.Forms.GroupBox() + Me.lblGuitarWhammy = New System.Windows.Forms.Label() + Me.lblGuitarJoy = New System.Windows.Forms.Label() + Me.clbGuitarButtons = New System.Windows.Forms.CheckedListBox() + Me.groupBox8 = New System.Windows.Forms.GroupBox() + Me.chkC = New System.Windows.Forms.CheckBox() + Me.chkZ = New System.Windows.Forms.CheckBox() + CType(Me.pbIR, System.ComponentModel.ISupportInitialize).BeginInit() + Me.groupBox1.SuspendLayout() + Me.groupBox2.SuspendLayout() + Me.groupBox3.SuspendLayout() + Me.groupBox4.SuspendLayout() + Me.groupBox5.SuspendLayout() + Me.groupBox6.SuspendLayout() + Me.groupBox7.SuspendLayout() + Me.groupBox8.SuspendLayout() + Me.SuspendLayout() + ' + ' clbButtons + ' + Me.clbButtons.FormattingEnabled = True + Me.clbButtons.Items.AddRange(New Object() { "A", "B", "-", "Home", "+", "1", "2", "Up", "Down", "Left", "Right"}) + Me.clbButtons.Location = New System.Drawing.Point(8, 16) + Me.clbButtons.Name = "clbButtons" + Me.clbButtons.Size = New System.Drawing.Size(56, 184) + Me.clbButtons.TabIndex = 1 + ' + ' lblAccel + ' + Me.lblAccel.Location = New System.Drawing.Point(8, 20) + Me.lblAccel.Name = "lblAccel" + Me.lblAccel.Size = New System.Drawing.Size(88, 48) + Me.lblAccel.TabIndex = 2 + Me.lblAccel.Text = "Accel Values" + ' + ' chkLED4 + ' + Me.chkLED4.AutoSize = True + Me.chkLED4.Location = New System.Drawing.Point(8, 76) + Me.chkLED4.Name = "chkLED4" + Me.chkLED4.Size = New System.Drawing.Size(53, 17) + Me.chkLED4.TabIndex = 3 + Me.chkLED4.Text = "LED4" + Me.chkLED4.UseVisualStyleBackColor = True +' Me.chkLED4.CheckedChanged += New System.EventHandler(Me.chkLED1_CheckedChanged); + ' + ' chkLED3 + ' + Me.chkLED3.AutoSize = True + Me.chkLED3.Location = New System.Drawing.Point(8, 56) + Me.chkLED3.Name = "chkLED3" + Me.chkLED3.Size = New System.Drawing.Size(53, 17) + Me.chkLED3.TabIndex = 3 + Me.chkLED3.Text = "LED3" + Me.chkLED3.UseVisualStyleBackColor = True +' Me.chkLED3.CheckedChanged += New System.EventHandler(Me.chkLED1_CheckedChanged); + ' + ' chkLED2 + ' + Me.chkLED2.AutoSize = True + Me.chkLED2.Location = New System.Drawing.Point(8, 36) + Me.chkLED2.Name = "chkLED2" + Me.chkLED2.Size = New System.Drawing.Size(53, 17) + Me.chkLED2.TabIndex = 3 + Me.chkLED2.Text = "LED2" + Me.chkLED2.UseVisualStyleBackColor = True +' Me.chkLED2.CheckedChanged += New System.EventHandler(Me.chkLED1_CheckedChanged); + ' + ' chkLED1 + ' + Me.chkLED1.AutoSize = True + Me.chkLED1.Location = New System.Drawing.Point(8, 16) + Me.chkLED1.Name = "chkLED1" + Me.chkLED1.Size = New System.Drawing.Size(53, 17) + Me.chkLED1.TabIndex = 3 + Me.chkLED1.Text = "LED1" + Me.chkLED1.UseVisualStyleBackColor = True +' Me.chkLED1.CheckedChanged += New System.EventHandler(Me.chkLED1_CheckedChanged); + ' + ' chkRumble + ' + Me.chkRumble.AutoSize = True + Me.chkRumble.Location = New System.Drawing.Point(8, 96) + Me.chkRumble.Name = "chkRumble" + Me.chkRumble.Size = New System.Drawing.Size(62, 17) + Me.chkRumble.TabIndex = 4 + Me.chkRumble.Text = "Rumble" + Me.chkRumble.UseVisualStyleBackColor = True +' Me.chkRumble.CheckedChanged += New System.EventHandler(Me.chkRumble_CheckedChanged); + ' + ' pbBattery + ' + Me.pbBattery.Location = New System.Drawing.Point(8, 20) + Me.pbBattery.Maximum = 200 + Me.pbBattery.Name = "pbBattery" + Me.pbBattery.Size = New System.Drawing.Size(100, 23) + Me.pbBattery.Step = 1 + Me.pbBattery.TabIndex = 6 + ' + ' lblIR1 + ' + Me.lblIR1.AutoSize = True + Me.lblIR1.Location = New System.Drawing.Point(8, 16) + Me.lblIR1.Name = "lblIR1" + Me.lblIR1.Size = New System.Drawing.Size(24, 13) + Me.lblIR1.TabIndex = 7 + Me.lblIR1.Text = "IR1" + ' + ' lblIR2 + ' + Me.lblIR2.AutoSize = True + Me.lblIR2.Location = New System.Drawing.Point(8, 32) + Me.lblIR2.Name = "lblIR2" + Me.lblIR2.Size = New System.Drawing.Size(24, 13) + Me.lblIR2.TabIndex = 7 + Me.lblIR2.Text = "IR2" + ' + ' chkFound1 + ' + Me.chkFound1.AutoSize = True + Me.chkFound1.Location = New System.Drawing.Point(8, 148) + Me.chkFound1.Name = "chkFound1" + Me.chkFound1.Size = New System.Drawing.Size(46, 17) + Me.chkFound1.TabIndex = 8 + Me.chkFound1.Text = "IR 1" + Me.chkFound1.UseVisualStyleBackColor = True + ' + ' chkFound2 + ' + Me.chkFound2.AutoSize = True + Me.chkFound2.Location = New System.Drawing.Point(8, 164) + Me.chkFound2.Name = "chkFound2" + Me.chkFound2.Size = New System.Drawing.Size(46, 17) + Me.chkFound2.TabIndex = 8 + Me.chkFound2.Text = "IR 2" + Me.chkFound2.UseVisualStyleBackColor = True + ' + ' lblBattery + ' + Me.lblBattery.AutoSize = True + Me.lblBattery.Location = New System.Drawing.Point(112, 24) + Me.lblBattery.Name = "lblBattery" + Me.lblBattery.Size = New System.Drawing.Size(35, 13) + Me.lblBattery.TabIndex = 9 + Me.lblBattery.Text = "label1" + ' + ' pbIR + ' + Me.pbIR.Location = New System.Drawing.Point(8, 252) + Me.pbIR.Name = "pbIR" + Me.pbIR.Size = New System.Drawing.Size(256, 192) + Me.pbIR.TabIndex = 10 + Me.pbIR.TabStop = False + ' + ' chkExtension + ' + Me.chkExtension.AutoSize = True + Me.chkExtension.Location = New System.Drawing.Point(8, 228) + Me.chkExtension.Name = "chkExtension" + Me.chkExtension.Size = New System.Drawing.Size(52, 17) + Me.chkExtension.TabIndex = 12 + Me.chkExtension.Text = "None" + Me.chkExtension.UseVisualStyleBackColor = True + ' + ' lblChuk + ' + Me.lblChuk.Location = New System.Drawing.Point(8, 20) + Me.lblChuk.Name = "lblChuk" + Me.lblChuk.Size = New System.Drawing.Size(92, 40) + Me.lblChuk.TabIndex = 13 + Me.lblChuk.Text = "Accel Values" + ' + ' lblChukJoy + ' + Me.lblChukJoy.Location = New System.Drawing.Point(8, 64) + Me.lblChukJoy.Name = "lblChukJoy" + Me.lblChukJoy.Size = New System.Drawing.Size(92, 28) + Me.lblChukJoy.TabIndex = 16 + Me.lblChukJoy.Text = "Joystick Values" + ' + ' groupBox1 + ' + Me.groupBox1.Controls.Add(Me.lblAccel) + Me.groupBox1.Location = New System.Drawing.Point(80, 4) + Me.groupBox1.Name = "groupBox1" + Me.groupBox1.Size = New System.Drawing.Size(104, 72) + Me.groupBox1.TabIndex = 18 + Me.groupBox1.TabStop = False + Me.groupBox1.Text = "Wiimote Accel" + ' + ' groupBox2 + ' + Me.groupBox2.Controls.Add(Me.chkZ) + Me.groupBox2.Controls.Add(Me.chkC) + Me.groupBox2.Controls.Add(Me.lblChuk) + Me.groupBox2.Controls.Add(Me.lblChukJoy) + Me.groupBox2.Location = New System.Drawing.Point(80, 80) + Me.groupBox2.Name = "groupBox2" + Me.groupBox2.Size = New System.Drawing.Size(104, 136) + Me.groupBox2.TabIndex = 19 + Me.groupBox2.TabStop = False + Me.groupBox2.Text = "Nunchuk" + ' + ' groupBox3 + ' + Me.groupBox3.Controls.Add(Me.chkLED2) + Me.groupBox3.Controls.Add(Me.chkLED4) + Me.groupBox3.Controls.Add(Me.chkLED3) + Me.groupBox3.Controls.Add(Me.chkLED1) + Me.groupBox3.Controls.Add(Me.chkRumble) + Me.groupBox3.Location = New System.Drawing.Point(268, 252) + Me.groupBox3.Name = "groupBox3" + Me.groupBox3.Size = New System.Drawing.Size(72, 120) + Me.groupBox3.TabIndex = 20 + Me.groupBox3.TabStop = False + Me.groupBox3.Text = "Outputs" + ' + ' groupBox4 + ' + Me.groupBox4.Controls.Add(Me.pbBattery) + Me.groupBox4.Controls.Add(Me.lblBattery) + Me.groupBox4.Location = New System.Drawing.Point(188, 192) + Me.groupBox4.Name = "groupBox4" + Me.groupBox4.Size = New System.Drawing.Size(156, 52) + Me.groupBox4.TabIndex = 21 + Me.groupBox4.TabStop = False + Me.groupBox4.Text = "Battery" + ' + ' groupBox5 + ' + Me.groupBox5.Controls.Add(Me.lblIR3Raw) + Me.groupBox5.Controls.Add(Me.lblIR1Raw) + Me.groupBox5.Controls.Add(Me.lblIR4Raw) + Me.groupBox5.Controls.Add(Me.lblIR2Raw) + Me.groupBox5.Controls.Add(Me.lblIR3) + Me.groupBox5.Controls.Add(Me.lblIR1) + Me.groupBox5.Controls.Add(Me.lblIR4) + Me.groupBox5.Controls.Add(Me.lblIR2) + Me.groupBox5.Controls.Add(Me.chkFound3) + Me.groupBox5.Controls.Add(Me.chkFound4) + Me.groupBox5.Controls.Add(Me.chkFound1) + Me.groupBox5.Controls.Add(Me.chkFound2) + Me.groupBox5.Location = New System.Drawing.Point(188, 4) + Me.groupBox5.Name = "groupBox5" + Me.groupBox5.Size = New System.Drawing.Size(156, 188) + Me.groupBox5.TabIndex = 22 + Me.groupBox5.TabStop = False + Me.groupBox5.Text = "IR" + ' + ' lblIR3Raw + ' + Me.lblIR3Raw.AutoSize = True + Me.lblIR3Raw.Location = New System.Drawing.Point(8, 112) + Me.lblIR3Raw.Name = "lblIR3Raw" + Me.lblIR3Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR3Raw.TabIndex = 10 + Me.lblIR3Raw.Text = "IR3Raw" + ' + ' lblIR1Raw + ' + Me.lblIR1Raw.AutoSize = True + Me.lblIR1Raw.Location = New System.Drawing.Point(8, 80) + Me.lblIR1Raw.Name = "lblIR1Raw" + Me.lblIR1Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR1Raw.TabIndex = 10 + Me.lblIR1Raw.Text = "IR1Raw" + ' + ' lblIR4Raw + ' + Me.lblIR4Raw.AutoSize = True + Me.lblIR4Raw.Location = New System.Drawing.Point(8, 128) + Me.lblIR4Raw.Name = "lblIR4Raw" + Me.lblIR4Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR4Raw.TabIndex = 9 + Me.lblIR4Raw.Text = "IR4Raw" + ' + ' lblIR2Raw + ' + Me.lblIR2Raw.AutoSize = True + Me.lblIR2Raw.Location = New System.Drawing.Point(8, 96) + Me.lblIR2Raw.Name = "lblIR2Raw" + Me.lblIR2Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR2Raw.TabIndex = 9 + Me.lblIR2Raw.Text = "IR2Raw" + ' + ' lblIR3 + ' + Me.lblIR3.AutoSize = True + Me.lblIR3.Location = New System.Drawing.Point(8, 48) + Me.lblIR3.Name = "lblIR3" + Me.lblIR3.Size = New System.Drawing.Size(24, 13) + Me.lblIR3.TabIndex = 7 + Me.lblIR3.Text = "IR3" + ' + ' lblIR4 + ' + Me.lblIR4.AutoSize = True + Me.lblIR4.Location = New System.Drawing.Point(8, 64) + Me.lblIR4.Name = "lblIR4" + Me.lblIR4.Size = New System.Drawing.Size(24, 13) + Me.lblIR4.TabIndex = 7 + Me.lblIR4.Text = "IR4" + ' + ' chkFound3 + ' + Me.chkFound3.AutoSize = True + Me.chkFound3.Location = New System.Drawing.Point(60, 148) + Me.chkFound3.Name = "chkFound3" + Me.chkFound3.Size = New System.Drawing.Size(46, 17) + Me.chkFound3.TabIndex = 8 + Me.chkFound3.Text = "IR 3" + Me.chkFound3.UseVisualStyleBackColor = True + ' + ' chkFound4 + ' + Me.chkFound4.AutoSize = True + Me.chkFound4.Location = New System.Drawing.Point(60, 164) + Me.chkFound4.Name = "chkFound4" + Me.chkFound4.Size = New System.Drawing.Size(46, 17) + Me.chkFound4.TabIndex = 8 + Me.chkFound4.Text = "IR 4" + Me.chkFound4.UseVisualStyleBackColor = True + ' + ' clbCCButtons + ' + Me.clbCCButtons.FormattingEnabled = True + Me.clbCCButtons.Items.AddRange(New Object() { "A", "B", "X", "Y", "-", "Home", "+", "Up", "Down", "Left", "Right", "ZL", "ZR", "LTrigger", "RTrigger"}) + Me.clbCCButtons.Location = New System.Drawing.Point(4, 16) + Me.clbCCButtons.Name = "clbCCButtons" + Me.clbCCButtons.Size = New System.Drawing.Size(68, 244) + Me.clbCCButtons.TabIndex = 23 + ' + ' groupBox6 + ' + Me.groupBox6.Controls.Add(Me.lblTriggerR) + Me.groupBox6.Controls.Add(Me.lblTriggerL) + Me.groupBox6.Controls.Add(Me.lblCCJoy2) + Me.groupBox6.Controls.Add(Me.lblCCJoy1) + Me.groupBox6.Controls.Add(Me.clbCCButtons) + Me.groupBox6.Location = New System.Drawing.Point(348, 168) + Me.groupBox6.Name = "groupBox6" + Me.groupBox6.Size = New System.Drawing.Size(188, 268) + Me.groupBox6.TabIndex = 24 + Me.groupBox6.TabStop = False + Me.groupBox6.Text = "Classic Controller" + ' + ' lblTriggerR + ' + Me.lblTriggerR.AutoSize = True + Me.lblTriggerR.Location = New System.Drawing.Point(76, 104) + Me.lblTriggerR.Name = "lblTriggerR" + Me.lblTriggerR.Size = New System.Drawing.Size(51, 13) + Me.lblTriggerR.TabIndex = 25 + Me.lblTriggerR.Text = "Trigger R" + ' + ' lblTriggerL + ' + Me.lblTriggerL.AutoSize = True + Me.lblTriggerL.Location = New System.Drawing.Point(76, 88) + Me.lblTriggerL.Name = "lblTriggerL" + Me.lblTriggerL.Size = New System.Drawing.Size(49, 13) + Me.lblTriggerL.TabIndex = 24 + Me.lblTriggerL.Text = "Trigger L" + ' + ' lblCCJoy2 + ' + Me.lblCCJoy2.Location = New System.Drawing.Point(76, 52) + Me.lblCCJoy2.Name = "lblCCJoy2" + Me.lblCCJoy2.Size = New System.Drawing.Size(92, 32) + Me.lblCCJoy2.TabIndex = 24 + Me.lblCCJoy2.Text = "Right Joystick" + ' + ' lblCCJoy1 + ' + Me.lblCCJoy1.Location = New System.Drawing.Point(76, 16) + Me.lblCCJoy1.Name = "lblCCJoy1" + Me.lblCCJoy1.Size = New System.Drawing.Size(92, 32) + Me.lblCCJoy1.TabIndex = 24 + Me.lblCCJoy1.Text = "Left Joystick" + ' + ' groupBox7 + ' + Me.groupBox7.Controls.Add(Me.lblGuitarWhammy) + Me.groupBox7.Controls.Add(Me.lblGuitarJoy) + Me.groupBox7.Controls.Add(Me.clbGuitarButtons) + Me.groupBox7.Location = New System.Drawing.Point(348, 4) + Me.groupBox7.Name = "groupBox7" + Me.groupBox7.Size = New System.Drawing.Size(188, 160) + Me.groupBox7.TabIndex = 26 + Me.groupBox7.TabStop = False + Me.groupBox7.Text = "Guitar" + ' + ' lblGuitarWhammy + ' + Me.lblGuitarWhammy.AutoSize = True + Me.lblGuitarWhammy.Location = New System.Drawing.Point(92, 52) + Me.lblGuitarWhammy.Name = "lblGuitarWhammy" + Me.lblGuitarWhammy.Size = New System.Drawing.Size(51, 13) + Me.lblGuitarWhammy.TabIndex = 24 + Me.lblGuitarWhammy.Text = "Whammy" + ' + ' lblGuitarJoy + ' + Me.lblGuitarJoy.Location = New System.Drawing.Point(92, 16) + Me.lblGuitarJoy.Name = "lblGuitarJoy" + Me.lblGuitarJoy.Size = New System.Drawing.Size(92, 32) + Me.lblGuitarJoy.TabIndex = 24 + Me.lblGuitarJoy.Text = "Joystick Values" + ' + ' clbGuitarButtons + ' + Me.clbGuitarButtons.FormattingEnabled = True + Me.clbGuitarButtons.Items.AddRange(New Object() { "Green", "Red", "Yellow", "Blue", "Orange", "-", "+", "StrumUp", "StrumDown"}) + Me.clbGuitarButtons.Location = New System.Drawing.Point(4, 16) + Me.clbGuitarButtons.Name = "clbGuitarButtons" + Me.clbGuitarButtons.Size = New System.Drawing.Size(80, 139) + Me.clbGuitarButtons.TabIndex = 23 + ' + ' groupBox8 + ' + Me.groupBox8.Controls.Add(Me.clbButtons) + Me.groupBox8.Location = New System.Drawing.Point(4, 4) + Me.groupBox8.Name = "groupBox8" + Me.groupBox8.Size = New System.Drawing.Size(72, 220) + Me.groupBox8.TabIndex = 27 + Me.groupBox8.TabStop = False + Me.groupBox8.Text = "Wiimote" + ' + ' chkC + ' + Me.chkC.AutoSize = True + Me.chkC.Location = New System.Drawing.Point(8, 92) + Me.chkC.Name = "chkC" + Me.chkC.Size = New System.Drawing.Size(33, 17) + Me.chkC.TabIndex = 17 + Me.chkC.Text = "C" + Me.chkC.UseVisualStyleBackColor = True + ' + ' chkZ + ' + Me.chkZ.AutoSize = True + Me.chkZ.Location = New System.Drawing.Point(8, 112) + Me.chkZ.Name = "chkZ" + Me.chkZ.Size = New System.Drawing.Size(33, 17) + Me.chkZ.TabIndex = 17 + Me.chkZ.Text = "Z" + Me.chkZ.UseVisualStyleBackColor = True + ' + ' MainForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(541, 453) + Me.Controls.Add(Me.groupBox8) + Me.Controls.Add(Me.groupBox7) + Me.Controls.Add(Me.groupBox6) + Me.Controls.Add(Me.pbIR) + Me.Controls.Add(Me.groupBox5) + Me.Controls.Add(Me.groupBox4) + Me.Controls.Add(Me.groupBox3) + Me.Controls.Add(Me.groupBox1) + Me.Controls.Add(Me.chkExtension) + Me.Controls.Add(Me.groupBox2) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.MaximizeBox = False + Me.Name = "MainForm" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Wiimote Tester" +' Me.Load += New System.EventHandler(Me.Form1_Load); +' Me.FormClosing += New System.Windows.Forms.FormClosingEventHandler(Me.Form1_FormClosing); + CType(Me.pbIR, System.ComponentModel.ISupportInitialize).EndInit() + Me.groupBox1.ResumeLayout(False) + Me.groupBox2.ResumeLayout(False) + Me.groupBox2.PerformLayout() + Me.groupBox3.ResumeLayout(False) + Me.groupBox3.PerformLayout() + Me.groupBox4.ResumeLayout(False) + Me.groupBox4.PerformLayout() + Me.groupBox5.ResumeLayout(False) + Me.groupBox5.PerformLayout() + Me.groupBox6.ResumeLayout(False) + Me.groupBox6.PerformLayout() + Me.groupBox7.ResumeLayout(False) + Me.groupBox7.PerformLayout() + Me.groupBox8.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + #End Region + + Private clbButtons As System.Windows.Forms.CheckedListBox + Private lblAccel As System.Windows.Forms.Label + Private WithEvents chkLED4 As System.Windows.Forms.CheckBox + Private WithEvents chkLED3 As System.Windows.Forms.CheckBox + Private WithEvents chkLED2 As System.Windows.Forms.CheckBox + Private WithEvents chkLED1 As System.Windows.Forms.CheckBox + Private WithEvents chkRumble As System.Windows.Forms.CheckBox + Private pbBattery As System.Windows.Forms.ProgressBar + Private lblIR1 As System.Windows.Forms.Label + Private lblIR2 As System.Windows.Forms.Label + Private chkFound1 As System.Windows.Forms.CheckBox + Private chkFound2 As System.Windows.Forms.CheckBox + Private lblBattery As System.Windows.Forms.Label + Private pbIR As System.Windows.Forms.PictureBox + Private chkExtension As System.Windows.Forms.CheckBox + Private lblChuk As System.Windows.Forms.Label + Private lblChukJoy As System.Windows.Forms.Label + Private groupBox1 As System.Windows.Forms.GroupBox + Private groupBox2 As System.Windows.Forms.GroupBox + Private groupBox3 As System.Windows.Forms.GroupBox + Private groupBox4 As System.Windows.Forms.GroupBox + Private groupBox5 As System.Windows.Forms.GroupBox + Private clbCCButtons As System.Windows.Forms.CheckedListBox + Private groupBox6 As System.Windows.Forms.GroupBox + Private lblCCJoy2 As System.Windows.Forms.Label + Private lblCCJoy1 As System.Windows.Forms.Label + Private lblTriggerR As System.Windows.Forms.Label + Private lblTriggerL As System.Windows.Forms.Label + Private lblIR1Raw As System.Windows.Forms.Label + Private lblIR2Raw As System.Windows.Forms.Label + Private chkFound3 As System.Windows.Forms.CheckBox + Private chkFound4 As System.Windows.Forms.CheckBox + Private lblIR3Raw As System.Windows.Forms.Label + Private lblIR4Raw As System.Windows.Forms.Label + Private lblIR3 As System.Windows.Forms.Label + Private lblIR4 As System.Windows.Forms.Label + Private groupBox7 As System.Windows.Forms.GroupBox + Private lblGuitarWhammy As System.Windows.Forms.Label + Private lblGuitarJoy As System.Windows.Forms.Label + Private clbGuitarButtons As System.Windows.Forms.CheckedListBox + Private groupBox8 As System.Windows.Forms.GroupBox + Private chkZ As System.Windows.Forms.CheckBox + Private chkC As System.Windows.Forms.CheckBox + End Class +End Namespace + diff --git a/WiimoteVB/WiimoteTest/MainForm.resx b/WiimoteVB/WiimoteTest/MainForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteVB/WiimoteTest/MainForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/MainForm.vb b/WiimoteVB/WiimoteTest/MainForm.vb new file mode 100644 index 0000000..41110dc --- /dev/null +++ b/WiimoteVB/WiimoteTest/MainForm.vb @@ -0,0 +1,180 @@ +'//////////////////////////////////////////////////////////////////////////////// +' Form1.cs +' Managed Wiimote Library Tester +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System +Imports System.Drawing +Imports System.Drawing.Imaging +Imports System.IO +Imports System.Windows.Forms +Imports WiimoteLib + +Namespace WiimoteTest + Partial Public Class MainForm + Inherits Form + Private Delegate Sub UpdateWiimoteStateDelegate(ByVal args As WiimoteChangedEventArgs) + Private Delegate Sub UpdateExtensionChangedDelegate(ByVal args As WiimoteExtensionChangedEventArgs) + + Private wm As New Wiimote() + Private b As New Bitmap(256, 192, PixelFormat.Format24bppRgb) + Private g As Graphics + + Public Sub New() + InitializeComponent() + End Sub + + Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load + AddHandler wm.WiimoteChanged, AddressOf wm_WiimoteChanged + AddHandler wm.WiimoteExtensionChanged, AddressOf wm_WiimoteExtensionChanged + + g = Graphics.FromImage(b) + wm.Connect() + wm.SetReportType(InputReport.IRAccel, True) + wm.SetLEDs(False, True, True, False) + End Sub + + Private Sub UpdateExtensionChanged(ByVal args As WiimoteExtensionChangedEventArgs) + chkExtension.Text = args.ExtensionType.ToString() + chkExtension.Checked = args.Inserted + + If args.Inserted Then + wm.SetReportType(InputReport.IRExtensionAccel, True) + Else + wm.SetReportType(InputReport.IRAccel, True) + End If + End Sub + + Private Sub UpdateWiimoteState(ByVal args As WiimoteChangedEventArgs) + Dim ws As WiimoteState = args.WiimoteState + + clbButtons.SetItemChecked(0, ws.ButtonState.A) + clbButtons.SetItemChecked(1, ws.ButtonState.B) + clbButtons.SetItemChecked(2, ws.ButtonState.Minus) + clbButtons.SetItemChecked(3, ws.ButtonState.Home) + clbButtons.SetItemChecked(4, ws.ButtonState.Plus) + clbButtons.SetItemChecked(5, ws.ButtonState.One) + clbButtons.SetItemChecked(6, ws.ButtonState.Two) + clbButtons.SetItemChecked(7, ws.ButtonState.Up) + clbButtons.SetItemChecked(8, ws.ButtonState.Down) + clbButtons.SetItemChecked(9, ws.ButtonState.Left) + clbButtons.SetItemChecked(10, ws.ButtonState.Right) + + lblAccel.Text = ws.AccelState.Values.ToString() + + Select Case ws.ExtensionType + Case ExtensionType.Nunchuk + lblChuk.Text = ws.NunchukState.AccelState.Values.ToString() + lblChukJoy.Text = ws.NunchukState.Joystick.ToString() + chkC.Checked = ws.NunchukState.C + chkZ.Checked = ws.NunchukState.Z + + Case ExtensionType.ClassicController + clbCCButtons.SetItemChecked(0, ws.ClassicControllerState.ButtonState.A) + clbCCButtons.SetItemChecked(1, ws.ClassicControllerState.ButtonState.B) + clbCCButtons.SetItemChecked(2, ws.ClassicControllerState.ButtonState.X) + clbCCButtons.SetItemChecked(3, ws.ClassicControllerState.ButtonState.Y) + clbCCButtons.SetItemChecked(4, ws.ClassicControllerState.ButtonState.Minus) + clbCCButtons.SetItemChecked(5, ws.ClassicControllerState.ButtonState.Home) + clbCCButtons.SetItemChecked(6, ws.ClassicControllerState.ButtonState.Plus) + clbCCButtons.SetItemChecked(7, ws.ClassicControllerState.ButtonState.Up) + clbCCButtons.SetItemChecked(8, ws.ClassicControllerState.ButtonState.Down) + clbCCButtons.SetItemChecked(9, ws.ClassicControllerState.ButtonState.Left) + clbCCButtons.SetItemChecked(10, ws.ClassicControllerState.ButtonState.Right) + clbCCButtons.SetItemChecked(11, ws.ClassicControllerState.ButtonState.ZL) + clbCCButtons.SetItemChecked(12, ws.ClassicControllerState.ButtonState.ZR) + clbCCButtons.SetItemChecked(13, ws.ClassicControllerState.ButtonState.TriggerL) + clbCCButtons.SetItemChecked(14, ws.ClassicControllerState.ButtonState.TriggerR) + + lblCCJoy1.Text = ws.ClassicControllerState.JoystickL.ToString() + lblCCJoy2.Text = ws.ClassicControllerState.JoystickR.ToString() + + lblTriggerL.Text = ws.ClassicControllerState.TriggerL.ToString() + lblTriggerR.Text = ws.ClassicControllerState.TriggerR.ToString() + + Case ExtensionType.Guitar + clbGuitarButtons.SetItemChecked(0, ws.GuitarState.ButtonState.Green) + clbGuitarButtons.SetItemChecked(1, ws.GuitarState.ButtonState.Red) + clbGuitarButtons.SetItemChecked(2, ws.GuitarState.ButtonState.Yellow) + clbGuitarButtons.SetItemChecked(3, ws.GuitarState.ButtonState.Blue) + clbGuitarButtons.SetItemChecked(4, ws.GuitarState.ButtonState.Orange) + clbGuitarButtons.SetItemChecked(5, ws.GuitarState.ButtonState.Minus) + clbGuitarButtons.SetItemChecked(6, ws.GuitarState.ButtonState.Plus) + clbGuitarButtons.SetItemChecked(7, ws.GuitarState.ButtonState.StrumUp) + clbGuitarButtons.SetItemChecked(8, ws.GuitarState.ButtonState.StrumDown) + + lblGuitarJoy.Text = ws.GuitarState.Joystick.ToString() + lblGuitarWhammy.Text = ws.GuitarState.WhammyBar.ToString() + End Select + + g.Clear(Color.Black) + + If ws.IRState.IRSensors(0).Found Then + lblIR1.Text = ws.IRState.IRSensors(0).Position.ToString() & ", " & ws.IRState.IRSensors(0).Size + lblIR1Raw.Text = ws.IRState.IRSensors(0).RawPosition.ToString() + g.DrawEllipse(New Pen(Color.Red), CInt(Fix(ws.IRState.IRSensors(0).RawPosition.X / 4)), CInt(Fix(ws.IRState.IRSensors(0).RawPosition.Y / 4)), ws.IRState.IRSensors(0).Size+1, ws.IRState.IRSensors(0).Size+1) + End If + If ws.IRState.IRSensors(1).Found Then + lblIR2.Text = ws.IRState.IRSensors(1).Position.ToString() & ", " & ws.IRState.IRSensors(1).Size + lblIR2Raw.Text = ws.IRState.IRSensors(1).RawPosition.ToString() + g.DrawEllipse(New Pen(Color.Blue), CInt(Fix(ws.IRState.IRSensors(1).RawPosition.X / 4)), CInt(Fix(ws.IRState.IRSensors(1).RawPosition.Y / 4)), ws.IRState.IRSensors(1).Size+1, ws.IRState.IRSensors(1).Size+1) + End If + If ws.IRState.IRSensors(2).Found Then + lblIR3.Text = ws.IRState.IRSensors(2).Position.ToString() & ", " & ws.IRState.IRSensors(2).Size + lblIR3Raw.Text = ws.IRState.IRSensors(2).RawPosition.ToString() + g.DrawEllipse(New Pen(Color.Yellow), CInt(Fix(ws.IRState.IRSensors(2).RawPosition.X / 4)), CInt(Fix(ws.IRState.IRSensors(2).RawPosition.Y / 4)), ws.IRState.IRSensors(2).Size+1, ws.IRState.IRSensors(2).Size+1) + End If + If ws.IRState.IRSensors(3).Found Then + lblIR4.Text = ws.IRState.IRSensors(3).Position.ToString() & ", " & ws.IRState.IRSensors(3).Size + lblIR4Raw.Text = ws.IRState.IRSensors(3).RawPosition.ToString() + g.DrawEllipse(New Pen(Color.Orange), CInt(Fix(ws.IRState.IRSensors(3).RawPosition.X / 4)), CInt(Fix(ws.IRState.IRSensors(3).RawPosition.Y / 4)), ws.IRState.IRSensors(3).Size+1, ws.IRState.IRSensors(3).Size+1) + End If + + If ws.IRState.IRSensors(0).Found AndAlso ws.IRState.IRSensors(1).Found Then + g.DrawEllipse(New Pen(Color.Green), CInt(Fix(ws.IRState.RawMidpoint.X / 4)), CInt(Fix(ws.IRState.RawMidpoint.Y / 4)), 2, 2) + End If + + pbIR.Image = b + + chkFound1.Checked = ws.IRState.IRSensors(0).Found + chkFound2.Checked = ws.IRState.IRSensors(1).Found + chkFound3.Checked = ws.IRState.IRSensors(2).Found + chkFound4.Checked = ws.IRState.IRSensors(3).Found + + If ws.Battery > &Hc8 Then + pbBattery.Value = (&Hc8) + Else + pbBattery.Value = (CInt(Fix(ws.Battery))) + End If + Dim f As Single = (((100.0f * 48.0f * CSng(ws.Battery / 48.0f))) / 192.0f) + lblBattery.Text = f.ToString("F") + End Sub + + Private Sub wm_WiimoteChanged(ByVal sender As Object, ByVal args As WiimoteChangedEventArgs) + BeginInvoke(New UpdateWiimoteStateDelegate(AddressOf UpdateWiimoteState), args) + End Sub + + Private Sub wm_WiimoteExtensionChanged(ByVal sender As Object, ByVal args As WiimoteExtensionChangedEventArgs) + BeginInvoke(New UpdateExtensionChangedDelegate(AddressOf UpdateExtensionChanged), args) + End Sub + + Private Sub chkLED1_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkLED4.CheckedChanged, chkLED3.CheckedChanged, chkLED2.CheckedChanged, chkLED1.CheckedChanged + wm.SetLEDs(chkLED1.Checked, chkLED2.Checked, chkLED3.Checked, chkLED4.Checked) + End Sub + + Private Sub chkRumble_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkRumble.CheckedChanged + wm.SetRumble(chkRumble.Checked) + End Sub + + Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing + wm.Disconnect() + End Sub + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/MultipleWiimoteForm.Designer.vb b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.Designer.vb new file mode 100644 index 0000000..af83a98 --- /dev/null +++ b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.Designer.vb @@ -0,0 +1,61 @@ +Imports Microsoft.VisualBasic +Imports System +Namespace WiimoteTest + Partial Public Class MultipleWiimoteForm + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (components IsNot Nothing) Then + components.Dispose() + End If + MyBase.Dispose(disposing) + End Sub + + #Region "Windows Form Designer generated code" + + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.tabWiimotes = New System.Windows.Forms.TabControl() + Me.SuspendLayout() + ' + ' tabWiimotes + ' + Me.tabWiimotes.Dock = System.Windows.Forms.DockStyle.Fill + Me.tabWiimotes.Location = New System.Drawing.Point(0, 0) + Me.tabWiimotes.Name = "tabWiimotes" + Me.tabWiimotes.SelectedIndex = 0 + Me.tabWiimotes.Size = New System.Drawing.Size(710, 484) + Me.tabWiimotes.TabIndex = 0 + ' + ' MultipleWiimoteForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(710, 484) + Me.Controls.Add(Me.tabWiimotes) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.MaximizeBox = False + Me.Name = "MultipleWiimoteForm" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Multiple Wiimote Tester" +' Me.Load += New System.EventHandler(Me.MultipleWiimoteForm_Load); +' Me.FormClosing += New System.Windows.Forms.FormClosingEventHandler(Me.MultipleWiimoteForm_FormClosing); + Me.ResumeLayout(False) + + End Sub + + #End Region + + Private tabWiimotes As System.Windows.Forms.TabControl + End Class +End Namespace \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/MultipleWiimoteForm.resx b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/MultipleWiimoteForm.vb b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.vb new file mode 100644 index 0000000..c3fe408 --- /dev/null +++ b/WiimoteVB/WiimoteTest/MultipleWiimoteForm.vb @@ -0,0 +1,82 @@ +Imports Microsoft.VisualBasic +Imports System +Imports System.Collections.Generic +Imports System.Windows.Forms +Imports WiimoteLib + +Namespace WiimoteTest + Partial Public Class MultipleWiimoteForm + Inherits Form + ' map a wiimote to a specific state user control dealie + Private mWiimoteMap As Dictionary(Of Guid,WiimoteInfo) = New Dictionary(Of Guid,WiimoteInfo)() + Private mWC As WiimoteCollection + + Public Sub New() + InitializeComponent() + End Sub + + Private Sub MultipleWiimoteForm_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load + ' find all wiimotes connected to the system + mWC = New WiimoteCollection() + Dim index As Integer = 1 + + Try + mWC.FindAllWiimotes() + Catch ex As WiimoteNotFoundException + MessageBox.Show(ex.Message, "Wiimote not found error", MessageBoxButtons.OK, MessageBoxIcon.Error) + Catch ex As WiimoteException + MessageBox.Show(ex.Message, "Wiimote error", MessageBoxButtons.OK, MessageBoxIcon.Error) + Catch ex As Exception + MessageBox.Show(ex.Message, "Unknown error", MessageBoxButtons.OK, MessageBoxIcon.Error) + End Try + + For Each wm As Wiimote In mWC + ' create a new tab + Dim tp As New TabPage("Wiimote " & index) + tabWiimotes.TabPages.Add(tp) + + ' create a new user control + Dim wi As New WiimoteInfo(wm) + tp.Controls.Add(wi) + + ' setup the map from this wiimote's ID to that control + mWiimoteMap(wm.ID) = wi + + ' connect it and set it up as always + AddHandler wm.WiimoteChanged, AddressOf wm_WiimoteChanged + AddHandler wm.WiimoteExtensionChanged, AddressOf wm_WiimoteExtensionChanged + + wm.Connect() + If wm.WiimoteState.ExtensionType <> ExtensionType.BalanceBoard Then + wm.SetReportType(InputReport.IRExtensionAccel, IRSensitivity.Maximum, True) + End If + + wm.SetLEDs(index) + index += 1 + Next wm + End Sub + + Private Sub wm_WiimoteChanged(ByVal sender As Object, ByVal e As WiimoteChangedEventArgs) + Dim wi As WiimoteInfo = mWiimoteMap((CType(sender, Wiimote)).ID) + wi.UpdateState(e) + End Sub + + Private Sub wm_WiimoteExtensionChanged(ByVal sender As Object, ByVal e As WiimoteExtensionChangedEventArgs) + ' find the control for this Wiimote + Dim wi As WiimoteInfo = mWiimoteMap((CType(sender, Wiimote)).ID) + wi.UpdateExtension(e) + + If e.Inserted Then + CType(sender, Wiimote).SetReportType(InputReport.IRExtensionAccel, True) + Else + CType(sender, Wiimote).SetReportType(InputReport.IRAccel, True) + End If + End Sub + + Private Sub MultipleWiimoteForm_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing + For Each wm As Wiimote In mWC + wm.Disconnect() + Next wm + End Sub + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/My Project/AssemblyInfo.vb b/WiimoteVB/WiimoteTest/My Project/AssemblyInfo.vb new file mode 100644 index 0000000..7c8ec6e --- /dev/null +++ b/WiimoteVB/WiimoteTest/My Project/AssemblyInfo.vb @@ -0,0 +1,34 @@ +Imports Microsoft.VisualBasic +Imports System.Reflection +Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + + +' The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' + + diff --git a/WiimoteVB/WiimoteTest/My Project/Resources.Designer.vb b/WiimoteVB/WiimoteTest/My Project/Resources.Designer.vb new file mode 100644 index 0000000..4a1e329 --- /dev/null +++ b/WiimoteVB/WiimoteTest/My Project/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.312 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + + +Imports Microsoft.VisualBasic +Imports System +Namespace My + + + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + ' This class was auto-generated by the StronglyTypedResourceBuilder + ' class via a tool like ResGen or Visual Studio. + ' To add or remove a member, edit your .ResX file then rerun ResGen + ' with the /str option, or rebuild your VS project. + _ + Friend Class Resources + + Private Shared resourceMan As Global.System.Resources.ResourceManager + + Private Shared resourceCulture As Global.System.Globalization.CultureInfo + + _ + Friend Sub New() + End Sub + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If (resourceMan Is Nothing) Then + Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Shared Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/My Project/Resources.resx b/WiimoteVB/WiimoteTest/My Project/Resources.resx new file mode 100644 index 0000000..25a6121 --- /dev/null +++ b/WiimoteVB/WiimoteTest/My Project/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/My Project/Settings.Designer.vb b/WiimoteVB/WiimoteTest/My Project/Settings.Designer.vb new file mode 100644 index 0000000..36da105 --- /dev/null +++ b/WiimoteVB/WiimoteTest/My Project/Settings.Designer.vb @@ -0,0 +1,29 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.312 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + + +Imports Microsoft.VisualBasic +Imports System +Namespace My + + + _ + Friend NotInheritable Partial Class Settings + Inherits System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings)) + + Public Shared ReadOnly Property [Default]() As Settings + Get + Return defaultInstance + End Get + End Property + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/My Project/Settings.settings b/WiimoteVB/WiimoteTest/My Project/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/WiimoteVB/WiimoteTest/My Project/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WiimoteVB/WiimoteTest/Program.vb b/WiimoteVB/WiimoteTest/Program.vb new file mode 100644 index 0000000..58ef538 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Program.vb @@ -0,0 +1,19 @@ +Imports Microsoft.VisualBasic +Imports System +Imports System.Windows.Forms + +Namespace WiimoteTest + Friend NotInheritable Class Program + ''' + ''' The main entry point for the application. + ''' + Private Sub New() + End Sub + _ + Shared Sub Main() + Application.EnableVisualStyles() + Application.SetCompatibleTextRenderingDefault(False) + Application.Run(New MultipleWiimoteForm()) + End Sub + End Class +End Namespace \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/Properties/AssemblyInfo.vb b/WiimoteVB/WiimoteTest/Properties/AssemblyInfo.vb new file mode 100644 index 0000000..1957804 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Properties/AssemblyInfo.vb @@ -0,0 +1,34 @@ +Imports Microsoft.VisualBasic +Imports System.Reflection +Imports System.Runtime.CompilerServices +Imports System.Runtime.InteropServices + +' General Information about an assembly is controlled through the following +' set of attributes. Change these attribute values to modify the information +' associated with an assembly. + + + + + + + + + +' Setting ComVisible to false makes the types in this assembly not visible +' to COM components. If you need to access a type in this assembly from +' COM, set the ComVisible attribute to true on that type. + + +' The following GUID is for the ID of the typelib if this project is exposed to COM + + +' Version information for an assembly consists of the following four values: +' +' Major Version +' Minor Version +' Build Number +' Revision +' + + diff --git a/WiimoteVB/WiimoteTest/Properties/Resources.Designer.vb b/WiimoteVB/WiimoteTest/Properties/Resources.Designer.vb new file mode 100644 index 0000000..0cce505 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Properties/Resources.Designer.vb @@ -0,0 +1,63 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.312 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + + +Imports Microsoft.VisualBasic +Imports System +Namespace My + + + ''' + ''' A strongly-typed resource class, for looking up localized strings, etc. + ''' + ' This class was auto-generated by the StronglyTypedResourceBuilder + ' class via a tool like ResGen or Visual Studio. + ' To add or remove a member, edit your .ResX file then rerun ResGen + ' with the /str option, or rebuild your VS project. + _ + Friend Class Resources + + Private Shared resourceMan As Global.System.Resources.ResourceManager + + Private Shared resourceCulture As Global.System.Globalization.CultureInfo + + _ + Friend Sub New() + End Sub + + ''' + ''' Returns the cached ResourceManager instance used by this class. + ''' + _ + Friend Shared ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager + Get + If (resourceMan Is Nothing) Then + Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly) + resourceMan = temp + End If + Return resourceMan + End Get + End Property + + ''' + ''' Overrides the current thread's CurrentUICulture property for all + ''' resource lookups using this strongly typed resource class. + ''' + _ + Friend Shared Property Culture() As Global.System.Globalization.CultureInfo + Get + Return resourceCulture + End Get + Set(ByVal value As Global.System.Globalization.CultureInfo) + resourceCulture = value + End Set + End Property + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/Properties/Resources.resx b/WiimoteVB/WiimoteTest/Properties/Resources.resx new file mode 100644 index 0000000..25a6121 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/Properties/Settings.Designer.vb b/WiimoteVB/WiimoteTest/Properties/Settings.Designer.vb new file mode 100644 index 0000000..7a320a6 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Properties/Settings.Designer.vb @@ -0,0 +1,29 @@ +'------------------------------------------------------------------------------ +' +' This code was generated by a tool. +' Runtime Version:2.0.50727.312 +' +' Changes to this file may cause incorrect behavior and will be lost if +' the code is regenerated. +' +'------------------------------------------------------------------------------ + + +Imports Microsoft.VisualBasic +Imports System +Namespace My + + + _ + Friend NotInheritable Partial Class Settings + Inherits Global.System.Configuration.ApplicationSettingsBase + + Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings)) + + Public Shared ReadOnly Property [Default]() As Settings + Get + Return defaultInstance + End Get + End Property + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/Properties/Settings.settings b/WiimoteVB/WiimoteTest/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/WiimoteVB/WiimoteTest/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/WiimoteVB/WiimoteTest/SingleWiimoteForm.Designer.vb b/WiimoteVB/WiimoteTest/SingleWiimoteForm.Designer.vb new file mode 100644 index 0000000..47d75ab --- /dev/null +++ b/WiimoteVB/WiimoteTest/SingleWiimoteForm.Designer.vb @@ -0,0 +1,62 @@ +Imports Microsoft.VisualBasic +Imports System +Namespace WiimoteTest + Partial Public Class SingleWiimoteForm + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (components IsNot Nothing) Then + components.Dispose() + End If + MyBase.Dispose(disposing) + End Sub + + #Region "Windows Form Designer generated code" + + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.wiimoteInfo1 = New WiimoteTest.WiimoteInfo() + Me.SuspendLayout() + ' + ' wiimoteInfo1 + ' + Me.wiimoteInfo1.Dock = System.Windows.Forms.DockStyle.Fill + Me.wiimoteInfo1.Location = New System.Drawing.Point(0, 0) + Me.wiimoteInfo1.Name = "wiimoteInfo1" + Me.wiimoteInfo1.Size = New System.Drawing.Size(698, 453) + Me.wiimoteInfo1.TabIndex = 0 + ' + ' SingleWiimoteForm + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(698, 453) + Me.Controls.Add(Me.wiimoteInfo1) + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle + Me.MaximizeBox = False + Me.Name = "SingleWiimoteForm" + Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen + Me.Text = "Wiimote Tester" +' Me.Load += New System.EventHandler(Me.Form1_Load); +' Me.FormClosing += New System.Windows.Forms.FormClosingEventHandler(Me.Form1_FormClosing); + Me.ResumeLayout(False) + + End Sub + + #End Region + + Private wiimoteInfo1 As WiimoteInfo + + End Class +End Namespace + diff --git a/WiimoteVB/WiimoteTest/SingleWiimoteForm.resx b/WiimoteVB/WiimoteTest/SingleWiimoteForm.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteVB/WiimoteTest/SingleWiimoteForm.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/SingleWiimoteForm.vb b/WiimoteVB/WiimoteTest/SingleWiimoteForm.vb new file mode 100644 index 0000000..49c1c08 --- /dev/null +++ b/WiimoteVB/WiimoteTest/SingleWiimoteForm.vb @@ -0,0 +1,54 @@ +'//////////////////////////////////////////////////////////////////////////////// +' SingleWiimoteForm.cs +' Managed Wiimote Library Tester +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System +Imports System.Windows.Forms +Imports WiimoteLib + +Namespace WiimoteTest + Partial Public Class SingleWiimoteForm + Inherits Form + Private wm As New Wiimote() + + Public Sub New() + InitializeComponent() + End Sub + + Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load + wiimoteInfo1.Wiimote = wm + + AddHandler wm.WiimoteChanged, AddressOf wm_WiimoteChanged + AddHandler wm.WiimoteExtensionChanged, AddressOf wm_WiimoteExtensionChanged + wm.Connect() + wm.SetReportType(InputReport.IRAccel, True) + wm.SetLEDs(False, True, True, False) + End Sub + + Private Sub wm_WiimoteChanged(ByVal sender As Object, ByVal args As WiimoteChangedEventArgs) + wiimoteInfo1.UpdateState(args) + End Sub + + Private Sub wm_WiimoteExtensionChanged(ByVal sender As Object, ByVal args As WiimoteExtensionChangedEventArgs) + wiimoteInfo1.UpdateExtension(args) + + If args.Inserted Then + wm.SetReportType(InputReport.IRExtensionAccel, True) + Else + wm.SetReportType(InputReport.IRAccel, True) + End If + End Sub + + Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) Handles MyBase.FormClosing + wm.Disconnect() + End Sub + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/WiimoteInfo.Designer.vb b/WiimoteVB/WiimoteTest/WiimoteInfo.Designer.vb new file mode 100644 index 0000000..94223af --- /dev/null +++ b/WiimoteVB/WiimoteTest/WiimoteInfo.Designer.vb @@ -0,0 +1,779 @@ +Imports Microsoft.VisualBasic +Imports System +Namespace WiimoteTest + Partial Public Class WiimoteInfo + ''' + ''' Required designer variable. + ''' + Private components As System.ComponentModel.IContainer = Nothing + + ''' + ''' Clean up any resources being used. + ''' + ''' true if managed resources should be disposed; otherwise, false. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + If disposing AndAlso (components IsNot Nothing) Then + components.Dispose() + End If + MyBase.Dispose(disposing) + End Sub + + #Region "Component Designer generated code" + + ''' + ''' Required method for Designer support - do not modify + ''' the contents of this method with the code editor. + ''' + Private Sub InitializeComponent() + Me.groupBox8 = New System.Windows.Forms.GroupBox() + Me.clbButtons = New System.Windows.Forms.CheckedListBox() + Me.lblTriggerR = New System.Windows.Forms.Label() + Me.lblTriggerL = New System.Windows.Forms.Label() + Me.lblIR3 = New System.Windows.Forms.Label() + Me.lblIR4 = New System.Windows.Forms.Label() + Me.lblCCJoy2 = New System.Windows.Forms.Label() + Me.lblCCJoy1 = New System.Windows.Forms.Label() + Me.groupBox5 = New System.Windows.Forms.GroupBox() + Me.lblIR3Raw = New System.Windows.Forms.Label() + Me.lblIR1Raw = New System.Windows.Forms.Label() + Me.lblIR4Raw = New System.Windows.Forms.Label() + Me.lblIR2Raw = New System.Windows.Forms.Label() + Me.lblIR1 = New System.Windows.Forms.Label() + Me.lblIR2 = New System.Windows.Forms.Label() + Me.chkFound3 = New System.Windows.Forms.CheckBox() + Me.chkFound4 = New System.Windows.Forms.CheckBox() + Me.chkFound1 = New System.Windows.Forms.CheckBox() + Me.chkFound2 = New System.Windows.Forms.CheckBox() + Me.pbIR = New System.Windows.Forms.PictureBox() + Me.lblGuitarWhammy = New System.Windows.Forms.Label() + Me.groupBox7 = New System.Windows.Forms.GroupBox() + Me.clbTouchbar = New System.Windows.Forms.CheckedListBox() + Me.lblGuitarType = New System.Windows.Forms.Label() + Me.lblGuitarJoy = New System.Windows.Forms.Label() + Me.clbGuitarButtons = New System.Windows.Forms.CheckedListBox() + Me.groupBox6 = New System.Windows.Forms.GroupBox() + Me.clbCCButtons = New System.Windows.Forms.CheckedListBox() + Me.groupBox4 = New System.Windows.Forms.GroupBox() + Me.pbBattery = New System.Windows.Forms.ProgressBar() + Me.lblBattery = New System.Windows.Forms.Label() + Me.groupBox3 = New System.Windows.Forms.GroupBox() + Me.chkLED2 = New System.Windows.Forms.CheckBox() + Me.chkLED4 = New System.Windows.Forms.CheckBox() + Me.chkLED3 = New System.Windows.Forms.CheckBox() + Me.chkLED1 = New System.Windows.Forms.CheckBox() + Me.chkRumble = New System.Windows.Forms.CheckBox() + Me.chkZ = New System.Windows.Forms.CheckBox() + Me.chkC = New System.Windows.Forms.CheckBox() + Me.lblChuk = New System.Windows.Forms.Label() + Me.groupBox2 = New System.Windows.Forms.GroupBox() + Me.lblChukJoy = New System.Windows.Forms.Label() + Me.groupBox1 = New System.Windows.Forms.GroupBox() + Me.lblAccel = New System.Windows.Forms.Label() + Me.chkExtension = New System.Windows.Forms.CheckBox() + Me.groupBox9 = New System.Windows.Forms.GroupBox() + Me.lblCOG = New System.Windows.Forms.Label() + Me.chkLbs = New System.Windows.Forms.CheckBox() + Me.lblBBBR = New System.Windows.Forms.Label() + Me.lblBBTR = New System.Windows.Forms.Label() + Me.lblBBBL = New System.Windows.Forms.Label() + Me.lblBBTotal = New System.Windows.Forms.Label() + Me.lblBBTL = New System.Windows.Forms.Label() + Me.lblDevicePath = New System.Windows.Forms.Label() + Me.groupBox10 = New System.Windows.Forms.GroupBox() + Me.lbDrumVelocity = New System.Windows.Forms.ListBox() + Me.lblDrumJoy = New System.Windows.Forms.Label() + Me.clbDrums = New System.Windows.Forms.CheckedListBox() + Me.groupBox8.SuspendLayout() + Me.groupBox5.SuspendLayout() + CType(Me.pbIR, System.ComponentModel.ISupportInitialize).BeginInit() + Me.groupBox7.SuspendLayout() + Me.groupBox6.SuspendLayout() + Me.groupBox4.SuspendLayout() + Me.groupBox3.SuspendLayout() + Me.groupBox2.SuspendLayout() + Me.groupBox1.SuspendLayout() + Me.groupBox9.SuspendLayout() + Me.groupBox10.SuspendLayout() + Me.SuspendLayout() + ' + ' groupBox8 + ' + Me.groupBox8.Controls.Add(Me.clbButtons) + Me.groupBox8.Location = New System.Drawing.Point(0, 0) + Me.groupBox8.Name = "groupBox8" + Me.groupBox8.Size = New System.Drawing.Size(72, 220) + Me.groupBox8.TabIndex = 37 + Me.groupBox8.TabStop = False + Me.groupBox8.Text = "Wiimote" + ' + ' clbButtons + ' + Me.clbButtons.FormattingEnabled = True + Me.clbButtons.Items.AddRange(New Object() { "A", "B", "-", "Home", "+", "1", "2", "Up", "Down", "Left", "Right"}) + Me.clbButtons.Location = New System.Drawing.Point(8, 16) + Me.clbButtons.Name = "clbButtons" + Me.clbButtons.Size = New System.Drawing.Size(56, 184) + Me.clbButtons.TabIndex = 1 + ' + ' lblTriggerR + ' + Me.lblTriggerR.AutoSize = True + Me.lblTriggerR.Location = New System.Drawing.Point(76, 104) + Me.lblTriggerR.Name = "lblTriggerR" + Me.lblTriggerR.Size = New System.Drawing.Size(51, 13) + Me.lblTriggerR.TabIndex = 25 + Me.lblTriggerR.Text = "Trigger R" + ' + ' lblTriggerL + ' + Me.lblTriggerL.AutoSize = True + Me.lblTriggerL.Location = New System.Drawing.Point(76, 88) + Me.lblTriggerL.Name = "lblTriggerL" + Me.lblTriggerL.Size = New System.Drawing.Size(49, 13) + Me.lblTriggerL.TabIndex = 24 + Me.lblTriggerL.Text = "Trigger L" + ' + ' lblIR3 + ' + Me.lblIR3.AutoSize = True + Me.lblIR3.Location = New System.Drawing.Point(8, 48) + Me.lblIR3.Name = "lblIR3" + Me.lblIR3.Size = New System.Drawing.Size(24, 13) + Me.lblIR3.TabIndex = 7 + Me.lblIR3.Text = "IR3" + ' + ' lblIR4 + ' + Me.lblIR4.AutoSize = True + Me.lblIR4.Location = New System.Drawing.Point(8, 64) + Me.lblIR4.Name = "lblIR4" + Me.lblIR4.Size = New System.Drawing.Size(24, 13) + Me.lblIR4.TabIndex = 7 + Me.lblIR4.Text = "IR4" + ' + ' lblCCJoy2 + ' + Me.lblCCJoy2.Location = New System.Drawing.Point(76, 52) + Me.lblCCJoy2.Name = "lblCCJoy2" + Me.lblCCJoy2.Size = New System.Drawing.Size(108, 32) + Me.lblCCJoy2.TabIndex = 24 + Me.lblCCJoy2.Text = "Right Joystick" + ' + ' lblCCJoy1 + ' + Me.lblCCJoy1.Location = New System.Drawing.Point(76, 16) + Me.lblCCJoy1.Name = "lblCCJoy1" + Me.lblCCJoy1.Size = New System.Drawing.Size(108, 32) + Me.lblCCJoy1.TabIndex = 24 + Me.lblCCJoy1.Text = "Left Joystick" + ' + ' groupBox5 + ' + Me.groupBox5.Controls.Add(Me.lblIR3Raw) + Me.groupBox5.Controls.Add(Me.lblIR1Raw) + Me.groupBox5.Controls.Add(Me.lblIR4Raw) + Me.groupBox5.Controls.Add(Me.lblIR2Raw) + Me.groupBox5.Controls.Add(Me.lblIR3) + Me.groupBox5.Controls.Add(Me.lblIR1) + Me.groupBox5.Controls.Add(Me.lblIR4) + Me.groupBox5.Controls.Add(Me.lblIR2) + Me.groupBox5.Controls.Add(Me.chkFound3) + Me.groupBox5.Controls.Add(Me.chkFound4) + Me.groupBox5.Controls.Add(Me.chkFound1) + Me.groupBox5.Controls.Add(Me.chkFound2) + Me.groupBox5.Location = New System.Drawing.Point(184, 0) + Me.groupBox5.Name = "groupBox5" + Me.groupBox5.Size = New System.Drawing.Size(176, 188) + Me.groupBox5.TabIndex = 34 + Me.groupBox5.TabStop = False + Me.groupBox5.Text = "IR" + ' + ' lblIR3Raw + ' + Me.lblIR3Raw.AutoSize = True + Me.lblIR3Raw.Location = New System.Drawing.Point(8, 112) + Me.lblIR3Raw.Name = "lblIR3Raw" + Me.lblIR3Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR3Raw.TabIndex = 10 + Me.lblIR3Raw.Text = "IR3Raw" + ' + ' lblIR1Raw + ' + Me.lblIR1Raw.AutoSize = True + Me.lblIR1Raw.Location = New System.Drawing.Point(8, 80) + Me.lblIR1Raw.Name = "lblIR1Raw" + Me.lblIR1Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR1Raw.TabIndex = 10 + Me.lblIR1Raw.Text = "IR1Raw" + ' + ' lblIR4Raw + ' + Me.lblIR4Raw.AutoSize = True + Me.lblIR4Raw.Location = New System.Drawing.Point(8, 128) + Me.lblIR4Raw.Name = "lblIR4Raw" + Me.lblIR4Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR4Raw.TabIndex = 9 + Me.lblIR4Raw.Text = "IR4Raw" + ' + ' lblIR2Raw + ' + Me.lblIR2Raw.AutoSize = True + Me.lblIR2Raw.Location = New System.Drawing.Point(8, 96) + Me.lblIR2Raw.Name = "lblIR2Raw" + Me.lblIR2Raw.Size = New System.Drawing.Size(46, 13) + Me.lblIR2Raw.TabIndex = 9 + Me.lblIR2Raw.Text = "IR2Raw" + ' + ' lblIR1 + ' + Me.lblIR1.AutoSize = True + Me.lblIR1.Location = New System.Drawing.Point(8, 16) + Me.lblIR1.Name = "lblIR1" + Me.lblIR1.Size = New System.Drawing.Size(24, 13) + Me.lblIR1.TabIndex = 7 + Me.lblIR1.Text = "IR1" + ' + ' lblIR2 + ' + Me.lblIR2.AutoSize = True + Me.lblIR2.Location = New System.Drawing.Point(8, 32) + Me.lblIR2.Name = "lblIR2" + Me.lblIR2.Size = New System.Drawing.Size(24, 13) + Me.lblIR2.TabIndex = 7 + Me.lblIR2.Text = "IR2" + ' + ' chkFound3 + ' + Me.chkFound3.AutoSize = True + Me.chkFound3.Location = New System.Drawing.Point(60, 148) + Me.chkFound3.Name = "chkFound3" + Me.chkFound3.Size = New System.Drawing.Size(46, 17) + Me.chkFound3.TabIndex = 8 + Me.chkFound3.Text = "IR 3" + Me.chkFound3.UseVisualStyleBackColor = True + ' + ' chkFound4 + ' + Me.chkFound4.AutoSize = True + Me.chkFound4.Location = New System.Drawing.Point(60, 164) + Me.chkFound4.Name = "chkFound4" + Me.chkFound4.Size = New System.Drawing.Size(46, 17) + Me.chkFound4.TabIndex = 8 + Me.chkFound4.Text = "IR 4" + Me.chkFound4.UseVisualStyleBackColor = True + ' + ' chkFound1 + ' + Me.chkFound1.AutoSize = True + Me.chkFound1.Location = New System.Drawing.Point(8, 148) + Me.chkFound1.Name = "chkFound1" + Me.chkFound1.Size = New System.Drawing.Size(46, 17) + Me.chkFound1.TabIndex = 8 + Me.chkFound1.Text = "IR 1" + Me.chkFound1.UseVisualStyleBackColor = True + ' + ' chkFound2 + ' + Me.chkFound2.AutoSize = True + Me.chkFound2.Location = New System.Drawing.Point(8, 164) + Me.chkFound2.Name = "chkFound2" + Me.chkFound2.Size = New System.Drawing.Size(46, 17) + Me.chkFound2.TabIndex = 8 + Me.chkFound2.Text = "IR 2" + Me.chkFound2.UseVisualStyleBackColor = True + ' + ' pbIR + ' + Me.pbIR.Location = New System.Drawing.Point(4, 248) + Me.pbIR.Name = "pbIR" + Me.pbIR.Size = New System.Drawing.Size(256, 192) + Me.pbIR.TabIndex = 28 + Me.pbIR.TabStop = False + ' + ' lblGuitarWhammy + ' + Me.lblGuitarWhammy.AutoSize = True + Me.lblGuitarWhammy.Location = New System.Drawing.Point(92, 140) + Me.lblGuitarWhammy.Name = "lblGuitarWhammy" + Me.lblGuitarWhammy.Size = New System.Drawing.Size(51, 13) + Me.lblGuitarWhammy.TabIndex = 24 + Me.lblGuitarWhammy.Text = "Whammy" + ' + ' groupBox7 + ' + Me.groupBox7.Controls.Add(Me.clbTouchbar) + Me.groupBox7.Controls.Add(Me.lblGuitarType) + Me.groupBox7.Controls.Add(Me.lblGuitarWhammy) + Me.groupBox7.Controls.Add(Me.lblGuitarJoy) + Me.groupBox7.Controls.Add(Me.clbGuitarButtons) + Me.groupBox7.Location = New System.Drawing.Point(364, 272) + Me.groupBox7.Name = "groupBox7" + Me.groupBox7.Size = New System.Drawing.Size(188, 176) + Me.groupBox7.TabIndex = 36 + Me.groupBox7.TabStop = False + Me.groupBox7.Text = "Guitar" + ' + ' clbTouchbar + ' + Me.clbTouchbar.FormattingEnabled = True + Me.clbTouchbar.Items.AddRange(New Object() { "Green", "Red", "Yellow", "Blue", "Orange"}) + Me.clbTouchbar.Location = New System.Drawing.Point(88, 16) + Me.clbTouchbar.Name = "clbTouchbar" + Me.clbTouchbar.Size = New System.Drawing.Size(80, 79) + Me.clbTouchbar.TabIndex = 25 + ' + ' lblGuitarType + ' + Me.lblGuitarType.AutoSize = True + Me.lblGuitarType.Location = New System.Drawing.Point(4, 156) + Me.lblGuitarType.Name = "lblGuitarType" + Me.lblGuitarType.Size = New System.Drawing.Size(31, 13) + Me.lblGuitarType.TabIndex = 24 + Me.lblGuitarType.Text = "Type" + ' + ' lblGuitarJoy + ' + Me.lblGuitarJoy.Location = New System.Drawing.Point(92, 104) + Me.lblGuitarJoy.Name = "lblGuitarJoy" + Me.lblGuitarJoy.Size = New System.Drawing.Size(92, 32) + Me.lblGuitarJoy.TabIndex = 24 + Me.lblGuitarJoy.Text = "Joystick Values" + ' + ' clbGuitarButtons + ' + Me.clbGuitarButtons.FormattingEnabled = True + Me.clbGuitarButtons.Items.AddRange(New Object() { "Green", "Red", "Yellow", "Blue", "Orange", "-", "+", "StrumUp", "StrumDown"}) + Me.clbGuitarButtons.Location = New System.Drawing.Point(4, 16) + Me.clbGuitarButtons.Name = "clbGuitarButtons" + Me.clbGuitarButtons.Size = New System.Drawing.Size(80, 139) + Me.clbGuitarButtons.TabIndex = 23 + ' + ' groupBox6 + ' + Me.groupBox6.Controls.Add(Me.lblTriggerR) + Me.groupBox6.Controls.Add(Me.lblTriggerL) + Me.groupBox6.Controls.Add(Me.lblCCJoy2) + Me.groupBox6.Controls.Add(Me.lblCCJoy1) + Me.groupBox6.Controls.Add(Me.clbCCButtons) + Me.groupBox6.Location = New System.Drawing.Point(364, 0) + Me.groupBox6.Name = "groupBox6" + Me.groupBox6.Size = New System.Drawing.Size(188, 268) + Me.groupBox6.TabIndex = 35 + Me.groupBox6.TabStop = False + Me.groupBox6.Text = "Classic Controller" + ' + ' clbCCButtons + ' + Me.clbCCButtons.FormattingEnabled = True + Me.clbCCButtons.Items.AddRange(New Object() { "A", "B", "X", "Y", "-", "Home", "+", "Up", "Down", "Left", "Right", "ZL", "ZR", "LTrigger", "RTrigger"}) + Me.clbCCButtons.Location = New System.Drawing.Point(4, 16) + Me.clbCCButtons.Name = "clbCCButtons" + Me.clbCCButtons.Size = New System.Drawing.Size(68, 244) + Me.clbCCButtons.TabIndex = 23 + ' + ' groupBox4 + ' + Me.groupBox4.Controls.Add(Me.pbBattery) + Me.groupBox4.Controls.Add(Me.lblBattery) + Me.groupBox4.Location = New System.Drawing.Point(184, 188) + Me.groupBox4.Name = "groupBox4" + Me.groupBox4.Size = New System.Drawing.Size(176, 52) + Me.groupBox4.TabIndex = 33 + Me.groupBox4.TabStop = False + Me.groupBox4.Text = "Battery" + ' + ' pbBattery + ' + Me.pbBattery.Location = New System.Drawing.Point(8, 20) + Me.pbBattery.Maximum = 200 + Me.pbBattery.Name = "pbBattery" + Me.pbBattery.Size = New System.Drawing.Size(128, 23) + Me.pbBattery.Step = 1 + Me.pbBattery.TabIndex = 6 + ' + ' lblBattery + ' + Me.lblBattery.AutoSize = True + Me.lblBattery.Location = New System.Drawing.Point(140, 24) + Me.lblBattery.Name = "lblBattery" + Me.lblBattery.Size = New System.Drawing.Size(35, 13) + Me.lblBattery.TabIndex = 9 + Me.lblBattery.Text = "label1" + ' + ' groupBox3 + ' + Me.groupBox3.Controls.Add(Me.chkLED2) + Me.groupBox3.Controls.Add(Me.chkLED4) + Me.groupBox3.Controls.Add(Me.chkLED3) + Me.groupBox3.Controls.Add(Me.chkLED1) + Me.groupBox3.Controls.Add(Me.chkRumble) + Me.groupBox3.Location = New System.Drawing.Point(264, 248) + Me.groupBox3.Name = "groupBox3" + Me.groupBox3.Size = New System.Drawing.Size(96, 120) + Me.groupBox3.TabIndex = 32 + Me.groupBox3.TabStop = False + Me.groupBox3.Text = "Outputs" + ' + ' chkLED2 + ' + Me.chkLED2.AutoSize = True + Me.chkLED2.Location = New System.Drawing.Point(8, 36) + Me.chkLED2.Name = "chkLED2" + Me.chkLED2.Size = New System.Drawing.Size(53, 17) + Me.chkLED2.TabIndex = 3 + Me.chkLED2.Text = "LED2" + Me.chkLED2.UseVisualStyleBackColor = True +' Me.chkLED2.CheckedChanged += New System.EventHandler(Me.chkLED_CheckedChanged); + ' + ' chkLED4 + ' + Me.chkLED4.AutoSize = True + Me.chkLED4.Location = New System.Drawing.Point(8, 76) + Me.chkLED4.Name = "chkLED4" + Me.chkLED4.Size = New System.Drawing.Size(53, 17) + Me.chkLED4.TabIndex = 3 + Me.chkLED4.Text = "LED4" + Me.chkLED4.UseVisualStyleBackColor = True +' Me.chkLED4.CheckedChanged += New System.EventHandler(Me.chkLED_CheckedChanged); + ' + ' chkLED3 + ' + Me.chkLED3.AutoSize = True + Me.chkLED3.Location = New System.Drawing.Point(8, 56) + Me.chkLED3.Name = "chkLED3" + Me.chkLED3.Size = New System.Drawing.Size(53, 17) + Me.chkLED3.TabIndex = 3 + Me.chkLED3.Text = "LED3" + Me.chkLED3.UseVisualStyleBackColor = True +' Me.chkLED3.CheckedChanged += New System.EventHandler(Me.chkLED_CheckedChanged); + ' + ' chkLED1 + ' + Me.chkLED1.AutoSize = True + Me.chkLED1.Location = New System.Drawing.Point(8, 16) + Me.chkLED1.Name = "chkLED1" + Me.chkLED1.Size = New System.Drawing.Size(53, 17) + Me.chkLED1.TabIndex = 3 + Me.chkLED1.Text = "LED1" + Me.chkLED1.UseVisualStyleBackColor = True +' Me.chkLED1.CheckedChanged += New System.EventHandler(Me.chkLED_CheckedChanged); + ' + ' chkRumble + ' + Me.chkRumble.AutoSize = True + Me.chkRumble.Location = New System.Drawing.Point(8, 96) + Me.chkRumble.Name = "chkRumble" + Me.chkRumble.Size = New System.Drawing.Size(62, 17) + Me.chkRumble.TabIndex = 4 + Me.chkRumble.Text = "Rumble" + Me.chkRumble.UseVisualStyleBackColor = True +' Me.chkRumble.CheckedChanged += New System.EventHandler(Me.chkRumble_CheckedChanged); + ' + ' chkZ + ' + Me.chkZ.AutoSize = True + Me.chkZ.Location = New System.Drawing.Point(8, 112) + Me.chkZ.Name = "chkZ" + Me.chkZ.Size = New System.Drawing.Size(33, 17) + Me.chkZ.TabIndex = 17 + Me.chkZ.Text = "Z" + Me.chkZ.UseVisualStyleBackColor = True + ' + ' chkC + ' + Me.chkC.AutoSize = True + Me.chkC.Location = New System.Drawing.Point(8, 92) + Me.chkC.Name = "chkC" + Me.chkC.Size = New System.Drawing.Size(33, 17) + Me.chkC.TabIndex = 17 + Me.chkC.Text = "C" + Me.chkC.UseVisualStyleBackColor = True + ' + ' lblChuk + ' + Me.lblChuk.Location = New System.Drawing.Point(8, 20) + Me.lblChuk.Name = "lblChuk" + Me.lblChuk.Size = New System.Drawing.Size(92, 40) + Me.lblChuk.TabIndex = 13 + Me.lblChuk.Text = "Accel Values" + ' + ' groupBox2 + ' + Me.groupBox2.Controls.Add(Me.chkZ) + Me.groupBox2.Controls.Add(Me.chkC) + Me.groupBox2.Controls.Add(Me.lblChuk) + Me.groupBox2.Controls.Add(Me.lblChukJoy) + Me.groupBox2.Location = New System.Drawing.Point(76, 76) + Me.groupBox2.Name = "groupBox2" + Me.groupBox2.Size = New System.Drawing.Size(104, 136) + Me.groupBox2.TabIndex = 31 + Me.groupBox2.TabStop = False + Me.groupBox2.Text = "Nunchuk" + ' + ' lblChukJoy + ' + Me.lblChukJoy.Location = New System.Drawing.Point(8, 64) + Me.lblChukJoy.Name = "lblChukJoy" + Me.lblChukJoy.Size = New System.Drawing.Size(92, 28) + Me.lblChukJoy.TabIndex = 16 + Me.lblChukJoy.Text = "Joystick Values" + ' + ' groupBox1 + ' + Me.groupBox1.Controls.Add(Me.lblAccel) + Me.groupBox1.Location = New System.Drawing.Point(76, 0) + Me.groupBox1.Name = "groupBox1" + Me.groupBox1.Size = New System.Drawing.Size(104, 72) + Me.groupBox1.TabIndex = 30 + Me.groupBox1.TabStop = False + Me.groupBox1.Text = "Wiimote Accel" + ' + ' lblAccel + ' + Me.lblAccel.Location = New System.Drawing.Point(8, 20) + Me.lblAccel.Name = "lblAccel" + Me.lblAccel.Size = New System.Drawing.Size(88, 48) + Me.lblAccel.TabIndex = 2 + Me.lblAccel.Text = "Accel Values" + ' + ' chkExtension + ' + Me.chkExtension.AutoSize = True + Me.chkExtension.Location = New System.Drawing.Point(4, 224) + Me.chkExtension.Name = "chkExtension" + Me.chkExtension.Size = New System.Drawing.Size(52, 17) + Me.chkExtension.TabIndex = 29 + Me.chkExtension.Text = "None" + Me.chkExtension.UseVisualStyleBackColor = True + ' + ' groupBox9 + ' + Me.groupBox9.Controls.Add(Me.lblCOG) + Me.groupBox9.Controls.Add(Me.chkLbs) + Me.groupBox9.Controls.Add(Me.lblBBBR) + Me.groupBox9.Controls.Add(Me.lblBBTR) + Me.groupBox9.Controls.Add(Me.lblBBBL) + Me.groupBox9.Controls.Add(Me.lblBBTotal) + Me.groupBox9.Controls.Add(Me.lblBBTL) + Me.groupBox9.Location = New System.Drawing.Point(556, 0) + Me.groupBox9.Name = "groupBox9" + Me.groupBox9.Size = New System.Drawing.Size(136, 112) + Me.groupBox9.TabIndex = 38 + Me.groupBox9.TabStop = False + Me.groupBox9.Text = "Balance Board" + ' + ' lblCOG + ' + Me.lblCOG.AutoSize = True + Me.lblCOG.Location = New System.Drawing.Point(8, 92) + Me.lblCOG.Name = "lblCOG" + Me.lblCOG.Size = New System.Drawing.Size(30, 13) + Me.lblCOG.TabIndex = 2 + Me.lblCOG.Text = "COG" + ' + ' chkLbs + ' + Me.chkLbs.AutoSize = True + Me.chkLbs.Location = New System.Drawing.Point(28, 68) + Me.chkLbs.Name = "chkLbs" + Me.chkLbs.Size = New System.Drawing.Size(62, 17) + Me.chkLbs.TabIndex = 1 + Me.chkLbs.Text = "Pounds" + Me.chkLbs.UseVisualStyleBackColor = True + ' + ' lblBBBR + ' + Me.lblBBBR.AutoSize = True + Me.lblBBBR.Location = New System.Drawing.Point(76, 48) + Me.lblBBBR.Name = "lblBBBR" + Me.lblBBBR.Size = New System.Drawing.Size(22, 13) + Me.lblBBBR.TabIndex = 0 + Me.lblBBBR.Text = "BR" + ' + ' lblBBTR + ' + Me.lblBBTR.AutoSize = True + Me.lblBBTR.Location = New System.Drawing.Point(76, 16) + Me.lblBBTR.Name = "lblBBTR" + Me.lblBBTR.Size = New System.Drawing.Size(22, 13) + Me.lblBBTR.TabIndex = 0 + Me.lblBBTR.Text = "TR" + ' + ' lblBBBL + ' + Me.lblBBBL.AutoSize = True + Me.lblBBBL.Location = New System.Drawing.Point(8, 48) + Me.lblBBBL.Name = "lblBBBL" + Me.lblBBBL.Size = New System.Drawing.Size(20, 13) + Me.lblBBBL.TabIndex = 0 + Me.lblBBBL.Text = "BL" + ' + ' lblBBTotal + ' + Me.lblBBTotal.AutoSize = True + Me.lblBBTotal.Location = New System.Drawing.Point(36, 32) + Me.lblBBTotal.Name = "lblBBTotal" + Me.lblBBTotal.Size = New System.Drawing.Size(31, 13) + Me.lblBBTotal.TabIndex = 0 + Me.lblBBTotal.Text = "Total" + ' + ' lblBBTL + ' + Me.lblBBTL.AutoSize = True + Me.lblBBTL.Location = New System.Drawing.Point(8, 16) + Me.lblBBTL.Name = "lblBBTL" + Me.lblBBTL.Size = New System.Drawing.Size(20, 13) + Me.lblBBTL.TabIndex = 0 + Me.lblBBTL.Text = "TL" + ' + ' lblDevicePath + ' + Me.lblDevicePath.AutoSize = True + Me.lblDevicePath.Location = New System.Drawing.Point(8, 444) + Me.lblDevicePath.Name = "lblDevicePath" + Me.lblDevicePath.Size = New System.Drawing.Size(63, 13) + Me.lblDevicePath.TabIndex = 39 + Me.lblDevicePath.Text = "DevicePath" + ' + ' groupBox10 + ' + Me.groupBox10.Controls.Add(Me.lbDrumVelocity) + Me.groupBox10.Controls.Add(Me.lblDrumJoy) + Me.groupBox10.Controls.Add(Me.clbDrums) + Me.groupBox10.Location = New System.Drawing.Point(556, 112) + Me.groupBox10.Name = "groupBox10" + Me.groupBox10.Size = New System.Drawing.Size(136, 180) + Me.groupBox10.TabIndex = 40 + Me.groupBox10.TabStop = False + Me.groupBox10.Text = "Drums" + ' + ' lbDrumVelocity + ' + Me.lbDrumVelocity.FormattingEnabled = True + Me.lbDrumVelocity.Location = New System.Drawing.Point(68, 16) + Me.lbDrumVelocity.Name = "lbDrumVelocity" + Me.lbDrumVelocity.Size = New System.Drawing.Size(56, 121) + Me.lbDrumVelocity.TabIndex = 41 + ' + ' lblDrumJoy + ' + Me.lblDrumJoy.Location = New System.Drawing.Point(8, 144) + Me.lblDrumJoy.Name = "lblDrumJoy" + Me.lblDrumJoy.Size = New System.Drawing.Size(92, 32) + Me.lblDrumJoy.TabIndex = 27 + Me.lblDrumJoy.Text = "Joystick Values" + ' + ' clbDrums + ' + Me.clbDrums.FormattingEnabled = True + Me.clbDrums.Items.AddRange(New Object() { "Red", "Blue", "Green", "Yellow", "Orange", "Pedal", "-", "+"}) + Me.clbDrums.Location = New System.Drawing.Point(4, 16) + Me.clbDrums.Name = "clbDrums" + Me.clbDrums.Size = New System.Drawing.Size(60, 124) + Me.clbDrums.TabIndex = 26 + ' + ' WiimoteInfo + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6F, 13F) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.groupBox10) + Me.Controls.Add(Me.lblDevicePath) + Me.Controls.Add(Me.groupBox9) + Me.Controls.Add(Me.groupBox8) + Me.Controls.Add(Me.groupBox5) + Me.Controls.Add(Me.pbIR) + Me.Controls.Add(Me.groupBox7) + Me.Controls.Add(Me.groupBox6) + Me.Controls.Add(Me.groupBox4) + Me.Controls.Add(Me.groupBox3) + Me.Controls.Add(Me.groupBox2) + Me.Controls.Add(Me.groupBox1) + Me.Controls.Add(Me.chkExtension) + Me.Name = "WiimoteInfo" + Me.Size = New System.Drawing.Size(696, 464) + Me.groupBox8.ResumeLayout(False) + Me.groupBox5.ResumeLayout(False) + Me.groupBox5.PerformLayout() + CType(Me.pbIR, System.ComponentModel.ISupportInitialize).EndInit() + Me.groupBox7.ResumeLayout(False) + Me.groupBox7.PerformLayout() + Me.groupBox6.ResumeLayout(False) + Me.groupBox6.PerformLayout() + Me.groupBox4.ResumeLayout(False) + Me.groupBox4.PerformLayout() + Me.groupBox3.ResumeLayout(False) + Me.groupBox3.PerformLayout() + Me.groupBox2.ResumeLayout(False) + Me.groupBox2.PerformLayout() + Me.groupBox1.ResumeLayout(False) + Me.groupBox9.ResumeLayout(False) + Me.groupBox9.PerformLayout() + Me.groupBox10.ResumeLayout(False) + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + #End Region + + Public groupBox8 As System.Windows.Forms.GroupBox + Public clbButtons As System.Windows.Forms.CheckedListBox + Public lblTriggerR As System.Windows.Forms.Label + Public lblTriggerL As System.Windows.Forms.Label + Public lblIR3 As System.Windows.Forms.Label + Public lblIR4 As System.Windows.Forms.Label + Public lblCCJoy2 As System.Windows.Forms.Label + Public lblCCJoy1 As System.Windows.Forms.Label + Public groupBox5 As System.Windows.Forms.GroupBox + Public lblIR3Raw As System.Windows.Forms.Label + Public lblIR1Raw As System.Windows.Forms.Label + Public lblIR4Raw As System.Windows.Forms.Label + Public lblIR2Raw As System.Windows.Forms.Label + Public lblIR1 As System.Windows.Forms.Label + Public lblIR2 As System.Windows.Forms.Label + Public chkFound3 As System.Windows.Forms.CheckBox + Public chkFound4 As System.Windows.Forms.CheckBox + Public chkFound1 As System.Windows.Forms.CheckBox + Public chkFound2 As System.Windows.Forms.CheckBox + Public pbIR As System.Windows.Forms.PictureBox + Public lblGuitarWhammy As System.Windows.Forms.Label + Public groupBox7 As System.Windows.Forms.GroupBox + Public lblGuitarJoy As System.Windows.Forms.Label + Public clbGuitarButtons As System.Windows.Forms.CheckedListBox + Public groupBox6 As System.Windows.Forms.GroupBox + Public clbCCButtons As System.Windows.Forms.CheckedListBox + Public groupBox4 As System.Windows.Forms.GroupBox + Public pbBattery As System.Windows.Forms.ProgressBar + Public lblBattery As System.Windows.Forms.Label + Public groupBox3 As System.Windows.Forms.GroupBox + Public WithEvents chkLED2 As System.Windows.Forms.CheckBox + Public WithEvents chkLED4 As System.Windows.Forms.CheckBox + Public WithEvents chkLED3 As System.Windows.Forms.CheckBox + Public WithEvents chkLED1 As System.Windows.Forms.CheckBox + Public WithEvents chkRumble As System.Windows.Forms.CheckBox + Public chkZ As System.Windows.Forms.CheckBox + Public chkC As System.Windows.Forms.CheckBox + Public lblChuk As System.Windows.Forms.Label + Public groupBox2 As System.Windows.Forms.GroupBox + Public lblChukJoy As System.Windows.Forms.Label + Public groupBox1 As System.Windows.Forms.GroupBox + Public lblAccel As System.Windows.Forms.Label + Public chkExtension As System.Windows.Forms.CheckBox + Private groupBox9 As System.Windows.Forms.GroupBox + Private chkLbs As System.Windows.Forms.CheckBox + Private lblBBBR As System.Windows.Forms.Label + Private lblBBTR As System.Windows.Forms.Label + Private lblBBBL As System.Windows.Forms.Label + Private lblBBTotal As System.Windows.Forms.Label + Private lblBBTL As System.Windows.Forms.Label + Private lblCOG As System.Windows.Forms.Label + Private lblDevicePath As System.Windows.Forms.Label + Public clbTouchbar As System.Windows.Forms.CheckedListBox + Public lblGuitarType As System.Windows.Forms.Label + Private groupBox10 As System.Windows.Forms.GroupBox + Public clbDrums As System.Windows.Forms.CheckedListBox + Public lblDrumJoy As System.Windows.Forms.Label + Private lbDrumVelocity As System.Windows.Forms.ListBox + + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/WiimoteInfo.resx b/WiimoteVB/WiimoteTest/WiimoteInfo.resx new file mode 100644 index 0000000..19dc0dd --- /dev/null +++ b/WiimoteVB/WiimoteTest/WiimoteInfo.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WiimoteVB/WiimoteTest/WiimoteInfo.vb b/WiimoteVB/WiimoteTest/WiimoteInfo.vb new file mode 100644 index 0000000..5e3153c --- /dev/null +++ b/WiimoteVB/WiimoteTest/WiimoteInfo.vb @@ -0,0 +1,208 @@ +'//////////////////////////////////////////////////////////////////////////////// +' MultipleWiimoteForm.cs +' Managed Wiimote Library Tester +' Written by Brian Peek (http://www.brianpeek.com/) +' for MSDN's Coding4Fun (http://msdn.microsoft.com/coding4fun/) +' Visit http://blogs.msdn.com/coding4fun/archive/2007/03/14/1879033.aspx +' and http://www.codeplex.com/WiimoteLib +' for more information +'//////////////////////////////////////////////////////////////////////////////// + + +Imports Microsoft.VisualBasic +Imports System +Imports System.Drawing +Imports System.Drawing.Imaging +Imports System.Windows.Forms +Imports WiimoteLib + +Namespace WiimoteTest + Partial Public Class WiimoteInfo + Inherits UserControl + Private Delegate Sub UpdateWiimoteStateDelegate(ByVal args As WiimoteChangedEventArgs) + Private Delegate Sub UpdateExtensionChangedDelegate(ByVal args As WiimoteExtensionChangedEventArgs) + + Private b As New Bitmap(256, 192, PixelFormat.Format24bppRgb) + Private g As Graphics + Private mWiimote As Wiimote + + Public Sub New() + InitializeComponent() + g = Graphics.FromImage(b) + End Sub + + Public Sub New(ByVal wm As Wiimote) + Me.New() + mWiimote = wm + End Sub + + Public Sub UpdateState(ByVal args As WiimoteChangedEventArgs) + BeginInvoke(New UpdateWiimoteStateDelegate(AddressOf UpdateWiimoteChanged), args) + End Sub + + Public Sub UpdateExtension(ByVal args As WiimoteExtensionChangedEventArgs) + BeginInvoke(New UpdateExtensionChangedDelegate(AddressOf UpdateExtensionChanged), args) + End Sub + + Private Sub chkLED_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkLED2.CheckedChanged, chkLED4.CheckedChanged, chkLED3.CheckedChanged, chkLED1.CheckedChanged + mWiimote.SetLEDs(chkLED1.Checked, chkLED2.Checked, chkLED3.Checked, chkLED4.Checked) + End Sub + + Private Sub chkRumble_CheckedChanged(ByVal sender As Object, ByVal e As EventArgs) Handles chkRumble.CheckedChanged + mWiimote.SetRumble(chkRumble.Checked) + End Sub + + Private Sub UpdateWiimoteChanged(ByVal args As WiimoteChangedEventArgs) + Dim ws As WiimoteState = args.WiimoteState + + clbButtons.SetItemChecked(0, ws.ButtonState.A) + clbButtons.SetItemChecked(1, ws.ButtonState.B) + clbButtons.SetItemChecked(2, ws.ButtonState.Minus) + clbButtons.SetItemChecked(3, ws.ButtonState.Home) + clbButtons.SetItemChecked(4, ws.ButtonState.Plus) + clbButtons.SetItemChecked(5, ws.ButtonState.One) + clbButtons.SetItemChecked(6, ws.ButtonState.Two) + clbButtons.SetItemChecked(7, ws.ButtonState.Up) + clbButtons.SetItemChecked(8, ws.ButtonState.Down) + clbButtons.SetItemChecked(9, ws.ButtonState.Left) + clbButtons.SetItemChecked(10, ws.ButtonState.Right) + + lblAccel.Text = ws.AccelState.Values.ToString() + + chkLED1.Checked = ws.LEDState.LED1 + chkLED2.Checked = ws.LEDState.LED2 + chkLED3.Checked = ws.LEDState.LED3 + chkLED4.Checked = ws.LEDState.LED4 + + Select Case ws.ExtensionType + Case ExtensionType.Nunchuk + lblChuk.Text = ws.NunchukState.AccelState.Values.ToString() + lblChukJoy.Text = ws.NunchukState.Joystick.ToString() + chkC.Checked = ws.NunchukState.C + chkZ.Checked = ws.NunchukState.Z + + Case ExtensionType.ClassicController + clbCCButtons.SetItemChecked(0, ws.ClassicControllerState.ButtonState.A) + clbCCButtons.SetItemChecked(1, ws.ClassicControllerState.ButtonState.B) + clbCCButtons.SetItemChecked(2, ws.ClassicControllerState.ButtonState.X) + clbCCButtons.SetItemChecked(3, ws.ClassicControllerState.ButtonState.Y) + clbCCButtons.SetItemChecked(4, ws.ClassicControllerState.ButtonState.Minus) + clbCCButtons.SetItemChecked(5, ws.ClassicControllerState.ButtonState.Home) + clbCCButtons.SetItemChecked(6, ws.ClassicControllerState.ButtonState.Plus) + clbCCButtons.SetItemChecked(7, ws.ClassicControllerState.ButtonState.Up) + clbCCButtons.SetItemChecked(8, ws.ClassicControllerState.ButtonState.Down) + clbCCButtons.SetItemChecked(9, ws.ClassicControllerState.ButtonState.Left) + clbCCButtons.SetItemChecked(10, ws.ClassicControllerState.ButtonState.Right) + clbCCButtons.SetItemChecked(11, ws.ClassicControllerState.ButtonState.ZL) + clbCCButtons.SetItemChecked(12, ws.ClassicControllerState.ButtonState.ZR) + clbCCButtons.SetItemChecked(13, ws.ClassicControllerState.ButtonState.TriggerL) + clbCCButtons.SetItemChecked(14, ws.ClassicControllerState.ButtonState.TriggerR) + + lblCCJoy1.Text = ws.ClassicControllerState.JoystickL.ToString() + lblCCJoy2.Text = ws.ClassicControllerState.JoystickR.ToString() + + lblTriggerL.Text = ws.ClassicControllerState.TriggerL.ToString() + lblTriggerR.Text = ws.ClassicControllerState.TriggerR.ToString() + + Case ExtensionType.Guitar + clbGuitarButtons.SetItemChecked(0, ws.GuitarState.FretButtonState.Green) + clbGuitarButtons.SetItemChecked(1, ws.GuitarState.FretButtonState.Red) + clbGuitarButtons.SetItemChecked(2, ws.GuitarState.FretButtonState.Yellow) + clbGuitarButtons.SetItemChecked(3, ws.GuitarState.FretButtonState.Blue) + clbGuitarButtons.SetItemChecked(4, ws.GuitarState.FretButtonState.Orange) + clbGuitarButtons.SetItemChecked(5, ws.GuitarState.ButtonState.Minus) + clbGuitarButtons.SetItemChecked(6, ws.GuitarState.ButtonState.Plus) + clbGuitarButtons.SetItemChecked(7, ws.GuitarState.ButtonState.StrumUp) + clbGuitarButtons.SetItemChecked(8, ws.GuitarState.ButtonState.StrumDown) + + clbTouchbar.SetItemChecked(0, ws.GuitarState.TouchbarState.Green) + clbTouchbar.SetItemChecked(1, ws.GuitarState.TouchbarState.Red) + clbTouchbar.SetItemChecked(2, ws.GuitarState.TouchbarState.Yellow) + clbTouchbar.SetItemChecked(3, ws.GuitarState.TouchbarState.Blue) + clbTouchbar.SetItemChecked(4, ws.GuitarState.TouchbarState.Orange) + + lblGuitarJoy.Text = ws.GuitarState.Joystick.ToString() + lblGuitarWhammy.Text = ws.GuitarState.WhammyBar.ToString() + lblGuitarType.Text = ws.GuitarState.GuitarType.ToString() + + Case ExtensionType.Drums + clbDrums.SetItemChecked(0, ws.DrumsState.Red) + clbDrums.SetItemChecked(1, ws.DrumsState.Blue) + clbDrums.SetItemChecked(2, ws.DrumsState.Green) + clbDrums.SetItemChecked(3, ws.DrumsState.Yellow) + clbDrums.SetItemChecked(4, ws.DrumsState.Orange) + clbDrums.SetItemChecked(5, ws.DrumsState.Pedal) + clbDrums.SetItemChecked(6, ws.DrumsState.Minus) + clbDrums.SetItemChecked(7, ws.DrumsState.Plus) + + lbDrumVelocity.Items.Clear() + lbDrumVelocity.Items.Add(ws.DrumsState.RedVelocity) + lbDrumVelocity.Items.Add(ws.DrumsState.BlueVelocity) + lbDrumVelocity.Items.Add(ws.DrumsState.GreenVelocity) + lbDrumVelocity.Items.Add(ws.DrumsState.YellowVelocity) + lbDrumVelocity.Items.Add(ws.DrumsState.OrangeVelocity) + lbDrumVelocity.Items.Add(ws.DrumsState.PedalVelocity) + + lblDrumJoy.Text = ws.DrumsState.Joystick.ToString() + + Case ExtensionType.BalanceBoard + If chkLbs.Checked Then + lblBBTL.Text = ws.BalanceBoardState.SensorValuesLb.TopLeft.ToString() + lblBBTR.Text = ws.BalanceBoardState.SensorValuesLb.TopRight.ToString() + lblBBBL.Text = ws.BalanceBoardState.SensorValuesLb.BottomLeft.ToString() + lblBBBR.Text = ws.BalanceBoardState.SensorValuesLb.BottomRight.ToString() + lblBBTotal.Text = ws.BalanceBoardState.WeightLb.ToString() + Else + lblBBTL.Text = ws.BalanceBoardState.SensorValuesKg.TopLeft.ToString() + lblBBTR.Text = ws.BalanceBoardState.SensorValuesKg.TopRight.ToString() + lblBBBL.Text = ws.BalanceBoardState.SensorValuesKg.BottomLeft.ToString() + lblBBBR.Text = ws.BalanceBoardState.SensorValuesKg.BottomRight.ToString() + lblBBTotal.Text = ws.BalanceBoardState.WeightKg.ToString() + End If + lblCOG.Text = ws.BalanceBoardState.CenterOfGravity.ToString() + End Select + + g.Clear(Color.Black) + + UpdateIR(ws.IRState.IRSensors(0), lblIR1, lblIR1Raw, chkFound1, Color.Red) + UpdateIR(ws.IRState.IRSensors(1), lblIR2, lblIR2Raw, chkFound2, Color.Blue) + UpdateIR(ws.IRState.IRSensors(2), lblIR3, lblIR3Raw, chkFound3, Color.Yellow) + UpdateIR(ws.IRState.IRSensors(3), lblIR4, lblIR4Raw, chkFound4, Color.Orange) + + If ws.IRState.IRSensors(0).Found AndAlso ws.IRState.IRSensors(1).Found Then + g.DrawEllipse(New Pen(Color.Green), CInt(Fix(ws.IRState.RawMidpoint.X / 4)), CInt(Fix(ws.IRState.RawMidpoint.Y / 4)), 2, 2) + End If + + pbIR.Image = b + + If ws.Battery > &Hc8 Then + pbBattery.Value = (&Hc8) + Else + pbBattery.Value = (CInt(Fix(ws.Battery))) + End If + lblBattery.Text = ws.Battery.ToString() + lblDevicePath.Text = "Device Path: " & mWiimote.HIDDevicePath + End Sub + + Private Sub UpdateIR(ByVal irSensor As IRSensor, ByVal lblNorm As Label, ByVal lblRaw As Label, ByVal chkFound As CheckBox, ByVal color As Color) + chkFound.Checked = irSensor.Found + + If irSensor.Found Then + lblNorm.Text = irSensor.Position.ToString() & ", " & irSensor.Size + lblRaw.Text = irSensor.RawPosition.ToString() + g.DrawEllipse(New Pen(color), CInt(Fix(irSensor.RawPosition.X / 4)), CInt(Fix(irSensor.RawPosition.Y / 4)), irSensor.Size+1, irSensor.Size+1) + End If + End Sub + + Private Sub UpdateExtensionChanged(ByVal args As WiimoteExtensionChangedEventArgs) + chkExtension.Text = args.ExtensionType.ToString() + chkExtension.Checked = args.Inserted + End Sub + + Public WriteOnly Property Wiimote() As Wiimote + Set(ByVal value As Wiimote) + mWiimote = value + End Set + End Property + End Class +End Namespace diff --git a/WiimoteVB/WiimoteTest/WiimoteTest.vbproj b/WiimoteVB/WiimoteTest/WiimoteTest.vbproj new file mode 100644 index 0000000..c78dfd0 --- /dev/null +++ b/WiimoteVB/WiimoteTest/WiimoteTest.vbproj @@ -0,0 +1,108 @@ + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {48223EAB-B2E0-4A64-9074-4444662EB693} + WinExe + + + WiimoteTest + + + 2.0 + + + + + true + full + false + bin\Debug\ + true + true + prompt + + + pdbonly + true + bin\Release\ + false + true + prompt + + + + + + + + + + + Form + + + SingleWiimoteForm.vb + + + Form + + + MultipleWiimoteForm.vb + + + + + Designer + SingleWiimoteForm.vb + + + MultipleWiimoteForm.vb + Designer + + + ResXFileCodeGenerator + Resources.Designer.vb + Designer + + + WiimoteInfo.vb + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.vb + + + True + Settings.settings + True + + + UserControl + + + WiimoteInfo.vb + + + + + {37A555DF-7012-4B99-8A47-1C922A361E52} + WiimoteLib + + + + + \ No newline at end of file