0% found this document useful (0 votes)
86 views47 pages

DMT-DDv2.16 API e

The DMT-DD v2.16 API Specification Sheet provides detailed information on the system requirements, API usage, and implementation examples for a touch screen driver. It covers various functionalities such as device connection, calibration, enabling/disabling touch, and acquiring device status. The document includes specific API functions, parameters, return values, and examples in C/C++ for developers to integrate the driver effectively.

Uploaded by

jorge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views47 pages

DMT-DDv2.16 API e

The DMT-DD v2.16 API Specification Sheet provides detailed information on the system requirements, API usage, and implementation examples for a touch screen driver. It covers various functionalities such as device connection, calibration, enabling/disabling touch, and acquiring device status. The document includes specific API functions, parameters, return values, and examples in C/C++ for developers to integrate the driver effectively.

Uploaded by

jorge
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 47

Reference Document

Touch Screen Driver


DMT-DD v2.16 API Spcification Sheet
Date: June 2, 2022
DMT-DD API Specification Sheet

Table of Contents
1. System Requirements ................................................................................................................................... 3
1.1. System Configuration .............................................................................................................................................................. 3
1.2. Execute Prerequisites.............................................................................................................................................................. 3
2. How to Use API ............................................................................................................................................... 4
3. Common API....................................................................................................................................................... 5
3.1. Acquiring the number of connected devices. ........................................................................................................ 5
3.2. Acquiring Device Instance Path ...................................................................................................................................... 5
4. API for Calibration .......................................................................................................................................... 6
4.1. Performing 4-point calibration ............................................................................................................................................ 6
4.2. Performing 9-point calibration ............................................................................................................................................ 7
4.3. Deleting Calibration Data ..................................................................................................................................................... 8
5. Implementation Example of Calibration Execution ................................................................... 9
6. Enabling/Disabling Touch API ............................................................................................................... 10
6.1. Enabling and Disabling of Touch ................................................................................................................................. 10
6.2. Acquiring Enabling/Disabling Status of Touch ..................................................................................................... 10
7. Implementation Example of Enabling/Disabling Touch ........................................................ 11
8. Acquiring Status ............................................................................................................................................. 12
8.1. Acquiring Status Information ............................................................................................................................................ 12
9. Implementation Example of Status Acquisition ........................................................................ 13
10. Device Initialization ....................................................................................................................................... 14
10.1. Device Initialization ................................................................................................................................................................. 14
11. Implementation Example of Device Initialization ...................................................................... 15
12. Acquiring assignment information of registered monitor .................................................. 16
11.1. Acquiring assignment information of registered monitor ..................................................................................... 16
11.2. Registering assignment information of monitor ......................................................................................................... 16
13. Implementation Example of Assignment Information of Registered Monitor ........ 17
14. Touch Data Acquisition ............................................................................................................................. 18
14.1. Touch Detection (Registration or Cancel of Windows Even) ......................................................................... 18
14.2. Touch Data......................................................................................................................................................................................... 18
15. Implementation Example of Touch Data Acquisition ............................................................ 20
16. EEPROM Setting............................................................................................................................................. 25
15.1. Acquiring status of EEPROM ................................................................................................................................................ 25
15.2. Setting Status of EEPROM .................................................................................................................................................... 25
17. Implementation Example of EEPROM Calibration ................................................................... 26
18. Right-Click Setting ........................................................................................................................................ 27
18.1. Acquiring method of Right-Click .......................................................................................................................................... 27
18.2. Setting method of Right-click ................................................................................................................................................ 28
19. Implementation Example of Right-click setting ......................................................................... 29
20. Output Rate Setting ..................................................................................................................................... 30
20.1. Acquiring output rate ................................................................................................................................................................... 30
20.2. Setting Output rate ....................................................................................................................................................................... 30
21. Implementation Example of Output Rate Setting..................................................................... 31

DEC-S0337A 1 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

22. Controller Direct Output ............................................................................................................................ 32


22.1 Controller Direct Sending ........................................................................................................................................................... 32
23. Implementation Example of Controller Direct Output ........................................................... 33
24. Direct Input from Controller ................................................................................................................... 34
24.1 Communication with Controller ............................................................................................................................................... 34
25. Implementation Example of Direct Input from Controller .................................................. 35
26. XY Inversion and Swap ............................................................................................................................. 36
26.1 Acquiring X Inversion Status ................................................................................................................................................... 36
26.2 Acquiring Y Inversion Status ................................................................................................................................................... 36
26.3 Acquiring XY Swap Status ....................................................................................................................................................... 37
26.4 Setting X Inversion Status ........................................................................................................................................................ 37
26.5 Setting Y Inversion Status ........................................................................................................................................................ 38
26.6 Setting XY Swap Status ............................................................................................................................................................. 38
27. Implementation Example of XY Inversion and Swap ............................................................ 39
28. Acquiring Calibration Information ....................................................................................................... 40
28.1 Acquiring Calibration Result ..................................................................................................................................................... 40
29. Implementation Example of Acquiring Calibration Information ...................................... 42

DEC-S0337A 2 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

1. System Requirements
1.1. System Configuration
(1) OS
Windows XP/7/8/8.1/10/11 32bit / 64bit Home or greater Editions

(2) Connection Interface


USB / Serial

(3) Monitor
Multi-display supported.

1.2. Execute Prerequisites


(1) Software
OS Required Software

Windows XP / 7 / 8 / 8.1 Microsoft .Net Framework 3.5

Microsoft .Net Framework 4.6


Windows 10 / 11
Microsoft Visual C++ Redistributable Package for Visual Studio 2015-2019

DEC-S0337A 3 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

2. How to Use API

These libraries support operation systems of 32bit and 64bit.


Each screen is displayed in either Japanese or English according to the language setting of the
operation system.

Administrative privilege is necessary for execution.

The libraries are as follow. Select the appropriate file according to Windows versions.
OS Required .Net Framework Folder
Windows XP / 7 / 8 / 8.1 Microsoft .Net Framework 3.5 NET3.5
Windows 10 / 11 Microsoft .Net Framework 4.6 NET4.6

■How to Build
Copy or make the reference path of the files under /lib appropriate to the OS into build-source paths,
then execute build.

/NET3.5
|─lib
|─DriverSetting.h
|─DriverSetting.lib
|─DriverSetting_x64.lib
/NET4.6
|─lib
|─DriverSetting.h
|─DriverSetting.lib
|─DriverSetting_x64.lib

■How to Execute
Copy all the files under /bin appropriate to the OS into the folder in which the built execute files are
stored.

/NET3.5
|─bin
|─DriverSetting.dll
|─DriverSetting_x64.dll
/NET4.6
|─bin
|─DriverSetting.dll
|─DriverSetting_x64.dll

DEC-S0337A 4 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

3. Common API

3.1. Acquiring the number of connected devices.

Acquire the number of the devices being connected currently.

int GetTouchDeviceCount(void)

Parameter Type Variable Name Description

1 void - None

Return Value
Success :Number of devices being connected
Fail :0 *No connection of a device

Remark
None

3.2. Acquiring Device Instance Path

Acquire [no]th device instance path.

int GetTouchDeviceInstancePath(USHORT no, char* DeviceInstancePath)

Parameter Type Variable Name Description


The maximum number is the number of
1 USHORT no
the devices being connected.
2 char* DeviceInstancePath char array of [MAX_PATH] size
Specify [no] as 1 or greater
Return Value
Success :Size of DeviceInstancePath
Fail :0

Remark
At success, [no]th device instance path will be stored into DeviceInstancePath of parameter.
[MAX_PATH] is the maximum path size defined by Windows..

DEC-S0337A 5 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

4. API for Calibration

4.1. Performing 4-point calibration

Specify the device instance path and perform 4-point calibration. If the device is not assigned with a
monitor, an error will be returned.

If EERPOM is enabled, calibration data will be written into the EPROM.

int ExecuteCalibration(char* DeviceInstancePath)

Parameter Type Variable Name Description

1 Char* DeviceInstancePath Device Instance Path

Return Value
Success :1
Cancel :0
Fail :-1
No assignment :-2
Not supported :-3

Remark
If the parameter is NULL, selection screen of device (monitor) on which calibration is to be performed
will appear.
After selecting a monitor by following the instruction on the screen, calibration screen will appear.

If timeout setting is registered (except when it is registered as None) in the registry, the calibration will
automatically end (cancelled) after certain duration of time passed without any operation after the time
ideal point (cross and circle) appeared.

Timeout Setting Value

Registry Path
HKLM¥SYSTEM¥CurrentControlSet¥services¥MultiFunctionDriver¥Parameters¥Devic
e

Name Type Explanation Value


CabTimeout REG_DWORD Timeout Time (sec) 0(default) / 15 / 30 / 60

DEC-S0337A 6 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

4.2. Performing 9-point calibration

Specify the device instance path and perform 9-point calibration. If the device is not assigned with a
monitor, an error will be returned.

When EPROM is enabled, the calibration data will be written into the EERPOM.

int ExecuteCalibration9point(char* DeviceInstancePath)

Parameter Type Variable Name Description

1 Char* DeviceInstancePath Device Instance Path

Return Value
Success :1
Cancel :0
Fail :-1
No Assignment :-2
Not supported :-3

Remark
If the parameter is NULL, selection screen of device (monitor) on which calibration is to be performed
will appear.
After selecting a monitor by following the instruction on the screen, calibration screen will appear.

If timeout setting is registered (except when it is registered as None) in the registry, the calibration will
automatically end (cancelled) after certain duration of time passed without any operation after the time
ideal point (cross and circle) appeared.

Timeout Setting Value

Registry Path
HKLM¥SYSTEM¥CurrentControlSet¥services¥MultiFunctionDriver¥Parameters¥Devic
e

Name Type Description Value


CabTimeout REG_DWORD Timeout Time (sec) 0(Default) / 15 / 30 / 60

DEC-S0337A 7 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

4.3. Deleting Calibration Data

Delete the calibration data of the specified device instance path.

When EEPROM is enabled, the calibration data will be deleted from the EEPROM.

int ClearCalibration (char* DeviceInstancePath)

Parameter Type Variable Name Description

1 Char* DeviceInstancePath Device Instance Path

Return Value
Success :1
Fail :-1
Not supported :-3

Remark
In the case of NULL, calibration data of all the devices will be deleted.

DEC-S0337A 8 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

5. Implementation Example of Calibration Execution

An example of implementation (C/C++) is as follows

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") //”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
USHORT num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquring device instance path


GetTouchDeviceInstancePath(i, device);

// Specify the devie and execute calibration


int Result = ExecuteCalibration(device);

switch(Result)
{
// Calibration is completed
case 1:
printf("calibration is Complete¥n");
break;

case 0: // Cancel
case -1: // Fail
case -2: // No assingment with a monitor
printf("calibration is not Complete¥n");
break;
}
}

return;
}

DEC-S0337A 9 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

6. Enabling/Disabling Touch API

6.1. Enabling and Disabling of Touch

Setting enabling/disabling touch of the controller of specified device instance path.

int SetTouchEnable(char *DeviceInstancePath, bool flg)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

2 bool flg TRUE= Enabling FALSE=Disabling

Return Value
Success :1
Fail :-1

Remark
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.

6.2. Acquiring Enabling/Disabling Status of Touch

Acquiring status of enabling/disabling touch of controller of specified device instance path.

int GetTouchEnable(char *DeviceInstancePath)

parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

Return Value
Enable :1
Disable :0
Fail :-1

Remark
If DeviceInstancePath is NULL, Fail (-1) will be returned.

DEC-S0337A 10 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

7. Implementation Example of Enabling/Disabling Touch

An example of implementation (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") //”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring device instance path.


GetTouchDeviceInstancePath(i, device);

// Disbaing touch.
int Result = SetTouchEnable(device, false);

if (Result == true)
{
// Sccess
printf("Disable Touch is Complete¥n");
}
else
{
// Fail
printf("Disable Touch is Failed¥n");
}
}
}

DEC-S0337A 11 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

8. Acquiring Status

8.1. Acquiring Status Information

Acquire status of controller of specified device instance path.

int GetTouchDeviceState(char *DeviceInstancePath)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

Return Value
In operation :1
No connection :0
Fail :-1
Driver is abnormal :-2
Communication fails :-3
Port open fails :-4
Controller is abnormal :-5

Remark
If DeviceInstancePath is NULL, fail(-1) will be returned.

DEC-S0337A 12 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

9. Implementation Example of Status Acquisition

An implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring device instance path


GetTouchDeviceInstancePath(i, device);

// Acuqring status
int Result = GetTouchDeviceState(device);

switch(Result)
{
// In operation
case 1:
printf("get device state is OK¥n");
break;

case 0: // No connection
case -1: // Fail
case -2: // Driver is abnormal
case -3: // Communication fails
case -4: // Port open fails
case -5: // Controller is abnormal
printf("get device state is Failed¥n");
break;
}
}
}

DEC-S0337A 13 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

10. Device Initialization

10.1. Device Initialization

Initialize the controller of specified device instance path.

int ResetTouchDevice(char *DeviceInstancePath)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

Return Value
Initialization is completed :1
Time-out :0
Fail :-1
Communication fails :-3
Port open fails :-4
Controller is abnormal :-5
Not supported :2

Reamarks
If DeviceInstancePath is NULL, fail (-1) will be returned.

DEC-S0337A 14 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

11. Implementation Example of Device Initialization

Implementation example (C/C++) is as follows..

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring device instance path


GetTouchDeviceInstancePath(i, device);

// Initializing device
int Result = ResetTouchDevice(device);

switch(Result)
{
// Initialization is completed
case 1:
printf("device reset is Complete¥n");
break;

case 0: // Timeout
case -1: // Fail
case -3: // Communication fails
case -4: // Port open fails
case -5: // Controller is abnormal
case 2: // Not supported
printf("device reset is Failed¥n");
break;
}
}
}

DEC-S0337A 15 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

12. Acquiring assignment information of registered monitor

12.1. Acquiring assignment information of registered monitor

Acquire registered assignment information of specified device instance path.

int GetAttachedMonitorSymbol(char *DeviceInstancePath, char *MonitorSymbol)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

2 char* MonitorSymbol char array of [MAX_PATH] size

Return Value
Success :Size of MonitorSymbol
Fail :0

Remark
If DeviceInstancePath is NULL, fail(0) will be returned.

12.2. Registering assignment information of monitor

Set assignment information of specified device instance path.

bool SetAttachedMonitorSymbol(char *DeviceInstancePath, char *MonitorSymbol)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

2 char* MonitorSymbol char array of [MAX_PATH] size

Return Value
Success :1
Fail :0

Remark
If DeviceInstancePath is NULL, fail (0) will be returned.
If MonitorSymbol is NULL or NIL, assignment information will be deleted.

DEC-S0337A 16 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

13. Implementation Example of Assignment Information of Registered Monitor

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bits


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];
char symbol[MAX_PATH];

// Acquiring device instance path


GetTouchDeviceInstancePath(i, device);

// Acquring asignment information of registered monitor


int symbolSize= GetAttachedMonitorSymbol(device, symbol);

if (symbolSize != 0)
{
// Success
printf("get attached monitor symbol is Complete¥n");
}
else
{
// Fail
printf("get attached monitor symbol is Failed¥n");
}

// Registering assignment information of monitor


int iResult = SetAttachedMonitorSymbol(device, symbol);
if(iResult == 1) {
// Success
printf("set attached monitor symbol is Complete¥n");
} else {
// Fail
printf("set attached monitor symbol is Failed¥n");
}
}

DEC-S0337A 17 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

14. Touch Data Acquisition

14.1. Touch Detection (Registration or Cancel of Windows Even)

Register or cancel touch detection using Windows event.


If touch is made after registration, WM_INPUT message will be informed to the registered handle.

int RegisterTouchEventNotify (char *DeviceInstancePath, HWND handle)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path


Registration= Handle to which event is
2 HWND handle sent
Cancel=NULL

Return Value
Success :1
Fail :-1

Remark
If DeviceInstancePath is NULL, registration or cancel is made to all the touch devices.

After registration, normal touch and mouse output will not be made until cancellation.

14.2. Touch Data

The data informed with WM_INPUT message will be acquired by RawInput API of Windows.

Details of the values saved in structure of [RAWINPUT] after acquisition is as follows.

・Structure of [RAWINPUTHEADER]

Name Type Value

dwType DWORD RIM_TYPEHID


dwSizeHid DWORD 17

DEC-S0337A 18 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

[ReportID] of the head [0] byte is used to identify the acquired data.

・Touch Data [bRawData] array of [RAWHID] structure

offset Name Type Value

0 ReportID UCHAR 「10」 Fixed


1 Status UCHAR Bit7 「1」 Fixed
Touch ID
00000:1st point
Bit2~6 00001:2nd point

10100:20th point (Max)
0:Touch-up
Bit0
1:Touch-down
2 X USHORT Coordinate Value:0~32767

4 Y USHORT Coordinate Value:0~32767

6 Width USHORT Depends on the controller being connected

8 Height USHORT Depends on the controller being connected

10 Pressuer USHORT Depends on the controller being connected

12 Azimuth USHORT Depends on the controller being connected

14 ScanTime USHORT Depends on the controller being connected

16 ContactCount UCHAR 「1」 fixed

・Mouse Data 「bRawData」 of 「RAWHID」 structure

offset Name Type Value

0 ReportID UCHAR 「11」 fixed


1 Status UCHAR 0:Right-button up
Bit1 1:Right-button down
0:Left-button up
Bit0 1:Left-button down
2 X ULONG Coordinate Value:0~65535
6 Y ULONG Coordinate Value:0~65535

DEC-S0337A 19 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

15. Implementation Example of Touch Data Acquisition

Implementation example (C/C++) is as follows.

#include "stdafx.h"
#include <windows.h>
#include <string>

#include <Cfgmgr32.h>
#include <setupapi.h>
#pragma comment(lib, "setupapi.lib")

#pragma comment(lib, "../DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bits


#include "../DriverSetting.h"

// Sample of structure to save the received data

#pragma pack(push,1)
struct Touch {
UCHAR Status;
USHORT X;
USHORT Y;
USHORT Width;
USHORT Height;
USHORT Pressuer;
USHORT Azimuth;
USHORT ScanTime;
UCHAR ContactCount;
};

struct Mouse {
UCHAR Status;
UCHAR Dummy1;
UCHAR Dummy2;
unsigned long X;
unsigned long Y;
};

typedef struct RAWDATA {


UCHAR ReportID;
union {
Touch touch;
Mouse mouse;
};
}RawData, * PRawData;
#pragma pack(pop)

DEC-S0337A 20 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

// Sample of acquiring idneitification infomration of touch device

// Convert to device instance path from device symbol name


int GetSymbolToInstance(char *symbol, char *instance)
{
int i;
instance[0] = 0x00;

for (i=0; i<(int)(strlen(symbol) -4); i++) {


instance[i] = symbol[i +4];

if ('#' == instance[i]) {
instance[i] = '¥¥';
} else if ('{' == instance[i]) {
instance[i -1] = '¥0';
break;
} else if ('¥0' == instance[i]) {
break;
}
}
return (int)strlen(instance);
}

// Aqcuring instance path of parent device from device instance path


BOOL GetDeviceInstance(char *pDevice, char *pInstance)
{
BOOL bRet = FALSE;
SP_DEVINFO_DATA DevInfo;
char _pDevice[MAX_PATH]= "";
GetSymbolToInstance(pDevice, _pDevice);

//Refer to MSDN for details of setupAPI


HDEVINFO Devs = SetupDiCreateDeviceInfoList( NULL, NULL);
if (NULL == Devs) return FALSE;

memset( &DevInfo, 0x00, sizeof(DevInfo));


DevInfo.cbSize = sizeof(DevInfo);

if (SetupDiOpenDeviceInfoA( Devs, _pDevice, NULL, 0, &DevInfo)) {


DEVINST ParInst;
if (CR_SUCCESS == CM_Get_Parent(&ParInst, DevInfo.DevInst, 0)) {
if (CR_SUCCESS == CM_Get_Device_IDA(ParInst, pInstance,
MAX_DEVICE_ID_LEN, 0)) {
bRet = TRUE;
}
}
}
SetupDiDestroyDeviceInfoList( Devs);
return bRet;
}

DEC-S0337A 21 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

// Acquisition sample of RawInput API

//Acquiring information fomr handle of WM_INPUT event


BOOL GetRawData(LPARAM lp, PRawData pRawData, char *pInstance)
{
UINT dwSize;
char lpb[0xFF];
RAWINPUT* raw = (RAWINPUT*)lpb;
char Device[MAX_PATH] = "";

UINT cbSize;

//Refer to MSDN for details of GetRawInputData()


GetRawInputData((HRAWINPUT)lp, RID_INPUT,NULL, &dwSize,
sizeof(RAWINPUTHEADER));
if(0 >= dwSize || 0xFF <= dwSize)
return FALSE;

UINT gwSize = GetRawInputData((HRAWINPUT)lp, RID_INPUT, lpb, &dwSize,


sizeof(RAWINPUTHEADER));
if(gwSize != dwSize)
return FALSE;

if(raw->header.dwType != RIM_TYPEHID)
return FALSE;

if(raw->data.hid.dwSizeHid != sizeof(RawData))
return FALSE;

cbSize = MAX_PATH;

GetRawInputDeviceInfoA(raw->header.hDevice, RIDI_DEVICENAME, Device, &cbSize);


if (0 >= strlen(Device))
return FALSE;

memcpy(pRawData, raw->data.hid.bRawData, sizeof(RawData));

// Acquring device instance path of output source


return GetDeviceInstance(Device, pInstance);;
}

DEC-S0337A 22 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

//Acquisition sample of RawInput API

// Acquiring touch ID (0~max)


#define Get_Hid_Degitizer_TouchID(status) (status & 0x7c) >> 2
// Acquiring touch input (0:touch up :touch down)
#define Get_Hid_Degitizer_TouchState(status) (status & 0x01)

// Acquisition of touch data


void InputRawData(LPARAM lp)
{
RawData RawData;
char Instance[MAX_PATH] = "";

//Acquiring data from handle of WM_INPUT event


// The same value as GetTouchDeviceInstancePath() will be stored in Instance.
// Can be used for identification when multiple touch screens are connected
GetRawData(lp, &RawData, Instance);

switch(RawData.ReportID) {
// Touch data
case 10: {
Touch* pTouch = (Touch*)&RawData.touch;
int id = Get_Hid_Degitizer_TouchID(pTouch->Status);
int State = Get_Hid_Degitizer_TouchState(pTouch->Status);
int x = pTouch->X;
int y = pTouch->Y;
}break;

// Mouse data
case 11: {
Mouse* pMouse = (Mouse*)&RawData.mouse;
int State = pMouse->Status;
long x = pMouse->X;
long y = pMouse->Y;
}break;
}
}

//Processing touch data informed in WM_INPUT


LRESULT CALLBACK WndProc(HWND hwnd , UINT msg , WPARAM wp , LPARAM lp)
{
switch (msg) {
case WM_INPUT:
InputRawData(lp);
break;
}
return DefWindowProc(hwnd , msg , wp , lp);
}

DEC-S0337A 23 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

// Touch detection (Windows event regier/deregister) sample of API

// Main function Windows application


int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
WNDCLASS winc;
{
memset(&winc, 0, sizeof(WNDCLASS));
winc.lpfnWndProc = WndProc;
winc.hInstance = hInstance;
winc.lpszClassName = "Sample";
}
RegisterClass(&winc);
HWND hWnd = CreateWindow(("Sample"), "", 0 , 0 ,0, 0, 0, NULL, NULL,
hInstance, NULL);

// Activation of touch detection


if( 1 != RegisterTouchEventNotify(NULL, hWnd) ) {
return -1;
}

// Main message loop:


while (GetMessage(&msg, NULL, 0, 0)) {
DispatchMessage(&msg);
}

// Disablement of touch detection


RegisterTouchEventNotify(NULL, NULL);

return 0;
}

DEC-S0337A 24 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

16. EEPROM Setting

16.1. Acquiring status of EEPROM

Acquire usage status of EEPROM of controller of specified device instance path.

int GetEEPROM(char *DeviceInstancePath)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

Return Value
EEPROM enabled :1
EEPROM disabled :0
Fail :-1
EEPROM absent :-2
EEPROM abnormal :-3

Remark
If DeviceInstancePath is NULL, fail (-1) will be returned.

16.2. Setting Status of EEPROM

Setting the usage status of EEPROM of controller of specified device instance path

int SetEEPROM(char *DeviceInstancePath, bool state)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

2 Bool state Enabled :true Disabled :false

Return Value
EEPROM enabled :1
EEPROM disabled :0
Fail :-1
EEPROM absent :-2
EEPROM abnormal :-3

Remark
If DeviceInstancePath is NULL, fail (-1) will be returned.

DEC-S0337A 25 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

17. Implementation Example of EEPROM Calibration

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>
#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit
#include "DriverSetting.h"

void main(void)
{
// Specifing the device and executing calibration
int num = GetTouchDeviceCount();

if(0 >= num) {


// Device does not exist
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];
// Aqcuiring device instance path
GetTouchDeviceInstancePath(i, device);

// Acquiring status of EEPROM *IfEEPROM is to be enabled, [SetEEPROM] is used.


int iState = GetEEPROM(device);

if( 1 != iState) {
/EEPROM calibration cannot ne executed if status of EEPROM is other than
enabled.
printf("Device=%d GetEEPROM is ERROR iStatus=%d ¥n", i, iState);
continue;
}

// 4-point calibration *For 9-point calibration, [ExecuteCalibration9point] is used.


iState = ExecuteCalibration(device);

if( 1 == iState) {
// Success
printf("Device=%d ExecuteCalibration is Complete ¥n", i);
}else {
// Fail
printf("Device=%d ExecuteCalibration is ERROR iStatus=%d ¥n", i, iState);
}
}
return;
}

DEC-S0337A 26 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

18. Right-Click Setting

18.1. Acquiring method of Right-Click

Acquire method of Right-Click of controller of specified device instance path.

int GetEnableRightClick ( char DeviceInstancePath,


int* PressAndHoldTime,
int* PressAndHoldRange)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

0: unset
2 Int* PressAndHoldTime
100 to 1000: detection time(ms)

0: unset
3 Int* PressAndHoldRange
100 to 1000: detection area

Return Value
Right-Click (Long touch) enabled :1
Right-Click (2-point touch) enabled :2
Right-Click disabled :0
Fail :-1

Remark
The current setting will be stored into PressAndHoldTime/PressAndHoldRange.
PressAndHoldTime and PressAndHoldRange are available only if Right-Click (Long touch) is enabled.
If DeviceInstancePath is NULL, fail (-1) will be returned.

DEC-S0337A 27 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

18.2. Setting method of Right-click

Setting the method of Right-click of controller of specified device instance path

int SetEnableRightClick( char *DeviceInstancePath,


int state,
int PressAndHoldTime,
int PressAndHoldRange)

Parameter Type Variable Name Description

1 char* DeviceInstancePath Device Instance Path

0: disable
2 Bool state 1: Right-click (long touch) enable
2: Right-click (2-point touch) enable

100 to 1000: detection time (ms)


3 int PressAndHoldTIme
Default: 300

100 to 1000: detection area


4 int PressAndHoldRange
Default: 300

Return Value
Success :1
Fail :-1

Remark
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.
PressAndHoldTime and PressAndHoldRange are available only if Right-Click (Long touch) is enabled.
Right-click setting is available only if mouse input is enabled.

DEC-S0337A 28 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

19. Implementation Example of Right-click setting

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") //”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];
int iPressAndHoldTime;
int iPressAndHoldRange;

// Acquiring device instance path.


GetTouchDeviceInstancePath(i, device);

// Acquiring method of Right-click of specified device.


int iState = GetEnableRightClick ( device,
&iPressAndHoldTime,
&iPressAndHoldRange);

printf("Device=%s GetEnableRightClick State=%d HoldTime=%d HoldRange=%d¥n",


device, iState, iPressAndHoldTime, iPressAndHoldRange);

// Switching Enable/Disable
int iFlg = 1; // Right-click (Long touch) enabled.
if( iState > 0) {
iFlg = 0; // Right-click disabled.
}

// Setting the method of Right-click of specified device to default value.


iState = SetEnableRightClick ( device, iFlg, 300, 300);

printf("Device=%s SetEnableRightClick State=%d¥n", device, iState);


}
}

DEC-S0337A 29 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

20. Output Rate Setting

20.1. Acquiring output rate

Acquiring output rate of controller of specified device instance path.

int GetOutPutRate (char *DeviceInstancePath)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path

Return Value
Success :1 or greater
Not supported :0
Fail :-1

Remark
If the controller is not supported, “not supported” (0) will be returned.
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

20.2. Setting Output rate

Setting output rate of controller of specified device instance path.

int DirectCommand (char *DeviceInstancePath, unsigned char *Command, int Size)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 Int iRate Output rate

Return Value
Success :1
Not supported :0
Fail :-1

Remark
If the controller is not supported, “not supported” (0) will be returned.
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

DEC-S0337A 30 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

21. Implementation Example of Output Rate Setting

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring device instance path


GetTouchDeviceInstancePath(i, device);

// Setting output rate


int iState = SetOutPutRate(device, 30);

// Not supported or fail


if (0 >= iState)
{
printf("Device=%d SetOutPutRate ERROR State=%d ¥n", i, iState);
continue;
}

// Acquring output rate


iState = GetOutPutRate(device);
printf("Device=%d GetOutPutRate rate=%d ¥n", i, iState);
}
}

DEC-S0337A 31 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

22. Controller Direct Output

22.1 Controller Direct Sending

Sending a specified command to the controller of specified device instance path

int DirectCommand (char *DeviceInstancePath, unsigned char *Command, int Size)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 unsigned char * Command Send command
Send size
3 int Size Serial : 1 - 61 bytes
USB : 1 - 64 bytes

Return Value
Success :1
Fail :-1

Remark
If the controller is not supported, “fail” (-1) will be returned.

DEC-S0337A 32 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

23. Implementation Example of Controller Direct Output

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

// Directly sending the coordinate termination command of TSC controller


unsigned char stopCmd[] = { 0x02 };
int iState = DirectCommand(device, stopCmd, sizeof(stopCmd));

// Fail
if (0 >= iState)
{
printf("Device=%d DirectCommand ERROR State=%d ¥n", i, iState);
}
}
}

DEC-S0337A 33 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

24. Direct Input from Controller

24.1 Communication with Controller

Starting or stopping communication with controller of a specified Device Instance Path

int DirectCommunication (char *DeviceInstancePath, int State)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 int State 1:Start 0:Stop

Return Value
Success :1
Fail :-1

Remark
If the connected controller is not supported, “fail”(-1) will be returned.
If communication with controller is not started, “fail” (-1) will be returned.

24.2 Direct Input from Controller

Receiving a specified command to the controller of specified device instance path

int DirectRequest (char *DeviceInstancePath, unsigned char *Data, int Size, int TimeOut)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 unsigned char * Data Receive data
Request size
3 int Size Serial : 1 - 61 bytes
USB : 1 - 64 bytes
4 int TimeOut TimeOut : 0 to 10000 (ms)

Return Value
Success :Receive Size
TimeOut :0
Fail :-1

Remark
If the connected controller is not supported, “fail”(-1) will be returned.
If communication with controller is not started, “fail” (-1) will be returned.

DEC-S0337A 34 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

25. Implementation Example of Direct Input from Controller

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num)
{
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

// Starting direction communication with controller


if(1 == DirectCommunication (device, 1))
{
// Sending 3-byte data
unsigned char send_data[] = { 0x0A, 0x0B, 0x0C };
DirectCommand(device, send_data, sizeof(send_data));

// Requesting 3-byte data, time out after 100ms


unsigned char recv_data[3];
int iState = DirectRequest (device, recv_data, sizeof(recv_data), 100);

// Confirming received result


if(iState >= 0)
printf("Device=%d DirectRequest RecvSize=%d ¥n", i, iState);
else
printf("Device=%d DirectRequest ERROR ¥n", i);

// Ending direct communication with controller


DirectCommunication(device, 0);
}
else
{
printf("Device=%d DirectCommunication Start ERROR ¥n", i);
}
}
}

DEC-S0337A 35 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

26. XY Inversion and Swap

26.1 Acquiring X Inversion Status

Acquiring X inversion status of controller of a specified Device Instance Path

int GetInvertedX (char *DeviceInstancePath)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path

Return Value
Enable :1
Disable :0
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

26.2 Acquiring Y Inversion Status

Acquiring Y inversion status of controller of a specified Device Instance Path

int GetInvertedY (char *DeviceInstancePath)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path

Return Value
Enable :1
Disable :0
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

Return Value
Success :1
Fail :-1

DEC-S0337A 36 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

26.3 Acquiring XY Swap Status

Acquiring XY swap status of controller of a specified Device Instance Path

int GetSwapXY (char *DeviceInstancePath)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path

Return Value
Enable :1
Disable :0
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

26.4 Setting X Inversion Status

Setting X inversion status of controller of a specified Device Instance Path

int SetInvertedX (char *DeviceInstancePath, bool flg)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 bool flg TRUE= Enabling FALSE=Disabling

Return Value
Success :1
Fail :-1

Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.

DEC-S0337A 37 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

26.5 Setting Y Inversion Status

Setting Y inversion status of controller of a specified Device Instance Path

int SetInvertedY (char *DeviceInstancePath, bool flg)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 bool flg TRUE= Enabling FALSE=Disabling

Return Value
Success :1
Fail :-1

Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.

26.6 Setting XY Swap Status

Setting XY swap status of controller of a specified Device Instance Path

int SetSwapXY (char *DeviceInstancePath, bool flg)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 bool flg TRUE= Enabling FALSE=Disabling

Return Value
Success: 1
Fail: -1

Reamrks
If DeviceInstancePath is NULL, the status of all the touch screens will be changed at once.

DEC-S0337A 38 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

27. Implementation Example of XY Inversion and Swap

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

// Enabling X inversion
if (true== SetInvertedX(device, true)){
if (true== GetInvertedX(device)) {
printf("X Line is Inverted ¥n");
}
}

// Enablig Y inversoin
if (true== SetInvertedY(device, true)) {
if (true== GetInvertedY(device)) {
printf("Y Line is Inverted ¥n");
}
}

// Enabling XY swap
if (true== SetSwapXY(device, true)) {
if (true== GetSwapXY(device)) {
printf("XY Line is Swaped ¥n");
}
}
}
}

DEC-S0337A 39 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

28. Acquiring Calibration Information

28.1 Acquiring Calibration Result

Acquiring calibration information of controller of a specified Device Instance Path

int GetCalibrationInfomation (char *DeviceInstancePath, Correction* correction, Correction* ideal)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 Correction* correction Corrected point
3 Correction ideal Ideal point

Return Value
4-point calibration : 1 *If EEPROM is enabled, calibration information will be acquired from EEPROM.
9-point calibration : 2 *If EEPROM is enabled, calibration information will be acquired from EEPROM.
Calibration inactive: 0 *If calibration is not performed, calibration inactive will be returned,
Fail :-1
Not supported : -2 *If the controller does not support EERPOM, Not supported will be returned.

Parameter
typedef struct CORRECTION{
USHORT p00x; /** @brief p00 X coordinate (4 points /9 points) 0〜32767*/
USHORT p00y; /** @brief p00 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p10x; /** @brief p10 X coordinate (4 points /9 points) 0〜32767*/
USHORT p10y; /** @brief p10 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p01x; /** @brief p01 X coordinate (4 points /9 points) 0〜32767*/
USHORT p01y; /** @brief p01 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p11x; /** @brief p11 X coordinate (4 points /9 points) 0〜32767*/
USHORT p11y; /** @brief p11 Y coordinate (4 points /9 points) 0〜32767*/
USHORT p20x; /** @brief p20 X coordinate (9 points) 0〜32767*/
USHORT p20y; /** @brief p20 Y coordinate (9 points) 0〜32767*/
USHORT p21x; /** @brief p21 X coordinate (9 points) 0〜32767*/
USHORT p21y; /** @brief p21 Y coordinate (9 points) 0〜32767*/
USHORT p02x; /** @brief p02 X coordinate (9 points) 0〜32767*/
USHORT p02y; /** @brief p02 Y coordinate (9 points) 0〜32767*/
USHORT p12x; /** @brief p12 X coordinate (9 points) 0〜32767*/
USHORT p12y; /** @brief p12 Y coordinate (9 points) 0〜32767*/
USHORT p22x; /** @brief p22 X coordinate (9 points) 0〜32767*/
USHORT p22y; /** @brief p22 Y coordinate (9 points) 0〜32767*/
}Correction;

DEC-S0337A 40 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

Reamrks

In 4-point caliration, 4 points P00 – P11 indicated as follows will be the effective coordinates for both
corrected and ideal points.

P00(X,Y) P10(X,Y)

P01(X,Y) P11(X,Y)

In 9-point caliration, 9 points P00 – P22 indicated as follows will be the effective coordinates for both
corrected and ideal points.

P00(X,Y) P10(X,Y) P20(X,Y)

P01(X,Y) P11(X,Y) P21(X,Y)

P02(X,Y) P12(X,Y) P22(X,Y)

DEC-S0337A 41 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

29. Implementation Example of Acquiring Calibration Information

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

Correction correction, ideal;

// Enabling X inversion
switch(GetCalibrationInfomation (device, &correction, &ideal))
{
case 0: // Calibration inactive (Calibration is not performed)
printf("calibration is Complete¥n");
break;

case 1: // 4-points calibration


printf("4 Points Calibration is P00(%d,%d) to P11(%d,%d)¥n",
correction.p00x, correction.p00y, correction.p11x, correction.p11y);
break;

case 2: // 9-points calibration


printf("9 Points Calibration is P00(%d,%d) to P22(%d,%d)¥n",
correction.p00x, correction.p00y, correction.p22x, correction.p22y);
break;

case -1: // Fail


case -2: // Not supported
printf(" GetCalibrationInfomation Error¥n");
break;
}
}
}

DEC-S0337A 42 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

30. COM port Setting

30.1 Changing COM port No.

Changing COM port number used by controller of specified device instance path.

int SetComPortNo (char *DeviceInstancePath, int comport)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 int comport COM port number

Return Value
Success :1
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
If a non-existent COM port number is specified, “fail” (-1) will be returned.

30.2 Controls COM port

Controls COM port used by controller of specified device instance path.

int SerialDeviceEnable (char *DeviceInstancePath, BOOL enable)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 BOOL enable True:Open / false:Close

Return Value
Open :1
Close :0
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

DEC-S0337A 43 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

31. Implementation Example of COM port setting

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
int iState;
char device[MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

// Changing COM port to “1”


iState = SetComPortNo(device, 1);
if( 1 != iState) {
printf("Device=%d SetComPortNo is ERROR iStatus=%d ¥n", i, iState);
continue;
}

// Close COM port


iState = SerialDeviceEnable(device, false);
if( 0 != iState) {
printf("Device=%d SerialDeviceEnable is ERROR iStatus=%d ¥n", i, iState);
continue;
}

// Open COM port


iState = SerialDeviceEnable(device, true);
if( 1 != iState) {
printf("Device=%d SerialDeviceEnable is ERROR iStatus=%d ¥n", i, iState);
continue;
}
}
}

DEC-S0337A 44 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

32. Configuration Setting

32.1 Changing configuration setting.

Changing configuration setting used by controller of specified device instance path.

int SetConfig (char *DeviceInstancePath, char * ConfigFileName)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 char* ConfigFileName Configuration file name

Return Value
Success :1
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.
For the configuration file name, specify one of the configuration file names that can be selected on the
DMT-DD setting tool.

32.2 Acquiring Configuration File name

Acquire configuration file name of controller of specified device instance path.

int GetConfig (char *DeviceInstancePath, char * ConfigFileName)

Parameter Type Variable Name Description


1 char* DeviceInstancePath Device Instance Path
2 char* ConfigFileName char array of [MAX_PATH] size

Return Value
Success : :Size of ConfigFileName
Fail :-1

Reamrks
If DeviceInstancePath is NULL, “fail” (-1) will be returned.

DEC-S0337A 45 ©2022 DMC Co., Ltd.


DMT-DD API Specification Sheet

33. Implementation Example of Acquiring Calibration Information

Implementation example (C/C++) is as follows.

#include <stdio.h>
#include <windows.h>

#pragma comment(lib, "DriverSetting.lib") // ”DriverSetting_x64.lib” for 64bit


#include "DriverSetting.h"

void main(void)
{
int num = GetTouchDeviceCount();
if(0 >= num) {
// Device does not exist.
return;
}

for(int i = 1; i <= num; i++)


{
char device[MAX_PATH];
char configFileName [MAX_PATH];

// Acquiring Device Instance Path


GetTouchDeviceInstancePath(i, device);

// Acquring Configuration File Name


if(-1 == GetConfig (device, configFileName)) {
continue;
}

printf("Device=%d Current ConfigFileName is %s ¥n", i, configFileName);

// Setting Mouse input mode


if( 1 != SetConfig (device, "Mouse.mfd")) {
printf("Device=%d SetConfig is Failed ¥n", i);
continue;
}

// Setting Touch input mode


if( 1 != SetConfig (device, "Touch.mfd ")) {
printf("Device=%d SetConfig is Failed ¥n", i);
continue;
}
}
}

DEC-S0337A 46 ©2022 DMC Co., Ltd.

You might also like