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.
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.
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
Return Value:
Returns an IDevice.
This function creates an instance of an MMS type of device, DynaFlex Family.
Return Value:
Returns an MMXDevice.
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.
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.
This function returns a list of IDevice. IDevice is the base for utilizing the MagTek Universal SDK interface.
Return Value:
Returns a list of IDevice.
This function returns the API version.
Return Value:
Returns an integer representing the API version.
This function sets the MQTT (Message Queuing Telemetry Transport) broker information. Call prior to device discovery.
Return Value: None
This function sets the MQTT client ID to establish a connection.
Return Value: None
This function sets the MQTT certificate information.
Return Value: None
This function sets the MQTTDeviceDiscoveryTimeout value.
Return Value: None
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.
Return Value: None
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”
Return Value: None
This function sets the MQTTQoS value.
Return Value: None
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”
Return Value: None
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
This function sets the SystemStatusCallback global value.
Return Value: None
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://)
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.
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
Parameter
Description
clientID
Client ID. If not set, the default value is [HostName]-[RandomUUID]
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.
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.
Parameter
Description
callback
Name of a class or structure that implements the IMQTTDeviceStatusCallback interface events. Call after calling getDeviceList().
Parameter
Description
topic
Base topic for which to publish messages. Full topic is composed by the SDK.
Parameter
Description
qos
The quality of service level for publishing messages. Range:
0 = At most once (default)
1 = At least once
2 = Exactly once
Parameter
Description
topic
Base topic for which to subscribe for messages. Full topic is composed by the SDK.
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.
MMXDevice CoreAPI.createMMSDevice();MTPPSCRA CoreAPI.createPPSCRA();MTSCRA CoreAPI.createSCRA();List<IDevice> CoreAPI.getDeviceList();
List<IDevice> CoreAPI.getDeviceList(DeviceType deviceType);
List<IDevice> CoreAPI.getDeviceList(List<DeviceType> deviceTypes);int CoreAPI.getAPIVersion();void setMQTTBrokerInfo(
string uri,
string username = null,
string password = null);void setMQTTClientID(string clientID);void setMQTTClientCertificateInfo(CertificateInfo certificateInfo);void setMQTTDeviceDiscoveryTimeout(int timeout);subscribe topic = “MagTek/Server/DynaFlexIIPED”
monitored subscription = “MagTek/Server/DynaFlexIIPED/#”.void startMQTTDeviceStatusMonitoring(
IMQTTDeviceStatusCallback callback);“<basetopic>/<DeviceID>/MMSMessage”.void setMQTTPublishTopic(string topic);void setMQTTQos(int qos);“<basetopic>/<DeviceID>/MMSMessage”.void setMQTTSubscribeTopic(string topic);void stopMQTTDeviceStatusMonitoring();void setSystemStatusCallback(ISystemStatusCallback callback);