Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
posprintdll
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
yunpeng.song
posprintdll
Commits
00ae810a
Commit
00ae810a
authored
Jan 09, 2019
by
李定达
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.添加串口打印配置从接口获取
parent
123a16d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
130 additions
and
13 deletions
+130
-13
LoadDll.cpp
+123
-12
LoadDll.h
+7
-1
No files found.
LoadDll.cpp
View file @
00ae810a
...
@@ -1286,13 +1286,20 @@ void CommPort()
...
@@ -1286,13 +1286,20 @@ void CommPort()
int
iFlowControl
=-
1
;
//ox
int
iFlowControl
=-
1
;
//ox
GetProfilePath
(
CONFIGFILE
);
GetProfilePath
(
CONFIGFILE
);
memset
(
func
,
0
,
sizeof
(
func
));
memset
(
func
,
0
,
sizeof
(
func
));
com
=
GetPrivateProfileString
(
"COMDEF"
,
"COM"
,
NULL
,
func
,
sizeof
(
func
),
CONFIGFILE
);
com
=
m_printclass
.
com_info
.
com
;
//com = GetPrivateProfileString("COMDEF", "COM", NULL, func, sizeof(func), CONFIGFILE);
if
(
com
<=
0
)
memset
(
func
,
0
,
sizeof
(
func
));
if
(
com
<=
0
)
memset
(
func
,
0
,
sizeof
(
func
));
iBaudrate
=
GetPrivateProfileInt
(
"COMDEF"
,
"Baudrate"
,
RESULT
,
CONFIGFILE
);
iBaudrate
=
m_printclass
.
com_info
.
iBaudrate
;
iDataBits
=
GetPrivateProfileInt
(
"COMDEF"
,
"DataBits"
,
RESULT
,
CONFIGFILE
);
iDataBits
=
m_printclass
.
com_info
.
iDataBits
;
iStopBits
=
GetPrivateProfileInt
(
"COMDEF"
,
"StopBits"
,
RESULT
,
CONFIGFILE
);
iStopBits
=
m_printclass
.
com_info
.
iStopBits
;
iParity
=
GetPrivateProfileInt
(
"COMDEF"
,
"Parity"
,
RESULT
,
CONFIGFILE
);
iParity
=
m_printclass
.
com_info
.
iParity
;
iFlowControl
=
GetPrivateProfileInt
(
"COMDEF"
,
"FlowControl"
,
RESULT
,
CONFIGFILE
);
iFlowControl
=
m_printclass
.
com_info
.
iFlowControl
;
//iBaudrate = GetPrivateProfileInt("COMDEF", "Baudrate", RESULT, CONFIGFILE);
//iDataBits = GetPrivateProfileInt("COMDEF", "DataBits", RESULT, CONFIGFILE);
//iStopBits = GetPrivateProfileInt("COMDEF", "StopBits", RESULT, CONFIGFILE);
//iParity = GetPrivateProfileInt("COMDEF", "Parity", RESULT, CONFIGFILE);
//iFlowControl = GetPrivateProfileInt("COMDEF", "FlowControl", RESULT, CONFIGFILE);
VC_Log_WriteLog
(
4
,
"串口 %d"
,
com
);
VC_Log_WriteLog
(
4
,
"比特率 %d"
,
iBaudrate
);
VC_Log_WriteLog
(
4
,
"比特率 %d"
,
iBaudrate
);
VC_Log_WriteLog
(
4
,
"数据位 %d"
,
iDataBits
);
VC_Log_WriteLog
(
4
,
"数据位 %d"
,
iDataBits
);
VC_Log_WriteLog
(
4
,
"停止位 %d"
,
iStopBits
);
VC_Log_WriteLog
(
4
,
"停止位 %d"
,
iStopBits
);
...
@@ -1797,6 +1804,78 @@ void _GetPrintIni(char inidata[])
...
@@ -1797,6 +1804,78 @@ void _GetPrintIni(char inidata[])
}
}
break
;
break
;
}
}
case
19
:
//com
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
com
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
com
=
0
;
}
break
;
}
case
20
:
//iBaudrate
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
iBaudrate
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
iBaudrate
=
-
1
;
}
break
;
}
case
21
:
//iDataBits
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
iDataBits
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
iDataBits
=
-
1
;
}
break
;
}
case
22
:
//iStopBits
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
iStopBits
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
iStopBits
=
-
1
;
}
break
;
}
case
23
:
//iParity
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
iParity
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
iParity
=
-
1
;
}
break
;
}
case
24
:
//iFlowControl
{
if
(
ss
.
size
()
!=
0
)
{
m_printclass
.
com_info
.
iFlowControl
=
atoi
(
ss
.
c_str
());
}
else
{
m_printclass
.
com_info
.
iFlowControl
=
-
1
;
}
break
;
}
default
:
default
:
{
{
m_printclass
.
printname
=
"Driver"
;
m_printclass
.
printname
=
"Driver"
;
...
@@ -1818,6 +1897,12 @@ void _GetPrintIni(char inidata[])
...
@@ -1818,6 +1897,12 @@ void _GetPrintIni(char inidata[])
m_printclass
.
label_ip
=
"127.0.0.1"
;
m_printclass
.
label_ip
=
"127.0.0.1"
;
m_printclass
.
label_parall
=
"LPT1"
;
m_printclass
.
label_parall
=
"LPT1"
;
m_printclass
.
label_prt_type
=
"4"
;
m_printclass
.
label_prt_type
=
"4"
;
m_printclass
.
com_info
.
com
=
0
;
m_printclass
.
com_info
.
iBaudrate
=
-
1
;
m_printclass
.
com_info
.
iDataBits
=
-
1
;
m_printclass
.
com_info
.
iFlowControl
=
-
1
;
m_printclass
.
com_info
.
iParity
=
-
1
;
m_printclass
.
com_info
.
iStopBits
=
-
1
;
break
;
break
;
}
}
}
}
...
@@ -2115,7 +2200,7 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2115,7 +2200,7 @@ int PrintCloseBpla(char *page, char *num)
strcpy
(
tmp2
,
m_printclass
.
tsc_speed
.
c_str
());
strcpy
(
tmp2
,
m_printclass
.
tsc_speed
.
c_str
());
strcpy
(
tmp3
,
m_printclass
.
tsc_chroma
.
c_str
());
strcpy
(
tmp3
,
m_printclass
.
tsc_chroma
.
c_str
());
var
=
BPLA_Set
(
2
,
0
,
0
);
var
=
BPLA_Set
(
1
,
0
,
0
);
if
(
var
!=
BPLA_OK
)
if
(
var
!=
BPLA_OK
)
{
{
...
@@ -2155,8 +2240,8 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2155,8 +2240,8 @@ int PrintCloseBpla(char *page, char *num)
if
(
var
!=
BPLA_OK
)
if
(
var
!=
BPLA_OK
)
{
{
VC_Log_WriteLog
(
1
,
" %s"
,
"标签打印机设置打印区域失败"
);
VC_Log_WriteLog
(
1
,
" %s"
,
"标签打印机设置打印区域失败"
);
return
0
;
return
0
;
}
}
var
=
BPLA_StartArea
(
1
,
400
,
0
,
0
,
0
,
0
,
0
,
0
);
var
=
BPLA_StartArea
(
1
,
400
,
0
,
0
,
0
,
0
,
0
,
0
);
...
@@ -2168,6 +2253,14 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2168,6 +2253,14 @@ int PrintCloseBpla(char *page, char *num)
return
0
;
return
0
;
}
}
var
=
BPLA_SetSaveFile
(
0
,
"D:
\\
a.txt"
,
1
);
if
(
var
!=
BPLA_OK
)
{
VC_Log_WriteLog
(
1
,
" %s"
,
"不保存打印数据失败失败"
);
return
0
;
}
heigth
=
0
;
heigth
=
0
;
//TSC_sendcommand("DIRECTION 1");
//TSC_sendcommand("DIRECTION 1");
...
@@ -2175,13 +2268,24 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2175,13 +2268,24 @@ int PrintCloseBpla(char *page, char *num)
int
i
=
0
;
int
i
=
0
;
vector
<
char
*>
tmpbuf
;
char
tmpfont_name
[
40
]
=
{
0
};
while
(
i
<
m_label_args
.
size
())
while
(
i
<
m_label_args
.
size
())
{
{
char
tmpfont_name
[
40
]
=
{
0
};
char
tmpdata
[
256
]
=
{
0
};
//char tmpdata[256] = {0};
char
*
tmpdata
=
(
char
*
)
malloc
(
sizeof
(
char
)
*
256
);
tmpbuf
.
push_back
(
tmpdata
);
memset
(
tmpdata
,
0
,
sizeof
(
char
)
*
256
);
Function_Argv
argv
=
m_label_args
[
i
];
Function_Argv
argv
=
m_label_args
[
i
];
//TSC_windowsfont(x, heigth, font_size, rotate, font_type, line, font_name, tmp);
//TSC_windowsfont(x, heigth, font_size, rotate, font_type, line, font_name, tmp);
strcpy
(
tmpfont_name
,
argv
.
font_name
.
c_str
());
if
(
i
==
0
)
strcpy
(
tmpfont_name
,
argv
.
font_name
.
c_str
());
strcpy
(
tmpdata
,
argv
.
data
.
c_str
());
strcpy
(
tmpdata
,
argv
.
data
.
c_str
());
TRUETYPEFONTSTYLE
founttype
=
{
0
,
0
,
0
};
TRUETYPEFONTSTYLE
founttype
=
{
0
,
0
,
0
};
...
@@ -2192,6 +2296,7 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2192,6 +2296,7 @@ int PrintCloseBpla(char *page, char *num)
if
(
var
!=
BPLA_OK
)
if
(
var
!=
BPLA_OK
)
{
{
VC_Log_WriteLog
(
1
,
" %s"
,
"行打印失败"
);
VC_Log_WriteLog
(
1
,
" %s"
,
"行打印失败"
);
VC_Log_WriteLog
(
1
,
" %s %d"
,
"ERROR:"
,
var
);
break
;
break
;
}
}
++
i
;
++
i
;
...
@@ -2207,6 +2312,12 @@ int PrintCloseBpla(char *page, char *num)
...
@@ -2207,6 +2312,12 @@ int PrintCloseBpla(char *page, char *num)
heigth
=
0
;
heigth
=
0
;
for
(
int
i
=
0
;
i
<
tmpbuf
.
size
();
++
i
)
{
VC_Log_WriteLog
(
1
,
" free memory"
);
free
(
tmpbuf
[
i
]);
}
return
1
;
return
1
;
}
}
...
...
LoadDll.h
View file @
00ae810a
...
@@ -345,7 +345,12 @@ typedef int (__stdcall *windowsfont)(int x, int y, int fontheight,
...
@@ -345,7 +345,12 @@ typedef int (__stdcall *windowsfont)(int x, int y, int fontheight,
//----------------------------------end----------------------------------//
//----------------------------------end----------------------------------//
typedef
struct
{
typedef
struct
{
int
com
;
int
iBaudrate
;
//比特率
int
iDataBits
;
//数据位
int
iStopBits
;
//停止位
int
iParity
;
//校验位
int
iFlowControl
;
//ox
}
COM_Info
;
}
COM_Info
;
...
@@ -371,6 +376,7 @@ typedef struct
...
@@ -371,6 +376,7 @@ typedef struct
string
label_usb
;
//标签打印机usb的名字
string
label_usb
;
//标签打印机usb的名字
string
label_ip
;
//标签打印机IP
string
label_ip
;
//标签打印机IP
string
label_prt_type
;
//3网络打印;4驱动打印
string
label_prt_type
;
//3网络打印;4驱动打印
COM_Info
com_info
;
//串口打印信息
}
PrintClass
,
*
pPrintclass
;
}
PrintClass
,
*
pPrintclass
;
/****************加载和卸载动态库**************************/
/****************加载和卸载动态库**************************/
bool
_LoadPosdll
(
void
);
bool
_LoadPosdll
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment