Gyrometer Class
회전계 센서를 나타냅니다.
이 센서는 x, y 및 z축에 대한 각 속도 값을 반환합니다.
구문
특성
- DualApiPartitionAttribute()
- MarshalingBehaviorAttribute(Agile)
- StaticAttribute(Windows.Devices.Sensors.IGyrometerStatics, NTDDI_WIN8)
- ThreadingAttribute(Both)
- VersionAttribute(NTDDI_WIN8)
구성원
Gyrometer클래스에는 다음과 같은 유형의 구성원이 있습니다.
이벤트
Gyrometer클래스에는 다음 이벤트가 있습니다.
| 이벤트 | 설명 |
|---|---|
| ReadingChanged | Occurs each time the gyrometer reports the current sensor reading. |
메서드
The Gyrometer 클래스 다음 메서드가 있습니다. C#, Visual Basic 및 C++에서는 다음에서 메서드를 상속합니다. Object 클래스.
| 메서드 | 설명 |
|---|---|
| GetCurrentReading | Gets the current gyrometer reading. |
| GetDefault | Returns the default gyrometer. |
속성
Gyrometer클래스 다음 속성이 있습니다.
| 속성 | 액세스 유형 | 설명 |
|---|---|---|
| 읽기 전용 | Gets the minimum report interval supported by the gyrometer. | |
| 읽기/쓰기 | Gets or sets the current report interval for the gyrometer. |
설명
다음 예제에서는 XAML 및 C#로 작성된 Windows 스토어 앱에서 GetDefault 메서드를 사용하여 회전계와의 연결을 설정하는 방법을 보여 줍니다. 통합 회전계가 없을 경우 메서드는 null 값을 반환합니다.
_gyrometer = Gyrometer.GetDefault();
다음 예제에서는 XAML로 작성된 Windows 스토어 앱이 ReadingChanged 이벤트 처리기를 등록하는 방법을 보여 줍니다.
private void ScenarioEnable(object sender, RoutedEventArgs e) { if (_gyrometer != null) { // Establish the report interval _gyrometer.ReportInterval = _desiredReportInterval; Window.Current.VisibilityChanged += new WindowVisibilityChangedEventHandler(VisibilityChanged); _gyrometer.ReadingChanged += new TypedEventHandler<Gyrometer, GyrometerReadingChangedEventArgs>(ReadingChanged); ScenarioEnableButton.IsEnabled = false; ScenarioDisableButton.IsEnabled = true; } else { rootPage.NotifyUser("No gyrometer found", NotifyType.StatusMessage); } }
다음 예제에서는 ReadingChanged 이벤트 처리기를 보여 줍니다.
async private void ReadingChanged(object sender, GyrometerReadingChangedEventArgs e) { await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { GyrometerReading reading = e.Reading; ScenarioOutput_X.Text = String.Format("{0,5:0.00}", reading.AngularVelocityX); ScenarioOutput_Y.Text = String.Format("{0,5:0.00}", reading.AngularVelocityY); ScenarioOutput_Z.Text = String.Format("{0,5:0.00}", reading.AngularVelocityZ); }); }
요구 사항
|
지원되는 최소 클라이언트 | Windows 8 [Windows 스토어 앱, 데스크톱 앱] |
|---|---|
|
지원되는 최소 서버 | Windows Server 2012 [Windows 스토어 앱, 데스크톱 앱] |
|
지원되는 최소 전화 | Windows Phone 8 |
|
네임스페이스 |
|
|
메타데이터 |
|
참고 항목