diff options
| author | J M Rossy <[email protected]> | 2015-07-29 15:40:09 -0700 |
|---|---|---|
| committer | J M Rossy <[email protected]> | 2015-07-29 16:34:40 -0700 |
| commit | 5d61a4a79a1e96dc5d9af1e5e712c84507307544 (patch) | |
| tree | 49ed270893578cd18758b74ffcca16dc7ab948d6 /wpd/WpdBasicHardwareDriver/WpdObjectProperties.h | |
| parent | 5d41613e26e147d2300c786bb2b34cb4b4067a25 (diff) | |
Samples update for public Windows 10 release
Fix #2 Enabling WPP Recorder in Sensors Samples causes errors
Fix #4 Add back fixed KMDOD sample
Add new BarcodeScanner sample in pos folder
Add new MagneticStripeReader sample in pos folder
Add new SynpaticsTouch sample in input folder
Add new Power Engine Plugin sample in pofx folder
Add new DeviceMft sample in avstream folder
Add new AvsCamera sample in root
Add new SimBatt sample in root
Add other pre-existing samples not yet released for Win10
Diffstat (limited to 'wpd/WpdBasicHardwareDriver/WpdObjectProperties.h')
| -rw-r--r-- | wpd/WpdBasicHardwareDriver/WpdObjectProperties.h | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/wpd/WpdBasicHardwareDriver/WpdObjectProperties.h b/wpd/WpdBasicHardwareDriver/WpdObjectProperties.h new file mode 100644 index 00000000..1860e0ad --- /dev/null +++ b/wpd/WpdBasicHardwareDriver/WpdObjectProperties.h @@ -0,0 +1,111 @@ +#pragma once + +#define DEVICE_PROTOCOL_VALUE L"Sensor Protocol ver 1.00" +#define DEVICE_FIRMWARE_VERSION_VALUE L"1.0.0.0" +#define DEVICE_POWER_LEVEL_VALUE 100 +#define DEVICE_MODEL_VALUE L"RS232 Sensor" +#define DEVICE_FRIENDLY_NAME_VALUE L"Parallax BS2 Sensor" +#define DEVICE_MANUFACTURER_VALUE L"Windows Portable Devices Group" +#define DEVICE_SERIAL_NUMBER_VALUE L"01234567890123-45676890123456" +#define DEVICE_SUPPORTS_NONCONSUMABLE_VALUE FALSE + +#define SENSOR_OBJECT_ID L"Sensor" +#define SENSOR_OBJECT_NAME_VALUE L"Parallax Sensor" +#define COMPASS_SENSOR_OBJECT_ID L"Compass" +#define COMPASS_SENSOR_OBJECT_NAME_VALUE L"HM55B Compass Sensor" +#define PIR_SENSOR_OBJECT_ID L"PIR" +#define PIR_SENSOR_OBJECT_NAME_VALUE L"Passive Infra-Red Sensor" +#define QTI_SENSOR_OBJECT_ID L"QTI" +#define QTI_SENSOR_OBJECT_NAME_VALUE L"QTI Light Sensor" +#define FLEX_SENSOR_OBJECT_ID L"Flex" +#define FLEX_SENSOR_OBJECT_NAME_VALUE L"Flex Force Sensor" +#define PING_SENSOR_OBJECT_ID L"Ping" +#define PING_SENSOR_OBJECT_NAME_VALUE L"Ultrasonic Distance Sensor" +#define PIEZO_SENSOR_OBJECT_ID L"Piezo" +#define PIEZO_SENSOR_OBJECT_NAME_VALUE L"Piezo Vibration Sensor" +#define TEMP_SENSOR_OBJECT_ID L"TempHumidity" +#define TEMP_SENSOR_OBJECT_NAME_VALUE L"Sensiron Temperature and Humidity Sensor" +#define MEMSIC_SENSOR_OBJECT_ID L"Memsic" +#define MEMSIC_SENSOR_OBJECT_NAME_VALUE L"Memsic Dual-Axis G-Force Sensor" +#define HITACHI_SENSOR_OBJECT_ID L"Hitachi" +#define HITACHI_SENSOR_OBJECT_NAME_VALUE L"Hitachi Tri-Axis G-Force Sensor" +// INSERT ID and NAME definitions for other sensors here!! + + +GUID GetObjectFormat(CAtlStringW strObjectID); +GUID GetObjectContentType(CAtlStringW strObjectID); +HRESULT AddSupportedPropertyKeys(_In_ LPCWSTR wszObjectID, + _In_ IPortableDeviceKeyCollection* pKeys); + +VOID AddCommonPropertyKeys(_In_ IPortableDeviceKeyCollection* pKeys); +VOID AddDevicePropertyKeys(_In_ IPortableDeviceKeyCollection* pKeys); + +VOID AddSensorPropertyKeys(_In_ IPortableDeviceKeyCollection* pKeys); //Required for sensor props + +class WpdObjectProperties +{ +public: + + WpdObjectProperties(); + virtual ~WpdObjectProperties(); + + HRESULT Initialize(_In_ WpdBaseDriver* pBaseDriver); + + HRESULT DispatchWpdMessage(_In_ REFPROPERTYKEY Command, + _In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnGetSupportedProperties(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnGetPropertyValues(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnGetAllPropertyValues(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnSetPropertyValues(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnGetPropertyAttributes(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + HRESULT OnDeleteProperties(_In_ IPortableDeviceValues* pParams, + _In_ IPortableDeviceValues* pResults); + + VOID SetSensorReading(LONGLONG llNewReading); + + LONGLONG GetSensorReading(); + + VOID SetUpdateInterval(DWORD dwNewInterval); + + DWORD GetUpdateInterval(); + + HRESULT SendUpdateIntervalToDevice(DWORD dwNewInterval); + + BOOL IsValidUpdateInterval(DWORD dwInterval); + +private: + + HRESULT GetPropertyValuesForObject(_In_ LPCWSTR wszObjectID, + _In_ IPortableDeviceKeyCollection* pKeys, + _In_ IPortableDeviceValues* pValues); + + HRESULT GetPropertyAttributesForObject(_In_ LPCWSTR wszObjectID, + _In_ REFPROPERTYKEY Key, + _In_ IPortableDeviceValues* pAttributes); + + +private: + WpdBaseDriver* m_pBaseDriver; + + // This critical section protects the sensor reading from concurrent access + // by the application (which reads it) and the read request callback (which updates it) + CComAutoCriticalSection m_SensorReadingCriticalSection; + LONGLONG m_llSensorReading; + + // A critical section is not needed for the update interval because it is accessed + // by the client application, and set/get requests from the application arrive serially + // through the sequential WDF queue. + DWORD m_dwUpdateInterval; +}; |
