All pages
Powered by GitBook
1 of 1

Loading...

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

Return Value: None

This method sets the connection type of the device..

Parameters

Return Value: None

This method sets the address of the device.

Parameters:

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

Return Value: None

This method sets the device ID.

Return Value: None

This method opens the connection to the device.

Parameters: None

Return Value: None

This method closes the connection to the device.

Parameters: None Return Value: None

This method returns whether the device is connected or not.

Parameters: None

Return Value:

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

This method sends a command string to the device.

Parameters:

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

This method sends a command to the device.

Parameters:

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

This method sends a command to the device.

Parameters:

Return Value:

  • 0 = Success

  • 9 = Error

  • 15 = Busy

IP

[PORT]

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

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)

connectionType

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

Parameter

Description

connectionType

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

Parameter

Description

deviceAddress

String value of the address.

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]

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]

Parameter

Description

deviceID

String value of the device ID.

Parameter

Description

dataString

Command to be sent in hexadecimal string format.

Parameter

Description

dataBytes

Command to be sent in byte array format.

dataBytesLength

Length of the command bytes.

Parameter

Description

message

MTCMSMessage to be sent to the device.

setConnectionType

setAddress

setDeviceID

openDevice

closeDevice

isDeviceConnected

sendDataString

sendDataBytes

sendMTCMSMessage

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

The data baud rate . (Default: 9600)

MTCMS_API void setConnectionType(MTConnectionType connectionType); 
MTCMS_API void setAddress(const char* deviceAddress);
MTCMS_API void setDeviceID(const char* deviceID); 
MTCMS_API void openDevice(); 
MTCMS_API void closeDevice();
MTCMS_API bool isDeviceConnected();
MTCMS_API int sendCommandString(const char* dataString);
MTCMS_API int sendDataBytes( 
const unsigned char* dataBytes, 
int dataBytesLength);
MTCMS_API int sendMTCMSMessage(MTCMSMessage* message);