本文整理汇总了C#中SensorReadingEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# SensorReadingEventArgs类的具体用法?C# SensorReadingEventArgs怎么用?C# SensorReadingEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SensorReadingEventArgs类属于命名空间,在下文中一共展示了SensorReadingEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: accelerometer_CurrentValueChanged
void accelerometer_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
{
AddJOValue("accX", e.SensorReading.Acceleration.X);
AddJOValue("accY", e.SensorReading.Acceleration.Y);
AddJOValue("accZ", e.SensorReading.Acceleration.Z);
AddJOValue("timestamp", DeviceTools.GetUnixTime());
}
示例2: gyroscope_CurrentValueChanged
/// <summary>
/// Get the current rotation rate. This value is in radians per second.
/// </summary>
/// <returns>The MainViewModel object.</returns>
void gyroscope_CurrentValueChanged(object sender, SensorReadingEventArgs<GyroscopeReading> e)
{
AddJOValue("currentRotationRateX", e.SensorReading.RotationRate.X);
AddJOValue("currentRotationRateY", e.SensorReading.RotationRate.Y);
AddJOValue("currentRotationRateZ", e.SensorReading.RotationRate.Z);
AddJOValue("timestamp", DeviceTools.GetUnixTime());
}
示例3: AccelerometerOnCurrentValueChanged
/// <summary>
/// Accelerometers the on current value changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="sensorReadingEventArgs">The sensor reading event arguments.</param>
private void AccelerometerOnCurrentValueChanged(
object sender,
SensorReadingEventArgs<AccelerometerReading> sensorReadingEventArgs)
{
LatestReading = sensorReadingEventArgs.SensorReading.Acceleration.AsVector3();
readingAvailable.Invoke(sender, LatestReading);
}
示例4: acc_CurrentValueChanged
void acc_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
{
//Dispatcher.BeginInvoke(() => UpdateUI(e.SensorReading));
AccelerometerReading t =e.SensorReading;
Vector3 a=t.Acceleration;
if (Math.Abs(a.X) < Math.Abs(this.currentThreshold)) return;
if (a.X * this.currentThreshold > 0)
{
this.accQuicklyForwardTime = t.Timestamp;
}
else if(t.Timestamp - this.accQuicklyForwardTime < TimeSpan.FromSeconds(.2))
{
this.accQuicklyForwardTime = DateTimeOffset.MinValue;
this.Dispatcher.BeginInvoke(delegate()
{
switch (this.random.Next(0, 4))
{
case 0: SoundEffects.Punch1.Play(); break;
case 1: SoundEffects.Punch2.Play(); break;
case 2: SoundEffects.Punch3.Play(); break;
case 3: SoundEffects.Punch4.Play(); break;
}
switch (this.random.Next(0, 10))
{
case 0: SoundEffects.Grunt1.Play(); break;
case 1: SoundEffects.Grunt2.Play(); break;
case 2: SoundEffects.Grunt3.Play(); break;
}
});
}
}
示例5: ReadingChanged
private void ReadingChanged(SensorReadingEventArgs<AccelerometerReading> e)
{
Vector3 currentReading = e.SensorReading.Acceleration;
double distanceTraveled = 2;
double boundingBoxStrokeThickness = boundingBox.StrokeThickness;
double rightBumper = ContentGrid.Width - ball.Width - boundingBoxStrokeThickness; // right margin is 0
double leftBumper = ContentGrid.Margin.Left + boundingBoxStrokeThickness; // left margin is non-zero
double bottomBumper = ContentGrid.Height - ball.Height - boundingBoxStrokeThickness;
double topBumper = ContentGrid.Margin.Top + boundingBoxStrokeThickness;
double acceleration = Math.Abs(currentReading.Z) == 0 ? 0.02 : Math.Abs(currentReading.Z);
// acceleration = (acceleration * 2)%2;
Debug.WriteLine("Accel" + acceleration);
double ballX = (double)ball.GetValue(Canvas.LeftProperty) +(double)distanceTraveled * (currentReading.X / acceleration);
double ballY = (double)ball.GetValue(Canvas.TopProperty) - (double)distanceTraveled * (currentReading.Y / acceleration);
if (ballX < leftBumper) {
ballX = leftBumper;
}
else if (ballX > rightBumper) {
ballX = rightBumper;
}
if (ballY < topBumper) {
ballY = topBumper;
}
else if (ballY > bottomBumper) {
ballY = bottomBumper;
}
ball.SetValue(Canvas.LeftProperty, ballX);
ball.SetValue(Canvas.TopProperty, ballY);
}
示例6: gyro_CurrentValueChanged
void gyro_CurrentValueChanged(object sender, SensorReadingEventArgs<GyroscopeReading> e)
{
Dispatcher.BeginInvoke(() =>
{
txtRotRate.Text = string.Format("{0},{1},{2}", e.SensorReading.RotationRate.X, e.SensorReading.RotationRate.Y, e.SensorReading.RotationRate.Z);
txtTimestamp.Text = e.SensorReading.Timestamp.ToString();
});
}
示例7: gyroscope_CurrentValueChanged
void gyroscope_CurrentValueChanged(object sender, SensorReadingEventArgs<GyroscopeReading> e)
{
var reading = e.SensorReading;
var rate = reading.RotationRate;
this.readingAvailable.Invoke<GyroReading>(
sender,
new GyroReading(reading.Timestamp, rate.X, rate.Y, rate.Z));
}
示例8: GyroscopeCurrentValueChanged
/// <summary>
/// Gyroscopes the current value changed.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The e.</param>
private void GyroscopeCurrentValueChanged(object sender, SensorReadingEventArgs<GyroscopeReading> e)
{
if (_gyroscope.IsDataValid)
{
LatestReading = e.SensorReading.RotationRate.AsVector3();
readingAvailable.Invoke(this, this.LatestReading);
}
}
示例9: LeerEstado
private void LeerEstado(object sender, SensorReadingEventArgs<AccelerometerReading> e) {
Dispatcher.BeginInvoke(() =>
{
txbox_x.Text = e.SensorReading.Acceleration.X.ToString();
txbox_y.Text = e.SensorReading.Acceleration.Y.ToString();
txbox_z.Text = e.SensorReading.Acceleration.Z.ToString();
});
}
示例10: motion_CurrentValueChanged
public void motion_CurrentValueChanged(object sender, SensorReadingEventArgs<MotionReading> e)
{
if (motion.IsDataValid)
{
values[0] = e.SensorReading.Attitude.Yaw;
values[1] = e.SensorReading.Attitude.Pitch;
values[2] = e.SensorReading.Attitude.Roll;
}
}
示例11: GyroscopeCurrentValueChanged
void GyroscopeCurrentValueChanged(object sender, SensorReadingEventArgs<GyroscopeReading> e)
{
Deployment.Current.Dispatcher.BeginInvoke(() =>
{
tbXCoordinate.Text = e.SensorReading.RotationRate.X.ToString();
tbYCoordinate.Text = e.SensorReading.RotationRate.Y.ToString();
tbZCoordinate.Text = e.SensorReading.RotationRate.Z.ToString();
});
}
示例12: _compass_CurrentValueChanged
void _compass_CurrentValueChanged(object sender, SensorReadingEventArgs<CompassReading> e)
{
lock (_locker)
{
_trueHeading = e.SensorReading.TrueHeading.ToString();
Monitor.Pulse(_locker);
}
}
示例13: AccelerometerOnCurrentValueChanged
private static void AccelerometerOnCurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> sensorReadingEventArgs)
{
if (readingAvailable != null)
{
var ac = sensorReadingEventArgs.SensorReading.Acceleration;
readingAvailable.Invoke(
accelerometer,
new AccelometerStatus(ac.X, ac.Y, ac.Z));
}
}
示例14: compass_CurrentValueChanged
void compass_CurrentValueChanged(object sender, SensorReadingEventArgs<CompassReading> e)
{
AddJOValue("trueHeading", e.SensorReading.TrueHeading);
AddJOValue("magneticHeading", e.SensorReading.MagneticHeading);
AddJOValue("headingAccuracy", e.SensorReading.HeadingAccuracy);
AddJOValue("rawMagneticReadingX", e.SensorReading.MagnetometerReading.X);
AddJOValue("rawMagneticReadingY", e.SensorReading.MagnetometerReading.Y);
AddJOValue("rawMagneticReadingZ", e.SensorReading.MagnetometerReading.Z);
AddJOValue("timestamp", DeviceTools.GetUnixTime());
}
示例15: _accelerometer_CurrentValueChanged
private void _accelerometer_CurrentValueChanged(object sender, SensorReadingEventArgs<AccelerometerReading> e)
{
lock (_locker)
{
_xyz = string.Format("{0:0.00}, {1:0.00}, {2:0.00}", e.SensorReading.Acceleration.X,
e.SensorReading.Acceleration.Y,
e.SensorReading.Acceleration.Z);
Monitor.Pulse(_locker);
}
}