For the complete documentation index, see llms.txt. This page is also available as Markdown.
Page cover

MTCMS Class Methods

After creating an instance of the MTCMS class in your software project, use the methods described in this section to communicate with MagTek CMS device.

requestDeviceList

This method initiates request to discover devices that are visible to the host using the specified connection interface. The DeviceListReceived event will provide information regarding the available devices once the discovery process is completed.

MTCMS_API void requestDeviceList(MTConnectionType connectionType); Parameters:

Parameters:

Parameter

Description

connectionType

MTConnectionType value: MTConnectionType.USB, MTConnectionType.IP, MTConnectionType.Serial

Return Value: None

setConnectionType

This method sets the connection type of the device..

MTCMS_API void setConnectionType(MTConnectionType connectionType); 

Parameters

Parameter

Description

connectionType

MTConnectionType value: MTConnectionType.USB, MTConnectionType.IP, MTConnectionType.Serial

Return Value: None

setAddress

This method sets the address of the device.

Parameters:

Parameter

Description

deviceAddress

String value of the address.

The following table shows the address formats supported by the different connection types:

Connection Type

Address Format Parameter

Address Format Description

USB

[PATH]

The OS specific device path to the USB device. The path is normally retrieved from the Address property of MTDeviceInformation.

IP

[IPA]

The IP address of the device in dotted-quad notation (i.e. 192.178.1.123).

IP

[PORT]

The TCP port of the device. (Default: 5000)

Connection Type

Address Format

Serial

PORT=[PORT],

BAUDRATE=[BAUDRATE],

DATABITS=[DATABITS],

PARITY=[PARITY],

STOPBITS=[STOPBITS],

HANDSHAKE=[HANDSHAKE],

STARTINGBYTE=[STARTINGBYTE],

ENDINGBYTE=[ENDINGBYTE],

CRCMODE=[CRCMODE]

Connection Type

Parameter

Description

Serial

[PORT]

The OS specific device path to the serial port (i.e. COM4).

Serial

[BAUDRATE]

The data baud rate . (Default: 9600)

Serial

[DATABITS]

The data bits per byte. (Default: 8)

Serial

[PARITY]

The parity checking protocol. (Default: NONE).

Supported Values: NONE,EVEN,ODD,SPACE,MARK

Serial

[STOPBITS]

The number of stop bits per byte. (Default: 1)

Supported Values: 1,1.5,2

Serial

[HANDSHAKE]

The handshaking protocol for serial port transmission of data. (Default: NONE)

Supported Values: NONE,RTS,XONXOFF,RTSXONSOFF

Serial

[STARTINGBYTE]

The special character used as the starting byte for each message. (Default is empty string)

An empty string indicates no special character is used as the starting byte for each message.

Serial

[ENDINGBYTE]

The special character used as the ending byte for each message. (Default is 0x0A)

Serial

An empty string indicates no special character is used as the ending byte for each message.

Serial

[CRCMODE]

A value of 0 indicates CRC is disabled, otherwise CRC is enabled. (Default: 0)

Return Value: None

setDeviceID

This method sets the device ID.

Parameter

Description

deviceID

String value of the device ID.

Return Value: None

openDevice

This method opens the connection to the device.

Parameters: None

Return Value: None

closeDevice

This method closes the connection to the device.

Parameters: None Return Value: None

isDeviceConnected

This method returns whether the device is connected or not.

Parameters: None

Return Value:

Return true if the device is connected. Otherwise, return false.

sendDataString

This method sends a command string to the device.

Parameters:

Parameter

Description

dataString

Command to be sent in hexadecimal string format.

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

sendDataBytes

This method sends a command to the device.

Parameters:

Parameter

Description

dataBytes

Command to be sent in byte array format.

dataBytesLength

Length of the command bytes.

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

sendMTCMSMessage

This method sends a command to the device.

Parameters:

Parameter

Description

message

MTCMSMessage to be sent to the device.

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

Last updated