public class MSRUtils
extends java.lang.Object
MSRUtils
class for integrating the methods of the Magnetic Stripe Reader (MSR) device.
Provides convenient methods to interact with the MSR device.Constructor and Description |
---|
MSRUtils() |
Modifier and Type | Method and Description |
---|---|
MSROperationResult |
waitForSwipe(int timeout,
android.content.Context context)
Waits for a card swipe on the MSR device.
|
public MSROperationResult waitForSwipe(int timeout, android.content.Context context) throws DeviceException
This method opens the MSR device, waits for a card to be swiped within the specified timeout, and then closes the device.
In case of a timeout, the method returns null and closes the MSR reader. If a MSROperationResult
is returned, it is the responsibility of the calling application to close the MSR reader.
The timeout parameter specifies the maximum time to wait for a swipe:
timeout
- The maximum time to wait for a card swipe, in milliseconds.context
- The Android context.DeviceException
- for standard device-related issues as documented in DeviceException
.