Gyrometer 클래스

정의

x, y 및 z 축과 관련하여 각 속도 값을 제공하는 회전계 센서를 나타냅니다.

public ref class Gyrometer sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class Gyrometer final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class Gyrometer
Public NotInheritable Class Gyrometer
상속
Object Platform::Object IInspectable Gyrometer
특성

Windows 요구 사항

디바이스 패밀리
Windows 10 (10.0.10240.0에서 도입되었습니다.)
API contract
Windows.Foundation.UniversalApiContract (v1.0에서 도입되었습니다.)

예제

구현의 예는 회전계 샘플을 참조하세요.

설명

센서 데이터는 디바이스의 고정 센서 좌표계를 기준으로 제공되며 디스플레이 방향과 독립적입니다. 입력 제어를 위해 센서 데이터를 사용하거나 화면의 요소를 조작하는 애플리케이션의 경우 개발자는 현재 디스플레이 방향을 고려하여 데이터를 적절하게 보정해야 합니다. 센서 좌표계에 대한 자세한 내용은 센서 데이터 및 디스플레이 방향을 참조하세요.

다음 예제에서는 XAML 및 C#으로 빌드된 UWP 앱이 GetDefault 메서드를 사용하여 회전계에 대한 연결을 설정하는 방법을 보여 줍니다. 통합 회전계를 찾을 수 없는 경우 메서드는 null 값을 반환합니다.

_gyrometer = Gyrometer.GetDefault();

다음 예제에서는 XAML로 빌드된 UWP 앱이 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 버전 SDK 버전 추가된 값
1709 16299 FromIdAsync
1709 16299 GetDeviceSelector
1709 16299 MaxBatchSize
1709 16299 ReportLatency
2004 19041 ReportThreshold

속성

DeviceId

디바이스 식별자를 가져옵니다.

MaxBatchSize

센서에서 일괄 처리할 수 있는 최대 이벤트 수를 가져옵니다.

MinimumReportInterval

회전계에서 지원하는 최소 보고서 간격을 가져옵니다.

ReadingTransform

센서 데이터에 적용해야 하는 변환을 가져오거나 설정합니다. 적용할 변환은 센서 데이터를 정렬할 디스플레이 방향과 연결됩니다.

ReportInterval

회전계의 현재 보고서 간격을 가져오거나 설정합니다.

ReportLatency

센서 정보의 일괄 처리 사이의 지연을 가져오거나 설정합니다.

ReportThreshold

회전계 센서의 GyrometerDataThreshold를 가져옵니다 .

메서드

FromIdAsync(String)

식별자에서 센서를 비동기적으로 가져옵니다.

GetCurrentReading()

현재 회전계 판독값을 가져옵니다.

GetDefault()

기본 회전계를 반환합니다.

GetDeviceSelector()

디바이스 선택기를 가져옵니다.

이벤트

ReadingChanged

회전계가 현재 센서 판독값을 보고할 때마다 발생합니다.

적용 대상

추가 정보