CAS Communication Library Eng 191017
CAS Communication Library Eng 191017
CASPRTC V2.5.2
Copyright CAS
201710/17
1
INDEX
1. CAS CommLib........................................................................................................ 6
1.1 Concept....................................................................................................... 6
1.1.1 CommLib Structure..........................................................................6
1.1.2 CommLib communication method.................................................6
1.1.3 CommLib communication procedure............................................8
1.1.4 File structure....................................................................................9
1.1.5 CLInterpreter DATAOPTION.INI......................................................9
1.1.6 Define value....................................................................................12
1.1.7 int gRecvProc(TD_ST_TRANSDATA_V02 tdData)........................15
1.1.8 int gStateProc(TD_ST_TRANSDATA_V02 tdData).......................17
1.2 CASPRTC................................................................................................... 19
1.2.1 CASPRTC.DLL Diagram..................................................................19
1.2.2 Interface – CASPRTC......................................................................20
1.2.2.1 CASPRTC : SetRecvWindow()....................................................20
1.2.2.2 CASPRTC : SetCommLibrary()...................................................21
1.2.2.3 CASPRTC : AddInterpreter()......................................................22
1.2.2.4 CASPRTC : AddConnection().....................................................24
1.2.2.5 CASPRTC : AddConnectionEx().................................................26
1.2.2.6 CASPRTC : AddMsgConnection ().............................................28
1.2.2.7 CASPRTC : AddProcConnection()..............................................31
1.2.2.8 CASPRTC : AddProcConnectionEx()..........................................34
1.2.2.9 CASPRTC : DeleteConnection().................................................37
1.2.2.10 CASPRTC : Connect()................................................................38
1.2.2.11 CASPRTC : Disconnect()...........................................................39
1.2.2.12 CASPRTC : SendData().............................................................40
1.2.2.13 CASPRTC : SendDataEx().........................................................42
1.2.2.14 CASPRTC : IsConnect().............................................................45
1.2.3 Interface – Interpreter..................................................................46
1.2.3.1 Interpreter : Initialize()............................................................46
1.2.3.2 Interpreter : Interpret().............................................................47
1.2.3.2 Interpreter : Deinterpret()........................................................50
1.2.3.3 Interpreter : GetLibraryInfo()...................................................52
1.2.3.4 Interpreter : AddBuffer()...........................................................53
1.2.3.5 Interpreter : DeleteBuffer()......................................................55
1.2.4 Structure.........................................................................................57
2
1.2.4.1 _stTransData................................................................................57
1.2.4.2 _stTransDataV02.........................................................................61
1.2.4.3 _stSocketInfo...............................................................................66
1.2.4.4 _stSocketInfoV02........................................................................69
1.2.4.5 _stSerialInfo................................................................................73
1.2.4.6 _stDataPLUv06............................................................................76
1.2.4.7 _stDataDisc..................................................................................85
1.2.4.8 _stDataDept.................................................................................88
1.2.4.9 _stDataGroup..............................................................................89
1.2.4.10 _stDataTaxRate.........................................................................90
1.2.4.11 _stDataSaleMsg........................................................................91
1.2.4.12 _stDataOrigin............................................................................92
1.2.4.13 _stDataBarcode.........................................................................93
1.2.4.14 _stDataTare................................................................................94
1.2.4.15 _stPcsUnit..................................................................................95
1.2.4.16 _stDataIngredient.....................................................................96
1.2.4.17 _stDataNutrifact_V02...............................................................97
1.2.4.18 _stDataTrace..............................................................................99
1.2.4.19 _stDataCountry.......................................................................100
1.2.4.20 _stDataSlaught.......................................................................101
1.2.4.21 _stDataCut...............................................................................102
1.2.4.22 _stDataStore...........................................................................103
1.2.4.23 _stDataCustom........................................................................104
1.2.4.24 _stDataScrollMsg_v03............................................................105
1.2.4.25 _stDataSecurity......................................................................107
1.2.4.26 _stAck.......................................................................................108
1.2.4.27 _stDataState............................................................................109
1.2.3.28 _stScaleInfo.............................................................................110
1.2.4.29 _stScaleVersion.......................................................................112
2.FileTrans............................................................................................................... 114
2.1 Concept................................................................................................... 114
2.1.1 Structure.......................................................................................114
2.1.2 Interface........................................................................................114
2.1.3 Data structure..............................................................................115
2.1.3.1 PLU Data....................................................................................115
2.1.3.2 MESSAGE DATA..........................................................................117
3
2.1.3.3 ScaleInfo....................................................................................118
2.1.3.4 NUTRIFACT DATA.......................................................................118
2.1.3.5 VERSIONDATA...........................................................................118
2.1.3.6 DISCOUNT DATA.......................................................................118
2.2 Interface................................................................................................. 120
2.2.1 Interface – FileTrans....................................................................120
2.2.1.1 FileTrans : Connection()..........................................................120
2.2.1.2 FileTrans : ConnectionEx()......................................................121
2.2.1.3 FileTrans : AddPLU (PLUDATA)................................................122
2.2.1.4 FileTrans : AddMSG()...............................................................123
2.2.1.5 FileTrans : AddNutrifact()........................................................124
2.2.1.6 FileTrans : AddDiscount()........................................................126
2.2.1.7 FileTrans : SendPLU ()..............................................................127
2.2.1.8 FileTrans : SendMSG ()............................................................128
2.2.1.9 FileTrans : SendNutrifact ().....................................................129
2.2.1.10 FileTrans : SendDiscount ()...................................................130
2.2.1.11 FileTrans : RecvPLU ()............................................................131
2.2.1.12 FileTrans : RecvMSG ()...........................................................132
2.2.1.13 FileTrans : RecvNutrifact ()...................................................133
2.2.1.14 FileTrans : RecvDiscount ()...................................................134
2.2.1.15 FileTrans : RecvPLUData ()....................................................135
2.2.1.16 FileTrans : RecvMSGData ()..................................................136
2.2.1.17 FileTrans : RecvNutrifactData ()..........................................137
2.2.1.18 FileTrans : RecvDiscountData ()...........................................139
2.2.1.19 FileTrans : DeletePLU ().........................................................140
2.2.1.20 FileTrans : DeletePLUAll ()....................................................141
2.2.1.21 FileTrans : DeleteMSG ()........................................................142
2.2.1.22 FileTrans : DeleteNutrifact ()................................................143
2.2.1.23 FileTrans : DeleteDiscount ()................................................144
2.2.1.24 FileTrans : GetScaleInfo ()....................................................145
2.2.1.24 FileTrans : GetScaleInfoData ()............................................146
2.2.1.25 FileTrans : GetState ()...........................................................147
2.2.1.26 FileTrans : GetLibVersion ()..................................................148
2.2.1.27 FileTrans : DisconnectAll ()...................................................149
2.2.1.28 FileTrans : ReadPLU ()...........................................................150
2.2.1.29 FileTrans : ReadMSG ()..........................................................151
4
2.2.1.30 FileTrans : RecvVersion ().....................................................152
2.2.1.31 FileTrans : RecvVersionData ().............................................153
Appendix 1 – The available data by scale models..........................................................154
1. The available data by scale models......................................................154
2. The available PLU items by scale models............................................155
Appendix 2 -Tutorial.................................................................................................. 157
1. Start........................................................................................................... 157
2. Visual C++ Tutorial..................................................................................158
3. Delphi Tutorial..........................................................................................165
5
1. CAS CommLib
1.1 Concept
Module proceeding communication between scale and Application
Purpose of CommLib is that you can support any type of communication just when you know
interface provided by that.
1.1.1 CommLib Structure
CommLib Structure has 3 steps.
1st. Step – Manager module
2nd. Step – Interpreter module
3rd. Step – Communication module
Manager module provide the interface between Application and communication module and has
the function of controlling 2nd. and 3rd. functions.
Interpreter module interpret the data from application formatted data to scale formatted data or
otherwise.
Communication module transfer data from interpreter module to scale or otherwise.
Other modules than 1st. one are organized with more than one file. In the accordance of
communication type, you can add those files and develop.
Application (PC Application program)
Interface Manager
2nd. Step Interpreter module(CLInterpreter.DLL….)
Interpreter Manager
3 . Step
rd
Communication module (CASTCPIP.DLL, ….)
Socket…. Manager
6
(1) Data structure between Application and Module(TD_ST_TRANSDATA_V02)
Name Type and size(Byte) Description
shScaleID short int (2) Connection original number
lpIP LPSTR IP or identification code
btCommType BYTE(1) Communication type
(TCP/IP, ….)
btSendType BYTE(1) Communication method
(Broadcast, ….)
btDataType BYTE(1) Data type (PLU, ….)
wdScaleType WORD(2) Scale type (LP, ….)
wdScaleModel WORD(2) Model type (CL5000, ….)
wdAction WORD(2) Communication purpose
(Upload, ….)
wdDataSize WORD(2) Communication data size
*pData void Data structure pointer
dwScaleMainVersion DWORD Main Version of Scale
dwScaleSubVersion DWORD Sub Version of Scale
dwScaleCountry DWORD Country
dwScaleDataVersion DWORD Version of Data
dwReserveVersion DWORD Reserve
*pReserve void Reserve
7
CL5000J,CL7200
BARCODE CL5000, Send Barcode
CL5000J,CL7200
TARE CL5000, Send Tare
CL5000J,CL7200
PCSUNIT CL5000,CL7200 Send PCS UNIT
INGREDIENT LP1v1.6,CL5000, Send Ingredient
CL5000J,CL7200
NUTRIFACT CL5000,CL7200 Send Nutrition Factor
TRACE CL5000,CL7200 Send Traceability
COUNTRY CL5000,CL7200 Send Country
SLAUGHT CL5000,CL7200 Send Slaughter house
CUT CL5000,CL7200 Send Cut in house
STORE LP1v1.6,CL5000, Send Store information
CL5000J,CL7200
CUSTOM CL5000,CL7200 Send User information
SCROLL MESSAGE CL5000,CL7200 Send Scroll Message
SECURITY CL5000,CL7200 Send Security information
PARAMETER CL5000J Send Scale Setting Info.
8
6. Release connection procedure
7. Deleting Connection procedure
9
SUBSTRUCTURE_USE = 0 Lower reference file numbers (0)
SUBSTRUCTURE_COUNT = 0 Lower reference model
SUBSTRUCTURE_ITEM1_MODEL = Lower reference model file name
SUBSTRUCTURE_ITEM1_FILE =
10
PLU_FIELD48_DATACLAS = 3
Reference :
DATAOPTION.INI file has two types. One for Russia and the other for United
nation.
DATAOPTION_RUS.INI is the Russian configuration file. If you want to use that file,
Delete that file and change name of DATAOPTION_RUS.INI to DATAOPTION.INI.
Communication module DLL should be located in the same path on your laptop
as the application program.
DATAOPTION.INI also should be located on that path.
11
1.1.6 Define value
Definition of Constants in DLL(Dynamic Linked Library)
12
DF_STATE_RETRYOVER 8 End state of retrying to send data
DF_COMMTYPE_ANY 0 Communication type for any
DF_COMMTYPE_TCPIP 1 TCP/IP communication type
DF_COMMTYPE_UDP 2 UDP communication type
DF_COMMTYPE_SERIAL 3 RS232 communication type
DF_SENDTYPE_NORMAL 1 Normal data sending state
DF_SENDTYPE_BROADCAST 2 Broadcasting(UDP) data state
DF_NOTIMEOUT 0 No timing out for communication
DF_RETRY_REPEAT 0 Retry to send data when it fails
DF_LOG_NO 0 Make no log file
DF_LOG_WRITE 1 Make/Write log file
DF_TRANSTYPE_PROC 0 Receiving data with call back type
DF_TRANSTYPE_MSG 1 Receiving data with Windows Message
DF_TRANSTYPE_INDV 8 Receiving data with individual process
DF_MODULE_TCPIP 1 TCP/IP communication module
DF_MODULE_SERIAL 2 RS232 serial module
DF_MODULE_PROTOCOL 3 Protocol module
DF_MODULE_SOCKET 4 (Combined) socket module
DF_MODULE_INTERPRETER 5 Interpretation module
DF_MODULE_USB 6 USB module
DF_CMDTYPE_COMM 1 Module command about communication
DF_CMDTYPE_LOCAL 2 Command for device management
DF_CMDTYPE_LIB 3 Command of communication module
DF_ACTION_NOTHING 0 No execution
DF_ACTION_GETINFO 1 Getting information
DF_ACTION_UPLOAD 2 Getting data from scale
DF_ACTION_DOWNLOAD 3 Sending data to scale
DF_ACTION_DELETE 4 Deleting data of scale
DF_ACTION_DELETEALL 5 Deleting all data of scale
DF_ACTION_READ 6 Reading data
DF_ACTION_WRITE 7 Writing data
DF_ACTION_INITSCALE 8 Initializing scale
DF_ACTION_RESET 9 Restarting scale
DF_ACTION_SET 10 Setting information of scale
DF_ACTION_NORMAL 11 Normal execution
DF_ACTION_SEND 12 Sending data
13
DF_INIT_SOCKET 1 Initializing communication socket
DF_INIT_SERIAL 2 Initializing serial port
DF_INIT_LIBCOMM 3 Initializing module
DF_INIT_INTERPRETER 4 Initializing sentence interpreter
DF_INIT_LIBPROTOCOL 5 Initializing protocol library
DF_INIT_ALL 6 Initializing all library
DF_SIZE_RECVBUFFER 8192+1 Receiving buffer size
DF_SIZE_IPBUFFER 25 IP address buffer size
DF_SIZE_LOGPATHBUFFER 512 Log file path buffer size
DF_NOTHING 0 Ready
DF_BEGIN 1 Start
DF_END 2 End
DF_NAME_LIBTCPIP - “CASTICIP.DLL”
DF_NAME_LIBSERIAL - “CASSERIAL.DLL”
DF_NAME_LIBUSB - “CASUSB.DLL”
DF_NAME_LIBPROTOCOL - “CASPRTC.DLL”
DF_DATA_PLU_V02 9 PLU data type for communication
DF_DATA_PLU_V06 98 PLU data type for communication
DF_DATA_DISC 11 Discount data type for communication
DF_DATA_DEPT 12 Department data type for communication
DF_DATA_GROUP 13 Group data type for communication
DF_DATA_TAXRATE 14 Tax rate data type for communication
DF_DATA_SALEMSG 15 Sale message data type for communication
DF_DATA_ORIGIN 16 Origin data type for communication
DF_DATA_BARCODE 17 Barcode type for communication
DF_DATA_TARE 18 Tare data type for communication
DF_DATA_PCSUNIT 19 PCS Unit type for communication
DF_DATA_INGREDIENT 20 Ingredient data type for communication
DF_DATA_NUTRIFACT_V03 197 Nutrition factor data type for communication
DF_DATA_TRACE 22 Traceability data type for communication
DF_DATA_COUNTRY 23 Country data type for communication
DF_DATA_SLAUGHT 24 Slaughter data type for communication
DF_DATA_CUT 25 Cutting hall data type for communication
DF_DATA_STORE 26 Store data type for communication
DF_DATA_CUSTOM 27 Custom data type for communication
DF_DATA_SCROLLMSG_V03 203 Scroll Message data type for communication
14
DF_DATA_SECURITY 29 Security data type for communication
DF_DATA_REPORT 30 Report data type for communication
DF_DATA_LABEL 31 Label data type for communication
DF_DATA_IMAGE 32 Image data type for communication
DF_DATA_KEY 33 Keypad data type for communication
DF_DATA_PLUINFO 34 PLU Information data type for communication
DF_DATA_SCALECMD 35 Scale command data type for communication
DF_DATA_PARAMETER 38 Scale Setting data type (CL5000J)
DF_DATA_SCALEINFO 40 Scale information type for communication
DF_DATA_VERSION_TYPE1 61 Scale Version data type (CL5000J)
DF_DATA_VERSION_TYPE2 62 Scale Version data type (CL5000)
DF_LABEL_BEGIN 1 Start label data communication
DF_LABEL_HEADER 2 Label header communication
DF_LABEL_DATA 3 Label data communication
DF_LABEL_END 4 End label data communication
DF_IMAGE_BEGIN 5 Start image data communication
DF_IMAGE_HEADER 6 Image header communication
DF_IMAGE_DATA 7 Image data communication
DF_IMAGE_END 8 End image data communication
FLASH_PLU_STATUS_SIZE 50 Size of reading PLU state (LP16)
FLASH_PLU_STATUS 544 Address of PLU state (LP16)
EEP_ALL_SIZE 3153 EEP_ROM total size (LP16)
MESSAGE_ADDRESS 12961 Ingredient starting address (LP16)
If you declared Call back function when data communication, you can get data from
scale. Prototype of Call back function is gRecvProc function.
You can get that data of scale from TD_ST_TRANSDATA_V02 structured data.
If that procedure succeeds, that function returns TRUE, else that returns FALSE.
You should declared that function as global function and pass the pointer of that
function to AddProcConnection function as the argument.
tdDAta
TD_ST_TRANSDATA_V02 structured data. Refer to Structure Interface explanation.
Reference
15
LP typed scale have the original ID and Name.
For example, chName1 is used as dwPLU of TD_ST_PLU_V02(PLU data structure),
chName is used as btNo of TD_ST_DEPT(Department data structure).
If you succeed uploading data from scale, dwPLU and btNo are the numbers of that data.
Else that numbers are 0 or 0xFFFF. 0xFFFF means ‘No data’. 0 means communication
error occurrence on uploading.
You can identify the errors, if you checked the chName or chName1.
Error message
[Data type] + [‘:’] + [‘E’] + [Error number]
Error number
E99 : Data end (No data after that)
E98 : No data that assigned to that original number.
E97 : Data communication error
E95 : Data don’t exist
E84 : Data reception error
E82 : Original number interval error
ex> LP16:E99
R21:E99
If you succeeded to download data to scale, it returns the original numbered dwPLU or
btNo as TRUE, and chName or chName1 has the resulted sentence.
Else, it returns FALSE, and chName or chName1 has the resulted sentence.
Resulted sentence
[Data type] + [‘:’] + [Result code]
ex> w30:00001
w20:00001
Error code is same as the uploading procedure.
If it gets no response after time out limitation it will send request again. So you should
consider data double reception trouble.
Example
int gProcRecv(TD_ST_TRANSDATA_V02 tdData)
16
char chBuffer[1024];
CString csRecv;
CString csMsg;
if (tdData.wdAction == DF_ACTION_UPLOAD)
switch(tdData.btDataType)
case DF_DATA_LOWDATA:
csRecv.Format("%s", (LPSTR)tdData.pData);
break;
default:
g_dlgMain->JProcEndUpload();
break;
case 2:
g_dlgMain->JProcUpload(TRUE);
break;
break;
return TRUE;
If you declared Call back function when data communication, you can get data from
scale. Prototype of Call back function is gStateProc function.
You can get that data of scale from TD_ST_TRANSDATA_V02 structured data.
17
If that procedure succeeds, that function returns TRUE, else that returns FALSE.
You should declared that function as global function and pass the pointer of that
function to AddProcConnection function as the argument.
tdDAta
Refer to Structure Interface explanation. Use pData in TD_ST_TRANSDATA_V02 as
TD_ST_STATE.
Reference
Example
int gProcState(TD_ST_TRANSDATA_V02 tdData)
TD_ST_STATE *tdState;
CString csMsg;
CString csRecv;
tdState = (TD_ST_STATE*)tdData.pData;
csRecv.Format("%s", tdState->lpDescription);
csMsg += csRecv;
g_dlgMain->JProcAddState(csMsg);
return 0;
18
1.2 CASPRTC
1.2.1 CASPRTC.DLL Diagram
Application
Application Program Level
CASPRTC.DLL
ProtocolRecvProc
Information 1 SetIPList
Interpreter
Socket ID
Connect
SendToUpward
Socket IP
Disconnect
Socket Port
SetTimeOut
SEND
Recv Proc
MainRecvProc SetRetry
Information 2 Buffer 2
…
…
Buffer n
Information n
CASTCPIP.DLL/CASSERIAL.DLL
Module for data communication between application
and scale
19
1.2.2 Interface – CASPRTC
Function for setting Window handle for receiving data from scale during data transaction
process. When it succeeds indicate “TRUE,” and indicate “FALSE” for failure.
hWnd
Window handle device for receiving data as message.
Reference
DF_APIEXPORT
Example
HINSTANCE hDll = LoadLibrary(“CASPRTC.DLL”);
if (hDll)
if (pSetRecvWindow != NULL)
pSetRecvWindow(this->m_hWnd);
20
1.2.2.2 CASPRTC : SetCommLibrary()
During communication process with scale, function user can directly initialize module. However,
interface of communication module must be set correctly.
When it succeeds converse into “TRUE,” otherwise “FALSE”
iModuleID
Type of Data Module
Value Description
DF_MODULE_TCPIP Module for TCP/IP
DF_MODULE_SERIAL Module for Serial
DF_MODULE_PROTOCOL Module for Protocol
No use
DF_MODULE_SOCKET Module for Socket communication
No use
DF_MODULE_INTERPRETER Module for interpretation
lpModuleName
Setting Module name (File name)
Reference
DF_APIEXPORT
Example
HINSTANCE hDll = LoadLibrary(“CASPRTC.DLL”);
if (hDll)
TD_LIB_SETCOMMLIBRARYA *pSetCommLibrary =
if (pSetCommLibrary!= NULL)
21
1.2.2.3 CASPRTC : AddInterpreter()
This device initializes data interpreting module for communication process between application
part and hardware part during communication process with Scale.
When it succeeds converse to “TRUE,” and otherwise converse to “FALSE.”
wdScaleType
Setting scale type
Value Description
DF_SCALE_TYPE_LP Label Printer type scale
DF_SCALE_TYPE_RW Road weighing truck scale
DF_SCALE_TYPE_NT Indicator type
DF_SCALE_TYPE_POS Poscale type scale
DF_SCALE_ETC Non-specified or custom-made type
wdScaleModel
Setting Scale Model
Value Description
DF_SCALE_15 LP-1 V15 Model
DF_SCALE_16 LP-1 V16 Model
DF_SCALE_16RUS LP-1V16Rus Russian Model
DF_SCALE_17 LP-1 V17 Model
DF_SCALE_20 LP-2 Model
DF_SCALE_CL5000 CL5000 Model
DF_SCALE_CL5000JR CL5000J Model
DF_SCALE_CL5500 CL5500 Model
DF_SCALE_CL7200 CL7200 Model
22
DF_SCALE_ETC Non-specified or custom-made model
lpLibName
Interpreter file name
The above information is defined in CASPRTC.H
Reference
It is important to know the type and model of scale for communication.
Original data might be applied if interpreter is defined primarily.
User can use Scale Type or ScaleModel as DF_SCALE_ETC for the need of independent
function.
User disregards defining interpreter if there is no need of interpretation of
communication.
Example
HINSTANCE hDll = LoadLibrary(“CASPRTC.DLL”);
if (hDll)
TD_LIB_ADDINTERPRETERA *pAddInterpreter;
if (pAddInterpreter != NULL)
23
1.2.2.4 CASPRTC : AddConnection()
tdConnection
Data connection configuration
It includes every function of connection.
Please refer to TD_ST_CONNECTION, or _stSocketInfo
Reference
In the case of LP1v1.6, you should set time out period unlimited to avoid a retrying.
Data communication speed of LP1v1.6 is slow and the communication structure is not
able to adopt retrying. If you want to make retrying transmission on that, you should
make it yourself on your application.
DF_APIEXPORT
TD_ST_CONNECTION
Example
int g_RecvProc(TD_ST_TRANSDATA_V02 tdData)
return 0;
return 0;
24
HINSTANCE hDll = LoadLibrary(“CASPRTC.DLL”);
if (hDll)
TD_ST_CONNECTION tdConnection;
TD_LIB_ADDCONNECTIONA *pAddConnection;
tdConnection.btCommType = DF_COMMTYPE_TCPIP;
tdConnection.btTransType = DF_TRANSTYPE_PROC;
tdConnection.btDataType = DF_DATA_TEST;
tdConnection.btSocketType = SOCK_STREAM;
tdConnection.wdScaleType = DF_SCALE_ETC;
tdConnection.wdScaleModel = DF_SCALE_ETC;
tdConnection.lpIP = chIP;
tdConnection.lpLogFileName = chLogFile;
tdConnection.wdPort = 2000;
tdConnection.wdTimeOut = 1000;
tdConnection.wdRetryCount = 3;
tdConnection.pRecv = g_RecvProc;
tdConnection.pState = g_StateProc;
if (pAddConnection != NULL)
pAddConnection(tdConnection);
25
1.2.2.5 CASPRTC : AddConnectionEx()
tdConnection
Structure of data connection.
It contains all the characters on connection.
Please refer to the TD_ST_CONNECTION_V02, 또는 _stSocketInfoV02
Referenece
DF_APIEXPORT
TD_ST_CONNECTION_V02
EX)
// Receive call back function
return 0;
return 0;
if (hDll)
26
char chIP[] = {“10.10.0.80”};
int iSubVersion = 4;
int iDataVerison=15;
TD_ST_CONNECTION_V02 tdConnection;
TD_LIB_ADDCONNECTIONA *pAddConnection;
tdConnection.btCommType = DF_COMMTYPE_TCPIP;
tdConnection.btTransType = DF_TRANSTYPE_PROC;
tdConnection.btDataType = DF_DATA_TEST;
tdConnection.btSocketType = SOCK_STREAM;
tdConnection.wdScaleType = DF_SCALE_ETC;
tdConnection.wdScaleModel = DF_SCALE_ETC;
tdConnection.lpIP = chIP;
tdConnection.lpLogFileName = chLogFile;
tdConnection.wdPort = 2000;
tdConnection.wdTimeOut = 1000;
tdConnection.wdRetryCount = 3;
tdConnection.pRecv = g_RecvProc;
tdConnection.pState = g_StateProc;
tdConnection.dwScaleMainVersion=iMainVersion;
tdConnection.dwScaleSubVersion=iSubVersion;
tdConnection.dwScaleCountry=iCountry;
tdConnection.dwScaleDataVersion=iDataVersion;
tdConnection.dwReserveVersion=0;
tdConnection.pReserve=NULL;
if (pAddConnection != NULL)
pAddConnection(tdConnection);
27
// Serial communication example
if (hDll)
int iSubVersion = 4;
int iDataVerison=15;
TD_ST_CONNECTION_V02 tdConnection;
TD_LIB_ADDCONNECTIONA *pAddConnection;
tdConnection.btCommType = DF_COMMTYPE_SERIAL;
tdConnection.btTransType = DF_TRANSTYPE_PROC;
tdConnection.btDataType = DF_DATA_TEST;
tdConnection.btSocketType = DF_SERIAL_TYPE_57600;
tdConnection.wdScaleType = DF_SCALE_ETC;
tdConnection.wdScaleModel = DF_SCALE_ETC;
tdConnection.lpIP = chIP;
tdConnection.lpLogFileName = chLogFile;
tdConnection.wdPort = wdRecvTime;
tdConnection.wdTimeOut = 1000;
tdConnection.wdRetryCount = 3;
tdConnection.pRecv = g_RecvProc;
tdConnection.pState = g_StateProc;
tdConnection.dwScaleMainVersion=iMainVersion;
tdConnection.dwScaleSubVersion=iSubVersion;
tdConnection.dwScaleCountry=iCountry;
tdConnection.dwScaleDataVersion=iDataVersion;
tdConnection.dwReserveVersion=0;
28
if (pAddConnection != NULL)
pAddConnection(tdConnection);
29
1.2.2.6 CASPRTC : AddMsgConnection ()
This device is for adding a connection for delivering data from data communication
For data transaction process, it can be received through designated window message. When it
succeeds converse into “TRUE” and otherwise converse to “FALSE.”
It configures retrying time out limit and retrying number. This process waits the answer on
the rule of retrying.
If you don’t want to use retrying function, set retrying time out limit and number as ‘0’.
DF_APIEXPORT int AddMsgConnection(BYTE btCommType,
LPSTR lpTarget,
WORD wdPort,
WORD wdScaleType,
WORD wdScaleModel,
WORD wdTimeout,
WORD wdRetryCount,
BYTE btDataType,
DWORD dwRecvMsg,
DWORD dwStateMsg )
btCommType
Setting connection type
Value Description
DF_COMMTYPE_TCPIP Setting socket for TCP/IP
DF_COMMTYPE_UDP Setting socket for UDP
DF_COMMTYPE_SERIAL Setting port for Serial connection
lpTarget
Targer Ethernet IP number or Serial port name configuration
wdPort
Port number
wdScaleType
Currently communicating scale type
30
Value Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck Scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
wdScaleModel
Indicate model name (Scale type)
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_16RUS LP-16(Russia)
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdTimeout
Set an time out option
In the case of LP1v1.6, you should not use this(Set it over 900000)
wdRetryCount
Set a function for a number of retry
btDataType
Set type of data for transaction
Value Description
DF_DATA_LOWDATA Data with no need of interpreter
DF_DATA_STATE Data of connection status
DF_DATA_TEST Test data
dwRecvMsg
Window message number for receiving data
dwStateMsg
Window message number for the status of connection
31
Reference
In the case of LP1v1.6, you should set time out period unlimited to avoid a retrying.
Data communication speed of LP1v1.6 is slow and the communication structure is not
able to adopt retrying. If you want to make retrying transmission on that, you should
make it yourself on your application.
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
#define WM_CASRECV WM_USER+10
int OnBtnAddconnect()
if (hDll)
TD_LIB_ADDMSGCONNECTIONA *pAddConnt;
“AddMsgConnection”);
if (pAddConnt != NULL)
iRtn = pAddMsgConnection(btCommType,
m_csIP.GetBuffer(m_csIP.GetLength()),
atoi(m_csPort),
DF_SCALE_ETC,
DF_SCALE_ETC,
atoi(m_csTimeout),
atoi(m_csRetry),
DF_DATA_TEST,
WM_CASRECV,
WM_CASSTATE);
32
}
33
1.2.2.7 CASPRTC : AddProcConnection()
This device is for initializing interpreter module for middle data configuration that facilitate scale
and application program for data transaction.
When it succeeds converse to “TRUE,” and otherwise converse to “FALSE.”
btCommType
Setting connection type
Value Description
DF_COMMTYPE_TCPIP Setting socket for TCP/IP connection
DF_COMMTYPE_UDP Setting socket for UDP connection
DF_COMMTYPE_SERIAL Setting port for Serial connection
lpTarget
Target Ethernet IP number or Serial port name configuration
wdPort
Port number
wdScaleType
Currently communicating scale type
Value Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
34
wdScaleModel
Indicate model name (Scale type)
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_16RUS LP-16(Russia)
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdTimeout
Set an time out option
In the case of LP1v1.6, you should not use this(Set it over 900000)
wdRetryCount
Set a function for a number of retry
btDataType
Set type of data for transaction
Value Description
DF_DATA_LOWDATA Data without interpreter
DF_DATA_STATE Status data of connection
DF_DATA_TEST Test data
pRecvProc
Function pointer for receiving data
int TD_PROC_RECV (TD_ST_TRANSDATA_V02 tdTransData);
pStateProc
Function pointer for status data of connection
int TD_PROC_STATE (TD_ST_TRANSDATA_V02 tdTransData);
Reference
In the case of LP1v1.6, you should set time out period unlimited to avoid a retrying.
Data communication speed of LP1v1.6 is slow and the communication structure is not
able to adopt retrying. If you want to make retrying transmission on that, you should
make it yourself on your application.
35
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
#define WM_CASRECV WM_USER+10
int iRtn = 0;
return iRtn;
int iRtn = 0;
return iRtn;
int OnBtnAddconnect()
if (hDll)
TD_LIB_ADDPROCCONNECTIONA * pAddProcConnection;
“AddProcConnection”);
if (pAddConnt != NULL)
m_csIP.GetBuffer(m_csIP.GetLength()),
atoi(m_csPort),
DF_SCALE_ETC,
DF_SCALE_ETC,
atoi(m_csTimeout),
atoi(m_csRetry),
36
DF_DATA_TEST,
g_DataRecv,
g_StateRecv);
37
1.2.2.8 CASPRTC : AddProcConnectionEx()
On data transmission between scale and application program, it initializes the interpreter
module that translates data structure for being understandable to both sides.
If succeeded, it returns TRUE, or it returns FALSE.
It configures retrying time out limit and retrying number. This process waits the answer on
the rule of retrying.
If you don’t want to use retrying function, set retrying time out limit and number as ‘0’.
btCommType
Configure connection type
Value Description
DF_COMMTYPE_TCPIP Configure socket for TCP/IP communicaiton
DF_COMMTYPE_UDP Configure socket for UDP communicaiton
DF_COMMTYPE_SERIAL Configure socket for Serial communicaiton
lpTarget
Connection target Ethernet IP number or Serial port name string
wdPort
Port number
wdScaleType
Currently communicated scale type
Value Description
DF_SCALE_TYPE_LP Label printer scale
38
DF_SCALE_TYPE_RW Truck scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other typed scale
wdScaleModel
Scale model name
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_16RUS LP-16(Russia)
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdTimeout
Configure Retrying time out limit.
wdRetryCount
Configure Retrying number.
btDataType
Configure what data will be sent
Value Description
DF_DATA_LOWDATA Interpreter needless data
DF_DATA_STATE Connection state information data
DF_DATA_TEST Test data
pRecvProc
Pointer of function that receives data
int TD_PROC_RECV (TD_ST_TRANSDATA_V02 tdTransData);
pStateProc
Pointer of function that receives connection state information
int TD_PROC_STATE (TD_ST_TRANSDATA_V02 tdTransData);
shID
Configure scale ID.(Only for LP16RUS)
shFlag
39
Configuration option (Not confirmed)
Reference
If needed user can develop manually on the Application level.
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
#define WM_CASRECV WM_USER+10
int iRtn = 0;
return iRtn;
int iRtn = 0;
return iRtn;
int OnBtnAddconnect()
if (hDll)
TD_LIB_ADDPROCCONNECTIONEXA *pAddProcConnt;
“AddProcConnectionEx”);
if (pAddConnt != NULL)
m_csIP.GetBuffer(m_csIP.GetLength()),
40
atoi(m_csPort),
DF_SCALE_ETC,
DF_SCALE_ETC,
atoi(m_csTimeout),
atoi(m_csRetry),
DF_DATA_TEST,
g_DataRecv,
g_StateRecv,
1, 0);
41
1.2.2.9 CASPRTC : DeleteConnection()
This device is for deleting connection for communication with scale. When it succeeds converse
to “TRUE,” and otherwise converse to “FALSE.”
lpTarget
Target name for adding connection (ip, port name)
shID
Connection ID: set -1 if connection ID is not applied
Reference
Converse to “FALSE” when IpTarget and shID are both applied and are not matched.
DF_APIEXPORT
Example
int iRtn = 0;
TD_LIB_DELETECONNECTIONA *pDelete;
if (hDll != NULL)
if (pDelete != NULL)
42
1.2.2.10 CASPRTC : Connect()
This device is for connecting an additive connection. When it succeeds converse to “TRUE,”
and otherwise converse to “FALSE.”
lpTarget
Target name for adding connection (ip, port name)
shID
Connection ID: set -1 if connection ID is not applied
Reference
Converse to “FALSE” when IpTarget and shID are both applied and are not matched.
DF_APIEXPORT
Exmaple
int iRtn = 0;
TD_LIB_CONNECTA *pConnect;
if (hDll != NULL)
GetDlgItemText(IDC_EDT_IP, csIP);
if (pConnect != NULL)
43
1.2.2.11 CASPRTC : Disconnect()
This device is for initializing Interpreter module which converse data configuration into a
system for facilitating data transaction between scale and application program.
When it succeeds converse to “TRUE,” and otherwise converse to “FALSE.”
lpTarget
Target name for adding connection (ip, port name)
shID
Connection ID: set -1 if connection ID is not applied
Reference
Converse to “FALSE” when IpTarget and shID are both applied and are not matched.
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
int iRtn = 0;
TD_LIB_DISCONNECTA *pDisconnect;
if (hDll != NULL)
GetDlgItemText(IDC_EDT_IP, csIP);
if (pDisconnect != NULL)
44
1.2.2.12 CASPRTC : SendData()
In order to communicate with scale, it requires communication network for sending data. The
following series is mandatory option for sending data. When it succeeds converse to
“TRUE,” and otherwise converse to “FALSE.”
tdData
Sending data structure
Configure data and partially give point to void *pData. After giving data size to
wdDataSize, complete configuration process and sending data.
Reference
Sending btDataType of tdData also influences receiving btDataType of tdData Sent
data type set as a receiving data type. It is important that btDataType becomes
standard for interpretation process during data transaction process.
While data communication are doing, communication module directly send data
when it calls SendData function and directly proceed received data when it calls
gRecvProc(). But you should consider the procedure reading data from scale and
writing data to scale are time consuming procedure.
In the case of LPv1.6, it already has the structure which internally proceed that thing. But
CL5000 maybe would have the duplication of data when it goes on high speed data
communication.
DF_APIEXPORT
TD_ST_TRANSDATA
Example
int iRtn = 0;
TD_ST_TRANSDATA tdData;
TD_LIB_SENDATAA *pSendData;
if (hDll != NULL)
45
GetDlgItemText(IDC_EDT_IP, csIP);
if (pSendData != NULL)
tdData.btCommType = DF_COMMTYPE_TCPIP;
tdData.btDataType = DF_DATA_TEST;
tdData.btSendType = DF_SENDTYPE_NORMAL;
tdData.wdScaleType = DF_SCALE_ETC;
tdData.wdScaleModel= DF_SCALE_ETC;
tdData.shScaleID = -1;
tdData.lpIP= csIP.GetBuffer(csIP.GetLength());
tdData.wdDataSize = csData.GetLength();
tdData.pData = csData.GetBuffer(csData.GetLength());
iRtn = pSendData(tdData);
46
1.2.2.13 CASPRTC : SendDataEx()
This function includes scale version other data than SendData() function has.
tdData
Transmitted data structure
Make the data and assign the pointer of that data to void *pData and input data size to
wdDataSize.
After all configuration, you can transmit that data to the scale.
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
DWORD dwReserveVersion;
void *pReserve;
} TD_ST_TRANSDATA_V02;
wdAction
DF_ACTION_NOTHING 0
DF_ACTION_GETINFO 1
47
DF_ACTION_UPLOAD 2
DF_ACTION_DOWNLOAD 3
DF_ACTION_DELETE 4
DF_ACTION_DELETEALL 5 Relating to only
CL5000
DF_ACTION_READ 6
DF_ACTION_WRITE 7
DF_ACTION_INITSCALE 8
DF_ACTION_RESET 9
DF_ACTION_SET 10
DF_ACTION_NORMAL 11
DF_ACTION_SEND 12
DF_ACTION_ADDCONNECTION 13
DF_ACTION_CONNECT 14
DF_ACTION_DISCONNECT 15
DF_ACTION_DELETECONNECTION 16
DF_ACTION_CONNECTALL 17
DF_ACTION_CONNECTONE 18
DF_ACTION_CANCEL 19
DF_ACTION_RESETCONNECTINFO 20
Reference
Sending btDataType of tdData also influences receiving btDataType of tdData Sent
data type set as a receiving data type. It is important that btDataType becomes
standard for interpretation process during data transaction process.
While data communication are doing, communication module directly send data
when it calls SendData function and directly proceed received data when it calls
gRecvProc(). But you should consider the procedure reading data from scale and
writing data to scale are time consuming procedure.
In the case of LPv1.6, it already has the structure which internally proceed that thing. But
CL5000 maybe would have the duplication of data when it goes on high speed data
communication.
DF_APIEXPORT
TD_ST_TRANSDATA_V02
DF_ACTION_DELETEALL
48
That is used for all PLU data.
Proceeded result data is received as written below.
Fail
1. <“W02:E”><Size [2,S,H]><0x0A[1,B,H]>
Example
int iRtn = 0;
TD_ST_TRANSDATA_V02 tdData;
TD_LIB_SENDATAA *pSendData;
if (hDll != NULL)
GetDlgItemText(IDC_EDT_IP, csIP);
if (pSendData != NULL)
tdData.btCommType = DF_COMMTYPE_TCPIP;
tdData.btDataType = DF_DATA_TEST;
tdData.btSendType = DF_SENDTYPE_NORMAL;
tdData.wdScaleType = DF_SCALE_ETC;
tdData.wdScaleModel= DF_SCALE_ETC;
tdData.shScaleID = -1;
tdData.lpIP= csIP.GetBuffer(csIP.GetLength());
tdData.wdDataSize = csData.GetLength();
tdData.pData = csData.GetBuffer(csData.GetLength());
tdData.dwScaleMainVersion = dwScaleMainVersion;
49
tdData.dwScaleSubVersion = dwScaleSubVersion;
tdData.dwScaleCountry = dwScaleCountry;
iRtn = pSendData(tdData);
50
1.2.2.14 CASPRTC : IsConnect()
If you finished adding connection and tried to connect, you can send data to scale.
But maybe you get the time to check if the scale connect or not. At that time you can use
IsConnect function. If the scale connected, that returned TRUE. Else it returned FALSE.
lpTarget
It configures the NULL sentence and the identification sentence of IP that you want to
check whether connects.
shID
It configure the original identification number that you want to check whether connects.
Set this value -1 for no use, or higher than -1 for use.
Reference
If you want to check connection state, you should finish to add connection with
AddConnection() function before.
If you inputted lpTarget and shID simultaneously, lpTarget is superior than shID.
If you can check just shID, when you set lpTarget, NULL.
Example
int iRtn = 0;
TD_LIB_ISCONNECTA *pIsConnect;
if (hDll != NULL)
GetDlgItemText(IDC_EDT_IP, csIP);
if (pIsConnect != NULL)
51
1.2.3 Interface – Interpreter
This device is an Initializing interpreter module for data configuration facilitates data transaction
between scale and application program.
pRecv
Data sending pointer after the completion of data transaction
Reference
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
TD_PROC_RECV *pRecvProc;
int iRtn = 0;
pRecvProc = pRecv;
if (pRecvProc == pRecv)
iRtn = TRUE;
return iRtn;
52
1.2.3.2 Interpreter : Interpret()
User Part
If data from an upper application program is successfully converted, return the
reconfigured data size when it fails, converse into 0. Data becomes a factor while
rearranging and analyzing pData, then transfer initialized data.
Module developer
As a part of interpreter module, it converts data configuration that facilitates
transfer data from scale. After receiving data, analyze it into factor of tdData->pData.
When all of data is received, reform into TD_ST_TRANSDATA_V02 as an initialized
function. DataType configuration must be double checked during data transaction. More
detailed information, please refer to TD_ST_TRANSDATA_V02.
tdData
Configuration structure combining original data received from scale
TD_ST_TRANSDATA_V02 original configuration.
Original form
struct _stTransData {
short shScaleID;
LPSTR lpIP;
BYTE btCommType;
BYTE btSendType;
BYTE btDataType;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdDataSize;
void *pData;
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
DWORD dwReserveVersion;
void *pReserve;
53
} TD_ST_TRANSDATA_V02;
Reference
Argument tdData has the function that transfer data and return the result of
transference.
Data recept from scale are returned with string pointer in tdData.pData.
Interpreter compromise this returned data and rearrange that, put it on
tdData.pData
Stucture of tdData.pData is below
[8 Byte proceeded result information] + [Separate data structure pointer]
tdData.wdDataSize is the value that includes sizes of data above.
So after composing data like above, CASPRTC cuts off 8 byte from those data,
and sends remained real data to the Application.
Example
int Interpret(TD_ST_TRANSDATA_V02 tdData)
int iRtn = 0;
switch (tdData.btCommType)
54
{
case DF_COMMTYPE_TCPIP:
case DF_COMMTYPE_SERIAL:
switch(tdData.btDataType)
case DF_DATA_PLU:
break;
case DF_DATA_TEST:
iRtn = TestInterpret(&tdData);
if (pRecvProc != NULL)
pRecvProc(tdData);
else
iRtn = 0;
break;
break;
case DF_COMMTYPE_UDP:
iRtn = tdData.wdDataSize;
if (pRecvProc != NULL)
pRecvProc(tdData);
else
iRtn = 0;
break;
return iRtn;
int iRtn = 0;
int iSize = 0;
BYTE *pData;
BYTE btBuffer[DF_SIZE_RECVBUFFER];
pData = (BYTE*)tdData->pData;
55
iSize = tdData->wdDataSize;
pData[i] = btBuffer[i];
strcpy((char*)&pData[i], "-Interpret");
iRtn = i + 10;
tdData->wdDataSize = (WORD)iRtn;
return iRtn;
56
1.2.3.2 Interpreter : Deinterpret()
USER
During data transaction process between Application Program and Scale, it
reconfigures data into recognizable data for scale.
Return the date size when it succeeds, otherwise converse into “0”
Module Developer
Inserting Transferred Data to Scale and received Data into IpBuffer and convert.
It must be careful not to send initialized function pointer.
tdData
Configuration structure combining original data received from scale
TD_ST_TRANSDATA Original form
struct _stTransData {
short shScaleID;
LPSTR lpIP;
BYTE btCommType;
BYTE btSendType;
BYTE btDataType;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdDataSize;
void *pData;
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
DWORD dwReserveVersion;
void *pReserve;
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
57
DWORD dwReserveVersion;
void *pReserve;
} TD_ST_TRANSDATA_V02;
lpBuffer
Pointer factor for process original data and transferring reconfigured data
lpBuffer returns ([Proceeding result 8 Byte]+[Converted data]).
If error occurred, it returns just proceeding result.
If error occurred, it sends the previous tdData.pData data to the upper level.
Reference
DF_APIEXPORT
TD_ST_TRANSDATA_V02
Example
int Deinterpret(TD_ST_TRANSDATA_V02 tdData, LPSTR lpBuffer)
int iRtn = 0;
switch(tdData.btCommType)
case DF_COMMTYPE_TCPIP:
case DF_COMMTYPE_SERIAL:
switch(tdData.btDataType)
case DF_DATA_PLU:
break;
case DF_DATA_TEST:
break;
break;
58
case DF_COMMTYPE_UDP:
iRtn = tdData.wdDataSize;
break;
return iRtn;
int iRtn = 0;
BYTE *pData;
pData = (BYTE*)tdData.pData;
if (lpBuffer != NULL)
lpBuffer[i] = pData[i];
strcpy((char*)&lpBuffer[i], "-Deinterpret");
iRtn = i + 12;
return iRtn;
59
1.2.3.3 Interpreter : GetLibraryInfo()
It stores interpreter version data into configuration pointer that informing module data.
ptdLibInfo
Structure pointer for receiving moduel version information
Reference
DF_APIEXPORT
TD_ST_THIS
Example
int GetLibraryInfo(TD_ST_THIS *ptdInfo)
int iRtn = 0;
ptdInfo->btMainVer = 0;
ptdInfo->btSubVer = 1;
ptdInfo->btModifyYear = 5;
ptdInfo->btModifyMonth = 10;
ptdInfo->btModifyDay = 20;
iRtn = TRUE;
return iRtn;
60
1.2.3.4 Interpreter : AddBuffer()
This interface is called when one connection is added in the level of CASPRTC.
Use this interface when you assign the memory to the separate added connection or do some
works those need initialization.
pchIP
The final IP string(Null) in the added connection
That’s used for the case of TCP/IP communication, and “ ”(space) is used for
the other cases.
iPort
This is used for Ethernet Port # in the case of TCP/IP communication, and used
for Serial Port # in the case of RS232.
And in the other cases, this is used for the identification #.
iScaleID
The original number of the scale
iDataType
Data type
Definition Explanation
DF_DATA_PLU_V02 Plu Structure data
DF_DATA_DISC Discount Structure data
DF_DATA_DEPT Department Structure data
DF_DATA_GROUP Group Structure data
DF_DATA_TAXRATE Tax Rate Structure data
DF_DATA_SALEMSG Sale Message Structure data
DF_DATA_ORIGIN Origin Structure data
DF_DATA_BARCODE Barcode Structure data
DF_DATA_TARE Tare Structure data
DF_DATA_PCSUNIT Pcs Unit Structure data
DF_DATA_INGREDIENT Ingredient Structure data
DF_DATA_NUTRIFACT_V02 Nutrifact Structure data
DF_DATA_TRACE Trace Structure data
DF_DATA_COUNTRY Country Structure data
DF_DATA_SLAUGHT Slaught Structure data
61
DF_DATA_CUT Cutting hall Structure data
DF_DATA_STORE Store Structure data
DF_DATA_CUSTOM Customer Structure data
DF_DATA_SCROLLMSG_V03 Scroll Message Structure data
DF_DATA_SECURITY Security Structure data
DF_DATA_REPORT Report Structure data
DF_DATA_LABEL Label Structure data
DF_DATA_IMAGE Image Structure data
DF_DATA_KEY Keypad Structure data
DF_DATA_PLUINFO Plu status table Structure data
DF_DATA_SCALECMD Scale Command Structure data
DF_DATA_THIS This module Structure data
DF_DATA_SCALEINFO Scale information structure data
Reference
Example
62
1.2.3.5 Interpreter : DeleteBuffer()
This interface is called when one connection is deleted in the level of CASPRTC.
Use this interface when you release the memory to the separate added connection or do
initialization to the used data.
pchIP
The final IP string(Null) in the added connection
That’s used for the case of TCP/IP communication, and “ ”(space) is used for
the other cases.
iPort
This is used for Ethernet Port # in the case of TCP/IP communication, and used
for Serial Port # in the case of RS232.
And in the other cases, this is used for the identification #.
iScaleID
The original number of the scale
iDataType
Data type
Definition Explanation
DF_DATA_PLU_V02 Plu Structure data
DF_DATA_DISC Discount Structure data
DF_DATA_DEPT Department Structure data
DF_DATA_GROUP Group Structure data
DF_DATA_TAXRATE Tax Rate Structure data
DF_DATA_SALEMSG Sale Message Structure data
DF_DATA_ORIGIN Origin Structure data
DF_DATA_BARCODE Barcode Structure data
DF_DATA_TARE Tare Structure data
DF_DATA_PCSUNIT Pcs Unit Structure data
DF_DATA_INGREDIENT Ingredient Structure data
DF_DATA_NUTRIFACT_V02 Nutrifact Structure data
DF_DATA_TRACE Trace Structure data
DF_DATA_COUNTRY Country Structure data
63
DF_DATA_SLAUGHT Slaught Structure data
DF_DATA_CUT Cutting hall Structure data
DF_DATA_STORE Store Structure data
DF_DATA_CUSTOM Customer Structure data
DF_DATA_SCROLLMSG_V03 Scroll Message Structure data
DF_DATA_SECURITY Security Structure data
DF_DATA_REPORT Report Structure data
DF_DATA_LABEL Label Structure data
DF_DATA_IMAGE Image Structure data
DF_DATA_KEY Keypad Structure data
DF_DATA_PLUINFO Plu status table Structure data
DF_DATA_SCALECMD Scale Command Structure data
DF_DATA_THIS This module Structure data
DF_DATA_SCALEINFO Scale information structure data
Reference
Example
64
1.2.4 Structure
1.2.4.1 _stTransData
This structure is for exchanging data process. Application program and Protocol module use this
structure.
typedef struct _stTransData {
short shScaleID;
LPSTR lpIP;
BYTE btCommType;
BYTE btSendType;
BYTE btDataType;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdAction;
WORD wdDataSize;
void *pData;
} TD_ST_TRANSDATA;
btScaleID
Original number of Scale
lpIP
IP number string of Scale – need to be segmented
EX> 10.10.1.80
btCommType
Data communication type
Value Description
DF_COMMTYPE_TCPIP TCP/IP Socket Communication
DF_COMMTYPE_UDP UDP Socket Communication
DF_COMMTYPE_SERIAL Serial communication
btSendType
Set the type of data for transfer
Value Description
DF_SENDTYPE_NORMAL Basic Setting
DF_SENDTYPE_BROADCAST Relay every scale with UDP
Only UDP Socket can be used
65
btDataType
Communication Data type
Value Description
DF_DATA_PLU_V02 Data of Plu Structure
DF_DATA_DISC Data of Discount Structure
DF_DATA_DEPT Data of Department structure
DF_DATA_GROUP Data of Group Structure
DF_DATA_TAXRATE Data of Tax Rate Structure
DF_DATA_SALEMSG Data of Sale Message structure
DF_DATA_ORIGIN Data of Origin Structure
DF_DATA_BARCODE Data of Barcode Structure
DF_DATA_TARE Data of Tare Structure
DF_DATA_PCSUNIT Data of Pcs Unit structure
DF_DATA_INGREDIENT Data of Ingredient Structure
DF_DATA_NUTRIFACT_V02 Data of Nutrifact structure
DF_DATA_TRACE Data of Trace structure
DF_DATA_COUNTRY Data of Country Structure
DF_DATA_SLAUGHT Data of Slaught structure
DF_DATA_CUT Data of Cutting hall structure
DF_DATA_STORE Data of Store Structure
DF_DATA_CUSTOM Data of Customer structure
DF_DATA_SCROLLMSG_V03 Data of Scroll Message structure
DF_DATA_SECURITY Data of Security structure
DF_DATA_REPORT Data of Report structure
DF_DATA_LABEL Data of Label structure
DF_DATA_IMAGE Data of Image structure
DF_DATA_KEY Data of Keypad structure
DF_DATA_PLUINFO Data of Plu status table structure
DF_DATA_SCALECMD Data of Scale Command structure
DF_DATA_THIS Data of this module structure
DF_DATA_SCALEINFO Scale information structure data
shScaleType
Currently communicating scale type
Value Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck Scale
66
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
shScaleModel
Indicate the type of mode within scale type
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdAction
Input the Argument defining the characteristic of data being transferred.
Value Description
DF_ACTION_NOTHING Communicating simple data
DF_ACTION_GETINFO Getting Information
DF_ACTION_UPLOAD Receiving data from scale
DF_ACTION_DOWNLOAD Sending data from PC to scale
DF_ACTION_DELETE Deleting data in the scale
DF_ACTION_DELETEALL Deleting all data in the scale
DF_ACTION_READ Reading data from the scale
DF_ACTION_WRITE Writing data to the scale
DF_ACTION_INITSCALE Initializing the scale
DF_ACTION_RESET Resetting the scale
DF_ACTION_SET Setting the scale
DF_ACTION_NORMAL Communication normal data
DF_ACTION_SEND Transferring simple data
wdDataSize
Setting the size of pData size
*pData
Data void point for actual transfer and receive
67
Value Data structure
DF_DATA_PLU_V02 _stDataPLU
DF_DATA_DISC _stDataDisc
DF_DATA_DEPT _stDataDept
DF_DATA_GROUP _stDataGroup
DF_DATA_TAXRATE _stDataTaxRate
DF_DATA_SALEMSG _stDataSaleMsg
DF_DATA_ORIGIN _stDataOrigin
DF_DATA_BARCODE _stDataBarcode
DF_DATA_TARE _stDataTare
DF_DATA_PCSUNIT _stDataPcsUnit
DF_DATA_INGREDIENT _stDataIngredient
DF_DATA_NUTRIFACT_V02 _stDataNutrifact
DF_DATA_TRACE _stDataTrace
DF_DATA_COUNTRY _stDataCountry
DF_DATA_SLAUGHT _stDataSlaught
DF_DATA_CUT _stDataCut
DF_DATA_STORE _stDataStore
DF_DATA_CUSTOM _stDataCustom
DF_DATA_SCROLLMSG_V03 _stDataScrollMsg
DF_DATA_SECURITY _stDataSecurity
DF_DATA_REPORT _stDataReport
DF_DATA_LABEL _stDataLabel
DF_DATA_IMAGE _stDataImage
DF_DATA_KEY _stDataKey
DF_DATA_PLUINFO _stDataPluInfoTable
DF_DATA_SCALECMD _stDataScaleCommand
DF_DATA_THIS _stThisModule
DF_DATA_SCALEINFO Scale information structure data
Reference
typedef int TD_LIB_SENDDATATCPIP(TD_ST_TRANSDATA tdTransData);
Example
68
1.2.4.2 _stTransDataV02
Version of scale is added to _stTransData
typedef struct _stTransDataV02 {
short shScaleID;
LPSTR lpIP;
BYTE btCommType;
BYTE btSendType;
BYTE btDataType;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdAction;
WORD wdDataSize;
void *pData;
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
DWORD dwReserveVersion;
void *pReserve;
} TD_ST_TRANSDATA_V02;
btScaleID
Original number of Scale
lpIP
IP number string of Scale – need to be segmented
EX> 10.10.1.80
btCommType
Data communication type
Value Description
DF_COMMTYPE_TCPIP TCP/IP Socket Communication
DF_COMMTYPE_UDP UDP Socket Communication
DF_COMMTYPE_SERIAL Serial communication
btSendType
Set the type of data for transfer
Value Description
69
DF_SENDTYPE_NORMAL Basic Setting
DF_SENDTYPE_BROADCAST Relay every scale with UDP
Only UDP Socket can be used
btDataType
Communication Data type
Value Description
DF_DATA_PLU_V02 Data of Plu Structure
DF_DATA_DISC Data of Discount Structure
DF_DATA_DEPT Data of Department structure
DF_DATA_GROUP Data of Group Structure
DF_DATA_TAXRATE Data of Tax Rate Structure
DF_DATA_SALEMSG Data of Sale Message structure
DF_DATA_ORIGIN Data of Origin Structure
DF_DATA_BARCODE Data of Barcode Structure
DF_DATA_TARE Data of Tare Structure
DF_DATA_PCSUNIT Data of Pcs Unit structure
DF_DATA_INGREDIENT Data of Ingredient Structure
DF_DATA_NUTRIFACT_V02 Data of Nutrifact structure
DF_DATA_TRACE Data of Trace structure
DF_DATA_COUNTRY Data of Country Structure
DF_DATA_SLAUGHT Data of Slaught structure
DF_DATA_CUT Data of Cutting hall structure
DF_DATA_STORE Data of Store Structure
DF_DATA_CUSTOM Data of Customer structure
DF_DATA_SCROLLMSG_V03 Data of Scroll Message structure
DF_DATA_SECURITY Data of Security structure
DF_DATA_REPORT Data of Report structure
DF_DATA_LABEL Data of Label structure
DF_DATA_IMAGE Data of Image structure
DF_DATA_KEY Data of Keypad structure
DF_DATA_PLUINFO Data of Plu status table structure
DF_DATA_SCALECMD Data of Scale Command structure
DF_DATA_THIS Data of this module structure
DF_DATA_SCALEINFO Scale information structure data
shScaleType
Currently communicating scale type
70
Value Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck Scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
shScaleModel
Indicate the type of mode within scale type
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdAction
Input the Argument defining the characteristic of data being transferred.
Value Description
DF_ACTION_NOTHING Communicating simple data
DF_ACTION_GETINFO Getting Information
DF_ACTION_UPLOAD Receiving data from scale
DF_ACTION_DOWNLOAD Sending data from PC to scale
DF_ACTION_DELETE Deleting data in the scale
DF_ACTION_DELETEALL Deleting all data in the scale
DF_ACTION_READ Reading data from the scale
DF_ACTION_WRITE Writing data to the scale
DF_ACTION_INITSCALE Initializing the scale
DF_ACTION_RESET Resetting the scale
DF_ACTION_SET Setting the scale
DF_ACTION_NORMAL Communication normal data
DF_ACTION_SEND Transferring simple data
wdDataSize
Setting the size of pData size
71
*pData
Data void point for actual transfer and receive
72
Sub version of Scale
dwScaleDataVersion
Data Version
dwScaleCountry
Country
dwReserveVersion
Reserve
*pReserve
Reserve
Reference
typedef int TD_LIB_SENDDATATCPIP(TD_ST_TRANSDATA_V02 tdTransData);
Example
73
1.2.4.3 _stSocketInfo
Configuration form for initializing, confirming and setting socket information
typedef struct _stSocketInfo {
short shScaleID;
LPSTR lpIP;
WORD wdPort;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdTimeOut;
WORD wdRetryCount;
BYTE btCommType;
BYTE btTransType;
BYTE btSocketType;
BYTE btDataType;
DWORD dwMsgNo;
DWORD dwStateMsgNo;
BYTE btLogStatus;
LPSTR lpLogFileName;
TD_PROC_RECV *pRecvProc;
TD_PROC_STATE *pStateProc;
} TD_ST_SOCKETINFO;
shScaleID
Serial number of Scale
lpIP
IP number string of Scale – need to be segmented
EX> 10.10.1.80
wdPort
Setting IP port number
wdScaleType
Currently communicating scale type
Vaule Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck scale
74
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
wdScaleModel
Indicate the type of mode within scale type
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdTimeOut
Setting time out time
wdRetryCount
Setting number of retrial
btCommType
Setting Communication type. Setting SockType compared to CommType
Value Description
DF_COMMTYPE_TCPIP Setting Socket for TCP/IP communication
DF_COMMTYPE_UDP Setting Socket for UDP communication
DF_COMMTYPE_SERIAL Setting port for Serial communication
btTransType
Setting a receiving method for data through communication with application
program
Value Description
DF_TRANSTYPE_PROC Sending function pointer of RecvProc of SocketInfo
properties
DF_TRANSTYPE_MSG Sendig MsgNo message from SocketInfo proferties
75
btSocketType
Primarily set a Socket type. If setting goes through CommType, it needs to decide
whether to use UDP or TCP/IP in Socket type.
Value Description
SOCK_STREAM Use TCP/IP
SOCK_DGRAM Use UDP
iMsgNo
Sending received data to application program as set message number
dwStateMsgNo
Sending Communication status data to application program as set message number
btLogStatus
Setting whether to report communication status or not
lpLogFileName
Setting Log report file name
pRecvProc
Setting function pointer for processing received data
Function form
int (*pRecvProc)(TD_ST_TRANSDATA_V02 *pData);
pStateProc
Setting function pointer for processing communication status info
Function form
int (*pRecvProc)(TD_ST_TRANSDATA_V02*pData);
Reference
DF_APIEXPORT int AddConnection(TD_ST_CONNECTION tdConnection)
Example
-
76
1.2.4.4 _stSocketInfoV02
Configuration form for initializing, confirming and setting socket information
typedef struct _stSocketInfo {
short shScaleID;
LPSTR lpIP;
WORD wdPort;
WORD wdScaleType;
WORD wdScaleModel;
WORD wdTimeOut;
WORD wdRetryCount;
BYTE btCommType;
BYTE btTransType;
BYTE btSocketType;
BYTE btDataType;
DWORD dwMsgNo;
DWORD dwStateMsgNo;
BYTE btLogStatus;
LPSTR lpLogFileName;
TD_PROC_RECV *pRecvProc;
TD_PROC_STATE *pStateProc;
DWORD dwScaleMainVersion;
DWORD dwScaleSubVersion;
DWORD dwScaleCountry;
DWORD dwScaleDataVersion;
DWORD dwReserveVersion;
void *pReserve;
} TD_ST_SOCKETINFO_V02;
shScaleID
Serial number of Scale
lpIP
IP number string of Scale – need to be segmented
EX> 10.10.1.80
wdPort
Setting IP port number
77
wdScaleType
Currently communicating scale type
Vaule Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and connection
wdScaleModel
Indicate the type of mode within scale type
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
wdTimeOut
Setting time out time
wdRetryCount
Setting number of retrial
btCommType
Setting Communication type. Setting SockType compared to CommType
Value Description
DF_COMMTYPE_TCPIP Setting Socket for TCP/IP communication
DF_COMMTYPE_UDP Setting Socket for UDP communication
DF_COMMTYPE_SERIAL Setting port for Serial communication
btTransType
Setting a receiving method for data through communication with application
program
78
Value Description
DF_TRANSTYPE_PROC Sending function pointer of RecvProc of SocketInfo
properties
DF_TRANSTYPE_MSG Sendig MsgNo message from SocketInfo proferties
btSocketType
Primarily set a Socket type. If setting goes through CommType, it needs to decide
whether to use UDP or TCP/IP in Socket type.
Value Description
SOCK_STREAM Use TCP/IP
SOCK_DGRAM Use UDP
iMsgNo
Sending received data to application program as set message number
dwStateMsgNo
Sending Communication status data to application program as set message number
btLogStatus
Setting whether to report communication status or not
lpLogFileName
Setting Log report file name
pRecvProc
Setting function pointer for processing received data
Function form
int (*pRecvProc)(TD_ST_TRANSDATA_V02 *pData);
pStateProc
Setting function pointer for processing communication status info
Function form
int (*pRecvProc)(TD_ST_TRANSDATA_V02*pData);
79
Data Version
dwScaleCountry
Country
dwReserveVersion
Reserve
*pReserve
Reserve
Reference
DF_APIEXPORT int AddConnection(TD_ST_CONNECTION_V02 tdConnection)
Example
-
80
1.2.4.5 _stSerialInfo
Configuration form for initializing, confirming and setting socket information
typedef struct _stSerialInfo {
BYTE btScaleID;
short shPort;
int iBaudrate;
short shScaleType;
short shScaleModel;
short shTimeOut;
short shRetryCount;
BYTE btTransType;
int iMsgNo;
BYTE btLogStatus;
LPSTR lpLogFileName;
TD_RECV_PROC *pRecvProc;
} TD_ST_SERIALINFO;
btScaleID
Serial number of Scale
shPort
Setting Serial communication port
iBaudrate
Setting Serial communication speed
shScaleType
Currently communicating scale type
Value Description
DF_SCALE_TYPE_LP Label printer scale
DF_SCALE_TYPE_RW Truck Scale
DF_SCALE_TYPE_NT Indicator
DF_SCALE_TYPE_POS Poscale
DF_SCALE_TYPE_ETC Other scales and communication
shScaleModel
Indicate the type of mode within scale type
81
Value Description
DF_SCALE_15 LP-15
DF_SCALE_16 LP-16
DF_SCALE_17 LP-17
DF_SCALE_20 LP-2
DF_SCALE_5000 CL5000
DF_SCALE_5000JR CL5000J
DF_SCALE_5500 CL5500
DF_SCALE_CL7200 CL7200
shTimeOut
Setting Time out time
shRetryCount
Setting number of retrial
btTransType
Setting a receiving method for data through communication with application program
Value Description
DF_TRANSTYPE_PROC Sending function pointer of RecvProc of SocketInfo properties
DF_TRANSTYPE_MSG Sendig MsgNo message from SocketInfo proferties
iMsgNo
Sending received data to application program as set message number
btLogStatus
Sending Communication status data to application program as set message
lpLogFileName
Setting Log report file name
pRecvProc
Setting function pointer for processing received data
82
Function form
int (*pRecvProc)(TD_ST_TRANSDATA_V02 *pData);
83
1.2.4.6 _stDataPLUv06
This is a type of Data configuration of Data communication for exchanging PLU data. The main
focus is to exchange data between Protocol module and application. Protocol module converts
a received configuration into that of receivable configuration for scale. The configuration is sent
to communication module and communication module resend it to scale.
Reference: This configuration does not independently exchange data and included within
_stTransDataV02 for processing.
This data is for PLU network communication in both LP1 1.6v and CL5000 as well. All of the
unused fields should be se t to “0”
84
WORD wdBarcode1;
WORD wdBarcode2;
WORD wdPicture;
WORD wdProduceDate;
WORD wdPackDate;
WORD wdPackTime;
DWORD dwSellDate;
WORD wdSellTime;
WORD wdCookDate;
WORD wdIngredient;
WORD wdTraceability;
WORD wdBonus;
WORD wdNutrifact;
WORD wdSaleMSG;
WORD wdRefPLUDept;
DWORD dwRefPLUNo;
WORD wdCouplePLUDept;
DWORD dwCouplePLUNo;
WORD wdLinkPLUCount;
WORD wdLinkPLUDept1;
DWORD dwLinkPLUNo1;
WORD wdLinkPLUDept2;
DWORD dwLinkPLUNo2;
BYTE btTotalFlag;
DWORD dwTotalCount;
DWORD dwTotalPrice;
DWORD dwTotalWeight;
char chReserve1[50+1];
char chReserve2[50+1];
char chReserve3[50+1];
WORD wdNo;
WORD wdDirectSize;
char chDirectIngredient[1024+1];
BYTE btPackedDateFlag;
BYTE btPackedTimeFlag;
BYTE btSellByDateFlag;
85
BYTE btSellByTimeFlag;
char chName4[100+1];
char chName5[100+1];
char chName6[100+1];
char chName7[100+1];
char chName8[100+1];
BYTE btNameFontSize1;
BYTE btNameFontSize2;
BYTE btNameFontSize3;
BYTE btNameFontSize4;
BYTE btNameFontSize5;
BYTE btNameFontSize6;
BYTE btNameFontSize7;
BYTE btNameFontSize8;
BYTE btTraceItemFlag;
BYTE btDtIngredientFlag;
BYTE btDtSaleMsgFlag;
BYTE btDtNutriFactFlag;
BYTE btDtOriginFlag;
char chPictureFile[50];
} TD_ST_PLU_V06;
wdDepart
Setting department data. Range is from 1 to 99.
dwPLU
Setting PLU number. Range is from 1 to 99999.
And Same way for both CL5000 & LP1v1.6
If error occurs on uploading, dwPLU is set to ‘0’ and chName1 was configured with the
description of the error.
btPLUType
Setting PLU type.
Value Description
1 Weight
2 Count
86
3 PCS
chName1
Setting Plu name
And Same way for both CL5000 & LP1v1.6
chName2
Setting Plu name
And Same way for both CL5000 & LP1v1.6
chName3
Setting Plu name
wdGroup
Setting Group number
And Same way for both CL5000 & LP1v1.6
wdLabel1
Setting Label number
wdLabel2
Setting Label number
wdOrigin
Setting original production number.
btWeightUnit
Setting an unit for weight
.
Value Description
1 100g
2 1kg
dwFixWeight
Setting Fixed Weight
chPrefix
87
Configure the fixed detected code in serial number.(Korean defined version).
dwItemCode
This is to set Item Code
And Same way for both CL5000 & LP1v1.6
wdPieces
Setting number for selling unit
btQuatSymbol
Select selling unit indication symbol
btPriceType
Select Price type
dwUnitPrice
Setting PLU weight unit price
And Same way for both CL5000 & LP1v1.6
dwSpecialPrice
Setting PLU special price
wdTaxNo
Setting Tax rate number
dwTare
Setting Tare weight
And Same way for both CL5000 & LP1v1.6
wdTareNo
Setting tare weight number
dwPerTare
Setting percentage of tare
dwTareLimit
Setting limit of tare
88
wdBarcode1
Setting Bar code
wdBarcode2
Setting Bar code
wdPicture
Currently not use (Use it with Logo no in LP1v16 Russian defined version)
wdProduceDate
Configuring Produced date.
wdPackDate
Configuring Packed date.
wdPackTime
Configuring Packed time.
dwSellDate
This is to set the Sell by Date (Valid Date)
And Same way for both CL5000, LP1v1.6
Same item as LIFE item of LP1v1.6
wdSellTime
Configuring Sell by time.
wdCookDate
Configuring Cook by date.
wdIngredient
This is to set the Ingredient for both of CL5000 and LP1 1.6v session
In case of LP1 1.6v, you can refer to the menu “Message”
wdTraceability
Configuring Traceability.
wdBonus
Configuring Bonus.
wdNutrifact
Configuring Nutrition facts.
wdSaleMSG
Configuring Label advertisement message.
wdRefPLUDept
Configuring Reference department.
89
dwRefPLUNo
Configuring Reference PLU number.
wdCouplePLUDept
Configuring Coupled department.
dwCouplePLUNo
Configuring Coupled PLU number.
wdLinkPLUCount
Configuring Linked PLU counts.
dwLinkPLUDept1
Configuring Linked Department 1.
dwLinkPLUNo1
Configuring Linked PLU number 1.
wdLinkPLUDept2
Configuring Linked Department 2.
dwLinkPLUNo2
Configuring Linked PLU number 2.
btTotalFlag
This is to set Total Flag and is only for LP1 1.6v
When downloading data, This is on whether you want to use
“dwTotalcount, dwTotalPrice, dwTotalWeight” or Not
If you set it to 1, this is available
If you set it to 0, this is unavailable and it will make whole TotalFlag setting
to Default.
dwTotalCount
This is to set Total Count and this is used only for LP1v1.6
dwTotalPrice
This is to set Total Price and is used only for LP1v1.6
dwTotalWeight
This is to set TotalWeight and is only for LP1v1.6
chReserve1
Reserved Space 1 (In the case of LP1v16 Russian version, it is used for
Logo name[8Byte])
chReserve2
Reserved Space 2
90
chReserve3
Reserved Space 3
wdNo
wdDirectSize
Data size of Direct Ingredient data
chDirectIngredient
Direct Ingredient data
btPackedDateFlag
It determines wheter or not to print the Packed Date
0:Depending on Scale configuration
1:Not print
2:Print
btPackedTimeFlag
It determines wheter or not to print the Packed Time
0:Depending on Scale configuration
1:Not print
2:Print
3:Print the specified time
btSellByDateFlag
It determines wheter or not to print the Sell by Date
0:Depending on Scale configuration
1:Not print
2:Print
btSellByTimeFlag
It determines wheter or not to print the Packed Time
0:Depending on Scale configuration
1:Not print
2:Print
3:Print the specified time
chName4[100+1]
PLU Name4
chName5[100+1]
PLU Name5
chName6[100+1]
PLU Name6
91
chName7[100+1]
PLU Name7
chName8[100+1]
PLU Name8
btNameFontSize1
Size of the PLU Name1. It is for only GS Mart
btNameFontSize2
Size of the PLU Name2. It is for only GS Mart
btNameFontSize3
Size of the PLU Name3. It is for only GS Mart
btNameFontSize4
Size of the PLU Name4. It is for only GS Mart
btNameFontSize5
Size of the PLU Name5. It is for only GS Mart
btNameFontSize6
Size of the PLU Name6. It is for only GS Mart
btNameFontSize7
Size of the PLU Name7. It is for only GS Mart
btNameFontSize8
Size of the PLU Name8. It is for only GS Mart
btTraceItemFlag
Size of the PLU Name3. It is for only GS Mart
btDtIngredientFlag
btDtSaleMsgFlag
btDtNutriFactFlag
btDtOriginFlag
chPictureFile[50]
The file name of the the PLU image
92
1.2.4.7 _stDataDisc
This is a configuration for Data communication process. This is for exchanging Discount data
and data between Application program and Protocol module. It is not for independent usage and
must be added to _stTransData for transfer. Every data is not completely fulfilled through
downloading and uploading. Some of fields are not necessary. Please refer to following
categories.
93
btPLUType
Setting a type of PLU for discount setting
Value Description
1 Weight sale PLU
2 Counting sale PLU
3 Piece sale PLU
btDiscType
Setting discount form
Value Description
1 Unit price discount
2 % Unit price discount
3 Total price discount
4 % Total price discount
5 Fixed price
6 Free item
7 Free addition
8 Total price by total price
9 % Total price by total price
10 Unit price by total price
11 Extra by total price
wdTarget1
Setting the first discount point (weight or number)
dwValue1
Setting a discount price of the first discount point
wdTarget2
Setting the second point (weight or number)
dwValue2
Setting a discount price of the second discount point
btStartDate
Setting the Starting date of Discount
94
btEndDate
Setting the end date of Discount
btStartTime
Setting the starting time for discount
btEndTime
Setting the end date of discount
btWeek
Setting discount days
95
1.2.4.8 _stDataDept
This is a communication configuration form. It is used for exchanging department data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Configuring Department number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
wdSpeedKey
Configuring Speed key.
chName
Configuring name or description.
If error occurs on uploading, chName is set to description of error.
96
1.2.4.9 _stDataGroup
This is a communication configuration form. It is used for exchanging group data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData instead of being used independently.
wdNo
Configuring Group number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Input name or description.
If error occurs on uploading, chName is set to description of error.
97
1.2.4.10 _stDataTaxRate
This is a communication configuration form. It is used for exchanging tax rate data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Configuring Tax rate number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
btType
Configuring Tax-rate type.
chName
Configuring name or description.
If error occurs on uploading, chName is set to description of error.
wdValue
Configuring value.
98
1.2.4.11 _stDataSaleMsg
This is a communication configuration form. It is used for exchanging sales message data and
data between application and protocol module. Protocol module converts data into that of
receivable to scale. This is combined with _stTransData insteadt of being used independently.
This data is for PLU network communication in both LP1 1.6v and CL5000 as well. All of the
unused fields should be se t to “0”
This is for Advertising Sales scroll message data.
wdNo
This is to set Sale message Number in both LP1 1.6v and CL5000
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
This is to set the name of Sales message and description in
both LP1v1.6 & CL5000
If error occurs on uploading, chName is set to description of error.
99
1.2.4.12 _stDataOrigin
This is a communication configuration form. It is used for exchanging original production place
data and data between application and protocol module. Protocol module converts data into
that of receivable to scale. This is combined with _stTransData insteadt of being used
independently.
wdNo
Setting Origin number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
errors
chName
Setting Origin name or description.
If error occurs on uploading, chName is set to description of error.
100
1.2.4.13 _stDataBarcode
This is a communication configuration form. It is used for exchanging barcode data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Barcode number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
btType
Setting Barcode type.
btFormatNo
Setting Barcode format number.
chFormat
Setting Barcode format string.
chName
Setting Barcode name or description.
If error occurs on uploading, chName is set to description of error.
101
1.2.4.14 _stDataTare
This is a communication configuration form. It is used for exchanging tare data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
btNo
Setting Tare number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
btType
Setting Tare type.
wdValue
Setting Tare weight.
chName
Setting Tare name or description.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
102
1.2.4.15 _stPcsUnit
This is a communication configuration form. It is used for exchanging PCS Symbol data and
data between application and protocol module. Protocol module converts data into that of
receivable to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting PCS unit number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Setting PCS unit name or description.
If error occurs on uploading, chName is set to description of error.
103
1.2.4.16 _stDataIngredient
This is a communication configuration form. It is used for exchanging ingredient data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
This data is for PLU network communication in both LP1 1.6v and CL5000 as well. All of the
unused fields should be se t to “0”
This is for Message data.
wdNo
This is to set the Number of Ingredient in both LP1 1.6 & CL5000
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
This is to set the Name of Ingredient and Discription in both LP1 1.6v & CL5000
If error occurs on uploading, chName is set to description of error.
104
1.2.4.17 _stDataNutrifact_V02
This is a communication configuration form. It is used for exchanging nutrition data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
Use this structure when the data type is DF_DATA_NUTRIFACT_V03 or
DF_DATA_NUTRIFACT_V02.
wdNo;
Setting Nutrition factor number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
btType
Setting Nutrition factor type.
chName
Setting Nutrition factor name or description.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chServingSize
Setting an amount(like an advised amount) (Including units).
chServingPer
Setting an amount per a total amount.
dwValue[20]
Nutrition fact list
Array Explanation
105
dwValue[0] Calories
dwValue[1] Calories from fat
dwValue[2] Total fat
dwValue[3] Saturated fat
dwValue[4] Trans fat
dwValue[5] Cholesterole
dwValue[6] Sodium
dwValue[7] Total carbohydrate
dwValue[8] Dietary fibers
dwValue[9] Sugars
dwValue[10] Protein
dwValue[11] Vitamin a
dwValue[12] Calcium
dwValue[13] Vitamin C
dwValue[14] Iron
dwValue[15] Salt
dwValue[16] Energy
dwValue[17] Added Sugars
dwValue[18] Vitamin D
dwValue[19] Potassium
dwBaseSize
dwServingSize
dwServingUnit
106
1.2.4.18 _stDataTrace
This is a communication configuration form. It is used for exchanging trace data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Traceability number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Setting Tracebility name or description.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
wdBornCountry
Setting Born in country number.
wdBredCountry
Setting Bred in country number.
wdSlaughtHouse
Setting Slaughter in country number.
wdCuttingHall
Setting Cut in country number.
107
1.2.4.19 _stDataCountry
This is a communication configuration form. It is used for exchanging country data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Country number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Setting Country name or description.
If error occurs on uploading, chName is set to description of error.
108
1.2.4.20 _stDataSlaught
This is a communication configuration form. It is used for exchanging slaughter data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Slaughter house number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
wdCountry
Setting Country number.
chName
Setting Slaughter house name or description.
If error occurs on uploading, chName is set to description of error.
109
1.2.4.21 _stDataCut
This is a communication configuration form. It is used for exchanging cutting process data and
data between application and protocol module. Protocol module converts data into that of
receivable to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Cut in No.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
wdCountry
Setting Cut in Country No.
chName
Setting Cut in hall name or description.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
110
1.2.4.22 _stDataStore
This is a communication configuration form. It is used for exchanging store data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
This data is for PLU network communication in both LP1 1.6v and CL5000 as well. All of the
unused fields should be se t to “0”
This is for Head & Shop data.
wdNo
This is to set the Number of Store in both LP1 1.6v & CL5000
In LP1 1.6v, No 1~2 of btNo means 1st/2nd data of “Header”
In LP1 1.6v, No 3~4 of btNo means 3rd / 4th data of ”Shop”
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
This is to set theh Name of Store in both LP1 1.6v & CL5000
If error occurs on uploading, chName is set to description of error.
chTel
Setting Telephone number.
chText
Setting description.
111
1.2.4.23 _stDataCustom
This is a communication configuration form. It is used for exchanging customer data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Customer number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Setting Customer name.
If error occurs on uploading, chName is set to description of error.
chTel
Setting Telephone number.
dwCreditLimit
Setting Credit Limit.
chAddr1
Setting Address 1.
chAddr2
Setting Address 2.
chAddr3
Setting Address 3.
112
1.2.4.24 _stDataScrollMsg_v03
This is a communication configuration form. It is used for exchanging Scroll Message data and
data between application and protocol module. Protocol module converts data into that of
receivable to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting Scroll message number.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
btEffect
Setting Scroll message effect.
chName
Setting Scroll message name or description.
If error occurs on uploading, chName is set to description of error.
chMessage
Setting Scroll message.
btDaily
Setting Scroll message period.
113
btWeek
Setting Scroll message shown week.
btStartDate[3]
Setting Start date(Year/Month/Day).
btEndDate[3]
Setting End date(Year/Month/Day).
btStartTime[3]
Setting Start time.
btEndTime[3]
Setting End time.
btUse
btBlinkCount
btFontSize
btImageID
btSpeed
114
1.2.4.25 _stDataSecurity
This is a communication configuration form. It is used for exchanging Security data and data
between application and protocol module. Protocol module converts data into that of receivable
to scale. This is combined with _stTransData insteadt of being used independently.
wdNo
Setting the number of User.
If error occurs on uploading, it is set to ‘0’ and chName is set to description of
error.
chName
Setting User name.
If error occurs on uploading, chName is set to description of error.
chNickname
Setting User nickname.
chPassword
Setting Password.
btLevel
Setting Security level.
115
1.2.4.26 _stAck
This is a communication configuration form. It is used for exchanging transaction result data and
data between application and protocol module. Protocol module converts data into that of
receivable to scale. This configuration form receives information that scale succeessfuly
receiving data from Application program. This sends data and sets data received from Scale.
This is combined with _stTransData insteadt of being used independently.
Reference :
Protocol part must setting _stAck. After sending data, immediately receive result and sending
the data to application program. After the completion of the process, the next communication
process can be proceeded.
116
1.2.4.27 _stDataState
Main structure is used when communication state data transmission. This structure is used in
the application program and the protocol module.
wdState
State #
#define DF_STATE_CONNECT 1
#define DF_STATE_DISCONNECT 2
#define DF_STATE_CLOSE 3
#define DF_STATE_RECV 4
#define DF_STATE_SEND 5
#define DF_STATE_OUTOFBAND 6
#define DF_STATE_RETRY 7
#define DF_STATE_RETRYOVER 8
lpDescription
State explanation
Reference
typedef int TD_LIB_SENDDATATCPIP(TD_ST_TRANSDATA_V02 tdTransData);
Example
117
1.2.3.28 _stScaleInfo
This is the structure that is used for getting scale state data. This is used between Application
program and Protocol.
wdNo
chName[100+1]
btLoadFlag
0: Zero, 1: Non Zero, 2: Overload
btStableFlag
0: Unstable 1: Stable;
btTareFlag
0: No Tare, 1: Tare, 2: Percent Tare
btDualFlag
2: Dual Range
btWeightUnit
0: kg, 1: lb, 2:g
btWeightDecimalPoint
118
Weight floating position
btPriceDecimalPoint
Price floating position
btReserved
dwCurTare
Current Tare weight
iCurWeight
Current Weight
dwUnitPrice
Unit price
dwTotalPrice
Total price
dwPLUno
PLU number
wdDeptNo
Department number
Reference
Example
119
1.2.4.29 _stScaleVersion
This is the structure that is used for getting scale version.
wdNo
chName[100+1]
btScaleClass
DF_SCALE_TYPE_SERVER 0
DF_SCALE_TYPE_LP 100
DF_SCALE_TYPE_RW 200
DF_SCALE_TYPE_NT 300
DF_SCALE_TYPE_POS 400
wdScaleModel
DF_SCALE_15 15
DF_SCALE_16 16
DF_SCALE_16RUS 161
DF_SCALE_17 17
DF_SCALE_20 20
DF_SCALE_CL5000 5000
DF_SCALE_CL5000JR 5010
wdScaleType
DF_SCALE_BENCH 1
DF_SCALE_POLE 2
120
DF_SCALE_HANGING 3
DF_SCALE_SELF 4
wdScaleId
ID of scale
dwMainVersion
Main version of scale
dwSubVersion
Sub version of scale
wdDataVersion
Data version
wdCountry
Country
wdReserved
Reserve
121
2.FileTrans
2.1 Concept
2.1.1 Structure
FileTrans.DLL the added module that provides the interface for the simple function. It is easy to
develop simple PLU transmission in your application program. Because of interface simplicity, it
doesn’t support all functions of the previous DLL. So, it’s just for the simple PLU communication.
Structure
Application (PC Application program)
FileTrans module(FileTrans.DLL)
Interface Manager
2nd step Interpreter module(CLInterpreter.DLL….)
Interpreter Manager
3rd step Communication module (CASTCPIP.DLL, ….)
Socket…. Manager
Like above, using the previous communication library, it adds the FileTrans module between
Application program and 1st step interface module. Application can do data communication
through FileTrans module.
2.1.2 Interface
Connection(IP, PORT, SCALEID, MODEL)
ConnectionEx(IP, PORT, SCALEID, MODEL, VERSION)
AddPLU(PLUDATA)
AddMSG(MESSAGEDATA)
AddNutrifact (NUTRIFACTDATA)
SendPLU() – Just for Russian version
SendPLUEx() – For United nation(Functionally Same as SendPLU)
SendMSG()
122
SendNutrifact()
RecvPLU() – Just for Russian version
RecvPLUEx() – For United nation(Functionally Same as RecvPLU)
RecvMSG()
RecvNutrifact()
RecvVersion()
RecvPLUData(PLUDATA)
RecvMSGData(MESSAGEDATA)
RecvNutrifactData(NUTRIFACTDATA)
RecvVersionData(VERSIONDATA)
DeletePLU(DEPARTMENTNO,PLUNO)
DeleteMSG(MESSAGENO)
GetScaleInfo()
GetScaleInfoData(IP,INFO);
GetState()
GetLibVersion()
DisconnectAll()
ReadPLU(DepartmentNo,PluNo) – Just for Russian version
ReadPLUEx(DepartmentNo,PluNo) –For United nation(Functionally Same as SendPLU)
ReadMSG(MsgNo)
ReadNutrifact(NutrifactNo)
123
14 Pack date 18 N 6 ASCII 10
15 Pack time 19 N 6 ASCII 10
16 Produce date 20 N 6 ASCII 10
17 Ingredient no 25 N 6 ASCII 10
18 Use fixed price 26 N 2 ASCII 10
19 Traceability no 35 N 6 ASCII 10
20 Origin no 55 N 6 ASCII 10
21 Nutrifact 70 N 4 ASCII 10
22 Label no 80 N 4 ASCII 10
23 Aux label no 81 N 4 ASCII 10
24 Barcode no 85 N 4 ASCII 10
25 Barcode2 no 86 N 4 ASCII 10
26 Sale msg 90 N 4 ASCII 10
27 Special price 91 N 10 ASCII 10
28 Fixed weight 100 N 10 ASCII 10
29 Logo no N 2 ASCII 10
30 Logo name S 8 ASCII char
31 Plu name1 10 S 54 ASCII char
32 Plu name2 30 S 54 ASCII char
33 Plu name3 31 S 54 ASCII char
34 Directingredient S 300 ASCII char
124
29 Sale msg 90 N 4 ASCII 10
30 Special price 91 N 10 ASCII 10
31 Fixed weight 100 N 10 ASCII 10
32 Tax no 7 N 4 ASCII 10
33 Bonus 50 N 6 ASCII 10
34 Link Plu count 60 N 4 ASCII 10
35 Link Plu dept 1 61 N 4 ASCII 10
36 Link Plu dept 2 62 N 4 ASCII 10
37 Couple plu dept 64 N 4 ASCII 10
38 Ref Plu dept 71 N 4 ASCII 10
39 Link plu no 1 65 N 6 ASCII 10
40 Link plu no 2 62 N 6 ASCII 10
41 Couple plu no 68 N 6 ASCII 10
42 Ref plu no 69 N 6 ASCII 10
43 Picture 36 N 2 ASCII 10
44 Prefix 3 S 2 ASCII char
45 BarcodeEx 49 S 54 ASCII char
46 Plu name1 10 S 54 ASCII char
47 Plu name2 30 S 54 ASCII char
48 Plu name3 31 S 54 ASCII char
49 Directingredinet S 300 ASCII char
(2) LP1
Order Name ID Type Length Code type Dec
1 Message No 6 ASCII 10
2 Message Line1 54 ASCII char
3 Message Line2 54 ASCII char
4 Message Line3 54 ASCII char
5 Message Line4 54 ASCII char
6 Message Line5 54 ASCII char
7 Message Line6 54 ASCII char
8 Message Line7 54 ASCII char
9 Message Line8 54 ASCII char
2.1.3.3 ScaleInfo
Order Name Type Length C.type Dec
1 Current Dept no N 4 ASCII 10
2 Current PLU no N 6 ASCII 10
3 Tare On N 1
4 Load N 1 0,1,2
5 Stable/Overload N 1 1,2,3,
125
6 Weight N 10 ASCII 10
7 Tare N 10 ASCII 10
8 Unit price / -00002,+00002 N 10 ASCII 10
9 Total price/ -0002,+0002 N 10 ASCII 10
Tare On : 0= no tare, 1=tare, 2=percent tare
2.1.3.5 VERSIONDATA
Order Name Type Length C.type Dec
1 Scale Version S 30 ASCII char
126
11 StartDate Month N 2 ASCII 10
12 StartDate Day N 2 ASCII 10
13 EndDate Year N 4 ASCII 10
14 EndDate Month N 2 ASCII 10
15 EndDate Day N 2 ASCII 10
16 StartTime Hour N 2 ASCII 10
17 StartTime Minute N 2 ASCII 10
18 StartTime Second N 2 ASCII 10
19 EndTime Hour N 2 ASCII 10
20 EndTime Minute N 2 ASCII 10
21 EndTime Second N 2 ASCII 10
22 Week N 2 ASCII 10
23 PLU Name S 54 ASCII char
127
2.2 Interface
IP
String, IP of the scale registered on network, ex) “192.168.1.1”
PORT
integer, Port Number of the separate scale
If this value is ‘0’, configure automatically to the separate scale.
If MODEL=5000, ‘20304’.
If MODEL=161, ‘8111’.
SCALEID
integer, Scale ID.
If scale is LP-1V1.6RUS, this value should not be ‘0’.
It should be same as SCALEID of the scale.
MODEL
integer
Model=16 , LP-1V1.6 ENGLISH
Model=161 , LP-1V1.6 RUSSIAN
Model=5000, CL5000
Return
integer
0 = Not registered
1 = Registered
2 = Already registered
Reference
DisconnectAll()
128
2.2.1.2 FileTrans : ConnectionEx()
IP
String, IP of Registered Scale in Network. ex) “192.168.1.1”
PORT
integer, Port Number of each scale
If the value is 0, it is set as MODEL.
IF the MODEL=5000, 20304
MODEL=161 8111
SCALEID
integer, SCALE ID value of scale
It should be match with SCALE ID.
MODEL
integer
Model=16 , LP-1V1.6 ENGLISH
Model=161 , LP-1V1.6 RUSSIA
Model=5000, CL5000
VERSION
String, Scale version
Return
integer
0 = It is not registered
1 = Normal registration
2 = Already registered
Reference
DisconnectAll()
129
2.2.1.3 FileTrans : AddPLU (PLUDATA)
int AddPLU(PLUDATA)
PLUDATA
String
Make PLU Data according to Table 4.1.
Ex)
- Russia
000100000101010000000001000100000000012340001000000000100000101000001
000001000001000001000001000001010000010000010001000100010001000100010
00000000100000000101 Apple 1
- United nation
000100000101010000000001000100000000012340001000000000100000101000001
000001000001000001000001000001000001000001000001010000010000010001000
100010001000100010000000001000000000100010000010001000100010001000100
00010000010000010000010101 Apple 1
Return
integer
Return the number of registered PLUs.
Reference
SendPLU()
130
2.2.1.4 FileTrans : AddMSG()
int AddMSG(MESSAGEDATA)
MESSAGEDATA
String
Make Message Data according to Table 4.2.
Ex)
000001MessageAz012345678901234567890123456789012345678901234
Message1 Line2
Return
integer
Return the number of the registered MESSAGE.
Reference
SendMSG()
131
2.2.1.5 FileTrans : AddNutrifact()
int AddNutrifact(NUTRIFACTDATA)
NUTRIFACTDATA
String
Make Nutrifact Data
Nutrifact no : 4Byte string “0001”
Nutrifact Type : 2Byte string “00”
Base unit : 4Byte string “0001”
Serving Size : 4Byte string “0001”
Base Size : 4Byte string “0001”
Calories : 4Byte string “0001”
Calories from fat : 4Byte string “0001”
Total fat(g) : 4Byte string “0001”
Saturated fat(g) : 4Byte string “0001”
Trans fat(g) : 4Byte string “0001”
Cholesterol(mg) : 4Byte string “0001”
Sodium(mg) : 4Byte string “0001”
Total Carbohydrates(g) : 4Byte string “0001”
Dietary fibers(g) : 4Byte string “0001”
Sugars(g) : 4Byte string “0001”
Protein(g) : 4Byte string “0001”
Vitamin A(%) : 4Byte string “0001”
Calcium(%) : 4Byte string “0001”
Vitamin C(%) : 4Byte string “0001”
Iron(%) : 4Byte string “0001”
Name : 20Byte string “Nutrifact 1 “
Serving size(text) : “12 “
Serving per con : “1 “
Ex)
“000100000100020003000400050006000700080009001000110012001300140015
001600170018Nutrifact 1 12 1 “
132
Return
integer
Return the number of the registered Nutrifact.
Reference
SendNutrifact()
133
2.2.1.6 FileTrans : AddDiscount()
int AddMSG(DISCOUNTDATA)
DISCOUNTDATA
String
Make Message Data according to Table 4.7.
Return
integer
Return the number of the registered DISCOUNT.
Reference
SendDiscount()
134
2.2.1.7 FileTrans : SendPLU ()
(Russian defined version)
int SendPLU()
Return
Integer
If it’s not 0, start to send
Reference
AddPLU(),GetState()
135
2.2.1.8 FileTrans : SendMSG ()
int SendMSG()
Return
Integer
If it’s not ‘0’, start to send.
Reference
AddMSG(), GetState()
136
2.2.1.9 FileTrans : SendNutrifact ()
int SendNutrifact()
Return
Integer
If it’s not ‘0’, start to send.
Reference
AddNutrifact(), GetState()
137
2.2.1.10 FileTrans : SendDiscount ()
int SendDiscount()
Return
Integer
If it’s not ‘0’, start to send.
Reference
AddDiscount(), GetState()
138
2.2.1.11 FileTrans : RecvPLU ()
(Russian defined version)
int RecvPLU()
Return
Integer
If it’s not ‘0’, start to receive.
Reference
RecvPLUData(),GetState()
139
2.2.1.12 FileTrans : RecvMSG ()
int RecvMSG()
Return
Integer
If it’s not 0, start to receive
Reference
RecvMSGData(),GetState()
140
2.2.1.13 FileTrans : RecvNutrifact ()
int RecvNutrifact()
Return
Integer
If it’s not 0, start to receive
Reference
RecvNutrifactData(),GetState()
141
2.2.1.14 FileTrans : RecvDiscount ()
int RecvDiscount()
Return
Integer
If it’s not 0, start to receive
Reference
RecvDiscountData(),GetState()
142
2.2.1.15 FileTrans : RecvPLUData ()
int RecvPLUData(PLUDATA)
PLUDATA
String
PLU Data are returned according to Table 4.1.
Return
If ‘0’, it means the end of data, or it means returning counts
Reference
RecvPLU(), GetState()
143
2.2.1.16 FileTrans : RecvMSGData ()
int RecvMSGData(MESSAGEDATA)
MESSAGEDATA
String
Message Data are returned according to Table 4.2.
Return
If ‘0’, it means the end of data, or it means returning counts
Reference
RecvMSG (), GetState()
144
2.2.1.17 FileTrans : RecvNutrifactData ()
int RecvNutrifactData(NUTRIFACTDATA)
NUTRIFACTDATA
String
<<Nutrifact Data are returned >>
Ex)
“000100000100020003000400050006000700080009001000110012001300140015
145
001600170018Nutrifact 1 12 1 “
Return
If ‘0’, it means the end of data, or it means returning counts
Reference
RecvNutrifact (), GetState()
146
2.2.1.18 FileTrans : RecvDiscountData ()
int RecvDiscountData(DISCOUNTDATA)
DISCOUNTDATA
String
Discount data are returned according to Table 4.7.
Return
If ‘0’, it means the end of data, or it means returning counts
Reference
RecvDiscount (), GetState()
147
2.2.1.19 FileTrans : DeletePLU ()
int DeletePLU(DEPARTMENTNO,PLUNO)
DEPARTMENTNO
integer
PLUNO
integer
Return
If it’s not ‘0’, start to delete.
Reference
GetState()
148
2.2.1.20 FileTrans : DeletePLUAll ()
int DeletePLUAll(DEPARTMENTNO,PLUNO)
DEPARTMENTNO
integer , 1
PLUNO
Integer ,1
Return
If it’s not ‘0’, start to delete.
Reference
GetState()
149
2.2.1.21 FileTrans : DeleteMSG ()
int DeleteMSG(MESSAGENO)
MESSAGENO
Integer
Return
If it’s not ‘0’, start to delete.
Reference
GetState()
150
2.2.1.22 FileTrans : DeleteNutrifact ()
int DeleteNutrifact(NUTRIFACTNO)
NUTRIFACTNO
Integer
Return
If it’s not ‘0’, start to delete.
Reference
GetState()
151
2.2.1.23 FileTrans : DeleteDiscount ()
int DeleteDiscount(DISCOUNTNO)
DISCOUNTNO
Integer
Return
If it’s not ‘0’, start to delete.
Reference
GetState()
152
2.2.1.24 FileTrans : GetScaleInfo ()
int GetScaleInfo()
Return
If it’s not ‘0’, read the state of the separate scale.
Reference
GetScaleInfoData()
153
2.2.1.24 FileTrans : GetScaleInfoData ()
Return the state information ,read through GetScaleInfo(), with String value.
int GetScaleInfoData(IP,INFO);
IP
String
IP of the scale that the state data will be got from.
On of IP addresses those already had registered through Connection().
INFO
String
Message Data are returned according to Table 4.3.
Return
integer
1: The value was returned.
99: It can’t find IP.
Reference
GetScaleInfo ()
154
2.2.1.25 FileTrans : GetState ()
int GetState()
Return
integer
0 disconnect + not start
1 connecting
11 reconnect
20 disconnection
30 send data
40 receive date
50 scale close
51 1:Success
52 2:Connect fail
53 3:Retry fail
54 4:Data error
55 5:Timeout
60 Send fail
70 -
80 send timeout
99 disconnect all
Reference
SendPLU(), SendMSG(), RecvPLU(), RecvMSG(), GetScaleInfo(),
DeletePLU(), DeleteMSG(),
155
2.2.1.26 FileTrans : GetLibVersion ()
int GetLibVersion()
Return
integer
Version Number = 100
Reference
NONE
156
2.2.1.27 FileTrans : DisconnectAll ()
int DisconnectAll ()
Return
integer , No meaning
Reference
Connection()
157
2.2.1.28 FileTrans : ReadPLU ()
(Russian defined version)
int ReadPLU(DepartmentNo,Pluno)
DepartmentNo
integer
PluNo
Integer
Return
Integer
No meaning.
Reference
Connection()
158
2.2.1.29 FileTrans : ReadMSG ()
int ReadMSG(MsgNo)
MsgNo
Integer
Return
integer
No meaning
Reference
Connection()
159
2.2.1.30 FileTrans : RecvVersion ()
Return
If it’s not ‘0’, start to receive
Reference
RecvVersionData(),GetState()
160
2.2.1.31 FileTrans : RecvVersionData ()
int RecvVersionData(VERSIONDATA)
VERSIONDATA
String
Version Data is returned according to table of 4.6
Return
Meaningless
Reference
RecvVersion (), GetState()
161
Appendix 1 – The available data by scale models
1. The available data by scale models
Menu CL5000 CL5000JR LP17
PLU O O O
Discount O X X
Department O X X
Group O X O
Tax rate O X X
Sales message O O X
Table1
Orgin O O O
Barcode O O X
Tare O X X
PCS unit O O O
Ingredient O O O
NutriFact O X X
Traceability O X X
Table2
Country O X X
Slaughterhouse O X X
Cutting hall O X X
Store data O O O
Customer O X X
Store
Scroll message O O X
User/Security O X X
Scale O X X
PLU O O X
Group O O X
Deparment O O X
Report
Hourly O O X
Clerk O X X
Tax O X X
Total X O X
Label X X X
162
Label caption X X O
Keypad X X X
Version O O O
163
35 Packed Time O O O
36 Sell By Date O O O
37 Sell By Time O O O
38 CookByDate O X X
39 Ingredient No. O O O
40 Traceability No. O O X
41 Bonus O X X
42 NutriFact No. O O X
43 LabelMsg No. O O X
44 Reference Dept O X X
45 Reference PLU O X X
46 Coupled Dept O X X
47 Coupled PLU O X X
48 # of LinkPLU O X X
49 Link Dept1 O X X
50 Link PLU1 O X X
51 Link Dept2 O X X
52 Direct Ingredient O O X
53 Check Sell by date X X O
164
Appendix 2 -Tutorial
1. Start
165
2. Visual C++ Tutorial
(2) Execute Project / Project settings menu, click Object / Library module on the Link Tab
same as CASPRTC.LIB like the picture below.
166
(3) Declare #include header file name on the header file of CommApplication Dialog same
as CASPRTC.H like the picture below.
(4) Select Project / Add To Project / Files… menu, and add CASPRTC.H.
(5) It finished to ready for Application programming.
(6) Add 3 Edit Box, 1 List Box, and 3 Button Box on Dialog resource. Change Text of
Button controls to “Connect”, “Upload”, and Disconnect” separately. Deactivate Sort
function on List Box.
167
(7) Declare Control member variable on List box and declare that member variable on
Upload id.
ex>
CListBox m_lstState;
int m_iSendID;
168
ex>
int CCommApplicationDlg::CheckEnd(int iDataType, int iNo, CString csRecv)
int iRtn = 0;
int iPosition = 0;
CString csTemp;
if (!iNo)
iRtn = 0;
iRtn = 2;
else
iRtn = 1;
else
iRtn = 1;
return iRtn;
169
(10)Definite the function that receive data on CommApplication Dialog source file (.CPP) as
a global function.
ex>
int gProcRecv(TD_ST_TRANSDATA_V02 tdData)
char chBuffer[1024];
CString csIP;
CString csRecv;
TD_ST_PLU_V02 tdPLU;
TD_ST_TRANSDATA_V02 tdSendData;
if (tdData.wdAction == DF_ACTION_UPLOAD)
if (tdData.btDataType == DF_DATA_PLU)
switch (g_dlgMain->CheckEnd(tdData.btDataType,
((TD_ST_PLU_V02*)tdData.pData)->dwPLU,
((TD_ST_PLU_V02*)tdData.pData)->chName1))
170
g_dlgMain->m_lstState.AddString("Upload End");
break;
case 2:
csRecv.Format("%d, %s",
((TD_ST_PLU_V02*)tdData.pData)->dwPLU,
((TD_ST_PLU_V02*)tdData.pData)->chName1);
g_dlgMain->m_lstState.AddString(csRecv);
tdPLU.dwPLU = g_dlgMain->m_iSendID + 1;
tdPLU.btDepart = 1;
g_dlgMain->m_iSendID = tdPLU.dwPLU;
g_dlgMain->GetDlgItemText(IDC_EDIT1, csIP);
tdSendData.shScaleID = -1;
tdSendData.lpIP = csIP.GetBuffer(csIP.GetLength());
tdSendData.btCommType = tdData.btCommType;
tdSendData.btSendType = tdData.btSendType;
tdSendData.btDataType = tdData.btDataType;
tdSendData.wdScaleType = tdData.wdScaleType;
tdSendData.wdScaleModel = tdData.wdScaleModel;
tdSendData.wdAction = tdData.wdAction;
tdSendData.wdDataSize = sizeof(tdPLU);
tdSendData.pData = &tdPLU;
SendData(tdSendData);
break;
return TRUE;
(11)Definite the function that receive state data on CommApplication Dialog source file
(.CPP) as a global function.
ex>
171
int gProcState(TD_ST_TRANSDATA_V02 tdData)
TD_ST_STATE *tdState;
CString csMsg;
CString csRecv;
tdState = (TD_ST_STATE*)tdData.pData;
csRecv.Format("%s", tdState->lpDescription);
csMsg += csRecv;
g_dlgMain->m_lstState.AddString(csMsg);
return 0;
g_dlgMain = this;
SetDlgItemText(IDC_EDIT1, “10.10.3.33”);
SetDlgItemText(IDC_EDIT2, “20304”);
SetDlgItemText(IDC_EDIT3, “3000”);
SetCommLibrary(DF_MODULE_TCPIP, DF_NAME_LIBTCPIP);
CString csIP;
CString csPort;
CString csTimeout;
GetDlgItemText(IDC_EDIT1, csIP);
GetDlgItemText(IDC_EDIT2, csPort);
GetDlgItemText(IDC_EDIT3, csTimeout);
if (AddProcConnection(DF_COMMTYPE_TCPIP,
172
csIP.GetBuffer(csIP.GetLength()),
atoi(csPort),
DF_SCALE_TYPE_LP,
DF_SCALE_CL5000,
atoi(csTimeout),
3,
DF_DATA_PLU,
gProcRecv,
gProcState))
if (Connect(csIP.GetBuffer(csIP.GetLength()), -1))
else
else
CString csIP;
TD_ST_PLU_V02 tdPLU;
TD_ST_TRANSDATA_V02 tdData;
GetDlgItemText(IDC_EDIT1, csIP);
tdData.btCommType = DF_COMMTYPE_TCPIP;
tdData.btSendType = DF_SENDTYPE_NORMAL;
tdData.lpIP = csIP.GetBuffer(csIP.GetLength());
tdData.shScaleID = -1;
tdData.wdAction = DF_ACTION_UPLOAD;
173
tdData.wdScaleType = DF_SCALE_TYPE_LP;
tdData.wdScaleModel = DF_SCALE_CL5000;
tdPLU.btDepart = 1;
m_iSendID = tdPLU.dwPLU = 1;
tdData.btDataType = DF_DATA_PLU_V02;
tdData.wdDataSize = sizeof(tdPLU);
tdData.pData = &tdPLU;
if (!SendData(tdData))
m_lstState.AddString("-SendData() fail");
CString csIP;
GetDlgItemText(IDC_EDIT1, csIP);
if (Disconnect(csIP.GetBuffer(csIP.GetLength()), -1))
DeleteConnection("ALL", -1);
else
174
175
3. Delphi Tutorial
Interface declaration
unit CASPRTC;
interface
uses
Windows, Messages;
{$IFNDEF __CASPRTC_H}
{$DEFINE __CASPRTC_H}
{/// Dump of file casprtc.dll }
const
WM_RECEIVEDATA = WM_USER + 1; { CAS Interpreter On Receive Message }
WM_NETWORKSTATUS = WM_USER + 2; { CAS Interpreter Status Check Message }
DF_SCALE_ETC = 0;
DF_SCALE_TYPE_LP = 100;
DF_SCALE_TYPE_RW = 200;
DF_SCALE_TYPE_NT = 300;
DF_SCALE_TYPE_POS = 400;
DF_SCALE_15 = 15;
DF_SCALE_16 = 16;
DF_SCALE_17 = 17;
DF_SCALE_20 = 20;
DF_SCALE_CL5000 = 5000;
DF_COMM_READ = 10;
176
DF_COMM_WRITE = 20;
DF_COMM_RECV = 30;
DF_COMM_ACK = 40;
DF_STATE_CONNECT = 1;
DF_STATE_DISCONNECT = 2;
DF_STATE_CLOSE = 3;
DF_STATE_RECV = 4;
DF_STATE_SEND = 5;
DF_STATE_OUTOFBAND = 6;
DF_STATE_RETRY = 7;
DF_STATE_RETRYOVER = 8;
DF_SENDTYPE_NORMAL = 1;
DF_SENDTYPE_BROADCAST = 2;
DF_NOTIMEOUT = 0;
DF_RETRY_REPEAT = 0;
DF_LOG_NO = 0;
DF_LOG_WRITE = 1;
DF_TRANSTYPE_PROC = 0;
DF_TRANSTYPE_MSG = 1;
DF_TRANSTYPE_INDV = 8;
177
DF_MODULE_TCPIP = 1;
DF_MODULE_SERIAL = 2;
DF_MODULE_PROTOCOL = 3;
DF_MODULE_SOCKET = 4;
DF_MODULE_INTERPRETER = 5;
DF_MODULE_USB = 6;
DF_CMDTYPE_COMM = 1;
DF_CMDTYPE_LOCAL = 2;
DF_CMDTYPE_LIB = 3;
DF_INIT_SOCKET = 1;
DF_INIT_SERIAL = 2;
DF_INIT_LIBCOMM = 3;
DF_INIT_INTERPRETER = 4;
DF_INIT_LIBPROTOCOL = 5;
DF_INIT_ALL = 6;
DF_SIZE_RECVBUFFER = 8192+1;
DF_SIZE_IPBUFFER = 25;
DF_SIZE_LOGPATHBUFFER = 512;
178
DF_NOTHING = 0;
DF_BEGIN = 1;
DF_END = 2;
DF_NAME_LIBTCPIP = 'CASTCPIP.DLL';
DF_NAME_LIBSERIAL = 'CASSERIA.DLL';
DF_NAME_LIBPROTOCOL = 'CASPRTC.DLL';
DF_NAME_LIBUSB = 'CASUSB.DLL';
DF_DATA_PLU_V02 = 9;
DF_DATA_PLU_V06 = 98;
DF_DATA_PLU = 10;
DF_DATA_DISC = 11;
DF_DATA_DEPT = 12;
DF_DATA_GROUP = 13;
DF_DATA_TAXRATE = 14;
DF_DATA_SALEMSG = 15;
DF_DATA_ORIGIN = 16;
DF_DATA_BARCODE = 17;
DF_DATA_TARE = 18;
DF_DATA_PCSUNIT = 19;
DF_DATA_INGREDIENT = 20;
DF_DATA_NUTRIFACT = 21;
DF_DATA_TRACE = 22;
DF_DATA_COUNTRY = 23;
DF_DATA_SLAUGHT = 24;
DF_DATA_CUT = 25;
DF_DATA_STORE = 26;
DF_DATA_CUSTOM = 27;
DF_DATA_SCROLLMSG = 28;
DF_DATA_SECURITY = 29;
DF_DATA_REPORT = 30;
DF_DATA_LABEL = 31;
DF_DATA_IMAGE = 32;
DF_DATA_KEY = 33;
179
DF_DATA_PLUINFO = 34;
DF_DATA_SCALECMD = 35;
DF_LABEL_BEGIN = 1;
DF_LABEL_HEADER = 2;
DF_LABEL_DATA = 3;
DF_LABEL_END = 4;
DF_IMAGE_BEGIN = 5;
DF_IMAGE_HEADER = 6;
DF_IMAGE_DATA = 7;
DF_IMAGE_END = 8;
FLASH_PLU_STATUS_SIZE = 50;
FLASH_PLU_STATUS = 544;
EEP_ALL_SIZE = 3153;
MESSAGE_ADDRESS = 12961;
EEP_PLU_PRTCAP = 2545;
EEP_PLU_PRTCAP_SIZE = 20;
EEP_HEADER_DATA = 193;
EEP_SHOP_DATA = 322;
type
_stTransData = record
shScaleID: SmallInt;
lpIP: PChar;
btCommType: BYTE;
btSendType: BYTE;
btDataType: BYTE;
wdScaleType: Word;
wdScaleModel: Word;
wdAction: Word;
wdDataSize: Word;
pData: Pointer;
end {_stTransData};
TTransData = _stTransData;
180
PTTransData = ^_stTransData;
_stTransDataV02 = record
shScaleID: SmallInt;
lpIP: PChar;
btCommType: BYTE;
btSendType: BYTE;
btDataType: BYTE;
wdScaleType: Word;
wdScaleModel: Word;
wdAction: Word;
wdDataSize: Word;
pData: Pointer;
dwScaleMainVersion: DWord;
dwScaleSubVersion: DWord;
dwScaleCountry: DWord;
dwScaleDataVersion: DWord;
dwReserveVersion: DWord;
pReserve: Pointer;
end {_stTransDataV02};
TTransDataV02 = _stTransDataV02;
PTTransDataV02 = ^_stTransDataV02;
_stTransDataEx = record
shScaleID: SmallInt;
chIP: Array[0..40]of Char;
btCommType: BYTE;
btSendType: BYTE;
btDataType: BYTE;
wdScaleType: Word;
wdScaleModel: Word;
wdAction: Word;
wdDataSize: Word;
chData: Array[0..DF_SIZE_RECVBUFFER] of Char;
end {_stTransDataEx};
TTransDataEx = _stTransDataEx;
181
PTTransDataEx = ^_stTransDataEx;
_stDataThisModule = record
btModule: BYTE;
btCommand: BYTE;
btMainVer: BYTE;
btSubVer: BYTE;
btModifyYear: BYTE;
btModifyMonth: BYTE;
btModifyDay: BYTE;
end {_stDataThisModule};
TVersion = _stDataThisModule;
PTVersion = ^_stDataThisModule;
_stSocketInfo = record
shScaleID: SmallInt;
lpIP: PChar;
wdPort: Word;
wdScaleType: Word;
wdScaleModel: Word;
wdTimeOut: Word;
wdRetryCount: Word;
btCommType: BYTE;
btTransType: BYTE;
btSocketType: BYTE;
btDataType: BYTE;
dwMsgNo: LongInt;
dwStateMsgNo: LongInt;
btLogStatus: BYTE;
lpLogFileName: PChar;
pRecvProc: PRecvProc;
182
pStateProc: PStateProc;
end {_stSocketInfo};
TSocketInfo = _stSocketInfo;
TConectionInfo = _stSocketInfo;
PTSocketInfo = ^_stSocketInfo;
PTConnectionInfo = ^_stSocketInfo;
_stDataPluInfoTable = record
end {_stDataPluInfoTable};
TDataPLUInfoTable = _stDataPluInfoTable;
PTDataPLUInfoTable = ^_stDataPluInfoTable;
_stDataScaleCommand = record
btCmdType: BYTE;
btDataType: BYTE;
btMain: BYTE;
btSub: BYTE;
btModule: BYTE;
btParam: BYTE;
wdParam: Word;
dwParam: LongInt;
pParam: Pointer;
end {_stDataScaleCommand};
TDataScaleCommand = _stDataScaleCommand;
PTDataScaleCommand = ^_stDataScaleCommand;
_stDataState = record
wdState: Word;
lpDescription: PChar;
end {_stDataState};
TDataState = _stDataState;
PTDataState = ^_stDataState;
_stAckInfo = record
btIP: Array[0..19] of BYTE;
btDataType: BYTE;
183
wdAction: Word;
wdRetryCount: Word;
dwSendCount: DWord;
dwSendID: DWord;
dwRecvID: DWord;
dwPosition: DWord; // Reserve
end {TD_ST_ACKINFO;};
TAckInfo = _stAckInfo;
PTAckInfo = ^_stAckInfo;
_imageinfo = record
addr: LongInt;
size: LongInt;
id: Word;
width: Word;
height: Word;
end {_imageinfo};
TImageInfo = _imageinfo;
PTImageInfo = ^_imageinfo;
_lblheader = record
format: Array[0..6-1] of Char;
version: Array[0..2-1] of Char;
company: Array[0..10-1] of Char;
model: Array[0..4-1] of Char;
usage: Array[0..4-1] of Char;
id: Word;
width: Word;
height: Word;
name: Array[0..16-1] of BYTE;
size_label: LongInt;
item_addr: LongInt;
item_count: Word;
stImageIf: Array[0..5-1] of TImageInfo;
end {_lblheader};
TLabelHeader = _lblheader;
184
PTLabelHeader = ^_lblheader;
185
wdCookDate: Word;
wdIngredient: Word;
wdTraceability: Word;
wdBonus: Word;
wdNutrifact: Word;
wdSaleMSG: Word;
wdRefPLUDept: Word;
dwRefPLUNo: LongInt;
wdCouplePLUDept: Word;
dwCouplePLUNo: LongInt;
wdLinkPLUCount: Word;
wdLinkPLUDept1: Word;
dwLinkPLUNo1: LongInt;
wdLinkPLUDept2: Word;
dwLinkPLUNo2: LongInt;
btTotalFlag: BYTE;
dwTotalCount: LongInt;
dwTotalPrice: LongInt;
dwTotalWeight: LongInt;
chReserve1: Array[0..50] of Char;
chReserve2: Array[0..50] of Char;
chReserve3: Array[0..50] of Char;
end {_stDataPLU};
TDataPLU = _stDataPLU;
PTDataPLU = ^_stDataPLU;
186
wdLabel2: Word;
wdOrigin: Word;
btWeightUnit: BYTE;
dwFixWeight: LongInt;
chPrefix: Array[0..10] of Char;
dwItemCode: LongInt;
wdPieces: Word;
btQuatSymbol: BYTE;
btPriceType: BYTE;
dwUnitPrice: LongInt;
dwSpecialPrice: LongInt;
wdTaxNo: Word;
dwTare: LongInt;
wdTareNo: Word;
dwPerTare: LongInt;
dwTareLimit: LongInt;
wdBarcode1: Word;
wdBarcode2: Word;
wdPicture: Word;
wdProduceDate: Word;
wdPackDate: Word;
wdPackTime: Word;
dwSellDate: LongInt;
wdSellTime: Word;
wdCookDate: Word;
wdIngredient: Word;
wdTraceability: Word;
wdBonus: Word;
wdNutrifact: Word;
wdSaleMSG: Word;
wdRefPLUDept: Word;
dwRefPLUNo: LongInt;
wdCouplePLUDept: Word;
dwCouplePLUNo: LongInt;
wdLinkPLUCount: Word;
wdLinkPLUDept1: Word;
187
dwLinkPLUNo1: LongInt;
wdLinkPLUDept2: Word;
dwLinkPLUNo2: LongInt;
btTotalFlag: BYTE;
dwTotalCount: LongInt;
dwTotalPrice: LongInt;
dwTotalWeight: LongInt;
chReserve1: Array[0..50] of Char;
chReserve2: Array[0..50] of Char;
chReserve3: Array[0..50] of Char;
wdNo: Word;
wdDirectSize: Word;
chDirectIngredient: Array[0..1024] of Char;
end {_stDataPLUV02};
TDataPLUV02 = _stDataPLUV02;
PTDataPLUV02 = ^_stDataPLUV02;
188
_stDataDept = packed record
wdNo: Word;
wdSpeedKey: Word;
chName: Array[0..100] of Char;
end {_stDataDept};
TDataDepartment = _stDataDept;
PTDataDepartment = ^_stDataDept;
189
TDataOrigin = _stDataOrigin;
PTDataOrigin = ^_stDataOrigin;
190
_stDataNutrifact = packed record
wdNo: Word;
btType: BYTE;
chName: Array[0..100] of Char;
chServingSize: Array[0..50] of Char;
chServingPer: Array[0..50] of Char;
btaValue: Array[0..20] of BYTE;
end {_stDataNutrifact};
TDataNutrifact = _stDataNutrifact;
PTDataNutrifact = ^_stDataNutrifact;
191
_stDataCut = packed record
wdNo: Word;
wdCountry: Word;
chName: Array[0..100] of Char;
end {_stDataCut};
TDataCut = _stDataCut;
PTDataCut = ^_stDataCut;
192
btWeek: BYTE;
btStartDate: Array[0..3-1] of BYTE;
btEndDate: Array[0..3-1] of BYTE;
btStartTime: Array[0..3-1] of BYTE;
btEndTime: Array[0..3-1] of BYTE;
end {_stDataScrollMsg};
TDataScrollMsg = _stDataScrollMsg;
PTDataScrollMsg = ^_stDataScrollMsg;
193
wdSendCount: Word;
wdSendSize: Word;
wdRecvCount: Word;
wdRecvHead: Word;
wdRecvSize: Word;
wdRecvExpactSize: Word;
wdStateCount:Word;
wdStatePosition: Word;
chStateBuffer: Array[0..100] of Char;
chRecvBackup: Array[0..DF_SIZE_RECVBUFFER] of Char;
tdRecvIngredient: TDataIngredient;
tdSendBackup: TTransDataEx;
end {_stInterpreterBuffer};
TInterpreterBuffer = _stInterpreterBuffer;
PTInterpreterBuffer = ^_stInterpreterBuffer;
194
btDataType: BYTE;
pRecvProc: PRecvProc;
pStateProc: PStateProc): Integer; cdecl;
function AddMsgConnectionEx(btCommType: BYTE;
lpTarget: PChar;
wdPort: Word;
wdScaleType: Word;
wdScaleModel: Word;
wdTimeout: Word;
wdRetryCount: Word;
btDataType: BYTE;
dwRecvMsg: LongInt;
dwStateMsg: LongInt;
shID: SmallInt;
shFlag: SmallInt): Integer; cdecl;
function AddProcConnectionEx(btCommType: BYTE;
lpTarget: PChar;
wdPort: Word;
wdScaleType: Word;
wdScaleModel: Word;
wdTimeout: Word;
wdRetryCount: Word;
btDataType: BYTE;
pRecvProc: PRecvProc;
pStateProc: PStateProc;
shID: SmallInt;
shFlag: SmallInt): Integer; cdecl;
function Connect(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function DeleteConnection(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function Disconnect(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function GetCommType(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function GetConnectionCount: Integer; cdecl;
function GetLibraryInfo(pVersion: PTVersion ; lpModuleName: PChar): Integer; cdecl;
function GetRetryCount(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function GetTimeout(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function GetTransType(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
195
function Initialize(iFlag: Integer): Integer; cdecl;
function IsConnect(lpTarget: PChar; shID: SmallInt): Integer; cdecl;
function SendData(tdData: TTransData): Integer; cdecl;
function SendDataEx(tdData: TTransDataV02): Integer; cdecl;
function SetCommLibrary(iModuleID: Integer; lpModuleName: PChar): Integer; cdecl;
function SetRecvWindow(hWnd: HWND): Integer; cdecl;
function SetRetryCount(lpTarget: PChar; shID: SmallInt; iCount: Integer): Integer; cdecl;
function SetTimeout(lpTarget: PChar; shID: SmallInt; iInterval: Integer): Integer; cdecl;
{$ENDIF}
implementation
196
end.
Example
procedure TForm1.FormCreate(Sender: TObject);
var
ret: Integer;
version: TVersion;
versionString: String;
begin
version.btModule := 3;
GetLibraryInfo(@version, '');
[DF_NAME_LIBTCPIP,
version.btMainVer,
version.btSubVer,
version.btModifyYear,
version.btModifyMonth,
version.btModifyDay] );
self.AddStatus(versionString);
Edit5.Text := 'PLU-Down.txt';
Edit6.Text := 'PLU-Up.txt';
end;
var
res: Integer;
begin
197
PChar(Edit1.Text), // IP
StrToInt(Edit2.Text), // Port
StrToInt(Edit3.Text), // Timeout
result := res;
end;
// Connect
var
ret: Integer;
IP: String;
begin
// CL Connect
ret := InitCommLib();
IP := Edit1.Text;
if (ret = 0) then
else
end;
// Disconnect
198
var
ret: Integer;
msg: String;
begin
msg := Edit1.Text;
if (ret = 0) then
else
self.Abort;
end;
// Upload
var
transData: TtransDataV02;
plu: TDataPLUV02;
ret: Integer;
begin
transData.shScaleID := -1;
transData.btCommType := DF_COMMTYPE_TCPIP;
transData.btDataType := DF_DATA_PLU_V02;
transData.lpIP := PChar(Edit1.Text);
transData.wdAction := DF_ACTION_UPLOAD;
transData.wdScaleType := DF_SCALE_TYPE_LP;
transData.wdScaleModel := DF_SCALE_CL5000;
plu.btDepart := 1;
if (flag = 0) then
199
begin
plu.dwPLU := 1;
end
else
begin
plu.dwPLU := FActionInfo.dwSendID + 1;
end;
transData.pData := @plu;
FActionInfo.dwSendID := plu.dwPLU;
ret := SendData(transData);
if (ret = 0) then
else
end;
200