MTDevice device = new MTDevice(); if (device != null)
{
device.setConnectionType(MTConnectionType.USB);
device += OnDeviceConnectionStateChanged;
device += onDeviceResponseMessage;
device += onDeviceNotificationMessage;
}if (device != null)
{
device.openDevice();
}String dataString = “C00101C10100C20114”;
device.sendDataString(dataString);Byte[] dataBytes = new Byte[9] {0xC0,0x01,0x01,
0xC1,0x01,0x00,
0xC2,0x01,0x14};
device.sendDataBytes(dataBytes);MTCMSMessage message = new MTCMSMessage(0x01,0x00,0x14, 0xC4, null);
device.sendMTCMSMessage(message);MTCMSRequestMessage request = new MTCMSRequestMessage
(0x00,0x14, 0xC4, false);
device.sendMTCMSMessage(request);protected void OnDeviceConnectionStateChanged(object sender,
MTConnectionState state)
{
if (state == MTConnectionState.Connected)
{
sendToDisplay(“Device is Connected”);
}
else if (state == MTConnectionState.Disconnected)
{
sendToDisplay(“Device is Disconnected”);
}
}protected void OnDeviceResponseMessage(object sender,
MTCMSResponseMessage response)
{
sendToDisplay(“[Response Message]”
sendToDisplay(“AppID: ” + response.getApplicationID());
sendToDisplay(“CommandID: ” + response.getCommandID());
sendToDisplay(“ResultCode: ” + response.getResultCode());
}protected void OnDeviceNotificationMessage(object sender,
MTCMSNotificationMessage notification)
{
sendToDisplay(“[Notification Message]”
sendToDisplay(“AppID: ” notification. getApplicationID() );
sendToDisplay(“CommandID: ” + notification.getCommandID());
sendToDisplay(“ResultCode: ” + notification.getResultCode());
}if (device != null)
{
device.closeDevice();
}