那些年,用C#调用过的外部Dll

经常有人找到我咨询以前在csdn资源里分享的dll调用。算算也写过N多接口程序。翻一翻试试写篇随笔。

  • 明华IC读写器DLL
  • 爱迪尔门锁接口DLL
  • 通用OPOS指令打印之北洋pos打印机dll
  • 明泰非接触式RF读写器DLL
  • 二代身份证读取
  • 语音盒API的使用

还有很多,以后补上。大多找不到了。也是懒得找了。

先抄点名词解释

DllImport是System.Runtime.InteropServices命名空间下的一个属性类,其功能是提供从非托管DLL导出的函数的必要调用信息。
DllImport属性应用于方法,要求最少要提供包含入口点的dll的名称。
DllImport的定义如下:

[AttributeUsage(AttributeTargets.Method)]
  public class DllImportAttribute: System.Attribute
  {
   public DllImportAttribute(string dllName) {…} //定位参数为dllName
   public CallingConvention CallingConvention; //入口点调用约定
   public CharSet CharSet; //入口点采用的字符接
   public string EntryPoint; //入口点名称
   public bool ExactSpelling; //是否必须与指示的入口点拼写完全一致,默认false
   public bool PreserveSig; //方法的签名是被保留还是被转换
   public bool SetLastError; //FindLastError方法的返回值保存在这里
   public string Value { get {…} }
  }

Mwic_32.dll(明华IC卡)

using System;
using System.Text;
using System.Runtime.InteropServices; namespace mw_rdp
{
/// <summary>
/// IC4442 的摘要说明。
/// </summary>
public unsafe class IC4442
{
public IC4442()
{
//
// TODO: 在此处添加构造函数逻辑
//
} //向IC卡中写数据 [DllImport("Mwic_32.dll", EntryPoint = "swr_4442", SetLastError = true, CharSet = CharSet.Ansi, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] public static extern int swr_4442(int icdev, int offset, int len, char* w_string); [DllImport("Mwic_32.dll", EntryPoint="srd_4442", SetLastError=true,
CharSet=CharSet.Auto, ExactSpelling=false,
CallingConvention=CallingConvention.StdCall)]
//说明: 从指定地址读数据
// 调用: icdev: 通讯设备标识符 offset: 偏移地址,其值范围0~255
// len: 字符串长度,其值范围1~256 r_string: 读出数据所存放地址指针
//返回: <>0 错误 =0 正确
public static extern Int16 srd_4442(int icdev, Int16 offset, Int16 len,[MarshalAs(UnmanagedType.LPArray)]byte[] r_string ); [DllImport("Mwic_32.dll", EntryPoint="chk_4442", SetLastError=true,
CharSet=CharSet.Auto , ExactSpelling=false,
CallingConvention=CallingConvention.StdCall)]
// 说明: 检查卡型是否正确
//调用: icdev: 通讯设备标识符
//返回: <0 错误 =0 正确
public static extern Int16 chk_4442(int icdev); [DllImport("Mwic_32.dll", EntryPoint = "csc_4442", SetLastError = true,
CharSet = CharSet.Auto, ExactSpelling = true,
CallingConvention = CallingConvention.Winapi)]
public static extern Int16 Csc_4442(int icdev, int len, [MarshalAs(UnmanagedType.LPArray)] byte[] p_string); [DllImport("Mwic_32.dll", EntryPoint="wsc_4442", SetLastError=true,
CharSet=CharSet.Auto, ExactSpelling=false,
CallingConvention=CallingConvention.StdCall)]
//说明: 改写卡密码
//调用: icdev: 通讯设备标识符 len: 密码个数,其值为3 p_string: 新密码地址指针
//返回: <0 错误 =0 正确
public static extern Int16 wsc_4442(int icdev, Int16 len, [MarshalAs(UnmanagedType.LPArray)]byte[] p_string); [DllImport("Mwic_32.dll", EntryPoint="rsc_4442", SetLastError=true,
CharSet=CharSet.Auto, ExactSpelling=false,
CallingConvention=CallingConvention.StdCall)]
//说明: 读出卡密码
//调用: icdev: 通讯设备标识符 len: 密码个数,其值为3 p_string: 存放密码地址指针
// 返回: <>0 错误 =0 正确 public static extern Int16 rsc_4442(int icdev, Int16 len, [MarshalAs(UnmanagedType.LPArray)]byte[] p_string); [DllImport("Mwic_32.dll", EntryPoint="rsct_4442", SetLastError=true,
CharSet=CharSet.Auto, ExactSpelling=false,
CallingConvention=CallingConvention.StdCall)]
//说明: 读出密码错误计数器值
//调用: icdev: 通讯设备标识符 counter: 密码错误记数值存放指针
//返回: <0 错误 >=0 正确
public static extern Int16 rsct_4442(int icdev, out byte counter); }
}

MainDll.Dll(爱迪尔门锁)

public static class AdelDoorCardIfc
{
public enum AdelSoftType
{
Lock3200 = ,
Lock3200K,
Lock4200,
Lock4200D,
Lock5200,
Lock6200,
Lock7200,
Lock7200D,
Lock9200,
Lock9200T,
A30,
A50 = ,
A90 = ,
A92 =
}
public enum TMEncoder
{
DS9097E = ,
DS9097U =
}
public enum EnCoderType
{
手动发行机,
自动发行机,
MSR206磁卡
}
private const string IFC_DllFileName = "MainDll.Dll";
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int SetPort(int Soft, int Port, int EncoderType, int TMEncoder);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int Reader_Beep(int Sound);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int EndSession();
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern void ChangeUser(string username);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int Init(int Soft, string Server, string UName, int EnCoderType, int TMEncoder);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int NewKey(string RoomNo, string Gate, string StartTime, string GuestName, string GuestId, int OverFlag, out int CardNo, string str1, string str2);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int AddKey(string RoomNo, string Gate, string StartTime, string GuestName, string GuestId, int OverFlag, out int CardNo, string str1, string str2);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int DupKey(string RoomNo, string Gate, string StartTime, string GuestName, string GuestId, int OverFlag, out int CardNo, string str1, string str2);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int ReadCard(StringBuilder room, StringBuilder gate, StringBuilder stime, StringBuilder guestname, StringBuilder guestid, StringBuilder track1, StringBuilder track2, ref int cardno, ref int st);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int EraseCard(int CardNo, string str1, string str2);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int CheckOut(string RoomNo, int CardNo);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int LostCard(string RoomNo, int CardNo);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int ReadCardId(ref uint cardNo);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int ReadIC(int start, int len, StringBuilder buff);
[DllImport("MainDll.Dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
public static extern int WriteIC(int start, int len, StringBuilder buff);
public static void ShowMessageResult(int iResult, bool ifSystemBarNotity)
{
string text = string.Empty;
switch (iResult)
{
case :
text = "门口接口调用,操作成功!";
break;
case :
text = "读写错误或者数据错误!";
break;
case :
text = "卡已损坏!";
break;
case :
text = "没有检测到卡!";
break;
case :
text = "串口通信错误,请检测连接线!";
break;
case :
text = "卡被更换!";
break;
case :
text = "不是新卡!";
break;
case :
text = "卡是新卡!";
break;
case :
text = "非本系统卡!";
break;
case :
text = "不是客人卡!";
break;
case :
text = "不是会员卡!";
break;
case :
text = "密码错误!";
break;
case :
text = "无开门记录!";
break;
case :
text = "卡型不正确!";
break;
case :
text = "参数错误!";
break;
case :
text = "用户取消操作(按下<ESC>键)!";
break;
case :
text = "等待超时!";
break;
case :
text = "插卡错误!";
break;
case :
text = "卡是空白卡或插卡错误!";
break;
case :
text = "";
break;
case :
text = "没有调用Init函数!";
break;
case :
text = "不支持该版本的门锁软件!";
break;
case :
text = "连接(门锁系统数据库)错误!";
break;
case :
text = "门锁系统参数不存在!";
break;
case :
text = "初始化失败!";
break;
case :
text = "没有客人在住/指定客人不存在!";
break;
case :
text = "客房已满!";
break;
case :
text = "没有此卡记录!";
break;
case :
text = "没有调用SetPort函数!";
break;
case :
text = "无效的客房房号!";
break;
case :
text = "错误的时间范围!";
break;
case :
text = "卡号已存在,无法登记!";
break;
case :
text = "不支持调用!";
break;
case :
text = "无效的授权码,授权码错误或过期!";
break;
}
if (ifSystemBarNotity)
{
Utility.NotifyMessageBox(text, "接口系统提示");
}
else
{
MessageBox.Show(text, "接口系统提示");
}
}
}

posdll.dll(北洋打印机封装的OPOS指令打印DLL)

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.IO.Ports; namespace PosPrintService
{
/// <summary>
/// 北洋OPOS指令集二次开发包DLL调用
///
public class BeiYangOPOS
{
const string _DllVer = "1.4";
/// <summary>
/// 获取动态库版本号
/// </summary>
public string GetDllVer
{
get { return _DllVer;}
} /// <summary>
/// 设备打开后的句柄
/// </summary>
public IntPtr POS_IntPtr; /// <summary>
/// 函数返回值
/// </summary>
public uint POS_SUCCESS = ;// 函数执行成功
public uint POS_FAIL = ; // 函数执行失败
public uint POS_ERROR_INVALID_HANDLE = ; // 端口或文件的句柄无效
public uint POS_ERROR_INVALID_PARAMETER = ;// 参数无效
public uint POS_ERROR_NOT_BITMAP = ; // 不是位图格式的文件
public uint POS_ERROR_NOT_MONO_BITMAP = ;// 位图不是单色的
public uint POS_ERROR_BEYONG_AREA = ;//位图超出打印机可以处理的大小
public uint POS_ERROR_INVALID_PATH = ; // 没有找到指定的文件路径或名 /// <summary>
/// 停止位
/// </summary>
public uint POS_COM_ONESTOPBIT = 0x00;//停止位为1
public uint POS_COM_ONE5STOPBITS = 0x01;//停止位为1.5
public uint POS_COM_TWOSTOPBITS = 0x02;//停止位为2
/// <summary>
/// 奇偶校验
/// </summary>
public uint POS_COM_NOPARITY = 0x00;//无校验
public uint POS_COM_ODDPARITY = 0x01;//奇校验
public uint POS_COM_EVENPARITY = 0x02;//偶校验
public uint POS_COM_MARKPARITY = 0x03;//标记校验
public uint POS_COM_SPACEPARITY = 0x04;//空格校验
/// <summary>
/// 其他COM口参数及端口类型定义
/// </summary>
public uint POS_COM_DTR_DSR = 0x00;// 流控制为DTR/DST
public uint POS_COM_RTS_CTS = 0x01;// 流控制为RTS/CTS
public uint POS_COM_XON_XOFF = 0x02;// 流控制为XON/OFF
public uint POS_COM_NO_HANDSHAKE = 0x03;//无握手
public uint POS_OPEN_PARALLEL_PORT = 0x12;//打开并口通讯端口
public uint POS_OPEN_BYUSB_PORT = 0x13;//打开USB通讯端口
public uint POS_OPEN_PRINTNAME = 0X14;// 打开打印机驱动程序
public uint POS_OPEN_NETPORT = 0x15;// 打开网络接口 public uint POS_CUT_MODE_FULL = 0x00;// 全切
public uint POS_CUT_MODE_PARTIAL = 0x01;// 半切 /// <summary>
/// 打开POS机的端口 开始会话
/// </summary>
/// <param name="lpName">
///指向以 null 结尾的打印机名称或端口名称。
///当参数nParam的值为POS_COM_DTR_DSR、POS_COM_RTS_CTS、POS_COM_XON_XOFF或POS_COM_NO_HANDSHAKE 时, “COM1”,“COM2”,“COM3”,“COM4”等表示串口;
///当参数nParam的值为POS_OPEN_PARALLEL_PORT时,“LPT1”,“LPT2”等表示并口;
///当参数nParam的值为POS_OPEN_BYUSB_PORT时,“BYUSB-0”、“BYUSB-1”、“BYUSB-2”、“BYUSB-3”等表示USB端口。
///当参数nParam的值为POS_OPEN_PRINTNAME时,表示打开指定的打印机。
///当参数nParam的值为POS_OPEN_NETPORT时,表示打开指定的网络接口,如“192.168.10.251”表示网络接口IP地址</param>
/// <param name="nComBaudrate">串口通信需要的波特率</param>
/// <param name="nComDataBits">串口通信需要的数据位</param>
/// <param name="nComStopBits">串口通信需要的停止位</param>
/// <param name="nComParity">串口通信需要的是否要奇偶校验</param>
/// <param name="nParam">指向以 null 结尾的打印机名称或端口名称。
/// 参数nParam的值为POS_COM_DTR_DSR、POS_COM_RTS_CTS、POS_COM_XON_XOFF或POS_COM_NO_HANDSHAKE 时,
/// “COM1”,“COM2”,“COM3”,“COM4”等表示串口;
/// 当参数nParam的值为POS_OPEN_PARALLEL_PORT时,“LPT1”,“LPT2”等表示并口;
/// 当参数nParam的值为POS_OPEN_BYUSB_PORT时,“BYUSB-0”、“BYUSB-1”、“BYUSB-2”、“BYUSB-3”等表示USB端口。
/// 当参数nParam的值为POS_OPEN_PRINTNAME时,表示打开指定的打印机。</param>
/// <returns>如果函数调用成功,返回一个已打开的端口句柄。如果函数调用失败,返回值为 INVALID_HANDLE_VALUE (-1)。</returns>
[DllImport("POSDLL.dll", CharSet = CharSet.Ansi)]
public static extern IntPtr POS_Open([MarshalAs(UnmanagedType.LPStr)]string lpName,
uint nComBaudrate,
uint nComDataBits,
uint nComStopBits,
uint nComParity,
uint nParam); /// <summary>
/// 关闭已经打开的并口或串口,USB端口,网络接口或打印机。
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_Close(); /// <summary>
/// 复位打印机,把打印缓冲区中的数据清除,字符和行高的设置被清除,打印模式被恢复到上电时的缺省模式。
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_Reset(); /// <summary>
/// 设置打印机的移动单位。
/// </summary>
/// <param name="nHorizontalMU">把水平方向上的移动单位设置为 25.4 / nHorizontalMU 毫米。可以为0到255。</param>
/// <param name="nVerticalMU">把垂直方向上的移动单位设置为 25.4 / nVerticalMU 毫米。可以为0到255。</param>
/// <returns>
/// 如果函数成功,则返回值为 POS_SUCCESS。
/// 如果函数失败,则返回值为以下值之一:POS_FAIL POS_ERROR_INVALID_HANDLE POS_ERROR_INVALID_PARAMETER </returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetMotionUnit(uint nHorizontalMU, uint nVerticalMU);
/// <summary>
/// 选择国际字符集和代码页
/// </summary>
/// <param name="nCharSet">
/// 指定国际字符集。不同的国际字符集对0x23到0x7E的ASCII码值对应的符号定义是不同的。
/// 可以为以下列表中所列值之一。
/// 0x00 U.S.A 0x01 France 0x02 Germany 0x03 U.K. 0x04 Denmark I 0x05 Sweden
/// 0x06 Italy 0x07 Spain I 0x08 Japan 0x09 Nonway 0x0A Denmark II 0x0B Spain II
/// 0x0C Latin America 0x0D Korea </param>
/// <param name="nCodePage">
/// 指定字符的代码页。不同的代码页对0x80到0xFF的ASCII码值对应的符号定义是不同的。
/// 0x00 PC437 [U.S.A. Standard Europe 0x01 Reserved 0x02 PC850 [Multilingual]
/// 0x03 PC860 [Portuguese] 0x04 PC863 [Canadian-French] 0x05 PC865 [Nordic]
/// 0x12 PC852 0x13 PC858
/// </param>
/// <returns>
/// 如果函数成功,则返回值为 POS_SUCCESS。
/// 如果函数失败,则返回值为以下值之一:POS_FAIL POS_ERROR_INVALID_HANDLE POS_ERROR_INVALID_PARAMETER </returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetCharSetAndCodePage(uint nCharSet, uint nCodePage); /// <summary>
/// POS字体样式
/// </summary>
///
public uint POS_FONT_TYPE_STANDARD = 0x00;// 标准 ASCII
public uint POS_FONT_TYPE_COMPRESSED = 0x01;// 压缩 ASCII
public uint POS_FONT_TYPE_UDC = 0x02; // 用户自定义字符
public uint POS_FONT_TYPE_CHINESE = 0x03; // 标准 “宋体”
public uint POS_FONT_STYLE_NORMAL = 0x00; // 正常
public uint POS_FONT_STYLE_BOLD = 0x08; // 加粗
public uint POS_FONT_STYLE_THIN_UNDERLINE = 0x80; // 1点粗的下划线
public uint POS_FONT_STYLE_THICK_UNDERLINE = 0x100; // 2点粗的下划线
public uint POS_FONT_STYLE_UPSIDEDOWN = 0x200; // 倒置(只在行首有效)
public uint POS_FONT_STYLE_REVERSE = 0x400; // 反显(黑底白字)
public uint POS_FONT_STYLE_SMOOTH = 0x800; // 平滑处理(用于放大时)
public uint POS_FONT_STYLE_CLOCKWISE_90 = 0x1000; // 每个字符顺时针旋转 90 度 /// <summary>
/// 把将要打印的字符串数据发送到打印缓冲区中,并指定X 方向(水平)上的绝对起始点位置,
/// 指定每个字符宽度和高度方向上的放大倍数、类型和风格。
/// </summary>
/// <param name="pszString">指向以 null 结尾的字符串缓冲区</param>
/// <param name="nOrgx">指定 X 方向(水平)的起始点位置离左边界的点数。</param>
/// <param name="nWidthTimes">指定字符的宽度方向上的放大倍数。可以为 1到 6。</param>
/// <param name="nHeightTimes">指定字符高度方向上的放大倍数。可以为 1 到 6。</param>
/// <param name="nFontType">指定字符的字体类型。</param>
/// <param name="nFontStyle">指定字符的字体风格。</param>
/// <returns></returns> [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_S_TextOut([MarshalAs(UnmanagedType.LPStr)]string pszString,
uint nOrgx, uint nWidthTimes, uint nHeightTimes,
uint nFontType, uint nFontStyle); /// <summary>
/// 设置POS的打印模式 (只有两种 页模式和标准模式)
/// </summary>
/// <param name="nPrintMode">
/// POS_PRINT_MODE_STANDARD 0x00 标准模式(行模式)
/// POS_PRINT_MODE_PAGE 0x01 页模式
/// POS_PRINT_MODE_BLACK_MARK_LABEL 0x02 黑标记标签模式
/// POS_PRINT_MODE_WHITE_MARK_LABEL 0x03 白标记标签模式 </param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetMode(uint nPrintMode);
/// <summary>
/// 设置字符的行高。
/// </summary>
/// <param name="nDistance">指定行高点数。可以为 0 到 255。每点的距离与打印头分辨率相关。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetLineSpacing(uint nDistance);
/// <summary>
/// 设置字符的右间距(相邻两个字符的间隙距离)。
/// </summary>
/// <param name="nDistance">指定右间距的点数。可以为 0 到 255。每点的距离与打印头分辨率相关。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetRightSpacing(int nDistance); /// <summary>
/// 向前走纸。
/// 1.如果在标准打印模式(行模式)下打印文本,则打印缓冲区中的数据,且打印位置自动移动到下一行的行首。
/// 2.如果在标准打印模式(行模式)下打印位图,则在指定的位置打印位图,且打印位置自动移动到下一行的行首。
/// 3.如果在页模式或标签模式下,则把需要打印的数据设置在指定的位置,同时把打印位置移动到下一个行首,
/// 但是并不立即进纸并打印,而是一直到调用 POS_PL_Print 函数时才打印。
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_FeedLine();
/// <summary>
/// 打印头换n行
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_FeedLines(uint nLines); /// <summary>
/// 切纸
/// </summary>
/// <param name="nMode">模式编号 半切或是全切</param>
/// <param name="nDistance">走位的距离</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_CutPaper(uint nMode, uint nDistance); /// <summary>
/// 设置右边距
/// </summary>
/// <param name="nDistance">右边距</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_SetRightSpacing(uint nDistance);
/// <summary>
/// 预下载一幅位图到打印机的 RAM 中,同时指定此位图的 ID 号。
/// </summary>
/// <param name="pszPath">指向以 null 结尾的表示位图路径及其文件名的字符串。</param>
/// <param name="nID">指定将要下载的位图的 ID 号。可以为 0 到 7。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PreDownloadBmpToRAM([MarshalAs(UnmanagedType.LPStr)]string pszPath, uint nID);
/// <summary>
/// 下载并打印位图
/// </summary>
/// <param name="pszPath">指向以null 结尾的包含位图文件路径及其名称的字符串。</param>
/// <param name="nOrgx">指定将要打印的位图和左边界的距离点数。可以为 0到 65535 点。</param>
/// <param name="nMode">指定位图的打印模式。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_S_DownloadAndPrintBmp([MarshalAs(UnmanagedType.LPStr)]string pszPath, uint nOrgx, uint nMode); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_S_PrintBmpInRAM(uint nID, uint nOrgx, uint nMode); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_S_PrintBmpInFlash(uint nID, uint nOrgx, uint nMode); /// <summary>
/// 通过串口返回当前打印机的状态。此函数是实时的。
/// </summary>
/// <param name="address"></param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_RTQueryStatus(byte[] address); /// <summary>
/// 通过串口查询打印机当前的状态。此函数是非实时的。
/// </summary>
/// <param name="pszStatus">
/// 指向返回的状态数据的缓冲区,缓冲区大小为 1 个字节。
/// 0,1 0/1 容纸器中有纸 / 纸将用尽 2,3 0/1 打印头处有纸 / 无纸
/// 4,5 0/1 钱箱连接器引脚 3 的电平为低 / 高(表示打开或关闭)
/// 6,7 0 保留(固定为0)
/// </param>
/// <param name="nTimeouts">设置查询状态时大约的超时时间(毫秒)。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_QueryStatus(byte[] pszStatus, int nTimeouts);
/// <summary>
/// 通过网络接口查询返回当前打印机的状态。
/// </summary>
/// <param name="ipAddress">设备IP地址。如“192.168.10.251”。</param>
/// <param name="pszStatus">
/// 指向接收返回状态的缓冲区,缓冲区大小为 1 个字节。
/// 0 0/1 钱箱连接器引脚 3 的电平为低/高(表示打开或关闭)
/// 1 0/1 打印机联机/脱机
/// 2 0/1 上盖关闭/打开
/// 3 0/1 没有/正在由Feed键按下而进纸
/// 4 0/1 打印机没有/有出错
/// 5 0/1 切刀没有/有出错
/// 6 0/1 有纸/纸将尽(纸将尽传感器探测)
/// 7 0/1 有纸/纸用尽(纸传感器探测)
/// </param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern int POS_NETQueryStatus([MarshalAs(UnmanagedType.LPStr)]string ipAddress, out Byte pszStatus); /// <summary>
/// 设置并打印条码。
/// </summary>
/// <param name="pszInfo">指向以 null 结尾的字符串。每个字符允许的范围和格式与具体条码类型有关。</param>
/// <param name="nOrgx">指定将要打印的条码的水平起始点与左边界的距离点数。可以为 0 到65535。</param>
/// <param name="nType">
/// 指定条码的类型。可以为以下列表中所列值之一。
/// POS_BARCODE_TYPE_UPC_A 0x41 UPC-A POS_BARCODE_TYPE_UPC_E 0x42 UPC-C
/// POS_BARCODE_TYPE_JAN13 0x43 JAN13(EAN13) POS_BARCODE_TYPE_JAN8 0x44 JAN8(EAN8)
/// POS_BARCODE_TYPE_CODE39 0x45 CODE39 POS_BARCODE_TYPE_ITF 0x46 INTERLEAVED 2 OF 5
/// POS_BARCODE_TYPE_CODEBAR 0x47 CODEBAR POS_BARCODE_TYPE_CODE93 0x48 25
/// POS_BARCODE_TYPE_CODE128 0x49 CODE 128 </param>
/// <param name="nWidthX">
/// 指定条码的基本元素宽度。
/// 2 0.25mm 0.25mm 0.625mm 3 0.375mm 0.375mm 1.0mm 4 0.5mm 0.5mm 1.25mm
/// 5 0.625mm 0.625mm 1.625mm 6 0.75mm 0.75mm 1.875mm
/// </param>
/// <param name="nheight">指定条码的高度点数。可以为 1 到 255 。默认值为162 点。</param>
/// <param name="nHriFontType">
/// 指定 HRI(Human Readable Interpretation)字符的字体类型。可以为以下列表中所列值之一。
/// POS_FONT_TYPE_STANDARD 0x00 标准ASCII POS_FONT_TYPE_COMPRESSED 0x01 压缩ASCII
/// </param>
/// <param name="nHriFontPosition">
/// 指定HRI(Human Readable Interpretation)字符的位置。
/// POS_HRI_POSITION_NONE 0x00 不打印 POS_HRI_POSITION_ABOVE 0x01 只在条码上方打印
/// POS_HRI_POSITION_BELOW 0x02 只在条码下方打印 POS_HRI_POSITION_BOTH 0x03 条码上、下方都打印
/// </param>
/// <param name="nBytesOfInfo">指定由参数 pszInfoBuffer指向的字符串个数,即将要发送给打印机的字符总数。具体值与条码类型有关。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_S_SetBarcode([MarshalAs(UnmanagedType.LPStr)]string pszInfo,
uint nOrgx,uint nType,uint nWidthX,uint nheight,
uint nHriFontType,uint nHriFontPosition,uint nBytesOfInfo); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_SetArea(uint nOrgx , uint nOrgY , uint nWidth , uint nheight , uint nDirection ); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_TextOut([MarshalAs(UnmanagedType.LPStr)]string pszString,uint nOrgx,uint nOrgY,
uint nWidthTimes, uint nHeightTimes, uint nFontType, uint nFontStyle); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_PrintBmpInRAM(uint nID , uint nOrgx , uint nOrgY , uint nMode ); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_PrintBmpInFlash(uint nID, uint nOrgx, uint nOrgY, uint nMode); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_SetBarcode([MarshalAs(UnmanagedType.LPStr)]string pszInfo,
uint nOrgx , uint nOrgY , uint nType , uint nWidthX,uint nheight,
uint nHriFontType,uint nHriFontPosition,uint nBytesOfInfo); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_Clear(); [DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_PL_Print();
/// <summary>
/// 往钱箱引脚发送脉冲以打开钱箱。
/// </summary>
/// <param name="nID">指定钱箱的引脚。0x00 钱箱连接器引脚2 0x01 钱箱连接器引脚5 </param>
/// <param name="nOnTimes">指定往钱箱发送的高电平脉冲保持时间,即 nOnTimes × 2 毫秒。可以为1 到 255。</param>
/// <param name="nOffTimes">指定往钱箱发送的低电平脉冲保持时间,即 nOffTimes × 2 毫秒。可以为1 到 255。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_KickOutDrawer(uint nID, uint nOnTimes, uint nOffTimes);
/// <summary>
/// 新建一个打印作业。
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern bool POS_StartDoc();
/// <summary>
/// 结束一个打印作业。
/// </summary>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern bool POS_EndDoc();
/// <summary>
/// 发送数据到端口或文件。通用端口打印可以使用此函数 一般不能设置字体大小样式等
/// </summary>
/// <param name="hPort">端口或文件句柄。可以通过POS_Open来获取</param>
/// <param name="pszData">指向将要发送的数据缓冲区。</param>
/// <param name="nBytesToWrite">指定将要发送的数据的字节数。</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_WriteFile(IntPtr hPort, byte[] pszData, uint nBytesToWrite);
/// <summary>
/// 从串口,或USB端口或文件读数据到指定的缓冲区。
/// </summary>
/// <param name="hPort">端口或文件句柄。可以通过POS_Open来获取</param>
/// <param name="pszData">指向将要读取的数据缓冲区。</param>
/// <param name="nBytesToRead">数据的字节数</param>
/// <param name="nTimeouts">可能是读取数据的间隔时间</param>
/// <returns></returns>
[DllImport("POSDLL.dll", SetLastError = true)]
public static extern IntPtr POS_ReadFile(IntPtr hPort, byte[] pszData, uint nBytesToRead, uint nTimeouts); /// <summary>
/// 打开打印设备的串口
/// </summary>
/// <param name="PrintSerialPort">串口对象(需要先初始化并测试参数都有效的情况下,传进来)</param>
/// <returns>是否打开成功</returns>
public bool OpenComPort(ref SerialPort PrintSerialPort)
{
uint i_stopbits=;
if (PrintSerialPort.StopBits== StopBits.One)
i_stopbits=POS_COM_ONESTOPBIT;
if (PrintSerialPort.StopBits== StopBits.OnePointFive)
i_stopbits=POS_COM_ONE5STOPBITS;
if (PrintSerialPort.StopBits== StopBits.Two)
i_stopbits=POS_COM_TWOSTOPBITS; uint i_nComParity=;
if (PrintSerialPort.Parity== Parity.None)
i_nComParity=POS_COM_NOPARITY;
if (PrintSerialPort.Parity== Parity.Even)
i_nComParity=POS_COM_EVENPARITY;
if (PrintSerialPort.Parity== Parity.Odd)
i_nComParity=POS_COM_ODDPARITY;
if (PrintSerialPort.Parity== Parity.Space)
i_nComParity=POS_COM_SPACEPARITY;
if (PrintSerialPort.Parity== Parity.Mark)
i_nComParity=POS_COM_MARKPARITY; uint i_para=;
if (PrintSerialPort.Handshake== Handshake.None)
i_para=POS_COM_NO_HANDSHAKE;
if (PrintSerialPort.Handshake== Handshake.RequestToSend)
i_para=POS_COM_DTR_DSR;
if (PrintSerialPort.Handshake== Handshake.RequestToSendXOnXOff)
i_para=POS_COM_RTS_CTS;
if (PrintSerialPort.Handshake== Handshake.XOnXOff)
i_para=POS_COM_XON_XOFF; POS_IntPtr = POS_Open(PrintSerialPort.PortName,
(uint)PrintSerialPort.BaudRate,
(uint)PrintSerialPort.DataBits,
i_stopbits, i_nComParity, i_para); if ((int)POS_IntPtr != -)
return true;
else
return false;
}
/// <summary>
/// 打开打印设备并口
/// </summary>
/// <param name="LPTPortName">并口名称</param>
/// <returns>是否打开成功</returns>
public bool OpenLPTPort(string LPTPortName)
{
POS_IntPtr = POS_Open(LPTPortName, , , , , POS_OPEN_PARALLEL_PORT);
if ((int)POS_IntPtr != -)
return true;
else
return false;
}
/// <summary>
/// 打开打印设备的网口
/// </summary>
/// <param name="IPAddress">设备的IP地址</param>
/// <returns>是否打开成功</returns>
public bool OpenNetPort(string IPAddress)
{
POS_IntPtr = POS_Open(IPAddress, , , , , POS_OPEN_NETPORT);
if ((int)POS_IntPtr != -)
return true;
else
return false;
}
/// <summary>
/// 打开打印设备的USB端口
/// </summary>
/// <param name="USBPortName">“BYUSB-0”、“BYUSB-1”、“BYUSB-2”、“BYUSB-3”</param>
/// <returns>是否打开成功</returns>
public bool OpenUSBPort(string USBPortName)
{
POS_IntPtr = POS_Open(USBPortName, , , , , POS_OPEN_BYUSB_PORT);
if ((int)POS_IntPtr != -)
return true;
else
return false;
}
/// <summary>
/// 使用windows打印驱动程序来驱动OPOS设备
/// </summary>
/// <param name="PrintName">打印驱动程序对应的打印机名称</param>
/// <returns>是否打开成功</returns>
public bool OpenPrinter(string PrintName)
{
POS_IntPtr = POS_Open(PrintName, , , , , POS_OPEN_PRINTNAME);
if ((int)POS_IntPtr != -)
return true;
else
return false;
}
/// <summary>
/// 关闭设备端口
/// </summary>
/// <returns>是否关闭成功</returns>
public bool ClosePrinterPort()
{
IntPtr tmpIntPtr = POS_Close();
return ((uint)tmpIntPtr == POS_SUCCESS);
}
}
}

tsclib.dll(GP3120条形码打印机API)

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices; namespace Com.DataCool.GP3120API
{
/// <summary>
/// GP 3120条形码打印机API 分辨率:203 DPI
/// (单位换算:200 DPI,1 点=1/8 mm, 300 DPI,1 点=1/12 mm)
/// </summary>
public class TSC_Lib_API
{
/// <summary>
/// 指定计算机端的输出端口 单机打印时,请指定打印机驱动程序名称,例如: TSC TDP-245
/// 打开端口 独占打印机
/// </summary>
/// <param name="PrinterName"></param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int openport(string PrinterName); /// <summary>
/// 关闭指定的计算机端输出端口 结束端口的独占
/// </summary>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int closeport(); /// <summary>
/// 发送指令
/// </summary>
/// <param name="Command">内建指令见指令集pdf</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int sendcommand(string Command); /// <summary>
/// 清空打印机的缓冲区
/// </summary>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int clearbuffer(); /// <summary>
/// 跳页,该函数需在setup 后使用
/// </summary>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int formfeed(); /// <summary>
/// 设定纸张不回吐
/// </summary>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int nobackfeed(); /// <summary>
/// 设定标签的宽度、高度、打印速度、打印浓度、传感器类别、gap/black mark 垂直间距、gap/black mark 偏移距离)
/// </summary>
/// <param name="LabelWidth">标签宽度,单位mm</param>
/// <param name="LabelHeight">标签高度,单位mm</param>
/// <param name="Speed">打印速度 1.0: 每秒1.0 英寸打印速度 1.0,1.5,2.0,3.0,4.0,5.0,6.0</param>
/// <param name="Density">打印浓度 0~15,数字越大打印结果越黑</param>
/// <param name="Sensor">传感器类别 0 表示使用垂直间距传感器(gap sensor) 1 表示使用黑标传感器(black mark sensor) f垂直间距高度,g偏移距离 mm</param>
// f: 字符串型别,设定gap/black mark 垂直间距高度,单位: mm
// g: 字符串型别,设定gap/black mark 偏移距离,单位: mm,此参数若使用一般标签 时均设为0
/// <param name="Vertical">?</param>
/// <param name="Offset">设定gap/black mark 偏移距离,单位: mm,此参数若使用一般标签时均设为0</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int setup(string LabelWidth, string LabelHeight, string Speed, string Density, string Sensor, string Vertical, string Offset); /// <summary>
/// 下载单色PCX 格式图文件至打印机
/// </summary>
/// <param name="Filename">文件名(可包含路径)</param>
/// <param name="ImageName">下载至打印机内存内之文件名(请使用大写文件名)</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int downloadpcx(string Filename, string ImageName); /// <summary>
/// 使用条形码机内建条形码打印
/// </summary>
/// <param name="X">条形码X 方向起始点</param>
/// <param name="Y">条形码Y 方向起始点</param>
/// <param name="CodeType">一维条码类型 128 128M EAN128 25 25C 39 39C 93 EAN13 ...</param>
////// </param>
/// <param name="Height">条形码高度,高度以点来表示</param>
/// <param name="Readable">是否打印条形码码文0: 不打印码文1: 打印码文</param>
/// <param name="Rotation">条形码旋转角度0: 旋转0 度90: 旋转90 度180: 旋转180 度270: 旋转270 度</param>
/// <param name="Narrow">条形码窄bar 比例因子 请参考编程手册</param>
/// <param name="Wide">设定条形码窄bar 比例因子 请参考编程手册</param>
/// <param name="Code">条形码内容</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int barcode(string X, string Y, string CodeType, string Height, string Readable, string Rotation, string Narrow, string Wide, string Code); /// <summary>
/// 使用条形码机内建文字打印 (打印机硬字库)
/// </summary>
/// <param name="X">文字X 方向起始点</param>
/// <param name="Y">文字Y 方向起始点</param>
/// <param name="FontName">内建字型名称 1~5 TST24.BF2 TSS24.BF2 K</param>
/// <param name="Rotation">文字旋转角度 0~270(90的倍数)</param>
/// <param name="Xmul">文字X 方向放大倍数,1~8</param>
/// <param name="Ymul">文字Y 方向放大倍数,1~8</param>
/// <param name="Content">文字内容</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int printerfont(string X, string Y, string FontName, string Rotation, string Xmul, string Ymul, string Content); /// <summary>
/// 打印条形码 (调用缓冲区设置的条码)
/// </summary>
/// <param name="NumberOfSet">打印标签个数(set)</param>
/// <param name="NumberOfCopoy">打印标签份数(copy)</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int printlabel(string NumberOfSet, string NumberOfCopoy); /// <summary>
/// 使用Windows TTF 字型打印文字
/// </summary>
/// <param name="X">X 方向起始点</param>
/// <param name="Y">Y 方向起始点</param>
/// <param name="FontHeight">字体高度</param>
/// <param name="Rotation">旋转的角度 0~270(90的倍数)</param>
/// <param name="FontStyle">字体外形 0-> 标准(Normal) 1-> 斜体(Italic) 2-> 粗体(Bold) 3-> 粗斜体(Bold and Italic)</param>
/// <param name="FontUnderline">底线0-> 无底线 1-> 加底线</param>
/// <param name="FaceName">字体名称。如: Arial, Times new Roman, 细名体, 标楷体</param>
/// <param name="TextContect">文字内容</param>
/// <returns></returns>
[DllImport("tsclib.dll")]
public static extern int windowsfont(int X, int Y, int FontHeight, int Rotation, int FontStyle, int FontUnderline, string FaceName, string TextContect);
}
}

umf.dll(明泰非接触式RF读写器)

public class S9Dll
{
/// <summary>
/// 初始化通讯口
/// </summary>
/// <param name="port">USB通讯口,取值0-99</param>
/// <param name="baud">通讯波特率,9600-115200</param>
/// <returns>成功返回串口标识符值,失败返回-1</returns>
[DllImport("umf.dll", EntryPoint = "fw_init")]
public static extern Int32 fw_init(Int16 port, Int32 baud); /// <summary>
/// 关闭端口
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <returns></returns>
[DllImport("umf.dll", EntryPoint = "fw_exit")]
public static extern Int32 fw_exit(Int32 icdev); /// <summary>
/// 寻卡,能返回在工作区域内某张卡的序列号
/// </summary>
/// <param name="icdev">通讯标识符</param>
/// <param name="_Bcnt">寻卡模式,0---表示IDLE模式,一次只对一张卡;1---表示ALL模式,一次可对应多张卡</param>
/// <param name="_Snr">返回的卡序列号</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_card")]
public static extern Int32 fw_card(Int32 icdev, Byte _Mode, ref ulong _Snr); /// <summary>
/// 寻卡,能返回在工作区域内某张卡的序列号(16进制)
/// </summary>
/// <param name="icdev">通讯标识符</param>
/// <param name="_Mode">寻卡模式,0---表示IDLE模式,一次只对一张卡;1---表示ALL模式,一次可对应多张卡</param>
/// <param name="_Snr">返回的卡序列号</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_card_hex")]
public static extern Int32 fw_card_hex(Int32 icdev, Byte _Mode, ref Byte _Snr); /// <summary>
/// 寻卡,能返回在工作区域内某张卡的序列号(10进制)
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">寻卡模式,0---表示IDLE模式,一次只对一张卡;1---表示ALL模式,一次可对应多张卡</param>
/// <param name="_Snr">返回的卡序列号</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_card_str")]
public static extern Int32 fw_card_str(Int32 icdev, Byte _Mode, ref Byte _Snr); /// <summary>
/// 寻卡请求
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">寻卡模式,0---表示IDLE模式,一次只对一张卡;1---表示ALL模式,一次可对应多张卡</param>
/// <param name="_TagType">返回卡的类型值,4--MIFARE ONE(M1);2--S70;8--MIFARE PRO;68--ULTRA LIGHT</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_request")]
public static extern Int32 fw_request(Int32 icdev, Byte _Mode, ref UInt32 _TagType); /// <summary>
/// 防卡冲突,返回卡的序列号
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Bcnt">防卡冲突的级别,这里值为0</param>
/// <param name="_Snr">返回卡序列号地址</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_anticoll")]
public static extern Int32 fw_anticoll(Int32 icdev, Byte _Bcnt, ref ulong _Snr); /// <summary>
/// 从多个卡中选取一个给定序列号的卡
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Snr">卡序列号</param>
/// <param name="_Size">指向返回的卡容量数据</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_select")]
public static extern Int32 fw_select(Int32 icdev, ulong _Snr, Byte _Size); /// <summary>
/// 将密码装入读写模块RAM中
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">装入密码模式,0--KEYA,4--KEYB</param>
/// <param name="_SecNr">扇区号(M1卡:0-15;ML卡:0)</param>
/// <param name="_NKey">写入读写器中的卡密码</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_load_key")]
public static extern Int32 fw_load_key(Int32 icdev, Byte _Mode, Byte _SecNr, Byte[] _NKey); /// <summary>
/// 核对密码函数
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">装入密码模式,0--KEYA,4--KEYB</param>
/// <param name="_SecNr">要验证密码的扇区号</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_authentication")]
public static extern Int32 fw_authentication(Int32 icdev, Byte _Mode, Byte _SecNr); /// <summary>
/// 核对密码函数,用此函数时,可以不用执行fw_load_key函数
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">装入密码模式,0--KEYA,4--KEYB</param>
/// <param name="_Addr">要验证密码的扇区号</param>
/// <param name="_PassBuff">扇区密码(6字节)</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_authentication_pass")]
public static extern Int32 fw_authentication_pass(Int32 icdev, Byte _Mode, Byte _Addr, Byte[] _PassBuff); /// <summary>
/// 读取卡中数据
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">M1卡---块地址(0-63),MS70(0-255)</param>
/// <param name="_Data">读出数据,字符串是ASCII码</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_read")]
public static extern Int32 fw_read(Int32 icdev, Byte _Addr, ref Byte _Data); /// <summary>
/// 读取卡中数据
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">M1卡---块地址(0-63),MS70(0-255)</param>
/// <param name="_Data">读出数据,字符串是十六进制</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_read_hex")]
public static extern Int32 fw_read_hex(Int32 icdev, Byte _Addr, ref Byte _Data); /// <summary>
/// 向卡中写入数据
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">M1卡---块地址(1-63),MS70(1-255)</param>
/// <param name="_Data">要写入的数据(字符串是ASCII码)</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_write")]
public static extern Int32 fw_write(Int32 icdev, Byte _Addr, ref Byte _Data); /// <summary>
/// 向卡中写入数据
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">M1卡---块地址(1-63),MS70(1-255)</param>
/// <param name="_Data">要写入的数据(十六进制)</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_write_hex")]
public static extern Int32 fw_write_hex(Int32 icdev, Byte _Addr, ref Byte _Data); /// <summary>
/// 中止对该卡操作
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_halt")]
public static extern Int32 fw_halt(Int32 icdev); /// <summary>
/// DES算法加解密函数
/// </summary>
/// <param name="_Key">密钥</param>
/// <param name="_Sour">要加解密的数据</param>
/// <param name="_Dest">加解密后的数据</param>
/// <param name="_M">加解密模式,M=1时,为加密;M=0时,为解密</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_des")]
public static extern Int32 fw_des(ref Byte _Key, ref Byte _Sour, ref Byte _Dest, Int32 _M); /// <summary>
/// 修改块3的数据
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_SecNr">扇区号(M1:0-15,S70:0-39)</param>
/// <param name="_KeyA">密码A</param>
/// <param name="_CtrlW">密码控制块</param>
/// <param name="_Bk">保留参数,取值位0</param>
/// <param name="_KeyB">密码B</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_changeb3")]
public static extern Int32 fw_changeb3(Int32 icdev, Byte _SecNr, ref Byte _KeyA, ref Byte _CtrlW, Byte _Bk, ref Byte _KeyB); /// <summary>
/// 初始化块值
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">块地址</param>
/// <param name="_Value">初始值</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_initval")]
public static extern Int32 fw_initval(Int32 icdev, Byte _Addr, ulong _Value); /// <summary>
/// 块加值
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">块地址</param>
/// <param name="_Value">要增加的值</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_increment")]
public static extern Int32 fw_increment(Int32 icdev, Byte _Addr, ulong _Value); /// <summary>
/// 读块值
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">块地址</param>
/// <param name="_Value">读出值的地址</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_readval")]
public static extern Int32 fw_readval(Int32 icdev, Byte _Addr, ref ulong _Value); /// <summary>
/// 块减值
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">块地址</param>
/// <param name="_Value">要减值</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_decrement")]
public static extern Int32 fw_decrement(Int32 icdev, Byte _Addr, ulong _Value); /// <summary>
/// 回传函数,将EEPROM中的内容传入卡的内部寄存器
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">要进行回传的块地址</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_restore")]
public static extern Int32 fw_restore(Int32 icdev, Byte _Addr); /// <summary>
/// 传送,将寄存器的内容传送到EEPROM中
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Addr">要传送的块地址</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_transfer")]
public static extern Int32 fw_transfer(Int32 icdev, Byte _Addr); /// <summary>
/// 操作卡配置
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Flag">设定要操作的卡类型(0x41=TYPEA,0x42=TYPEB,0x31=IS015693)</param>
/// <returns>成功返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_config_card")]
public static extern Int16 fw_config_card(Int32 icdev, Byte _Flag); /// <summary>
/// 字符串转换函数,十六进制字符转普通字符
/// </summary>
/// <param name="_A">转换后的无符号字节数组</param>
/// <param name="_Hex">待转换的16进制字符串</param>
/// <param name="len">要转换的无符号字节个数</param>
/// <returns></returns>
[DllImport("umf.dll", EntryPoint = "a_hex")]
public static extern Int16 a_hex(Byte[] _A, Byte[] _Hex, Int16 len); /// <summary>
/// 字符串转换函数,普通字符转十六进制字符
/// </summary>
/// <param name="_Hex">转换后的无符号字节数组</param>
/// <param name="_A">待转换的无符号字节数组</param>
/// <param name="len">转换后的hex字符串的长度</param>
[DllImport("umf.dll", EntryPoint = "hex_a")]
public static extern void hex_a(Byte[] _Hex, Byte[] _A, Int16 len); /// <summary>
/// 蜂鸣
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Msec">蜂鸣时间,单位是10毫秒</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll",EntryPoint="fw_beep")]
public static extern Int32 fw_beep(Int32 icdev,UInt32 _Msec); /// <summary>
/// 读取硬件版本号
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Buff">存放版本号的缓冲区,字符串形式</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_getver")]
public static extern Int32 fw_getver(Int32 icdev,StringBuilder _Buff); /// <summary>
/// 设置读写器数码管显示模式,关机后可保存设置值
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">显示模式,0--日期(格式"年yy-月mm-日dd");1--时间(格式"时hh-分mm-秒ss)</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_disp_mode")]
public static extern Int32 fw_disp_mode(Int32 icdev, Byte _Mode); /// <summary>
/// 读取读写器日期、星期、时间
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Time">返回数据,长度为7个字节,格式"年、星期、月、日、时、分、秒"</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_gettime")]
public static extern Int32 fw_gettime(Int32 icdev, ref Byte _Time); /// <summary>
/// 设置读写器时间
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Time">长度为7个字节,长度为7个字节,格式"年、星期、月、日、时、分、秒"</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_settime")]
public static extern Int32 fw_settime(Int32 icdev, ref Byte _Time); /// <summary>
/// 设置读写器数码管的控制模式
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Mode">显示模式,0--计算机控制,1--读写器控制</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_ctl_mode")]
public static extern Int32 fw_ctl_mode(Int32 icdev, Byte _Mode); /// <summary>
/// LED数码管显示任意数字
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Len">显示数字的个数</param>
/// <param name="_DispStr">要显示的数字</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_LED_disp8")]
public static extern Int32 fw_LED_disp8(Int32 icdev, Byte _Len, ref Byte _DispStr); /// <summary>
/// 设置LCD背光点亮或熄灭
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Bright">点亮或熄灭的标志,15-点亮,0-熄灭</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_lcd_setbright")]
public static extern Int32 fw_lcd_setbright(Int32 icdev, Byte _Bright); /// <summary>
/// 设置LCD显示的字符串
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <param name="_Digit">要显示的字符串</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_lcd_dispstr")]
public static extern Int32 fw_lcd_dispstr(Int32 icdev, ref Byte _Digit); /// <summary>
/// 清空LCD显示的字符
/// </summary>
/// <param name="icdev">通讯设备标识符</param>
/// <returns>成功则返回0</returns>
[DllImport("umf.dll", EntryPoint = "fw_lcd_dispclear")]
public static extern Int32 fw_lcd_dispclear(Int32 icdev);
}

qnviccub.dll(一款语音盒api)

using System;
using System.Text;
using System.Runtime.InteropServices; namespace SoftPOS
{
class BriSDKLib
{
public const int NULL = ;//c++ public const int QNV_FILETRANS_VER = 0x30301; public const string QNV_CC_LICENSE = "quniccub_x"; //播放/录音回调时如果返回该值,系统将自动删除该回调模块,下次将不会被回调
public const int CB_REMOVELIST = -; public const string MULTI_SEPA_CHAR = "|";//多个文件播放列表分割符号
public const int PROXYDIAL_SIGN = 0x40000000;//代拨标记
public const string PROXYDIAL_SIGN_STRU = "P";//代拨标记
public const string PROXYDIAL_SIGN_STRL = "p";//代拨标记 public const string RING_BEGIN_SIGN_STR = "";
public const string RING_END_SIGN_STR = "";
public const string RING_BEGIN_SIGN_CH = "";
public const string RING_END_SIGN_CH = ""; public const string RINGBACK_TELDIAL_STR = "";
public const string RINGBACK_PCDIAL_STR = "";
public const string RINGBACK_PCDIAL_CH = "";
public const string RINGBACK_TELDIAL_CH = ""; public const string DIAL_DELAY_SECOND = ",";//拨号时号码之间延迟1秒
public const string DIAL_DELAY_HSECOND = ".";//拨号时号码之间延迟0.5秒
public const string DIAL_CHECK_CITYCODE = ":";//拨号时该符号后自动过滤城市区号 public const string CC_PARAM_SPLIT = ",";//CC参数的分隔符号 //自动创建录音文件时的默认目录名
public const string RECFILE_DIR = "recfile";
//配置信息里的KEY
public const string INI_QNVICC = "qnvicc";
//默认配置文件名
public const string INI_FILENAME = "cc301config.ini";
//VOIP代拨标记
public const string CC_VOIP_SIGN = "VOIP";
//匿名登陆CC,密码跟号码为相同
public const string WEB_802ID = ""; public const int MAX_USB_COUNT = ;//支持的最多USB芯片数
public const int MAX_CHANNEL_COUNT = ;//支持的最多通道数
//声卡控制有效通道ID号
//0->255为USB设备通道号
public const int SOUND_CHANNELID = ;
//远程通信通道,HTTP上传/下载
public const int REMOTE_CHANNELID = ;
//CC控制通道
public const int CCCTRL_CHANNELID = ;
////socket 服务器端通道
public const int SOCKET_SERVER_CHANNELID = ;
//socket 终端通道
public const int SOCKET_CLIENT_CHANNELID = ; public const int MAX_CCMSG_LEN = ;//发送消息的最大长度
public const int MAX_CCCMD_LEN = ;//发送命令的最大长度 public const int DEFAULT_FLASH_ELAPSE = ;//默认拍插簧间隔时间(ms)
public const int DEFAULT_FLASHFLASH_ELAPSE = ;//默认拍插簧后间隔一定时间回调事件ms
public const int DEFAULT_RING_ELAPSE = ;//默认给内部话机/交换机震铃时间ms响 1秒
public const int DEFAULT_RINGSILENCE_ELAPSE = ;//默认给内部话机/交换机震铃后停止ms 4秒
public const int DEFAULT_RING_TIMEOUT = ;//默认给内线震铃超时次数,每次1秒响4秒停,总共时间就为N*5
public const int DEFAULT_REFUSE_ELAPSE = ;//拒接时默认使用间隔(ms)
public const int DEFAULT_DIAL_SPEED = ;//默认拨号速度ms
public const int DEFAULT_DIAL_SILENCE = ;//默认号码之间静音时间ms
public const int DEFAULT_CHECKDIALTONE_TIMEOUT = ;//检测拨号音超时就强制呼叫ms
public const int DEFAULT_CALLINTIMEOUT = ;//来电响铃超时ms //设备类型
public const int DEVTYPE_UNKNOW = -;//未知设备
//cc301系列
public const int DEVTYPE_T1 = 0x1009;
public const int DEVTYPE_T2 = 0x1000;
public const int DEVTYPE_T3 = 0x1008;
public const int DEVTYPE_T4 = 0x1005;
public const int DEVTYPE_T5 = 0x1002;
public const int DEVTYPE_T6 = 0x1004; public const int DEVTYPE_IR1 = 0x8100;
public const int DEVTYPE_IA1 = 0x8111;
public const int DEVTYPE_IA2 = 0x8112;
public const int DEVTYPE_IA4 = 0x8114;
public const int DEVTYPE_IB2 = 0x8122;
public const int DEVTYPE_IB3 = 0x8123; public const int DEVTYPE_IP1 = 0x8131; public const int DEVTYPE_IC2_R = 0x8200;
public const int DEVTYPE_IC2_LP = 0x8203;
public const int DEVTYPE_IC2_LPQ = 0x8207; //玻瑞器
public const int DEVTYPE_A1 = 0x1100000;
public const int DEVTYPE_A2 = 0x1200000;
public const int DEVTYPE_A3 = 0x1300000;
public const int DEVTYPE_A4 = 0x1400000;
public const int DEVTYPE_B1 = 0x2100000;
public const int DEVTYPE_B2 = 0x2200000;
public const int DEVTYPE_B3 = 0x2300000;
public const int DEVTYPE_B4 = 0x2400000;
public const int DEVTYPE_C4_L = 0x3100000;
public const int DEVTYPE_C4_P = 0x3200000;
public const int DEVTYPE_C4_LP = 0x3300000;
public const int DEVTYPE_C4_LPQ = 0x3400000;
public const int DEVTYPE_C7_L = 0x3500000;
public const int DEVTYPE_C7_P = 0x3600000;
public const int DEVTYPE_C7_LP = 0x3700000;
public const int DEVTYPE_C7_LPQ = 0x3800000;
public const int DEVTYPE_R1 = 0x4100000;
public const int DEVTYPE_C_PR = 0x4200000; //--------------------------------------------------------------
//设备功能模块
//是否具有内置喇叭功能
//可以PC播放语音到喇叭/通话时线路声音到喇叭
public const int DEVMODULE_DOPLAY = 0x1;
//是否具有可接入外线获取来电号码(FSK/DTMF双制式)/通话录音功能
//可以来电弹屏/通话录音/通话时获取对方按键(DTMF)
public const int DEVMODULE_CALLID = 0x2;
//是否具有可接入话机进行PSTN通话功能
//可以使用电话机进行PSTN通话/获取话机拨出的号码
public const int DEVMODULE_PHONE = 0x4;
//是否具有继电器切换断开/接通话机功能
//断开话机后可以:来电时话机不响铃/使用话机MIC独立采集录音配合DEVFUNC_RING模块给话机模拟来电震铃
public const int DEVMODULE_SWITCH = 0x8;
//PC播放语音给话机听筒,具有 DEVMODULE_SWITCH模块,switch后播放语音到话机听筒
public const int DEVMODULE_PLAY2TEL = 0x10;
//是否具有话机摘机后拨号/放音给线路的功能
//可以使用PC自动摘机进行拨号/通话时可以给对方播放语音/来电留言/外拨通知/来电IVR(语音答录)
public const int DEVMODULE_HOOK = 0x20;
//是否具有插入MIC/耳机功能
//可以用MIC/耳机进行PSTN通话/使用MIC独立录音/PC播放语音给耳机
public const int DEVMODULE_MICSPK = 0x40;
//是否具有让接在phone口的设备(电话机,交换机等)模拟震铃功能
//可以任意时刻让phone口的设备模拟来电震铃.如:在来电IVR(语音答录)之后进入工服务时给内部话机或交换机模拟震铃
public const int DEVMODULE_RING = 0x80;
//是否具有接收/发送传真功能
//可以发送图片,文档到对方的传真机/可以接收保存对方传真机发送过来的图片
public const int DEVMODULE_FAX = 0x100;
//具有级性反转检测对方摘机的功能
//如果PSTN线路在当地电信部门同时开通该级性反转检测服务,就可以在外拨时精确检测到对方摘机/挂机
//如果没有该功能,只有拨打的号码具有标准回铃才才能检测到对方摘机,对手机彩铃,IP等不具有标准回铃线路的不能检测对方摘机/挂机
public const int DEVMODULE_POLARITY = 0x800;
//---------------------------------------------------------------- //打开设备类型
public const int ODT_LBRIDGE = 0x0;//玻瑞器
public const int ODT_SOUND = 0x1;//声卡
public const int ODT_CC = 0x2;//CC模块
public const int ODT_SOCKET_CLIENT = 0x4;//SOCKET终端模块
public const int ODT_SOCKET_SERVER = 0x8;//SOCKET服务器模块
public const int ODT_ALL = 0xFF;//全部
public const int ODT_CHANNEL = 0x100;//关闭指定通道
// //-----------------------------------------------------
//linein线路选择
public const int LINEIN_ID_1 = 0x0;//默认正常状态录音,采集来电号码等
public const int LINEIN_ID_2 = 0x1;//电话机断开后话柄录音
public const int LINEIN_ID_3 = 0x2;//hook line 软摘机后录音,录音数据可以提高对方的音量,降低本地音量
public const int LINEIN_ID_LOOP = 0x3;//内部环路测试,设备测试使用,建议用户不需要使用
//----------------------------------------------------- public const int ADCIN_ID_MIC = 0x0;//mic录音
public const int ADCIN_ID_LINE = 0x1;//电话线录音 //adc
public const int DOPLAY_CHANNEL1_ADC = 0x0;
public const int DOPLAY_CHANNEL0_ADC = 0x1;
public const int DOPLAY_CHANNEL0_DAC = 0x2;
public const int DOPLAY_CHANNEL1_DAC = 0x3; //------------
public const int SOFT_FLASH = 0x1;//使用软件调用拍插完成
public const int TEL_FLASH = 0x2;//使用话机拍插完成
//------------
//拒接时使用模式
public const int REFUSE_ASYN = 0x0;//异步模式,调用后函数立即返回,但并不表示拒接完成,拒接完成后将接收到一个拒接完成的事件
public const int REFUSE_SYN = 0x1;//同步模式,调用后该函数被堵塞,等待拒接完成返回,系统不再有拒接完成的事件 //拍插簧类型
public const int FT_NULL = 0x0;
public const int FT_TEL = 0x1;//话机拍插簧
public const int FT_PC = 0x2;//软拍插簧
public const int FT_ALL = 0x3;
//------------------------------- //拨号类型
public const int DTT_DIAL = 0x0;//拨号
public const int DTT_SEND = 0x1;//二次发码/震铃发送CALLID
//------------------------------- //来电号码模式
public const int CALLIDMODE_NULL = 0x0;//未知
public const int CALLIDMODE_FSK = 0x1;//FSK来电
public const int CALLIDMODE_DTMF = 0x2;//DTMF来电
// //号码类型
public const int CTT_NULL = 0x0;
public const int CTT_MOBILE = 0x1;//移动号码
public const int CTT_PSTN = 0x2;//普通固话号码
//------------------------------ public const int CALLT_NULL = 0x0;//
public const int CALLT_CALLIN = 0x1;//来电
public const int CALLT_CALLOUT = 0x2;//去电
//------------------- public const int CRESULT_NULL = 0x0;
public const int CRESULT_MISSED = 0x1;//呼入未接
public const int CRESULT_REFUSE = 0x2;//呼入拒接
public const int CRESULT_RINGBACK = 0x3;//呼叫后回铃了
public const int CRESULT_CONNECTED = 0x4;//接通
//-------------------------------------- public const int OPTYPE_NULL = 0x0;
public const int OPTYPE_REMOVE = 0x1;//上传成功后删除本地文件 //设备错误ID
public const int DERR_READERR = 0x0;//读取数据发送错误
public const int DERR_WRITEERR = 0x1;//写入数据错误
public const int DERR_FRAMELOST = 0x2;//丢数据包
public const int DERR_REMOVE = 0x3;//设备移除
public const int DERR_SERIAL = 0x4;//设备序列号冲突
//--------------------------------------- //语音识别时的性别类型
public const int SG_NULL = 0x0;
public const int SG_MALE = 0x1;//男性
public const int SG_FEMALE = 0x2;//女性
public const int SG_AUTO = 0x3;//自动
//-------------------------------- //设备共享模式
public const int SM_NOTSHARE = 0x0;
public const int SM_SENDVOICE = 0x1;//发送语音
public const int SM_RECVVOICE = 0x2;//接收语音
//---------------------------------- //----------------------------------------------
//传真接受/发送
public const int FAX_TYPE_NULL = 0x0;
public const int FAX_TYPE_SEND = 0x1;//发送传真
public const int FAX_TYPE_RECV = 0x2;//接收传真
//------------------------------------------------ //
public const int TTS_LIST_REINIT = 0x0;//重新初始化新的TTS列表
public const int TTS_LIST_APPEND = 0x1;//追加TTS列表文件
//------------------------------------------------ //--------------------------------------------------------
public const int DIALTYPE_DTMF = 0x0;//DTMF拨号
public const int DIALTYPE_FSK = 0x1;//FSK拨号
//-------------------------------------------------------- //--------------------------------------------------------
public const int PLAYFILE_MASK_REPEAT = 0x1;//循环播放
public const int PLAYFILE_MASK_PAUSE = 0x2;//默认暂停
//-------------------------------------------------------- //播放文件回调的状态
public const int PLAYFILE_PLAYING = 0x1;//正在播放
public const int PLAYFILE_REPEAT = 0x2;//准备重复播放
public const int PLAYFILE_END = 0x3;//播放结束 public const int CONFERENCE_MASK_DISABLEMIC = 0x100;//停止MIC,会议中其它成员不能听到该用户说话
public const int CONFERENCE_MASK_DISABLESPK = 0x200;//停止SPK,不能听到会议中其它成员说话 public const int RECORD_MASK_ECHO = 0x1;//回音抵消后的数据
public const int RECORD_MASK_AGC = 0x2;//自动增益后录音
public const int RECORD_MASK_PAUSE = 0x4;//暂停 public const int CHECKLINE_MASK_DIALOUT = 0x1;//线路是否有正常拨号音(有就可以正常软拨号)
public const int CHECKLINE_MASK_REV = 0x2;//线路LINE口/PHONE口接线是否正常,不正常就表示接反了 public const int OUTVALUE_MAX_SIZE = ;//location返回的最大长度 //----------------------------------------------- //cc 消息参数
//具体字体参数意义请查看windows相关文档
public const string MSG_KEY_CC = "cc:"; //消息来源CC号
public const string MSG_KEY_NAME = "name:";//消息来源名称,保留
public const string MSG_KEY_TIME = "time:";//消息来源时间
public const string MSG_KEY_FACE = "face:";//字体名称
public const string MSG_KEY_COLOR = "color:";//字体颜色
public const string MSG_KEY_SIZE = "size:";//字体尺寸
public const string MSG_KEY_CHARSET = "charset:";//字体特征
public const string MSG_KEY_EFFECTS = "effects:";//字体效果
public const string MSG_KEY_LENGTH = "length:";//消息正文长度
//CC文件参数
public const string MSG_KEY_FILENAME = "filename:";//文件名
public const string MSG_KEY_FILESIZE = "filesize:";//文件长度
public const string MSG_KEY_FILETYPE = "filetype:";//文件类型 //
public const string MSG_KEY_CALLPARAM = "callparam:";//CC呼叫时的参数 //
public const string MSG_KEY_SPLIT = "\r\n";//参数之间分隔符号
public const string MSG_TEXT_SPLIT = "\r\n\r\n";//消息参数和消息内容的分隔符号 //----------------------------------------------------------------------
//回调函数原型
//----------------------------------------------------------------------
//
//缓冲播放回调原型
//uChannelID:通道ID
//dwUserData:用户自定义的数据
//lHandle:播放时返回的句柄
//lDataSize:当前缓冲的语音数据
//lFreeSize:当前缓冲的空闲长度
//返回 CB_REMOVELIST(-1) 将被系统删除该回调资源,下次不再回调/返回其它值保留
//typedef Int32 (CALLBACK *PCallBack_PlayBuf)(Int16 uChannelID,UInt32 dwUserData,Int32 lHandle,Int32 lDataSize,Int32 lFreeSize);
//type PCallBack_PlayBuf = function(uChannelID:Int16;dwUserData:longint;lHandle:longint;lDataSize:longint;lFreeSize:longint):longint;stdcall;
/////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////
//设置文件播放回调原型
//uChannelID:通道ID
//nPlayState:文件播放的状态,PLAYING/REPLAY/END
//dwUserData:用户自定义的数据
//lHandle:播放时返回的句柄
//lElapses:总共播放的时间(单位秒)
//返回 CB_REMOVELIST(-1) 系统将自动停止播放该文件/返回其它值保留
//typedef Int32 (CALLBACK *PCallBack_PlayFile)(Int16 uChannelID,UInt32 nPlayState,UInt32 dwUserData,Int32 lHandle,Int32 lElapses);
//type PCallBack_PlayFile = function(uChannelID:Int16;nPlayState:longint;dwUserData:longint;lHandle:longint;lElapses:longint):longint;stdcall; //////////////////////////////////////////////////////////////////////////////////////////
//缓冲录音回调原型 默认格式为8K/16位/单声道/线性
//uChannelID:通道ID
//dwUserData:用户自定义数据
//pBufData:语音数据
//lBufSize:语音数据的内存字节长度
//返回 CB_REMOVELIST(-1) 将被系统删除该回调资源,下次不再回调/返回其它值保留
//typedef Int32 (CALLBACK *PCallBack_RecordBuf)(Int16 uChannelID,UInt32 dwUserData,BRIBYTE8 *pBufData,Int32 lBufSize);
//type PCallBack_RecordBuf = function(uChannelID:Int16;dwUserData:longint;pBufData:PChar;lBufSize:longint):longint;stdcall;
//////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
//事件发生回调原型
//uChannelID:通道ID
//dwUserData:用户自定义数据
//lType:事件类型ID 查看BRI_EVENT.lEventType Define
//lResult:事件相关数据
//lParam:保留数据,扩展使用
//szData:事件相关数据
//pDataEx:附加数据,扩展使用
/////////////////////////////////////////////////////////////////////////////////////////
//typedef Int32 (CALLBACK *PCallBack_Event)(Int16 uChannelID,UInt32 dwUserData,Int32 lType,Int32 lHandle,Int32 lResult,Int32 lParam,BRIPCHAR8 pData,BRIPCHAR8 pDataEx);
//type PCallBack_Event = function(uChannelID:Int16;dwUserData:longint;lType:longint;lHandle:longint;lResult:longint;lParam:longint;pData:PChar;pDataEx:PChar):longint;stdcall; //数据结构
public const int MAX_BRIEVENT_DATA = ;//事件产生后保存的数据最大长度
[StructLayout(LayoutKind.Sequential)]
public struct TBriEvent_Data
{
public Byte uVersion;
public Byte uReserv;
public Int16 uChannelID;//事件来自通道ID
public Int32 lEventType;//事件类型ID 查看BRI_EVENT.lEventType Define
public Int32 lEventHandle;//事件相关句柄
public Int32 lResult;//事件相关数值
public Int32 lParam;//保留,扩展使用
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAX_BRIEVENT_DATA)]//事件相关数据.如:来电时,保存了来电的号码
public Byte[] szData;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = )]//保留,扩展使用
public Byte[] szDataEx;
} //type PTBriEvent_Data = ^TBriEvent_Data; //////////////////////////////////////////////////////////////////////
// BRI_EVENT.lEventType Define
// 事件类型定义.同步与系统发出的窗口消息(请选择其中一种方式处理)
/////////////////////////////////////////////////////////////////////// // 本地电话机摘机事件
public const int BriEvent_PhoneHook = ;
// 本地电话机挂机事件
public const int BriEvent_PhoneHang = ; // 外线通道来电响铃事件
// BRI_EVENT.lResult 为响铃次数
// BRI_EVENT.szData[0]="0" 开始1秒响铃
// BRI_EVENT.szData[0]="1" 为1秒响铃完成,开始4秒静音
public const int BriEvent_CallIn = ; // 得到来电号码
// BRI_EVENT.lResult=0 呼入来电(正常呼入来电)
// BRI_EVENT.lResult=1 呼入中第二次来电
// BRI_EVENT.szData[0]="0" DTMF模式来电
// BRI_EVENT.szData[0]="1" FSK模式来电
// 该事件可能在响铃前,也可能在响铃后
public const int BriEvent_GetCallID = ; // 对方停止呼叫(产生一个未接电话)
public const int BriEvent_StopCallIn = ; // 调用开始拨号后,全部号码拨号结束
public const int BriEvent_DialEnd = ; // 播放文件结束事件
// BRI_EVENT.lResult 播放文件时返回的句柄ID
public const int BriEvent_PlayFileEnd = ; // 多文件连播结束事件
//
public const int BriEvent_PlayMultiFileEnd = ; //播放字符结束
public const int BriEvent_PlayStringEnd = ; // 播放文件结束准备重复播放
// BRI_EVENT.lResult 播放文件时返回的句柄ID
//
public const int BriEvent_RepeatPlayFile = ; // 给本地设备发送震铃信号时发送号码结束
public const int BriEvent_SendCallIDEnd = ; //给本地设备发送震铃信号时超时
//默认不会超时
public const int BriEvent_RingTimeOut = ; //正在内线震铃
//BRI_EVENT.lResult 已经响铃的次数
// BRI_EVENT.szData[0]="0" 开始一次响铃
// BRI_EVENT.szData[0]="1" 一次响铃完成,准备静音
public const int BriEvent_Ringing = ; // 通话时检测到一定时间的静音.默认为5秒
public const int BriEvent_Silence = ; // 线路接通时收到DTMF码事件
// 该事件不能区分通话中是本地话机按键还是对方话机按键触发
public const int BriEvent_GetDTMFChar = ; // 拨号后,被叫方摘机事件(该事件仅做参考,原因如下:)
// 原因:
// 该事件只适用于拨打是标准信号音的号码时,也就是拨号后带有标准回铃音的号码。
// 如:当拨打的对方号码是彩铃(彩铃手机号)或系统提示音(179xx)都不是标准回铃音时该事件无效。
//
public const int BriEvent_RemoteHook = ; // 挂机事件
// 如果线路检测到被叫方摘机后,被叫方挂机时会触发该事件,不然被叫方挂机后就触发BriEvent_Busy事件
// 该事件或者BriEvent_Busy的触发都表示PSTN线路已经被断开
public const int BriEvent_RemoteHang = ; // 检测到忙音事件,表示PSTN线路已经被断开
public const int BriEvent_Busy = ; // 本地摘机后检测到拨号音
public const int BriEvent_DialTone = ; // 只有在本地话机摘机,没有调用软摘机时,检测到DTMF拨号
public const int BriEvent_PhoneDial = ; // 电话机拨号结束呼出事件。
// 也就时电话机拨号后接收到标准回铃音或者15秒超时
// BRI_EVENT.lResult=0 检测到回铃音// 注意:如果线路是彩铃是不会触发该类型
// BRI_EVENT.lResult=1 拨号超时
// BRI_EVENT.lResult=2 动态检测拨号码结束(根据*的号码规则进行智能分析,仅做参考)
// BRI_EVENT.szData[0]="1" 软摘机拨号结束后回铃了
// BRI_EVENT.szData[0]="0" 电话机拨号中回铃了
public const int BriEvent_RingBack = ; // MIC插入状态
// 只适用具有该功能的设备
public const int BriEvent_MicIn = ;
// MIC拔出状态
// 只适用具有该功能的设备
public const int BriEvent_MicOut = ; // 拍插簧(Flash)完成事件,拍插簧完成后可以检测拨号音后进行二次拨号
// BRI_EVENT.lResult=TEL_FLASH 用户使用电话机进行拍叉簧完成
// BRI_EVENT.lResult=SOFT_FLASH 调用StartFlash函数进行拍叉簧完成
public const int BriEvent_FlashEnd = ; // 拒接完成
public const int BriEvent_RefuseEnd = ; // 语音识别完成
public const int BriEvent_SpeechResult = ; //PSTN线路断开,线路进入空闲状态
//当前没有软摘机而且话机也没摘机
public const int BriEvent_PSTNFree = ; // 接收到对方准备发送传真的信号
public const int BriEvent_RemoteSendFax = ; // 接收传真完成
public const int BriEvent_FaxRecvFinished = ;
// 接收传真失败
public const int BriEvent_FaxRecvFailed = ; // 发送传真完成
public const int BriEvent_FaxSendFinished = ;
// 发送传真失败
public const int BriEvent_FaxSendFailed = ; // 启动声卡失败
public const int BriEvent_OpenSoundFailed = ; // 产生一个PSTN呼入/呼出日志
public const int BriEvent_CallLog = ; //检测到连续的静音
//使用QNV_GENERAL_CHECKSILENCE启动后检测到设定的静音长度
public const int BriEvent_RecvSilence = ; //检测到连续的声音
//使用QNV_GENERAL_CHECKVOICE启动后检测到设定的声音长度
public const int BriEvent_RecvVoice = ; //远程上传事件
public const int BriEvent_UploadSuccess = ;
public const int BriEvent_UploadFailed = ;
// 远程连接已被断开
public const int BriEvent_RemoteDisconnect = ; //HTTP远程下载文件完成
//BRI_EVENT.lResult 启动下载时返回的本次操作的句柄
public const int BriEvent_DownloadSuccess = ;
public const int BriEvent_DownloadFailed = ; //线路检测结果
//BRI_EVENT.lResult 为检测结果信息
public const int BriEvent_CheckLine = ; // 应用层调用软摘机/软挂机成功事件
// BRI_EVENT.lResult=0 软摘机
// BRI_EVENT.lResult=1 软挂机
public const int BriEvent_EnableHook = ;
// 喇叭被打开或者/关闭
// BRI_EVENT.lResult=0 关闭
// BRI_EVENT.lResult=1 打开
public const int BriEvent_EnablePlay = ;
// MIC被打开或者关闭
// BRI_EVENT.lResult=0 关闭
// BRI_EVENT.lResult=1 打开
public const int BriEvent_EnableMic = ;
// 耳机被打开或者关闭
// BRI_EVENT.lResult=0 关闭
// BRI_EVENT.lResult=1 打开
public const int BriEvent_EnableSpk = ;
// 电话机跟电话线(PSTN)断开/接通(DoPhone)
// BRI_EVENT.lResult=0 断开
// BRI_EVENT.lResult=1 接通
public const int BriEvent_EnableRing = ;
// 修改录音源 (无用/保留)
// BRI_EVENT.lResult 录音源数值
public const int BriEvent_DoRecSource = ;
// 开始软件拨号
// BRI_EVENT.szData 准备拨的号码
public const int BriEvent_DoStartDial = ; public const int BriEvent_EnablePlayMux = ; // 接收到FSK信号,包括通话中FSK/来电号码的FSK
public const int BriEvent_RecvedFSK = ;
//设备错误
public const int BriEvent_DevErr = ; //CCCtrl Event
//CC控制相关事件
public const int BriEvent_CC_ConnectFailed = ;//连接失败
public const int BriEvent_CC_LoginFailed = ;//登陆失败
public const int BriEvent_CC_LoginSuccess = ;//登陆成功
public const int BriEvent_CC_SystemTimeErr = ;//系统时间错误
public const int BriEvent_CC_CallIn = ;//有CC呼入请求
public const int BriEvent_CC_CallOutFailed = ;//呼叫失败
public const int BriEvent_CC_CallOutSuccess = ;//呼叫成功,正在呼叫
public const int BriEvent_CC_Connecting = ;//呼叫正在连接
public const int BriEvent_CC_Connected = ;//呼叫连通
public const int BriEvent_CC_CallFinished = ;//呼叫结束
public const int BriEvent_CC_ReplyBusy = ;//呼叫结束 public const int BriEvent_CC_RecvedMsg = ;//接收到用户即时消息
public const int BriEvent_CC_RecvedCmd = ;//接收到用户自定义命令 public const int BriEvent_CC_RegSuccess = ;//注册CC成功
public const int BriEvent_CC_RegFailed = ;//注册CC失败 public const int BriEvent_CC_RecvFileRequest = ;//接收到用户发送的文件请求
public const int BriEvent_CC_TransFileFinished = ;//传输文件结束 public const int BriEvent_CC_AddContactSuccess = ;//增加好友成功
public const int BriEvent_CC_AddContactFailed = ;//增加好友失败
public const int BriEvent_CC_InviteContact = ;//接收到增加好好友邀请
public const int BriEvent_CC_ReplyAcceptContact = ;//对方回复同意为好友
public const int BriEvent_CC_ReplyRefuseContact = ;//对方回复拒绝为好友
public const int BriEvent_CC_AcceptContactSuccess = ;//接受好友成功
public const int BriEvent_CC_AcceptContactFailed = ;//接受好友失败
public const int BriEvent_CC_RefuseContactSuccess = ;//拒绝好友成功
public const int BriEvent_CC_RefuseContactFailed = ;//拒绝好友失败
public const int BriEvent_CC_DeleteContactSuccess = ;//删除好友成功
public const int BriEvent_CC_DeleteContactFailed = ;//删除好友失败
public const int BriEvent_CC_ContactUpdateStatus = ;//好友登陆状态改变
public const int BriEvent_CC_ContactDownendStatus = ;//获取到所有好友改变完成 //终端接收到的事件
public const int BriEvent_Socket_C_ConnectSuccess = ;//连接成功
public const int BriEvent_Socket_C_ConnectFailed = ;//连接失败
public const int BriEvent_Socket_C_ReConnect = ;//开始重新连接
public const int BriEvent_Socket_C_ReConnectFailed = ;//重新连接失败
public const int BriEvent_Socket_C_ServerClose = ;//服务器断开连接
public const int BriEvent_Socket_C_DisConnect = ;//连接激活超时
public const int BriEvent_Socket_C_RecvedData = ;//接收到服务端发送过来的数据
//服务器端接收到的事件
public const int BriEvent_Socket_S_NewLink = ;//有新连接进入
public const int BriEvent_Socket_S_DisConnect = ;//终端连接激活超时
public const int BriEvent_Socket_S_ClientClose = ;//终端断开连接了
public const int BriEvent_Socket_S_RecvedData = ;//接收到终端发送过来的数据 public const int BriEvent_EndID = ;//空ID ///////////////////////////////////////////////////////////////
//消息定义说明
//////////////////////////////////////////////////////////////
public const int WM_USER = ;
public const int BRI_EVENT_MESSAGE = WM_USER + ;//事件消息
public const int BRI_RECBUF_MESSAGE = WM_USER + ;//缓冲录音数据消息 //文件录音格式
public const int BRI_WAV_FORMAT_DEFAULT = ; // BRI_AUDIO_FORMAT_PCM8K16B
public const int BRI_WAV_FORMAT_ALAW8K = ; // 8k/s
public const int BRI_WAV_FORMAT_ULAW8K = ; // 8k/s
public const int BRI_WAV_FORMAT_IMAADPCM8K4B = ; // 4k/s
public const int BRI_WAV_FORMAT_PCM8K8B = ; // 8k/s
public const int BRI_WAV_FORMAT_PCM8K16B = ; //16k/s
public const int BRI_WAV_FORMAT_MP38K8B = ; //~1.2k/s
public const int BRI_WAV_FORMAT_MP38K16B = ; //~2.4k/s
public const int BRI_WAV_FORMAT_TM8K1B = ; //~1.5k/s
public const int BRI_WAV_FORMAT_GSM6108K = ; //~2.2k/s
public const int BRI_WAV_FORMAT_END = ; //无效ID
//保留最多256个
//////////////////////////////////////////////////////////// //-------------------------------------------------------------------------------------
//
//
//----------------------------------------------------------------------------------
//设备信息
public const int QNV_DEVINFO_GETCHIPTYPE = ;//获取USB模块类型
public const int QNV_DEVINFO_GETCHIPS = ;//获取USB模块数量,该值等于最后一个通道的DEVID
public const int QNV_DEVINFO_GETTYPE = ;//获取通道类型
public const int QNV_DEVINFO_GETMODULE = ;//获取通道功能模块
public const int QNV_DEVINFO_GETCHIPCHID = ;//获取通道所在USB芯片的中的传输ID(0或者1)
public const int QNV_DEVINFO_GETSERIAL = ;//获取通道序列号(0-n)
public const int QNV_DEVINFO_GETCHANNELS = ;//获取通道数量
public const int QNV_DEVINFO_GETDEVID = ;//获取通道所在的USB模块ID(0-n)
public const int QNV_DEVINFO_GETDLLVER = ;//获取DLL版本号
public const int QNV_DEVINFO_GETCHIPCHANNEL = ;//获取该USB模块第一个传输ID所在的通道号
//----------------------------------------------------------------- //参数类型列表
//uParamType (可以使用API自动保存/读取)
public const int QNV_PARAM_BUSY = ;//检测到几个忙音回调
public const int QNV_PARAM_DTMFLEVEL = ;//dtmf检测时允许的性噪声比(0-5)
public const int QNV_PARAM_DTMFVOL = ;//dtmf检测时允许的能量(1-100)
public const int QNV_PARAM_DTMFNUM = ;//dtmf检测时允许的持续时间(2-10)
public const int QNV_PARAM_DTMFLOWINHIGH = ;//dtmf低频不能超过高频值(默认为6)
public const int QNV_PARAM_DTMFHIGHINLOW = ;//dtmf高频不能超过低频值(默认为4)
public const int QNV_PARAM_DIALSPEED = ;//拨号的DTMF长度(1ms-60000ms)
public const int QNV_PARAM_DIALSILENCE = ;//拨号时的间隔静音长度(1ms-60000ms)
public const int QNV_PARAM_DIALVOL = ;//拨号音量大小
public const int QNV_PARAM_RINGSILENCE = ;//来电不响铃多少时间超时算未接电话
public const int QNV_PARAM_CONNECTSILENCE = ;//通话时连续多少时间静音后回调
public const int QNV_PARAM_RINGBACKNUM = ;//拨几个数字以上后检测回铃开始有效//默认为2个,可起到忽略出局号码后检测的回铃音
public const int QNV_PARAM_SWITCHLINEIN = ;//自动切换LINEIN选择
public const int QNV_PARAM_FLASHELAPSE = ;//拍插簧间隔
public const int QNV_PARAM_FLASHENDELAPSE = ;//拍插簧后延迟一定时间再回调事件
public const int QNV_PARAM_RINGELAPSE = ;//内线震铃时时间长度
public const int QNV_PARAM_RINGSILENCEELAPSE = ;//内线震铃时静音长度
public const int QNV_PARAM_RINGTIMEOUT = ;//内线震铃时超时次数
public const int QNV_PARAM_RINGCALLIDTYPE = ;//内线震铃时发送号码的方式dtmf/fsk
public const int QNV_PARAM_REFUSEELAPSE = ;//拒接时间隔时间长度
public const int QNV_PARAM_DIALTONETIMEOUT = ;//检测拨号音超时
public const int QNV_PARAM_MINCHKFLASHELAPSE = ;//拍插簧检测时挂机至少的时间ms,挂机时间小于该值就不算拍插簧
public const int QNV_PARAM_MAXCHKFLASHELAPSE = ;//拍插簧检测时挂机最长的时间ms,挂机时间大于该值就不算拍插簧
public const int QNV_PARAM_HANGUPELAPSE = ;//检测电话机挂机时的至少时间长度ms,//建议挂机检测次数在拍插簧以上,避免发生挂机后又检测到拍插
public const int QNV_PARAM_OFFHOOKELAPSE = ;//检测电话机摘机时的至少时间长度ms
public const int QNV_PARAM_RINGHIGHELAPSE = ;//检测来电震铃时响铃的至少时间长度ms
public const int QNV_PARAM_RINGLOWELAPSE = ;//检测来电震铃时不响铃的至少时间长度ms public const int QNV_PARAM_SPEECHGENDER = ;//语音设置性别
public const int QNV_PARAM_SPEECHTHRESHOLD = ;//语音识别门限
public const int QNV_PARAM_SPEECHSILENCEAM = ;//语音识别静音门限
public const int QNV_PARAM_ECHOTHRESHOLD = ;//回音抵消处理抵消门限参数
public const int QNV_PARAM_ECHODECVALUE = ;//回音抵消处理减少增益参数 public const int QNV_PARAM_LINEINFREQ1TH = ;//第一组线路双频模式信号音频率
public const int QNV_PARAM_LINEINFREQ2TH = ;//第二组线路双频模式信号音频率
public const int QNV_PARAM_LINEINFREQ3TH = ;//第三组线路双频模式信号音频率 public const int QNV_PARAM_ADBUSY = ;//是否打开检测忙音叠加时环境(只有在使用两路外线网关时由于同时挂机才会触发忙音被叠加的环境,普通用户不需要使用)
public const int QNV_PARAM_ADBUSYMINFREQ = ;//检测忙音叠加时最小频率
public const int QNV_PARAM_ADBUSYMAXFREQ = ;//检测忙音叠加时最大频率 //增益控制
public const int QNV_PARAM_AM_MIC = ;//MIC增益
public const int QNV_PARAM_AM_SPKOUT = ;//耳机spk增益
public const int QNV_PARAM_AM_LINEIN = ;//线路输入能量
public const int QNV_PARAM_AM_LINEOUT = ;//mic到线路能量+播放语音到到线路能量
public const int QNV_PARAM_AM_DOPLAY = ;//喇叭输出增益
// //设备控制/状态
//uCtrlType
public const int QNV_CTRL_DOSHARE = ;//设备共享
public const int QNV_CTRL_DOHOOK = ;//软件摘挂机控制
public const int QNV_CTRL_DOPHONE = ;//控制电话机是否可用,可控制话机震铃,实现硬拍插簧等
public const int QNV_CTRL_DOPLAY = ;//喇叭控制开关
public const int QNV_CTRL_DOLINETOSPK = ;//线路声音到耳机,用耳机通话时打开
public const int QNV_CTRL_DOPLAYTOSPK = ;//播放的语音到耳机
public const int QNV_CTRL_DOMICTOLINE = ;//MIC说话声到电话线
public const int QNV_CTRL_ECHO = ;//打开/关闭回音抵消
public const int QNV_CTRL_RECVFSK = ;//打开/关闭接收FSK来电号码
public const int QNV_CTRL_RECVDTMF = ;//打开/关闭接收DTMF
public const int QNV_CTRL_RECVSIGN = ;//打开/关闭信号音检测
public const int QNV_CTRL_WATCHDOG = ;//打开关闭看门狗
public const int QNV_CTRL_PLAYMUX = ;//选择到喇叭的语音通道 line1x/pcplay ch0/line2x/pcplay ch1
public const int QNV_CTRL_PLAYTOLINE = ;//播放的语音到line
public const int QNV_CTRL_SELECTLINEIN = ;//选择输入的线路line通道
public const int QNV_CTRL_SELECTADCIN = ;//选择输入的为线路还是MIC语音
public const int QNV_CTRL_PHONEPOWER = ;//打开/关闭给话机供电使能,如果不给话机供电,dophone切换后,话机将不可用,所有对话机的操作都无效
public const int QNV_CTRL_RINGPOWER = ;//内线震铃使能
public const int QNV_CTRL_LEDPOWER = ;//LED指示灯
public const int QNV_CTRL_LINEOUT = ;//线路输出使能
public const int QNV_CTRL_SWITCHOUT = ;//硬件回音抵消
public const int QNV_CTRL_UPLOAD = ;//打开/关闭设备USB数据上传功能,关闭后将接收不到设备语音数据
public const int QNV_CTRL_DOWNLOAD = ;//打开/关闭设备USB数据下载功能,关闭后将不能发送语音/拨号到设备
//以下状态不能设置(set),只能获取(get)
public const int QNV_CTRL_PHONE = ;//电话机摘挂机状态
public const int QNV_CTRL_MICIN = ;//mic插入状态
public const int QNV_CTRL_RINGTIMES = ;//来电响铃的次数
public const int QNV_CTRL_RINGSTATE = ;//来电响铃状态,正在响还是不响
// //放音控制
//uPlayType
public const int QNV_PLAY_FILE_START = ;//开始播放文件
public const int QNV_PLAY_FILE_SETCALLBACK = ;//设置播放文件回调函数
public const int QNV_PLAY_FILE_SETVOLUME = ;//设置播放文件音量
public const int QNV_PLAY_FILE_GETVOLUME = ;//获取播放文件音量
public const int QNV_PLAY_FILE_PAUSE = ;//暂停播放文件
public const int QNV_PLAY_FILE_RESUME = ;//恢复播放文件
public const int QNV_PLAY_FILE_ISPAUSE = ;//检测是否已暂停播放
public const int QNV_PLAY_FILE_SETREPEAT = ;//设置是否循环播放
public const int QNV_PLAY_FILE_ISREPEAT = ;//检测是否在循环播放
public const int QNV_PLAY_FILE_SEEKTO = ;//跳转到某个时间(s)
public const int QNV_PLAY_FILE_SETREPEATTIMEOUT = ;//设置循环播放超时次数
public const int QNV_PLAY_FILE_GETREPEATTIMEOUT = ;//获取循环播放超时次数
public const int QNV_PLAY_FILE_SETPLAYTIMEOUT = ;//设置播放总共超时时长(s)
public const int QNV_PLAY_FILE_GETPLAYTIMEOUT = ;//获取播放总共超时时长
public const int QNV_PLAY_FILE_TOTALLEN = ;//总共时间(s)
public const int QNV_PLAY_FILE_CURSEEK = ;//当前播放的文件时间位置(s)
public const int QNV_PLAY_FILE_ELAPSE = ;//总共播放的时间(s),包括重复的,后退的,不包括暂停的时间
public const int QNV_PLAY_FILE_ISPLAY = ;//该句柄是否在播放
public const int QNV_PLAY_FILE_ENABLEAGC = ;//打开关闭自动增益
public const int QNV_PLAY_FILE_ISENABLEAGC = ;//检测是否打开自动增益
public const int QNV_PLAY_FILE_STOP = ;//停止播放指定文件
public const int QNV_PLAY_FILE_GETCOUNT = ;//获取正在文件播放的数量,可以用来检测如果没有了就可以关闭喇叭
public const int QNV_PLAY_FILE_STOPALL = ;//停止播放所有文件
//-------------------------------------------------------- public const int QNV_PLAY_BUF_START = ;//开始缓冲播放
public const int QNV_PLAY_BUF_SETCALLBACK = ;//设置缓冲播放回调函数
public const int QNV_PLAY_BUF_SETWAVEFORMAT = ;//设置缓冲播放语音的格式
public const int QNV_PLAY_BUF_WRITEDATA = ;//写缓冲数据
public const int QNV_PLAY_BUF_SETVOLUME = ;//设置音量
public const int QNV_PLAY_BUF_GETVOLUME = ;//获取音量
public const int QNV_PLAY_BUF_SETUSERVALUE = ;//设置用户自定义数据
public const int QNV_PLAY_BUF_GETUSERVALUE = ;//获取用户自定义数据
public const int QNV_PLAY_BUF_ENABLEAGC = ;//打开关闭自动增益
public const int QNV_PLAY_BUF_ISENABLEAGC = ;//检测是否打开了自动增益
public const int QNV_PLAY_BUF_PAUSE = ;//暂停播放文件
public const int QNV_PLAY_BUF_RESUME = ;//恢复播放文件
public const int QNV_PLAY_BUF_ISPAUSE = ;//检测是否已暂停播放
public const int QNV_PLAY_BUF_STOP = ;//停止缓冲播放
public const int QNV_PLAY_BUF_FREESIZE = ;//空闲字节
public const int QNV_PLAY_BUF_DATASIZE = ;//数据字节
public const int QNV_PLAY_BUF_TOTALSAMPLES = ;//总共播放的采样数
public const int QNV_PLAY_BUF_SETJITTERBUFSIZE = ;//设置动态缓冲长度,当缓冲数据播放为空后下次播放前缓冲内必须大于该长度的语音,可用在播放网络数据包,避免网络抖动
public const int QNV_PLAY_BUF_GETJITTERBUFSIZE = ;//获取动态缓冲长度
public const int QNV_PLAY_BUF_GETCOUNT = ;//获取正在缓冲播放的数量,可以用来检测如果没有了就可以关闭喇叭
public const int QNV_PLAY_BUF_STOPALL = ;//停止所有播放
//------------------------------------------------------- public const int QNV_PLAY_MULTIFILE_START = ;//开始多文件连续播放
public const int QNV_PLAY_MULTIFILE_PAUSE = ;//暂停多文件连续播放
public const int QNV_PLAY_MULTIFILE_RESUME = ;//恢复多文件连续播放
public const int QNV_PLAY_MULTIFILE_ISPAUSE = ;//检测是否暂停了多文件连续播放
public const int QNV_PLAY_MULTIFILE_SETVOLUME = ;//设置多文件播放音量
public const int QNV_PLAY_MULTIFILE_GETVOLUME = ;//获取多文件播放音量
public const int QNV_PLAY_MULTIFILE_ISSTART = ;//是否启动了多文件连续播放
public const int QNV_PLAY_MULTIFILE_STOP = ;//停止多文件连续播放
public const int QNV_PLAY_MULTIFILE_STOPALL = ;//停止全部多文件连续播放
//-------------------------------------------------------- public const int QNV_PLAY_STRING_INITLIST = ;//初始化字符播放列表
public const int QNV_PLAY_STRING_START = ;//开始字符播放
public const int QNV_PLAY_STRING_PAUSE = ;//暂停字符播放
public const int QNV_PLAY_STRING_RESUME = ;//恢复字符播放
public const int QNV_PLAY_STRING_ISPAUSE = ;//检测是否暂停了字符播放
public const int QNV_PLAY_STRING_SETVOLUME = ;//设置字符播放音量
public const int QNV_PLAY_STRING_GETVOLUME = ;//获取字符播放音量
public const int QNV_PLAY_STRING_ISSTART = ;//是否启动了字符播放
public const int QNV_PLAY_STRING_STOP = ;//停止字符播放
public const int QNV_PLAY_STRING_STOPALL = ;//停止全部字符播放
//-------------------------------------------------------- //录音控制
//uRecordType
public const int QNV_RECORD_FILE_START = ;//开始文件录音
public const int QNV_RECORD_FILE_PAUSE = ;//暂停文件录音
public const int QNV_RECORD_FILE_RESUME = ;//恢复文件录音
public const int QNV_RECORD_FILE_ISPAUSE = ;//检测是否暂停文件录音
public const int QNV_RECORD_FILE_ELAPSE = ;//获取已经录音的时间长度,单位(s)
public const int QNV_RECORD_FILE_SETVOLUME = ;//设置文件录音音量
public const int QNV_RECORD_FILE_GETVOLUME = ;//获取文件录音音量
public const int QNV_RECORD_FILE_PATH = ;//获取文件录音的路径
public const int QNV_RECORD_FILE_STOP = ;//停止某个文件录音
public const int QNV_RECORD_FILE_STOPALL = ;//停止全部文件录音
public const int QNV_RECORD_FILE_COUNT = ;//获取正在录音的数量
public const int QNV_RECORD_FILE_SETROOT = ;//设置默认录音目录
public const int QNV_RECORD_FILE_GETROOT = ;//获取默认录音目录
//---------------------------------------------------------- public const int QNV_RECORD_BUF_HWND_START = ;//开始缓冲录音窗口回调
public const int QNV_RECORD_BUF_HWND_STOP = ;//停止某个缓冲录音窗口回调
public const int QNV_RECORD_BUF_HWND_STOPALL = ;//停止全部缓冲录音窗口回调
public const int QNV_RECORD_BUF_CALLBACK_START = ;//开始缓冲录音回调
public const int QNV_RECORD_BUF_CALLBACK_STOP = ;//停止某个缓冲录音回调
public const int QNV_RECORD_BUF_CALLBACK_STOPALL = ;//停止全部缓冲录音回调
public const int QNV_RECORD_BUF_SETCBSAMPLES = ;//设置回调采样数,每秒8K,如果需要20ms回调一次就设置为20*8=160,/默认为20ms回调一次
public const int QNV_RECORD_BUF_GETCBSAMPLES = ;//获取设置的回调采样数
public const int QNV_RECORD_BUF_ENABLEECHO = ;//打开关闭自动增益
public const int QNV_RECORD_BUF_ISENABLEECHO = ;//检测自动增益是否打开
public const int QNV_RECORD_BUF_PAUSE = ;//暂停缓冲录音
public const int QNV_RECORD_BUF_ISPAUSE = ;//检测是否暂停缓冲录音
public const int QNV_RECORD_BUF_RESUME = ;//恢复缓冲录音
public const int QNV_RECORD_BUF_SETVOLUME = ;//设置缓冲录音音量
public const int QNV_RECORD_BUF_GETVOLUME = ;//获取缓冲录音音量
public const int QNV_RECORD_BUF_SETWAVEFORMAT = ;//设置录音回调的语音编码格式,默认为8K,16位,wav线性
public const int QNV_RECORD_BUF_GETWAVEFORMAT = ;//获取录音回调的语音编码格式
public const int QNV_RECORD_BUF_GETCBMSGID = ;//查询缓冲录音的窗口回调的消息ID,默认为BRI_RECBUF_MESSAGE
public const int QNV_RECORD_BUF_SETCBMSGID = ;//设置缓冲录音的窗口回调的消息ID,默认为BRI_RECBUF_MESSAGE //-------------------------------------------------------- //会议控制
//uConferenceType
public const int QNV_CONFERENCE_CREATE = ;//创建会议
public const int QNV_CONFERENCE_ADDTOCONF = ;//增加通道到某个会议
public const int QNV_CONFERENCE_GETCONFID = ;//获取某个通道的会议ID
public const int QNV_CONFERENCE_SETSPKVOLUME = ;//设置会议中某个通道放音音量
public const int QNV_CONFERENCE_GETSPKVOLUME = ;//获取会议中某个通道放音音量
public const int QNV_CONFERENCE_SETMICVOLUME = ;//设置会议中某个通道录音音量
public const int QNV_CONFERENCE_GETMICVOLUME = ;//获取会议中某个通道录音音量
public const int QNV_CONFERENCE_PAUSE = ;//暂停某个会议
public const int QNV_CONFERENCE_RESUME = ;//恢复某个会议
public const int QNV_CONFERENCE_ISPAUSE = ;//检测是否暂停了某个会议
public const int QNV_CONFERENCE_ENABLESPK = ;//打开关闭会议者听功能
public const int QNV_CONFERENCE_ISENABLESPK = ;//检测会议者听功能是否打开
public const int QNV_CONFERENCE_ENABLEMIC = ;//打开关闭会议者说功能
public const int QNV_CONFERENCE_ISENABLEMIC = ;//检测会议者说功能是否打开
public const int QNV_CONFERENCE_ENABLEAGC = ;//打开关闭自动增益
public const int QNV_CONFERENCE_ISENABLEAGC = ;//检测是否打开了自动增益
public const int QNV_CONFERENCE_DELETECHANNEL = ;//把通道从会议中删除
public const int QNV_CONFERENCE_DELETECONF = ;//删除一个会议
public const int QNV_CONFERENCE_DELETEALLCONF = ;//删除全部会议
public const int QNV_CONFERENCE_GETCONFCOUNT = ;//获取会议数量 public const int QNV_CONFERENCE_RECORD_START = ;//开始录音
public const int QNV_CONFERENCE_RECORD_PAUSE = ;//暂停录音
public const int QNV_CONFERENCE_RECORD_RESUME = ;//恢复录音
public const int QNV_CONFERENCE_RECORD_ISPAUSE = ;//检测是否暂停录音
public const int QNV_CONFERENCE_RECORD_FILEPATH = ;//获取录音文件路径
public const int QNV_CONFERENCE_RECORD_ISSTART = ;//检测会议是否已经启动了录音
public const int QNV_CONFERENCE_RECORD_STOP = ;//停止指定会议录音
public const int QNV_CONFERENCE_RECORD_STOPALL = ;//停止全部会议录音
//-------------------------------------------------------- //speech语音识别
public const int QNV_SPEECH_CONTENTLIST = ;//设置识别汉字内容列表
public const int QNV_SPEECH_STARTSPEECH = ;//开始识别
public const int QNV_SPEECH_ISSPEECH = ;//检测是否正在识别
public const int QNV_SPEECH_STOPSPEECH = ;//停止识别
public const int QNV_SPEECH_GETRESULT = ;//获取识别后的结果
//------------------------------------------------------------ //传真模块接口
public const int QNV_FAX_LOAD = ;//加载启动传真模块
public const int QNV_FAX_UNLOAD = ;//卸载传真模块
public const int QNV_FAX_STARTSEND = ;//开始发送传真
public const int QNV_FAX_STOPSEND = ;//停止发送传真
public const int QNV_FAX_STARTRECV = ;//开始接收传真
public const int QNV_FAX_STOPRECV = ;//停止接收传真
public const int QNV_FAX_STOP = ;//停止全部
public const int QNV_FAX_PAUSE = ;//暂停
public const int QNV_FAX_RESUME = ;//恢复
public const int QNV_FAX_ISPAUSE = ;//是否暂停
public const int QNV_FAX_TYPE = ;//传真状态是接受或者发送
public const int QNV_FAX_TRANSMITSIZE = ;//已经发送的图象数据大小
public const int QNV_FAX_IMAGESIZE = ;//总共需要发送图象数据大小
//---------------------------------------------------------- //函数event
//ueventType
public const int QNV_EVENT_POP = ;//获取后自动删除当前事件,pValue->PBRI_EVENT
public const int QNV_EVENT_POPEX = ;//获取后自动删除当前事件,pValue->字符分隔格式:chid,type,handle,result,data
public const int QNV_EVENT_TYPE = ;//获取事件类型,获取后不会自动删除,获取成功后使用 QNV_GENERAL_EVENT_REMOVE删除该事件
public const int QNV_EVENT_HANDLE = ;//获取事件句柄值
public const int QNV_EVENT_RESULT = ;//获取事件数值
public const int QNV_EVENT_PARAM = ;//获取事件保留参数
public const int QNV_EVENT_DATA = ;//获取事件数据
public const int QNV_EVENT_DATAEX = ;//获取事件附加数据
public const int QNV_EVENT_REMOVE = ;//删除最老的事件
public const int QNV_EVENT_REMOVEALL = ;//删除所有事件
public const int QNV_EVENT_REGWND = ;//注册接收消息的窗口句柄
public const int QNV_EVENT_UNREGWND = ;//删除接收消息的窗口句柄
public const int QNV_EVENT_REGCBFUNC = ;//注册事件回调函数
public const int QNV_EVENT_REGCBFUNCEX = ;//注册事件回调函数
public const int QNV_EVENT_UNREGCBFUNC = ;//删除事件回调函数
//----------------------------------------------------------- //函数general
//uGeneralType
public const int QNV_GENERAL_STARTDIAL = ;//开始拨号
public const int QNV_GENERAL_SENDNUMBER = ;//二次拨号
public const int QNV_GENERAL_REDIAL = ;//重拨最后一次呼叫的号码,程序退出后该号码被释放
public const int QNV_GENERAL_STOPDIAL = ;//停止拨号
public const int QNV_GENERAL_ISDIALING = ;//是否在拨号 public const int QNV_GENERAL_STARTRING = ;//phone口震铃
public const int QNV_GENERAL_STOPRING = ;//phone口震铃停止
public const int QNV_GENERAL_ISRINGING = ;//phone口是否在震铃 public const int QNV_GENERAL_STARTFLASH = ;//拍插簧
public const int QNV_GENERAL_STOPFLASH = ;//拍插簧停止
public const int QNV_GENERAL_ISFLASHING = ;//是否正在拍插簧 public const int QNV_GENERAL_STARTREFUSE = ;//拒接当前呼入
public const int QNV_GENERAL_STOPREFUSE = ;//终止拒接操作
public const int QNV_GENERAL_ISREFUSEING = ;//是否正在拒接当前呼入 public const int QNV_GENERAL_GETCALLIDTYPE = ;//获取本次呼入的来电号码类型
public const int QNV_GENERAL_GETCALLID = ;//获取本次呼入的来电号码
public const int QNV_GENERAL_GETTELDIALCODE = ;//获取本次电话机拨出的号码类型,return buf
public const int QNV_GENERAL_GETTELDIALCODEEX = ;//获取本次电话机拨出的号码类型,outbuf
public const int QNV_GENERAL_RESETTELDIALBUF = ;//清空电话拨的号码缓冲
public const int QNV_GENERAL_GETTELDIALLEN = ;//电话机已拨的号码长度 public const int QNV_GENERAL_STARTSHARE = ;//启动设备共享服务
public const int QNV_GENERAL_STOPSHARE = ;//停止设备共享服务
public const int QNV_GENERAL_ISSHARE = ;//是否启用设备共享服务模块 public const int QNV_GENERAL_ENABLECALLIN = ;//禁止/启用外线呼入
public const int QNV_GENERAL_ISENABLECALLIN = ;//外线是否允许呼入 public const int QNV_GENERAL_RESETRINGBACK = ;//复位检测到的回铃,重新启动检测
public const int QNV_GENERAL_CHECKCHANNELID = ;//检测通道ID是否合法
public const int QNV_GENERAL_CHECKDIALTONE = ;//检测拨号音
public const int QNV_GENERAL_CHECKSILENCE = ;//检测线路静音
public const int QNV_GENERAL_CHECKVOICE = ;//检测线路声音
public const int QNV_GENERAL_CHECKLINESTATE = ;//检测线路状态(是否可正常拨号/是否接反) public const int QNV_GENERAL_SETUSERVALUE = ;//用户自定义通道数据,系统退出后自动释放
public const int QNV_GENERAL_SETUSERSTRING = ;//用户自定义通道字符,系统退出后自动释放
public const int QNV_GENERAL_GETUSERVALUE = ;//获取用户自定义通道数据
public const int QNV_GENERAL_GETUSERSTRING = ;//获取用户自定义通道字符 //初始化通道INI文件参数
public const int QNV_GENERAL_READPARAM = ;//读取ini文件进行全部参数初始化
public const int QNV_GENERAL_WRITEPARAM = ;//把参数写入到ini文件
// //call log
public const int QNV_CALLLOG_BEGINTIME = ;//获取呼叫开始时间
public const int QNV_CALLLOG_RINGBACKTIME = ;//获取回铃时间
public const int QNV_CALLLOG_CONNECTEDTIME = ;//获取接通时间
public const int QNV_CALLLOG_ENDTIME = ;//获取结束时间
public const int QNV_CALLLOG_CALLTYPE = ;//获取呼叫类型/呼入/呼出
public const int QNV_CALLLOG_CALLRESULT = ;//获取呼叫结果
public const int QNV_CALLLOG_CALLID = ;//获取号码
public const int QNV_CALLLOG_CALLRECFILE = ;//获取录音文件路径 //工具函数,跟设备无关
//uToolType
public const int QNV_TOOL_PSTNEND = ;//检测PSTN号码是否已经结束
public const int QNV_TOOL_CODETYPE = ;//判断号码类型(内地手机/固话)
public const int QNV_TOOL_LOCATION = ;//获取号码所在地信息
public const int QNV_TOOL_DISKFREESPACE = ;//获取该硬盘剩余空间(M)
public const int QNV_TOOL_DISKTOTALSPACE = ;//获取该硬盘总共空间(M)
public const int QNV_TOOL_DISKLIST = ;//获取硬盘列表
public const int QNV_TOOL_RESERVID1 = ;//保留
public const int QNV_TOOL_RESERVID2 = ;//保留
public const int QNV_TOOL_CONVERTFMT = ;//转换语音文件格式
public const int QNV_TOOL_SELECTDIRECTORY = ;//选择目录
public const int QNV_TOOL_SELECTFILE = ;//选择文件
//------------------------------------------------------ //存储操作
public const int QNV_STORAGE_PUBLIC_READ = ;//读取共享区域数据
public const int QNV_STORAGE_PUBLIC_READSTR = ;//读取共享区域字符串数据,读到'\0'自动结束
public const int QNV_STORAGE_PUBLIC_WRITE = ;//写入共享区域数据
public const int QNV_STORAGE_PUBLIC_SETREADPWD = ;//设置读取共享区域数据的密码
public const int QNV_STORAGE_PUBLIC_SETWRITEPWD = ;//设置写入共享区域数据的密码
public const int QNV_STORAGE_PUBLIC_GETSPACESIZE = ;//获取存储空间长度 //远程操作
//RemoteType
public const int QNV_REMOTE_UPLOADFILE = ;//上传文件到WEB服务器(http协议)
public const int QNV_REMOTE_DOWNLOADFILE = ;//下载远程文件
public const int QNV_REMOTE_UPLOADDATA = ;//上传字符数据到WEB服务器(send/post)
//-------------------------------------------------------- //CC控制
public const int QNV_CCCTRL_SETLICENSE = ;//设置license
public const int QNV_CCCTRL_SETSERVER = ;//设置服务器IP地址
public const int QNV_CCCTRL_LOGIN = ;//登陆
public const int QNV_CCCTRL_LOGOUT = ;//退出
public const int QNV_CCCTRL_ISLOGON = ;//是否登陆成功了
public const int QNV_CCCTRL_REGCC = ;//注册CC号码
//
//语音
public const int QNV_CCCTRL_CALL_START = ;//呼叫CC
public const int QNV_CCCTRL_CALL_VOIP = ;//VOIP代拨固话
public const int QNV_CCCTRL_CALL_STOP = ;//停止呼叫
public const int QNV_CCCTRL_CALL_ACCEPT = ;//接听来电
public const int QNV_CCCTRL_CALL_BUSY = ;//发送忙提示
public const int QNV_CCCTRL_CALL_REFUSE = ;//拒接
public const int QNV_CCCTRL_CALL_STARTPLAYFILE = ;//播放文件
public const int QNV_CCCTRL_CALL_STOPPLAYFILE = ;//停止播放文件
public const int QNV_CCCTRL_CALL_STARTRECFILE = ;//开始文件录音
public const int QNV_CCCTRL_CALL_STOPRECFILE = ;//停止文件录音
public const int QNV_CCCTRL_CALL_HOLD = ;//保持通话,不影响播放文件
public const int QNV_CCCTRL_CALL_UNHOLD = ;//恢复通话
public const int QNV_CCCTRL_CALL_SWITCH = ;//呼叫转移到其它CC public const int QNV_CCCTRL_CALL_CONFHANDLE = ;//获取呼叫句柄所在的会议句柄
//
//消息/命令
public const int QNV_CCCTRL_MSG_SENDMSG = ;//发送消息
public const int QNV_CCCTRL_MSG_SENDCMD = ;//发送命令
//
//好友
public const int QNV_CCCTRL_CONTACT_ADD = ;//增加好友
public const int QNV_CCCTRL_CONTACT_DELETE = ;//删除好友
public const int QNV_CCCTRL_CONTACT_ACCEPT = ;//接受好友
public const int QNV_CCCTRL_CONTACT_REFUSE = ;//拒绝好友
public const int QNV_CCCTRL_CONTACT_GET = ;//获取好友状态 //好友信息/自己的信息
public const int QNV_CCCTRL_CCINFO_OWNERCC = ;//获取本人登陆的CC
public const int QNV_CCCTRL_CCINFO_NICK = ;//获取CC的昵称,如果没有输入CC就表示获取本人的昵称 //socket 终端控制
public const int QNV_SOCKET_CLIENT_CONNECT = ;//连接到服务器
public const int QNV_SOCKET_CLIENT_DISCONNECT = ;//断开服务器
public const int QNV_SOCKET_CLIENT_STARTRECONNECT = ;//自动重连服务器
public const int QNV_SOCKET_CLIENT_STOPRECONNECT = ;//停止自动重连服务器
public const int QNV_SOCKET_CLIENT_SENDDATA = ;//发送数据 //[Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder lpString, int nMaxCount
public const string QNVDLLNAME = "qnviccub.dll"; // 打开设备
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_OpenDevice(UInt32 uDevType, UInt32 uValue, string strValue);
// 关闭设备
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CloseDevice(UInt32 uDevType, UInt32 uValue);
// set dev ctrl
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_SetDevCtrl(Int16 nChannelID, UInt32 uCtrlType, Int32 nValue);
// get dev ctrl
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_GetDevCtrl(Int16 nChannelID, UInt32 uCtrlType);
// set param
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_SetParam(Int16 nChannelID, UInt32 uParamType, Int32 nValue);
// get param
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_GetParam(Int16 nChannelID, UInt32 uParamType);
// play file
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_PlayFile(Int16 nChannelID, UInt32 uPlayType, Int32 nValue, Int32 nValueEx, string pValue);
// play buf
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_PlayBuf(Int16 nChannelID, UInt32 uPlayType, Int32 nValue, Int32 nValueEx, string pValue);
// play multifile
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_PlayMultiFile(Int16 nChannelID, UInt32 uPlayType, Int32 nValue, Int32 nValueEx, string pValue);
// play string
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_PlayString(Int16 nChannelID, UInt32 uPlayType, Int32 nValue, Int32 nValueEx, string pValue);
// record file
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_RecordFile(Int16 nChannelID, UInt32 uRecordType, Int32 nValue, Int32 nValueEx, string pValue);
// record buf
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_RecordBuf(Int16 nChannelID, UInt32 uRecordType, Int32 nValue, Int32 nValueEx, string pValue);
// conference
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Conference(Int16 nChannelID, Int32 nConfID, UInt32 uConfType, Int32 nValue, string pValue);
// broadcast
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Broadcast(Int16 nChannelID, UInt32 uBroadType, Int32 nValue, string pValue);
// speech
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Speech(Int16 nChannelID, UInt32 uSpeechType, Int32 nValue, string pValue);
// fax
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Fax(Int16 nChannelID, UInt32 uFaxType, Int32 nValue, string pValue);
// event
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Event(Int16 nChannelID, UInt32 uEventType, Int32 nValue, string pInValue, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder pOutValue, Int32 nBufSize);
// general
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_General(Int16 nChannelID, UInt32 uGeneralType, Int32 nValue, string pValue);
// pstn call log
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CallLog(Int16 nChannelID, UInt32 uLogType, string pValue, Int32 nValue);
// devinfo
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_DevInfo(Int16 nChannelID, UInt32 uDevInfoType);
// tool
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Tool(UInt32 uToolType, Int32 nValue, string pInValue, string pInValueEx, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder pOutValue, Int32 nBufSize);
// storage
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Storage(UInt32 uDevID, Int32 nOPType, Int32 nSeek, string pPwd, string pValue, Int32 nBufSize);
// remote
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Remote(UInt32 uRemoteType, Int32 nValue, string pInValue, string pInValueEx, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder pOutValue, Int32 nBufSize);
// CC ctrl
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CCCtrl(UInt32 uCtrlType, string pInValue, Int32 nValue);
// CC Call
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CCCtrl_Call(UInt32 uCallType, Int32 lSessHandle, string pInValue, Int32 nValue);
// CC msg
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CCCtrl_Msg(UInt32 uMsgType, string pDestCC, string pMsgValue, string pParam, Int32 nReserv);
// CC contact
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CCCtrl_Contact(UInt32 uContactType, string pDestCC, string pValue);
// CC contact info
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_CCCtrl_CCInfo(UInt32 uInfoType, string pDestCC, [Out, MarshalAs(UnmanagedType.LPTStr)] StringBuilder pOutValue, Int32 nBufSize);
[DllImport("qnviccub.dll")]
public static extern Int32 QNV_Socket_Client(UInt32 uSktType, UInt32 nHandle, UInt32 nValue, string pInValue, Int32 nInValueLen);
}
}

二代身份证阅读器dll之termb.dll

using System.Runtime.InteropServices;
namespace SoftPOS
{
/// <summary>
/// 身份证阅读类
/// </summary>
public class CVRSDK
{
[DllImport("termb.dll", EntryPoint = "CVR_InitComm", CharSet = CharSet.Auto, SetLastError = false)]
public static extern int CVR_InitComm(int Port);//声明外部的标准动态库, 跟Win32API是一样的
[DllImport("termb.dll", EntryPoint = "CVR_Authenticate", CharSet = CharSet.Auto, SetLastError = false)]
public static extern int CVR_Authenticate();
[DllImport("termb.dll", EntryPoint = "CVR_Read_Content", CharSet = CharSet.Auto, SetLastError = false)]
public static extern int CVR_Read_Content(int Active);
[DllImport("termb.dll", EntryPoint = "CVR_CloseComm", CharSet = CharSet.Auto, SetLastError = false)]
public static extern int CVR_CloseComm();
[DllImport("termb.dll", EntryPoint = "GetPeopleName", CharSet = CharSet.Ansi, SetLastError = false)]
public static extern unsafe int GetPeopleName(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetPeopleNation", CharSet = CharSet.Ansi, SetLastError = false)]
public static extern int GetPeopleNation(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetPeopleBirthday", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleBirthday(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetPeopleAddress", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleAddress(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetPeopleIDCode", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleIDCode(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetDepartment", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetDepartment(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetStartDate", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetStartDate(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetEndDate", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetEndDate(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "GetPeopleSex", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetPeopleSex(ref byte strTmp, ref int strLen);
[DllImport("termb.dll", EntryPoint = "CVR_GetSAMID", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int CVR_GetSAMID(ref byte strTmp);
[DllImport("termb.dll", EntryPoint = "GetManuID", CharSet = CharSet.Ansi, SetLastError = false, CallingConvention = CallingConvention.StdCall)]
public static extern int GetManuID(ref byte strTmp);
}
}

  

上一篇:python+sklearn+kaggle机器学习


下一篇:ButterKnife Zelezny从配置到使用