本文整理汇总了C#中Sensor.SetProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Sensor.SetProperties方法的具体用法?C# Sensor.SetProperties怎么用?C# Sensor.SetProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sensor
的用法示例。
在下文中一共展示了Sensor.SetProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WeTabSensorData
/// <summary>
/// Initializes a new instance of the <see cref="WeTabSensorData"/> class.
/// </summary>
/// <param name="sensor">The sensor.</param>
/// <param name="report">The report object.</param>
public WeTabSensorData(Sensor sensor, SensorReport report)
{
// Get the message type
int message = Convert.ToInt32(report.Values[GetMessage.FormatId][0]);
switch (message)
{
case 0xea:
Message = WeTabSensorMessage.RotationChanged;
break;
case 0x94:
Message = WeTabSensorMessage.SensorButtonDown;
break;
case 0x95:
Message = WeTabSensorMessage.SensorButtonUp;
break;
default:
Message = WeTabSensorMessage.Unknown;
break;
}
// To read the accelerometer rotation we need to update
// the x,y,z properties
DataFieldInfo[] info = {
new DataFieldInfo(GetAcceleratorXRotation, "XLRX"),
new DataFieldInfo(GetAcceleratorYRotation, "XLRY"),
new DataFieldInfo(GetAcceleratorZRotation, "XLRZ")
};
IDictionary<PropertyKey, object> result = sensor.SetProperties(info);
XRotation = Convert.ToInt32(result[GetAcceleratorXRotation]);
YRotation = Convert.ToInt32(result[GetAcceleratorYRotation]);
ZRotation = Convert.ToInt32(result[GetAcceleratorZRotation]);
Orientation = CalculateOrientation(XRotation, YRotation, ZRotation);
}