CoreAPI
Use the CoreAPI to create an IDevice. IDevice is the bases for the MagTek Universal SDK.
If accessing a device specific API outside of MagTek Universal SDK, use the various functions in this section to create an instance of that device’s API. Once a device specific API is referenced, the associated library will need to be added into the application’s development project.
createCMSDevice
This function creates an instance of a CMS type of device.
The API’s of MagTek Universal SDK do not apply. See D998200160 MagTek Common Message Structure (MTCMS) for the MTCMS API.
MTDevice CoreAPI.createCMSDevice(Context context, Handler handler);Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.handler— An instance ofandroid.os.Handlerto allow SDK access to application-specific message queues.
Return Value:
Returns an MTDevice.
createDevice
This function creates an instance of IDevice. All API’s of MagTek Universal SDK can but utilized from IDevice.
IDevice CoreAPI.createDevice(
Context context,
DeviceType deviceType,
ConnectionType connectionType,
String address,
String model, String name, String serial,
CertificateInfo certificateInfo);Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.deviceType— Enumerated device type.connectionType— Enumerated connection type.address— Address for the device.For USB devices, address may be an empty string when only one device is attached. Otherwise address should be in the form:
USB://DEVICESERIALNUMBERfor example,
USB://99261829170E0810For Ethernet devices, address should be in the form:
IP://IP-Address:PORTfor example,
IP://10.57.10.180:26For Wireless devices, address should be in the form:
TLS12://TLSDEVICESERIALNUMBER TLS12TRUST://TLSDEVICESERIALNUMBERfor example,
TLS12://TLS99261829170E0810 TLS12TRUST://TLS99261829170E0810For Bluetooth LE devices, address should be in the form:
BLEEMV://DEVICENAMEfor example,
BLEEMV://DynaPro Go-EB66For WebSocket or Secure WebSocket devices, address should be in the form:
ws://IP-Addresswss://IP-Addressfor example:
ws://192.168.1.150orserialnumber.xxwss://serialnumber.xx(where xx is domain name)Place the client private key certificate (
client.p12) into a folder accessible by the custom software.For Serial devices, address should be in the form:
PORT=[PORT], BAUDRATE=[BAUDRATE], DATABITS=[DATABITS], PARITY=[PARITY], STOPBITS=[STOPBITS], HANDSHAKE=[HANDSHAKE], STARTINGBYTE=[STARTINGBYTE], ENDINGBYTE=[ENDINGBYTE], CRCMODE=[CRCMODE]model— Model name for the device.name— Unique name for the device to distinguish between multiple devices of the same model.serial— Serial number for the device.certificateInfo— The client private key certificate (client.p12) into a folder accessible by the custom software. See Certificate Requirements.
Return Value:
Returns an IDevice.
createMMSDevice
This function creates an instance of an MMS type of device, DynaFlex Family.
Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.deviceAdapter— Callback interface for MMS device messages.
Return Value:
Returns an MMXDevice.
createPPSCRA
This function creates an instance of an MTPPSCRA type of device.
The API’s of MagTek Universal SDK do not apply. See D998200078 IPAD, DynaPro, DynaPro Go, and DynaPro Mini PIN Encryption Devices Programmer’s Reference for the MTPPSCRA API.
Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.handler— An instance ofandroid.os.Handlerto allow SDK access to application-specific message queues.
Return Value:
Returns an MTPPSCRA.
createSCRA
This function creates an instance of a MTSCRA type of device.
The API’s of MagTek Universal SDK do not apply. See D99875723 uDynamo, Dynamag, DynaMAX, eDynamo, mDynamo, Insert, DynaWave, iDynamo 6 for the MTSCRA API.
Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.handler— An instance ofandroid.os.Handlerto allow SDK access to application-specific message queues.
Return Value:
Returns an MTSCRA.
getDeviceList
This function returns a list of IDevice. IDevice is the base for utilizing the MagTek Universal SDK interface.
Parameter
context— An instance ofandroid.content.Contextto allow SDK access to application-specific resources.deviceType— An enum for the type of MagTek readers which the SDK will control.deviceTypes— An enum list for the type of MagTek readers which the SDK will control.deviceListCallback— Callback interface for SDK to provide a list of device information in the system.
Return Value:
Returns a list of IDevice
getAPIVersion
This function returns the API version.
Return Value:
Returns an integer representing the API version.
setMQTTBrokerInfo
This function sets the MQTT (Message Queuing Telemetry Transport) broker information. Call prior to device discovery.
Parameter
uri— URI included the port. Support URIs:TCP:
test.mosquitto.org,test.mosquitto.org:1883,mqtt://test.mosquitto.org:1883,mqtt://broker.emqx.io:1883TCP (Authenticated):
test.mosquitto.org:1884,mqtt://test.mosquitto.org:1884TCP (Encrypted):
mqtts://test.mosquitto.org:8886,mqtts://broker.emqx.io:8883TCP (Encrypted & Authenticated):
mqtts://test.mosquitto.org:8885WebSocket:
ws://test.mosquitto.org:8080,ws://broker.emqx.io:8083WebSocket (Encrypted):
wss://test.mosquitto.org:8081,wss://broker.emqx.io:8084WebSocket (Authenticated):
ws://test.mosquitto.org:8090WebSocket, (Encrypted & Authenticated):
wss://test.mosquitto.org:8091username— Usernamepassword— Password
Return Value: None
setMQTTClientID
This function sets the MQTT client ID to establish a connection.
Parameter
clientID— Client ID. If not set, the default value is[HostName]-[RandomUUID]
Return Value: None
setMQTTClientCertificateInfo
This function sets the MQTT certificate information.
Parameter
certificateInfo— If client certificate is required when initiating a connection to the MQTT broker, this shall be used to establish the connection. If not set, the default value is NULL.
Return Value: None
setMQTTDeviceDiscoveryTimeout
This function sets the MQTTDeviceDiscoveryTimeout value.
Parameter
timeout— Time out in milliseconds. Default value = 5000 if not set. A call to getDeviceList() does not return the list until this time has expired.
Return Value: None
startMQTTDeviceStatusMonitoring
This function sets the MQTT callback interface instance.
After connecting to the MQTT broker, the MQTT Device Status Monitoring subscribes to
"<MQTTSubscribeTopic>/#" . The wildcard "/#" is automatically appended.
Example:
When a device status updates to “connected” or “disconnected”, OnConnected() and OnDisconnected() are invoked respectively.
This method can be called whether or not there is an active connection to an MQTT device.
Devices reporting with "/Status/connected" are added to the device list as follows:
Parameter
callback— Name of a class or structure that implements the IMQTTDeviceStatusCallback interface events. Call after calling getDeviceList().
Return Value: None
setMQTTPublishTopic
This function sets the base value for MQTTPublishTopic. When connected to the MQTT broker, the composed topic is in the format:
Example:
Base topic =
“MagTek/Device/DynaFlexIIPED/”Full topic =
“MagTek/Device/DynaFlexIIPED/B51E72D/MMSMessage”
Parameter
topic— Base topic for which to publish messages. Full topic is composed by the SDK.
Return Value: None
setMQTTQos
This function sets the MQTTQoS value.
Parameter
qos— The quality of service level for publishing messages. Range:0 = At most once (default)
1 = At least once
2 = Exactly once
Return Value: None
setMQTTSubscribeTopic
This function sets the base value for MQTTSubscribeTopic. When connected to the device, the composed topic is in the format:
“<basetopic>/<DeviceID>/MMSMessage”.
Example:
Base topic =
“MagTek/Server/DynaFlexIIPED/”Full topic =
“MagTek/Server/DynaFlexIIPED/B51E72D/MMSMessage”
Parameter
topic— Base topic for which to subscribe for messages.
Return Value: None
stopMQTTDeviceStatusMonitoring
This function stops the MQTT device status monitoring process. If called when already running, the process shall be stopped immediately. This method can be called whether or not there is an active connection to an MQTT device.
Return Value: None
setSystemStatusCallback
This function sets the SystemStatusCallback global value.
Parameter
callback— Name of a class or structure that implements the ISystemStatusCallback interface event. Call before starting any MQTT communication. When there is an error, the interface’s OnError() event is invoked.
Return Value: None

