资源简介
喷码机通讯协议 易码 EC1000通讯协议 含例子,及PDF等开发文档
代码片段和文件信息
using System;
using System.Runtime.InteropServices;
using System.Threading;
using ECRemote;
namespace RemoteDemoCWrap
{
class Program
{
private static uint cnt = 0;
private static uint portNum = 3;
private static bool noCallBack = false;
private static ECComRemote.callBackFunDelegate callBackDelegate;
/** 定义回调函数 */
public static void realCallBack (ref IntPtr lppar)
{
if (noCallBack)
{
return;
}
++cnt;
Console.WriteLine (“CallBack function called! {0} times“ cnt);
string str1 = ““;
string str2 = ““;
for (int i = 0; i < 6; ++i) {
str1 += (cnt % 10).ToString ();
}
for (int i = 0; i < 8; ++i) {
str2 += ((cnt + 1) % 10).ToString ();
}
string result = str1 + “\0“ + str2;
ECPrinterStatus status = new ECPrinterStatus();
ECComRemote.get_printer_status(portNum ref status);
Console.WriteLine(“Printer Status = {0}“ status.working_status);
setRemoteField(result portNum);
}
/**
* @brief 设置远程字段值
*
* @param value 要设置的字符串
* @param portnr 要使用的串口号
*/
static void setRemoteField (string strVal uint portnr)
{
ECComRemote.download_remote_head(portnr strVal.Length + 1 1 strVal);
}
static void Main (string[] args)
{
Console.Write(“Please type the serial port number:“);
portNum = Convert.ToUInt32(Console.ReadLine());
Console.WriteLine(“portNum = {0}“ portNum);
/** 首先打开串口 */
if (ECComRemote.open_port(portNum 38400))
{
Console.WriteLine(“OpenPort Ok!“);
ECPrinterStatus status = new ECPrinterStatus();
ECComRemote.get_printer_status(portNum ref status);
int cmd_status = ECComRemote.get_ack_nak(portNum);
if (cmd_status == (int)CMD_Status.CMD_ACK)
{
Console.WriteLine(“Get Printer Status Ok!“);
}
else
{
Console.WriteLine(“Get Printer Status Error!“);
}
Console.WriteLine(“Printer Status = {0}“ status.working_status);
/** 新建回调函数委托 */
callBackDelegate = new ECComRemote.callBackFunDelegate(realCallBack);
/** 注册回调函数 */
ECComRemote.load_cb_print_end(portNum callBackDelegate new IntPtr(0));
Console.WriteLine(“register callback function “);
ECComRemote.start_print(portNum);
}
else
{
Console.WriteLine(“OpenPort Failed!“);
Console.ReadKey();
return;
}
Console.WriteLine (“Press any key to quit:“);
Console.ReadKey ();
/** 释放dll中打开的所有 comRemoter对象 */
ECComRemote.remove_all_com_remote ();
noCallBack = true;
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 14328 2015-11-16 13:37 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Debug\CSharpDemo151116.vshost.exe
文件 490 2007-07-21 01:33 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Debug\CSharpDemo151116.vshost.exe.manifest
文件 14848 2015-11-18 09:24 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Debug\ECComDatali
文件 769024 2015-11-18 09:25 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Debug\ECComRemote.dll
文件 12288 2015-11-18 09:20 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Debug\ECRemote.dll
文件 6656 2016-05-31 09:09 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\CSharpDemo151116.exe
文件 15872 2016-05-31 09:09 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\CSharpDemo151116.pdb
文件 11608 2016-05-31 09:10 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\CSharpDemo151116.vshost.exe
文件 490 2010-03-17 22:39 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\CSharpDemo151116.vshost.exe.manifest
文件 14848 2015-11-18 09:24 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\ECComDatali
文件 769024 2015-11-18 09:25 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\ECComRemote.dll
文件 12288 2015-11-18 09:20 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\ECRemote.dll
文件 11776 2015-11-17 13:30 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\bin\Release\ECRemote.pdb
文件 3051 2016-05-31 09:08 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\CSharpDemo151116.csproj
文件 1198 2016-05-31 09:10 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\obj\Release\CSharpDemo151116.csproj.FileListAbsolute.txt
文件 6656 2016-05-31 09:09 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\obj\Release\CSharpDemo151116.exe
文件 15872 2016-05-31 09:09 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\obj\Release\CSharpDemo151116.pdb
文件 3129 2016-05-31 09:08 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\obj\Release\ResolveAssemblyReference.cache
文件 3162 2015-11-17 13:31 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\Program.cs
文件 1374 2015-11-16 13:37 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116\Properties\AssemblyInfo.cs
文件 938 2016-05-31 09:08 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116.sln
..A..H. 17920 2015-11-17 13:40 ComRemote SDK\C#\Demo\CSharpDemo151116\CSharpDemo151116.suo
文件 413101 2015-11-18 09:30 ComRemote SDK\C#\Demo\CSharpDemo151116.zip
文件 14848 2015-10-28 13:40 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\ECComDatali
文件 769024 2015-10-30 09:07 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\ECComRemote.dll
文件 12288 2015-10-29 16:41 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\ECRemote.dll
文件 20992 2015-10-29 16:59 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\NewCSharpSDK.exe
文件 32256 2015-10-29 16:59 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\NewCSharpSDK.pdb
文件 14328 2015-10-29 17:00 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\NewCSharpSDK.vshost.exe
文件 490 2007-07-21 01:33 ComRemote SDK\C#\Demo\VS2008\NewCSharpSDK\NewCSharpSDK\bin\Release\NewCSharpSDK.vshost.exe.manifest
............此处省略456个文件信息
评论
共有 条评论