CoreAPI
Use the CoreAPI to create an IDevice. IDevice, which is the basis 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 MagTek Common Message Structure (MTCMS) for the MTCMS API.
MTDevice CoreAPI.createCMSDevice();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 CoreAPI.createDevice(
DeviceType deviceType,
ConnectionType connectionType,
string address,
string model,
string name,
string serial,
CertificateInfo certificateInfo = null);Parameter
Description
deviceType
Enumerated device type.
connectionType
Enumerated connection type.
Parameter
Description
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://DEVICESERIALNUMBER
for example, USB://99261829170E0810
For Ethernet devices, address should be in the form:
IP://IP-Address:PORT
for example, IP://10.57.10.180:26
For Wireless DynaPro Go devices, address should be in the form: TLS12://TLSDEVICESERIALNUMBER TLS12TRUST://TLSDEVICESERIALNUMBER
for example, TLS12://TLS99261829170E0810 TLS12TRUST://TLS99261829170E0810
For Bluetooth LE devices, address should be in the form:
BLEEMV://DEVICENAME
for example, BLEEMV://DynaPro Go-EB66
For WebSocket or Secure WebSocket devices, address should be in the form:
ws://IP-Address or DEVICEADDRESS wss://IP-Address or DEVICEADDRESS
for example, ws://10.57.10.1 or ws://b512345.magtek.com wss://192.168.1.150 or wss://b512345.magtek.com
The client private key certificate (client.p12) must be accessible to the custom software that makes a secure WebSocket (wss://) connection to the DynaFlex II PED.
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.
Parameter
Description
certificateInfo
Certificate information for TLS Trust and WebSocket WSS connection. Optional. See the following for details on installing a certificate chain: DynaFlex II PED Using Wireless LAN Guide.
The client private key certificate (client.p12) must be accessible to the custom software that makes a secure WebSocket (wss://) connection to the DynaFlex II PED.
The client.p12 certificate is not needed if the connection type is not secure WebSocket (ws://)
Return Value:
Returns an IDevice.
createMMSDevice
This function creates an instance of an MMS type of device, DynaFlex Family.
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 IPAD, DynaPro, DynaPro Go, and DynaPro Mini PIN Encryption Devices Programmer’s Reference for the MTPPSCRA API.
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 uDynamo, Dynamag, DynaMAX, eDynamo, mDynamo, Insert, DynaWave, iDynamo 6 for the MTSCRA API.
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
Description
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.
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
Description
uri
URI included the port. Support URIs:
TCP: “test.mosquitto.org”, “test.mosquitto.org:1883”, “mqtt://test.mosquitto.org:1883”, “mqtt://broker.emqx.io:1883”
TCP (Authenticated): “test.mosquitto.org:1884”, “mqtt://test.mosquitto.org:1884”
TCP (Encrypted): “mqtts://test.mosquitto.org:8886”, “mqtts://broker.emqx.io:8883”
TCP (Encrypted & Authenticated): “mqtts://test.mosquitto.org:8885”
WebSocket: “ws://test.mosquitto.org:8080”, “ws://broker.emqx.io:8083”
WebSocket (Encrypted): “wss://test.mosquitto.org:8081” , “wss://broker.emqx.io:8084”
WebSocket (Authenticated): “ws://test.mosquitto.org:8090”
WebSocket, (Encrypted & Authenticated): “wss://test.mosquitto.org:8091”
username
Username
password
Password
Return Value: None
setMQTTClientID
This function sets the MQTT client ID to establish a connection.
Parameter
Description
clientID
Client ID. If not set, the default value is [HostName]-[RandomUUID]
Return Value: None
setMQTTClientCertificateInfo
This function sets the MQTT certificate information.
Parameter
Description
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
Description
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.
Parameter
Description
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
Description
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
Description
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:
Example:
Base topic = “MagTek/Server/DynaFlexIIPED/”
Full topic = “MagTek/Server/DynaFlexIIPED/B51E72D/MMSMessage”
Parameter
Description
topic
Base topic for which to subscribe for messages. Full topic is composed by the SDK.
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
Description
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
Last updated

