protected void ParseStatus(byte[] buff) { bool extensionConnected = (buff[3] & 0x02) != 0; _IsSpeakerEnabled = (buff[3] & 0x04) != 0; _IrSensorEnabled = (buff[3] & 0x08) != 0; _Leds = ((buff[3] & 0x10) == 0 ? WiimoteLeds.None : WiimoteLeds.Led1) | ((buff[3] & 0x20) == 0 ? WiimoteLeds.None : WiimoteLeds.Led2) | ((buff[3] & 0x40) == 0 ? WiimoteLeds.None : WiimoteLeds.Led3) | ((buff[3] & 0x80) == 0 ? WiimoteLeds.None : WiimoteLeds.Led4); BatteryLevel = buff[6]; if (extensionConnected && _Extension == null) { InitializeExtension(); } else if (_Extension != null && !extensionConnected) { ReportingMode = ReportingMode.None; if (ExtensionDetached != null) { ExtensionDetached(this, new WiimoteExtensionEventArgs(_Extension)); } _Extension = null; } }
protected void SetLeds(WiimoteLeds leds) { CreateReport(OutputReport.SetLeds); OutputBuffer[1] = (byte)((byte)leds << 4); SendReport(); }
private bool IsLedOn(WiimoteLeds led) { return((_Wiimote.Leds & led) == led); }
protected void ParseStatus(byte[] buff) { bool extensionConnected = (buff[3] & 0x02) != 0; _IsSpeakerEnabled = (buff[3] & 0x04) != 0; _IrSensorEnabled = (buff[3] & 0x08) != 0; _Leds = ((buff[3] & 0x10) == 0 ? WiimoteLeds.None : WiimoteLeds.Led1) | ((buff[3] & 0x20) == 0 ? WiimoteLeds.None : WiimoteLeds.Led2) | ((buff[3] & 0x40) == 0 ? WiimoteLeds.None : WiimoteLeds.Led3) | ((buff[3] & 0x80) == 0 ? WiimoteLeds.None : WiimoteLeds.Led4); BatteryLevel = buff[6]; if (extensionConnected && _Extension == null) InitializeExtension(); else if (_Extension != null && !extensionConnected) { ReportingMode = ReportingMode.None; if(ExtensionDetached != null) ExtensionDetached(this, new WiimoteExtensionEventArgs(_Extension)); _Extension = null; } }