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 /pos/drivers/MagneticStripeReader/PosEvents.cpp | |
| 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 'pos/drivers/MagneticStripeReader/PosEvents.cpp')
| -rw-r--r-- | pos/drivers/MagneticStripeReader/PosEvents.cpp | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/pos/drivers/MagneticStripeReader/PosEvents.cpp b/pos/drivers/MagneticStripeReader/PosEvents.cpp new file mode 100644 index 00000000..501a1a22 --- /dev/null +++ b/pos/drivers/MagneticStripeReader/PosEvents.cpp @@ -0,0 +1,50 @@ +#include <pch.h> + +/* +** Driver TODO: Add code to EvtDeviceOwnershipChange to reset the device state to a default. +** +** PosCx calls this callback to signal that the ownership of the device has transitioned from one file handle +** to another. When this happens, app developers expect that the settings for the device are restored to a +** "default" state, so the driver should do what is necessary to satisfy that expectation here. +** +*/ +VOID EvtDeviceOwnershipChange(_In_ WDFDEVICE Device, _In_opt_ WDFFILEOBJECT OldOwnerFileObj, _In_opt_ WDFFILEOBJECT NewOwnerFileObj) +{ + UNREFERENCED_PARAMETER(Device); + UNREFERENCED_PARAMETER(OldOwnerFileObj); + UNREFERENCED_PARAMETER(NewOwnerFileObj); + + // This function signals that ownership has transitioned from one file handle to another (typically from one app to another). + // As a result, the driver is expected to reset all settings to a default state. +} + +/* +** Driver TODO: +** +** This part of the sample demonstrates how the driver will return data to the runtime. How this method would be called depends +** on the driver implementation. +*/ +VOID EvtOnMsrScanDataRetrieved(_In_ WDFDEVICE Device) +{ + // Events that the runtime can handle for a magnetic stripe reader device are: + // PosEventType::MagneticStripeReaderDataReceived -- the standard event with MSR data + // PosEventType::MagneticStripeReaderErrorOccurred -- an event that should be sent if an error occured while scanning data + // PosEventType::StatusUpdated -- an event to indicate changes to power state + // + // Additionally, the following event is sent to the runtime, but is handled entirely by PosCx + // PosEventType::ReleaseDeviceRequested + + // The following shows an example of sending MSR data + + MSR_DATA_RECEIVED dataReceivedEventInfo; + + // Fill in all the fields in MSR_DATA_RECEIVED + + // This call actually pends the data to be send to the WinRT APIs. + NTSTATUS status = PosCxPutPendingEvent(Device, MSR_INTERFACE_TAG, PosEventType::MagneticStripeReaderDataReceived, sizeof(dataReceivedEventInfo), &dataReceivedEventInfo, POS_CX_EVENT_ATTR_DATA); + + if (!NT_SUCCESS(status)) + { + // This should only happen in rare cases such as out of memory (or that the device or interface tag isn't found). The driver should most likely drop the event. + } +}
\ No newline at end of file |
