Appendix B - API Walk Through
B.2
IDevice Walk Through
The following walks through how to make use of IDeviceError! Reference source not found..
Implement device events within the class to receive events.
CoreAPI IDevice.
IDevice subscribeAll().
IDevice other functions.
IDevice startTransaction().
Example
import comp.magtek.mtusdk;
.
// Extend the main window to receive events.
public class MainWindow implements IEventSubscriber,
IConfigurationCallback
{
/* For a list of a single device type.
DeviceType deviceType = DeviceType.MMS;
List<IDevice> deviceList = CoreAPI.getDeviceList(deviceType);
IDevice device = deviceList.get(0);
*/
/* For a list of multiple device types.
List<DeviceType> deviceTypes = null;
deviceTypes.Add(DeviceType.MMS);
deviceTypes.Add(DeviceType.CMS);
List<IDevice> deviceList = CoreAPI.getDeviceList(deviceTypes);
IDevice device = deviceList.get(0);
*/
/* Suscribe to events sent from the device.
These would be but not limited to: card inserted, card removed,
connection state...
Set MainWindow to receive the events. */
boolean return = device.unsubscribeAll(this);
boolean return = device.subscribeAll(this);
/* To handle events from some other class.
EventsVector eventsVector = new EventsVector()
boolean return = device.unsubscribeAll(eventsVector);
boolean return = device.subscribeAll(eventsVector);
*/
// Assign parameters for the transaction.
List<PaymentMethod> paymentMethod = new List<PaymentMethod>();
paymentMethod.Add(PaymentMethod.MSR);
paymentMethod.Add(PaymentMethod.Contact);
MagTek Universal SDK| For MMS Devices | Programmer's Manual ( Java )
Page 46
Need help?
Do you have a question about the Universal SDK and is the answer not in the manual?
Questions and answers