Commit 79266932 by yunpeng.song

合并代码

parents 77fbb803 8e25cd2c
......@@ -4,3 +4,16 @@ Debug/
fmposdll.sdf
fmposdll.suo
fmposdll.vcxproj.user
*.tlog
*.log
*.pdb
*.pch
*.obj
*.exp
*.lastbuildstate
*.manifest
*.sbr
Release/fmposdll.lib
Release/fmposdll.dll
Release/fmposdll.bsc
Release/test.exe
//Print.h
//返回值宏定义
#define BPLA_OK 1000 //一切正常
#define BPLA_COMERROR 1001 //通讯错或者未联接打印机
#define BPLA_PARAERROR 1002 //参数错误
#define BPLA_FILEOPENERROR 1003 //文件打开错误
#define BPLA_FILEREADERROR 1004 //文件读错误
#define BPLA_FILEWRITEERROR 1005 //文件写错误
#define BPLA_FILEERROR 1006 //文件不合要求
#define BPLA_NUMBEROVER 1007 //指定的接收信息数量过大
#define BPLA_IMAGETYPEERROR 1008 //图象文件格式不正确
#define BPLA_DRIVERERROR 1009 //驱动错误
#define BPLA_TIMEOUTERROR 1010 //超时错误
#define BPLA_LOADDLLERROR 1011 //加载动态库失败
#define BPLA_LOADFUNCERROR 1012 //加载动态库函数失败
#define BPLA_NOOPENERROR 1013 //端口未打开
//TrueType字体风格结构体定义
typedef struct TrueTypeFontStyle
{
BOOL Bold; //加粗
BOOL Italic; //倾斜
BOOL Underline; //下划线
} TRUETYPEFONTSTYLE;
BOOL LoadDll();//加载动态库文件及函数
//***************测试函数
typedef int (__stdcall *mBPLA_SetSaveFile)(int,char*,int); //将指令保存到文件
typedef int (__stdcall *mBPLA_GetVersion)(); //获取版本
//***************端口控制
typedef int (__stdcall *mBPLA_OpenCom)(char*,int,int); //打开配置串口
typedef int (__stdcall *mBPLA_OpenComEx)(char*,int,int,int); //打开配置串口,不检测
typedef int (__stdcall *mBPLA_CloseCom)(); //关闭串口
typedef int (__stdcall *mBPLA_OpenLpt)(int, int); //打开并口
typedef int (__stdcall *mBPLA_CloseLpt)(); //关闭并口
typedef int (__stdcall *mBPLA_OpenLptByAPI)(char *cLptName); //通过API打开并口
typedef int (__stdcall *mBPLA_CloseLptByAPI)(); //关闭API并口
typedef int (__stdcall *mBPLA_OpenUsb)(); //打开USB口
typedef int (__stdcall *mBPLA_OpenUsbByID)(int); //通过内部ID号打开USB口
typedef int (__stdcall *mBPLA_CloseUsb)(); //关闭USB口
typedef int (__stdcall *mBPLA_EnumUsbPrn)(int *iUsbPrnNum); //枚举USB类模式设备数量
typedef int (__stdcall *mBPLA_OpenUsbPrn)(int); //打开USB类模式端口
typedef int (__stdcall *mBPLA_CloseUsbPrn)(); //关闭USB类模式端口
typedef int (__stdcall *mBPLA_OpenNetPort)(char *cIpAddress,int iPort);//打开网络接口
typedef int (__stdcall *mBPLA_CloseNetPort)(); //关闭网络接口
typedef int (__stdcall *mBPLA_SetTimeOut)(int); //设置端口超时
typedef int (__stdcall *mBPLA_SetTimeOutEx)(int,int); //设置端口超时
//***************数据收发
typedef int (__stdcall *mBPLA_SendCommand)(char*,int); //发送指令
typedef int (__stdcall *mBPLA_ReceiveInfo)(int,char*,int*,int); //接收指令
typedef int (__stdcall *mBPLA_SendFile)(char*); //发送指令文件
typedef int (__stdcall *mBPLA_ReceiveFile)(int,char*, int*,int); //接收指令到文件
//***************驱动控制
typedef int (__stdcall *mBPLA_OpenPrinterDriver)(char* ); //打开驱动程序
typedef int (__stdcall *mBPLA_ClosePrinterDriver)(); //关闭驱动程序
typedef int (__stdcall *mBPLA_StartDoc)(); //开启打印作业
typedef int (__stdcall *mBPLA_EndDoc)(); //关闭打印作业
//***************设备设置
typedef int (__stdcall *mBPLA_DownloadImage)(char*,int,int,char*); //下载图象
typedef int (__stdcall *mBPLA_DownloadFont)(char*,int,int,int,int,int,int,int,int,char*);//下载字体
typedef int (__stdcall *mBPLA_DownErase)(int,int,char*); //删除指定的文件
typedef int (__stdcall *mBPLA_DownEraseAll)(int); //删除指定模块中的全部文件
typedef int (__stdcall *mBPLA_Reset)(); //复位打印机
typedef int (__stdcall *mBPLA_ForBack)(int,int); //进/退标签
typedef int (__stdcall *mBPLA_Set)(int,int,int); //出纸方式、纸张类型、工作模式
typedef int (__stdcall *mBPLA_SetSensor)(int); //选择传感器
typedef int (__stdcall *mBPLA_SetPaperLength)(int,int); //设置纸长度
typedef int (__stdcall *mBPLA_SetEnd)(int); //设置打印停止位置
//***************标签格式
typedef int (__stdcall *mBPLA_StartArea)(int,int,int,int,int,int,int,int);//进入标签模式
typedef int (__stdcall *mBPLA_SetMirror)(); //对条码无效
typedef int (__stdcall *mBPLA_SetCopy)(int pieces,int gap); //横向复制
typedef int (__stdcall *mBPLA_SetAllRotate)(int); //整体翻转
typedef int (__stdcall *mBPLA_SetAllMirror)(); //整体镜象
typedef int (__stdcall *mBPLA_PrintSaveLabel)(int); //打印已经保存的标签,不支持连续域设置
typedef int (__stdcall *mBPLA_Print)(int,int,int); //打印标签
typedef int (__stdcall *mBPLA_SaveLabel)(); //保存标签不打印
//***************内容设置
//图形打印
typedef int (__stdcall *mBPLA_PrintLine)(int,int,int,int,int); //直线
typedef int (__stdcall *mBPLA_PrintBox)(int,int,int,int,int,int,int); //矩形
typedef int (__stdcall *mBPLA_PrintCircle)(int,int,int,int,int); //圆
//图象打印
typedef int (__stdcall *mBPLA_LoadImage)(char*,int,int,int,int,int); //载入已经下载的图象
typedef int (__stdcall *mBPLA_PrintImage)(char*,int,int,int); //直接下载图象到打印位置
//文字打印
typedef int (__stdcall *mBPLA_PrintText)(char*,int,int,int,int,int,int,char*,int,int);//内部字体0-8、000-007和P06-P18
//打印内部点阵字体0-8、000-007和P06-P18,可以设置连续域
typedef int (__stdcall *mBPLA_PrintTextEx)(char* text,int startx,int starty,int rotate,int fonttype,int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
typedef int (__stdcall *mBPLA_PrintOut)(char*,int,int,int,char*,int,int,char*,int,int);//已经下载的外部字体打印
typedef int (__stdcall *mBPLA_PrintOutEx)(char*,int,int,int,char*,int,int,int,int);//已经下载的外部字体打印
typedef int (__stdcall *mBPLA_PrintTruetype)(char*,int,int,char*,int,int);//打印TRUETYPE字体
typedef int (__stdcall *mBPLA_PrintTruetypeEx)(char*,int,int,char*,int,int,int);//打印TRUETYPE字体,允许选择字体旋转方向和行列方向。
//打印TRUETYPE字体,可以设置字体风格
typedef int (__stdcall *mBPLA_PrintTruetypeStyle)(char* text,int startx,int starty,char* fontname,int fontheight,int fontwidth,TRUETYPEFONTSTYLE * sStyle,int rowrotate);
//中英文混排打印
typedef int (__stdcall *mBPLA_PrintMixText)(char*,int,int,int,int, int,char*,int,int, int,int,char*,int,int);
//中英文混排打印,增加连续域
typedef int (__stdcall *mBPLA_PrintMixTextBuild)(char* text,int startx,int en_starty,int cn_starty,int rotate, int en_fonttype,char* cn_fonttype,int en_width,int cn_width, int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
//中英文混排打印(指令格式)
typedef int (__stdcall *mBPLA_PrintMixTextEx)(char*,int,int,int,int, char*,char*,int,int,char*,int,int);
//中英文混排打印(指令格式),增加连续域
typedef int (__stdcall *mBPLA_PrintMixTextCmd)(char* text,int startx,int cn_starty,int xy_adjust,int rotate, char* en_fonttype,char* cn_fonttype,int pointwidth,int pointheight,int space,int bitmode,char* addvalue,int iValueStartPlace,int iValueLen);
//条码打印
//一维条码
typedef int (__stdcall *mBPLA_PrintBarcode)(char*,int,int,int,int,int,int,int,int);
//一维条码
typedef int (__stdcall *mBPLA_PrintBarcodeEx)(char*,int,int,int,int,int,int,int,int,char*,int,int);
//PDF417码
typedef int (__stdcall *mBPLA_PrintPDF)(char*,int,int,int,int,int,int,int,int,int,int,int,int);
//PDF417码
typedef int (__stdcall *mBPLA_PrintPDFEx)(char*,int,int,int,int,int,int,int,int,int,int,int,int,char*,int,int);
//MAXICODE码
typedef int (__stdcall *mBPLA_PrintMaxi)(char*,int,int);
//MAXICODE码
typedef int (__stdcall *mBPLA_PrintMaxiEx)(char*,int,int,int,char*,int,int);
//设置QR码的版面位置
typedef int (__stdcall *mBPLA_PrintQR)(unsigned char* codedata,int startx,int starty,int weigth,int symboltype,int languagemode,int number);
//***************查询
typedef int (__stdcall *mBPLA_CheckCom)(); //测试串口
typedef int (__stdcall *mBPLA_CheckStatus)(char*,char*,char*,char*,char*,char*,char*,char*);//测试状态
typedef int (__stdcall *mBPLA_CheckCut)(); //测试切刀
......@@ -127,9 +127,10 @@ typedef struct
int line;
string font_name;
string data;
double argvs;
} Function_Argv;
#define INIT_FUN_ARGV(tmpx, tmpheigth, tmpfont_size, tmpfont_type, tmpline, tmpfont_name, tmpdata) do { \
#define INIT_FUN_ARGV(tmpx, tmpheigth, tmpfont_size, tmpfont_type, tmpline, tmpfont_name, tmpdata, tmpnums) do { \
argv.x = tmpx; \
argv.y = tmpheigth; \
argv.font_size = tmpfont_size; \
......@@ -137,6 +138,7 @@ typedef struct
argv.line = tmpline; \
argv.font_name = string(tmpfont_name); \
argv.data = string(tmpdata); \
argv.argvs = tmpnums; \
}while(0);
/***************通用函数*****************/
......@@ -241,6 +243,8 @@ typedef bool (__stdcall *POS_EndSaveFile)();
typedef bool (__stdcall *POS_BeginSaveFile)(LPCTSTR lpFileName,bool bToPrinter);
/******只支持标准打印模式(行模式)的函数******/
typedef int (__stdcall *POS_S_SetAreaWidth)(int nWidth);
......@@ -358,7 +362,12 @@ typedef struct
string tsc_high; //标签打印的高度
string tsc_speed; //走纸速度
string tsc_chroma; //打印弄度
//标签打印机
string label_type; //标签打印机打印类型 TSC; BPAL;
string label_parall; //标签打印机并口名字
string label_usb; //标签打印机usb的名字
string label_ip; //标签打印机IP
string label_prt_type; //3网络打印;4驱动打印
} PrintClass,*pPrintclass;
/****************加载和卸载动态库**************************/
bool _LoadPosdll(void);
......@@ -414,9 +423,10 @@ int InitTscPort();
//font_name : 字体名称;宋体微软雅黑等;
//data : 打印数据;
//font_ratio: 字体每个粒度数对应的毫米;宋体 0.0666665; 为0时不自动换行;
//该函数不会调用打印接口只会绘制打印页面;
int WinPrintlnTsc(int x, int y, int font_size, int rotate, int font_type, int high_len, int line,const char *font_name, const char *data, double font_ratio);
//打印一页;触发打印;
//每打印一页都要调用;
int PrintCloseTsc(char *page, char *num);
int PrintClose(char *page, char *num);
#endif
File added
......@@ -103,7 +103,7 @@ extern "C" int __declspec(dllexport)TSCWinPrintln(int x, int y, int font_size,
extern "C" int __declspec(dllexport)TSCWinPrintPage(char *page, char *num)
{
return PrintCloseTsc(page, num);
return PrintClose(page, num);
}
extern "C" void __declspec(dllexport)PrintData(char data[])
......@@ -125,11 +125,10 @@ extern "C" void __declspec(dllexport)Unloaddll()
VC_POS_Close();
VC_Log_WriteLog(1,"%s","端口关闭成功");
}
if(g_hPosdll)
{
_UnloadPosdll();
VC_Log_WriteLog(1,"%s","卸载posdll成功");
}
_UnloadPosdll();
VC_Log_WriteLog(1,"%s","卸载posdll成功");
if (g_hLog)
{
_UnloadLogdll();
......
......@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "fmposdll", "fmposdll.vcxproj", "{A46CE5D4-D01B-CA08-372B-B0085099921E}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test", "..\test\test.vcxproj", "{A3A3F622-F88F-47BC-9776-9B44676755DB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
......@@ -15,10 +13,6 @@ Global
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Debug|Win32.Build.0 = Debug|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.ActiveCfg = Release|Win32
{A46CE5D4-D01B-CA08-372B-B0085099921E}.Release|Win32.Build.0 = Release|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Debug|Win32.ActiveCfg = Debug|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Debug|Win32.Build.0 = Debug|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Release|Win32.ActiveCfg = Release|Win32
{A3A3F622-F88F-47BC-9776-9B44676755DB}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -155,6 +155,7 @@
<CustomBuild Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="BPLAPrint.h" />
<ClInclude Include="LoadDll.h" />
<ClInclude Include="StdAfx.h" />
</ItemGroup>
......
......@@ -32,6 +32,9 @@
<ClInclude Include="StdAfx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="BPLAPrint.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="fmsdll.def">
......
// fmsFile.cpp: implementation of the fmsFile class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "fmsFile.h"
#include "LoadDll.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
fmsFile::fmsFile()
{
}
fmsFile::~fmsFile()
{
}
bool fmsFile::Loaddll()
{
if (false == LoadPosdll())
{
return false;
}
}
void fmsFile::OnOpenPort(int type)
{
switch(type)
{
case 0:
break;
}
}
\ 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