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

Appendix A Code Examples

Connect to Device

openDevice();

Send Command String to Device

const char* dataString = “C00101C10100C20114”; 
sendDataString(dataString);

Send Command Bytes to Device

unsigned char* dataBytes =
{0xC0,0x01,0x01,0xC1,0x01,0x00,0xC2,0x01,0x14};

sendDataBytes(dataBytes,9);

Send MTCMSMessage to Device

MTCMSMessage* message = CreateMTCMSMessage(0x01,0x00,0x14, NULL,0, 
false);
sendMTCMSMessage(message); 
ReleaseMTCMSMessage(message);

Receiving Connection State Updates from Device

void _stdcall OnDeviceConnectionStateChanged(void* sender, 
MTConnectionState state)
{
        switch (state)
        {
        case MTConnectionState::Connected: 
                Log(_T("[Connected]")); 
                break;
        case MTConnectionState::Connecting: 
                Log(_T("[Connecting...]")); 
                break;
        case MTConnectionState::Disconnecting: 
                Log(_T("[Disconnecting...]")); 
                break;
        case MTConnectionState::Disconnected: 
                Log(_T("[Disconnected]")); 
                break;
        }
}

Receiving Response Message from Device

Receiving Notification Message from Device

Close Device

Last updated