Commit 6becc16c by 李定达

1.调整打印库并测试完成

parent c3172fe7
...@@ -6,3 +6,5 @@ PrtLib/Debug/ ...@@ -6,3 +6,5 @@ PrtLib/Debug/
PrtLib/PrtLib/Debug/ PrtLib/PrtLib/Debug/
*.user *.user
*.sdf *.sdf
PrtLib/Release/
PrtLib/PrtLib/Release/
...@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00 ...@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010 # Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PrtLib", "PrtLib\PrtLib.vcxproj", "{597A700E-054E-438B-A0A5-B484BF0CBDF6}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PrtLib", "PrtLib\PrtLib.vcxproj", "{597A700E-054E-438B-A0A5-B484BF0CBDF6}"
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PrtLibTest", "PrtLibTest\PrtLibTest.vcxproj", "{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32 Debug|Win32 = Debug|Win32
...@@ -15,10 +13,6 @@ Global ...@@ -15,10 +13,6 @@ Global
{597A700E-054E-438B-A0A5-B484BF0CBDF6}.Debug|Win32.Build.0 = Debug|Win32 {597A700E-054E-438B-A0A5-B484BF0CBDF6}.Debug|Win32.Build.0 = Debug|Win32
{597A700E-054E-438B-A0A5-B484BF0CBDF6}.Release|Win32.ActiveCfg = Release|Win32 {597A700E-054E-438B-A0A5-B484BF0CBDF6}.Release|Win32.ActiveCfg = Release|Win32
{597A700E-054E-438B-A0A5-B484BF0CBDF6}.Release|Win32.Build.0 = Release|Win32 {597A700E-054E-438B-A0A5-B484BF0CBDF6}.Release|Win32.Build.0 = Release|Win32
{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}.Debug|Win32.ActiveCfg = Debug|Win32
{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}.Debug|Win32.Build.0 = Debug|Win32
{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}.Release|Win32.ActiveCfg = Release|Win32
{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
......
No preview for this file type
...@@ -17,15 +17,16 @@ ...@@ -17,15 +17,16 @@
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>MultiByte</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet> <CharacterSet>MultiByte</CharacterSet>
<UseOfMfc>Static</UseOfMfc>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">
...@@ -43,6 +44,7 @@ ...@@ -43,6 +44,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<IncludePath>.\include;$(IncludePath)</IncludePath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
...@@ -55,7 +57,8 @@ ...@@ -55,7 +57,8 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<ModuleDefinitionFile>prtlib.def</ModuleDefinitionFile> <ModuleDefinitionFile>
</ModuleDefinitionFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
...@@ -73,7 +76,8 @@ ...@@ -73,7 +76,8 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<ModuleDefinitionFile>prtlib.def</ModuleDefinitionFile> <ModuleDefinitionFile>
</ModuleDefinitionFile>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
......
...@@ -4,16 +4,16 @@ ...@@ -4,16 +4,16 @@
#define PRT_CONF_TYPE "type" #define PRT_CONF_TYPE "type"
#define PRT_CONF_LABELPRTTYPE "labelprttype" #define PRT_CONF_LABELPRTTYPE "labelprttype"
#define PRT_CONF_COM "com" #define PRT_CONF_COM "com"
#define PRT_CONF_BAUDRATE "Baudrate" #define PRT_CONF_BAUDRATE "baudrate"
#define PRT_CONF_FLOWCONTROL "FlowControl" #define PRT_CONF_FLOWCONTROL "flowcontrol"
#define PRT_CONF_DATABITS "DataBits" #define PRT_CONF_DATABITS "databits"
#define PRT_CONF_PARITY "Parity" #define PRT_CONF_PARITY "parity"
#define PRT_CONF_STOPBITS "StopBits" #define PRT_CONF_STOPBITS "wtopbits"
#define PRT_CONF_PAPERWIDTH "PaperWidth" #define PRT_CONF_PAPERWIDTH "paperwidth"
#define PRT_CONF_LPTNAME "parallel" #define PRT_CONF_LPTNAME "parallel"
#define PRT_CONF_IP "IP" #define PRT_CONF_IP "ip"
#define PRT_CONF_NAME "Name" #define PRT_CONF_NAME "name"
#define PRT_CONF_HIGH "high" #define PRT_CONF_HIGH "high"
#define PRT_CONF_WIGTH "wigth" #define PRT_CONF_WIGTH "width"
#endif #endif
...@@ -1271,7 +1271,7 @@ int GetPrtFout(int x, int *index, int font_size, double font_ratio, const char * ...@@ -1271,7 +1271,7 @@ int GetPrtFout(int x, int *index, int font_size, double font_ratio, const char *
return 1; return 1;
} }
int LabPrtLine(int x, int y, int line, char data[]) int LabPrtLine(int x, int y, int line, const char *data)
{ {
if(line == 0) if(line == 0)
{ {
...@@ -1359,6 +1359,9 @@ int TscPrintClose() ...@@ -1359,6 +1359,9 @@ int TscPrintClose()
Function_Argv argv = g_label_print_lines[i]; Function_Argv argv = g_label_print_lines[i];
strcpy(tmpfont_name, "宋体"); strcpy(tmpfont_name, "宋体");
strcpy(tmpdata, argv.data.c_str()); strcpy(tmpdata, argv.data.c_str());
LOG() << tmpdata;
TSC_windowsfont(argv.x, argv.y, LABEL_FOUT_SIZE, 0, 0, 0, tmpfont_name, tmpdata); TSC_windowsfont(argv.x, argv.y, LABEL_FOUT_SIZE, 0, 0, 0, tmpfont_name, tmpdata);
++ i; ++ i;
} }
...@@ -1623,7 +1626,7 @@ void NetPort() ...@@ -1623,7 +1626,7 @@ void NetPort()
string m_Usb;// usb的名字 string m_Usb;// usb的名字
string m_level; //日志的级别设定 默认 string m_level; //日志的级别设定 默认
string m_Ip ; string m_Ip ;
strcpy_s(func,g_info.ip.c_str()); //strcpy_s(func,g_info.ip.c_str());
VC_POS_Close(); VC_POS_Close();
g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_NETPORT); g_hComm = VC_POS_Open(func,0,0,0,0,POS_OPEN_NETPORT);
...@@ -1702,6 +1705,9 @@ int PrtOpen(char config[]) ...@@ -1702,6 +1705,9 @@ int PrtOpen(char config[])
{ {
g_first = true; g_first = true;
g_label_print_lines.clear(); g_label_print_lines.clear();
LOG() << "prt config : " << config;
int rlt = PrtSetConf::GetPrintInfo(config, PRT_TYPE, g_info); int rlt = PrtSetConf::GetPrintInfo(config, PRT_TYPE, g_info);
if (rlt != GETCONF_SUCCESS) if (rlt != GETCONF_SUCCESS)
......
...@@ -17,7 +17,7 @@ extern "C" int __declspec(dllexport)LabPrtOpen(char data[]); ...@@ -17,7 +17,7 @@ extern "C" int __declspec(dllexport)LabPrtOpen(char data[]);
//y y坐标; //y y坐标;
//data 打印数据; //data 打印数据;
//--------------------------------------------------------- //---------------------------------------------------------
extern "C" int __declspec(dllexport)LabPrtLine(int x, int y, int line, char data[]); extern "C" int __declspec(dllexport)LabPrtLine(int x, int y, int line, const char *data);
//杯贴打印完结; //杯贴打印完结;
extern "C" int __declspec(dllexport)LabPrtClose(); extern "C" int __declspec(dllexport)LabPrtClose();
/****************************************************小票**********************************************/ /****************************************************小票**********************************************/
...@@ -46,5 +46,7 @@ extern "C" bool __declspec(dllexport)PrintDataLine(char data[], int fontType, in ...@@ -46,5 +46,7 @@ extern "C" bool __declspec(dllexport)PrintDataLine(char data[], int fontType, in
extern "C" bool __declspec(dllexport)PrintBarCode(char data[], int type, int leftMargin, int fontType, int width, int height, int position); extern "C" bool __declspec(dllexport)PrintBarCode(char data[], int type, int leftMargin, int fontType, int width, int height, int position);
//打印二维码; //打印二维码;
extern "C" bool __declspec(dllexport)PrintQRCode(char data[], int type, int leftMargin, int width); extern "C" bool __declspec(dllexport)PrintQRCode(char data[], int type, int leftMargin, int width);
//
#endif #endif
\ No newline at end of file
...@@ -86,7 +86,7 @@ void testPrt() ...@@ -86,7 +86,7 @@ void testPrt()
{ {
int rlt; int rlt;
/*char c[] = "{\"IP\":\"172.16.13.254\",\"PaperWidth\":\"80\",\"type\":3}"; char c[] = "{\"IP\":\"172.16.13.252\",\"PaperWidth\":\"80\",\"type\":3}";
rlt = PrtOpen(c); rlt = PrtOpen(c);
...@@ -98,33 +98,33 @@ void testPrt() ...@@ -98,33 +98,33 @@ void testPrt()
rlt = PrtClose(); rlt = PrtClose();
Sleep(2000); //Sleep(2000);
char d[] = "{\"IP\":\"172.16.13.252\",\"PaperWidth\":\"56\",\"type\":3}"; //char d[] = "{\"IP\":\"172.16.13.252\",\"PaperWidth\":\"56\",\"type\":3}";
rlt = PrtOpen(d); //rlt = PrtOpen(d);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); //PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); //PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); //PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("轻轻的我走了,正如我轻轻的来;我轻轻的招手,作别西天的云彩.那河畔的金柳,是夕阳中的新娘;波光里的艳影,在我的心头荡漾.", 3, 0,1, 1); //PrintDataLine("轻轻的我走了,正如我轻轻的来;我轻轻的招手,作别西天的云彩.那河畔的金柳,是夕阳中的新娘;波光里的艳影,在我的心头荡漾.", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); //PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
rlt = PrtClose();*/ //rlt = PrtClose();
char e[] = "{\"IP\":\"172.16.13.254\",\"PaperWidth\":\"80\",\"type\":3}"; // char e[] = "{\"IP\":\"172.16.13.254\",\"PaperWidth\":\"80\",\"type\":3}";
rlt = PrtOpen(e); // rlt = PrtOpen(e);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); // PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); // PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); // PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
PrintDataLine("轻轻的我走了,正如我轻轻的来;我轻轻的招手,作别西天的云彩.那河畔的金柳,是夕阳中的新娘;波光里的艳影,在我的心头荡漾.", 3, 0,1, 1); // PrintDataLine("轻轻的我走了,正如我轻轻的来;我轻轻的招手,作别西天的云彩.那河畔的金柳,是夕阳中的新娘;波光里的艳影,在我的心头荡漾.", 3, 0,1, 1);
PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1); // PrintDataLine("李定达李定达李定达李定达李定达李定达李定达", 3, 0,1, 1);
//PrintQRCode(); // //PrintQRCode();
PrintBarCode("123456789", 73, 1, 0, 2, 100, 2); // PrintBarCode("123456789", 73, 1, 0, 2, 100, 2);
rlt = PrtClose(); // rlt = PrtClose();
char f[] = "{\"IP\":\"172.16.13.252\",\"PaperWidth\":\"56\",\"type\":3}"; char f[] = "{\"IP\":\"172.16.13.252\",\"PaperWidth\":\"56\",\"type\":3}";
...@@ -151,11 +151,11 @@ int main() ...@@ -151,11 +151,11 @@ int main()
if(!flag) if(!flag)
return 0; return 0;
for (int i = 0; i < 1; ++ i) for (int i = 0; i < 2; ++ i)
{ {
//testTSCPrt(); //testTSCPrt();
testPrt(); //testPrt();
} }
Unloaddll(); Unloaddll();
......
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{E3BC76AE-2FC6-4222-8A2C-DC520FA29C4D}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>PrtLibTest</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="源文件">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="头文件">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="资源文件">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
</Project>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment