All pages
Powered by GitBook
1 of 1

Loading...

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 of android.content.Context to allow SDK access to application-specific resources.

  • handler — An instance of android.os.Handler to allow SDK access to application-specific message queues.

Return Value:

Returns an MTDevice.

This function creates an instance of IDevice. All API’s of MagTek Universal SDK can but utilized from IDevice.

Parameter

  • context — An instance of android.content.Context to allow SDK access to application-specific resources.

  • deviceType — Enumerated device type.

  • connectionType — Enumerated connection type.

Return Value:

Returns an IDevice.

This function creates an instance of an MMS type of device, DynaFlex Family.

Parameter

  • context — An instance of android.content.Context to allow SDK access to application-specific resources.

  • deviceAdapter — Callback interface for MMS device messages.

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 D998200078 IPAD, DynaPro, DynaPro Go, and DynaPro Mini PIN Encryption Devices Programmer’s Reference for the MTPPSCRA API.

Parameter

  • context — An instance of android.content.Context to allow SDK access to application-specific resources.

  • handler — An instance of android.os.Handler to allow SDK access to application-specific message queues.

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 D99875723 uDynamo, Dynamag, DynaMAX, eDynamo, mDynamo, Insert, DynaWave, iDynamo 6 for the MTSCRA API.

Parameter

  • context — An instance of android.content.Context to allow SDK access to application-specific resources.

  • handler — An instance of android.os.Handler to allow SDK access to application-specific message queues.

Return Value:

Returns an MTSCRA.

This function returns a list of IDevice. IDevice is the base for utilizing the MagTek Universal SDK interface.

Parameter

  • context — An instance of android.content.Context to 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.

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.

Parameter

  • uri — URI included the port. Support URIs:

    1. TCP: test.mosquitto.org, test.mosquitto.org:1883, mqtt://test.mosquitto.org:1883, mqtt://broker.emqx.io:1883

Return Value: None

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

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

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

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

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

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

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

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.

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

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 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 wss://IP-Address

for example:

ws://192.168.1.150 or serialnumber.xx wss://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.

  • deviceListCallback — Callback interface for SDK to provide a list of device information in the system.

    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

  • createDevice

    createMMSDevice

    createPPSCRA

    createSCRA

    getDeviceList

    getAPIVersion

    setMQTTBrokerInfo

    setMQTTClientID

    setMQTTClientCertificateInfo

    setMQTTDeviceDiscoveryTimeout

    startMQTTDeviceStatusMonitoring

    setMQTTPublishTopic

    setMQTTQos

    setMQTTSubscribeTopic

    stopMQTTDeviceStatusMonitoring

    setSystemStatusCallback

    IDevice CoreAPI.createDevice( 
        Context context, 
        DeviceType deviceType,
        ConnectionType connectionType, 
        String address,
    String model, String name, String serial,
    CertificateInfo certificateInfo);
    MMXDevice CoreAPI.createMMSDevice( Context context, IMMXDeviceAdapter deviceAdapter);
    MTPPSCRA CoreAPI.createPPSCRA(Context context, Handler handler);
    MTSCRA CoreAPI.createPPSCRA(Context context, Handler handler);
    List<IDevice> CoreAPI.getDeviceList( 
        Context context,
        IDeviceListCallback deviceListCallback);
    
    List<IDevice> CoreAPI.getDeviceList( 
        Context context,
        DeviceType deviceType, 
        IDeviceListCallback deviceListCallback);
    
    List<IDevice> CoreAPI.getDeviceList( 
        Context context, 
        List<DeviceType> deviceTypes,
        IDeviceListCallback deviceListCallback);
    int CoreAPI.getAPIVersion();
    void setMQTTBrokerInfo(String uri);
    
    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/#”.
    <DeviceAddress>=“MagTek/Server/DynaFlexIIPED/B51E72D”
    void startMQTTDeviceStatusMonitoring( 
        IMQTTDeviceStatusCallback callback); 
    “<basetopic>/<DeviceID>/MMSMessage”.
    void setMQTTPublishTopic(String topic);
    void setMQTTQos(int qos);
    void setMQTTSubscribeTopic(String topic);
    void stopMQTTDeviceStatusMonitoring();
    void setSystemStatusCallback(ISystemStatusCallback callback);