private void reportingmodeBox_SelectedIndexChanged(object sender, EventArgs e) { ReportingMode selectedReportingMode = (ReportingMode)reportingmodeBox.SelectedItem; if (Wiimote.ReportingMode != selectedReportingMode && selectedReportingMode != ReportingMode.None) { Wiimote.SetReportingMode(selectedReportingMode); } }
public virtual void SetReportingMode(ReportingMode reportMode) { if (reportMode == ReportingMode.None) { throw new ArgumentException("The ReportingMode cannot be set to None.", "reportMode"); } CreateReport(OutputReport.SetDataReportMode); OutputBuffer[1] = 0x04; OutputBuffer[2] = (byte)reportMode; SendReport(); }
private void SetReportingMode(ReportingMode mode) { FSLog.Debug(CurrentMode, "=>", mode); if (Timer == null) { FSLog.Info("Not running"); return; } Timer.Stop(); if (mode == ReportingMode.Reporting) { CreateLocator(accuracyInMeters: 10, movementThreshold: 10, reportInterval: 2000); // Wait for 10 secs to get good position // Location updates checks if new position has better accuracy // and stores it if it does as best position. // When timer triggers, the best position is sent via LocationChanged event Timer.Interval = ReportingDuration; } else { // Destroy high accuracy locator if (Locator != null) { Locator.PositionChanged -= Locator_PositionChanged; Locator = null; } // The time we stay in idle mode Timer.Interval = IdleDuration; BestPosition = null; } CurrentMode = mode; Timer.Start(); }
private void CalibrateWiimote() { IWiimote wiimote = (IWiimote)Device; ReportingMode oldReportingMode = wiimote.ReportingMode; wiimote.SetReportingMode(ReportingMode.ButtonsAccelerometer); AccelerometerAxes <ushort> raw = wiimote.Accelerometer.Raw; Gtk.MessageDialog dialog = new Gtk.MessageDialog(null, Gtk.DialogFlags.Modal, Gtk.MessageType.Info, Gtk.ButtonsType.OkCancel, false, "Place the wiimote on a table.", new object[0]); if (dialog.Run() == -5) { ushort xZero, yZero, zZero, xOne, yOne, zOne = 0; xZero = raw.X; yZero = raw.Y; zOne = raw.Z; dialog.Markup = "Place the wiimote on its left side."; if (dialog.Run() == -5) { xOne = raw.X; zZero = raw.Z; // Invert zOne (so that the values are negated). zOne = (ushort)(zZero - (zOne - zZero)); dialog.Markup = "Place the wiimote on its lower side, so that it points up."; if (dialog.Run() == -5) { yOne = raw.Y; wiimote.WriteMemory(0x16, new byte[] { (byte)xZero, (byte)yZero, (byte)zZero, 0, (byte)xOne, (byte)yOne, (byte)zOne, 0 }, 0, 8); wiimote.Initialize(); } } } dialog.Destroy(); wiimote.SetReportingMode(oldReportingMode); }
private void calibrateToolStripMenuItem_Click(object sender, EventArgs e) { IWiimote wiimote = Wiimote; ReportingMode oldReportingMode = wiimote.ReportingMode; wiimote.SetReportingMode(ReportingMode.ButtonsAccelerometer); AccelerometerAxes <ushort> raw = wiimote.Accelerometer.Raw; if (MessageBox.Show("Place the wiimote on a table.", "Calibration", MessageBoxButtons.OKCancel) == DialogResult.OK) { ushort xZero, yZero, zZero, xOne, yOne, zOne = 0; xZero = raw.X; yZero = raw.Y; zOne = raw.Z; if (MessageBox.Show("Place the wiimote on its left side.", "Calibration", MessageBoxButtons.OKCancel) == DialogResult.OK) { xOne = raw.X; zZero = raw.Z; // Invert zOne (so that the values are negated). zOne = (ushort)(zZero - (zOne - zZero)); if (MessageBox.Show("Place the wiimote on its lower side, so that it points up.", "Calibration", MessageBoxButtons.OKCancel) == DialogResult.OK) { yOne = raw.Y; wiimote.WriteMemory(0x16, new byte[] { (byte)xZero, (byte)yZero, (byte)zZero, 0, (byte)xOne, (byte)yOne, (byte)zOne, 0 }, 0, 8); wiimote.Initialize(); } } } wiimote.SetReportingMode(oldReportingMode); }
public override void SetReportingMode(ReportingMode reportMode) { SetIRMode(GetIrMode((InputReport)reportMode)); base.SetReportingMode(reportMode); }
public virtual void SetReportingMode(ReportingMode reportMode) { if (reportMode == ReportingMode.None) throw new ArgumentException("The ReportingMode cannot be set to None.", "reportMode"); CreateReport(OutputReport.SetDataReportMode); OutputBuffer[1] = 0x04; OutputBuffer[2] = (byte)reportMode; SendReport(); }
public Sensor Create(ReportingMode mode) { return(new Sensor(this, mode)); }