summaryrefslogtreecommitdiff
path: root/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h
diff options
context:
space:
mode:
authorDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
committerDave Wilson <[email protected]>2015-03-17 19:50:07 -0700
commit97cf5197cf5b882b2c689d8dc2b555f2edf8f418 (patch)
tree46f3701832d70b420eb0fc0eb93261f9da45db3f /sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h
parentef1905bf1e8825bb31120dfb27e0daf3154d859a (diff)
Initial publish
Diffstat (limited to 'sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h')
-rw-r--r--sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h b/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h
new file mode 100644
index 00000000..8f96b902
--- /dev/null
+++ b/sensors/SimpleDeviceOrientationSensor/HardwareSimulator.h
@@ -0,0 +1,58 @@
+//Copyright (C) Microsoft Corporation, All Rights Reserved
+//
+//Abstract:
+//
+// This module contains the type definitions for the simple device orientation sensor sample
+// hardware simulator.
+//
+//Environment:
+//
+// Windows User-Mode Driver Framework (UMDF)
+
+#pragma once
+
+#include <windows.h>
+#include <wdf.h>
+
+#include <SensorsTrace.h>
+#include <SensorsCx.h>
+#include <windows.devices.sensors.h>
+
+#define HardwareSimulator_HardwareInterval (1000)
+
+typedef enum _SIMULATOR_STATE
+{
+ SimulatorState_NotInitialized = 0,
+ SimulatorState_Initialized,
+ SimulatorState_Started
+} SIMULATOR_STATE;
+
+typedef class _HardwareSimulator
+{
+private:
+ WDFTIMER m_Timer;
+ ULONG m_Index;
+ WDFWAITLOCK m_Lock;
+ SIMULATOR_STATE m_State;
+ WDFOBJECT m_SimulatorInstance;
+
+public:
+ _HardwareSimulator();
+ ~_HardwareSimulator();
+
+ // WDF callbacks
+ static EVT_WDF_TIMER OnTimerExpire;
+
+ static NTSTATUS Initialize(_In_ WDFDEVICE Device, _Out_ WDFOBJECT *SimulatorInstance);
+ NTSTATUS Cleanup();
+ NTSTATUS Start();
+ NTSTATUS Stop();
+ ABI::Windows::Devices::Sensors::SimpleOrientation GetOrientation();
+
+private:
+ NTSTATUS InitializeInternal(_In_ WDFOBJECT SimulatorInstance);
+
+} HardwareSimulator, *PHardwareSimulator;
+
+// Set up accessor function to retrieve device context
+WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(HardwareSimulator, GetHardwareSimulatorContextFromInstance);