我建了一个项目luyin1
在此项目里添加了一个类D160A , 内容如下:
using System;
using System.Runtime.InteropServices;
namespace luyin1
{
/// <summary>
/// 说明:创建类D160,导出并封装D系列模拟卡函数
/// </summary>
public struct TC_INI_TYPE
{
public short wCardNo;
public short wCardType;
public short wConnect;
public short wIRQ;
[MarshalAs(UnmanagedType.ByValArray , SizeConst = 32)]
public char[] cbDir;
[MarshalAs(UnmanagedType.ByValArray , SizeConst = 32)]
public short[] wAddress;
public short wMajorVer;
public short wMinorVer;
[MarshalAs(UnmanagedType.ByValArray , SizeConst = 32)]
public short[] wChType;
}
public struct TC_INI_TYPE_MORE
{
}
class D160A
{
public const short MAX_CHANNEL_NO = 128;
public const short LEN_FILEPATH = 128;
public const short MAX_CARD_NO = 32;
//初始化函数;
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern long LoadDRV();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void FreeDRV();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern long EnableCard(short wusedCh, short wFileBufLen);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void DisableCard();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void GetSysInfo(ref TC_INI_TYPE TmpIni);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void GetSysInfoMore(ref TC_INI_TYPE_MORE TmpMore);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short CheckValidCh();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short CheckChType(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short CheckChTypeNew(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool IsSupportCallerID();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void SetPackrate(short wPackRate);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void PUSH_PLAY();
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void SetBusyPara(short BusyLen);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void SetDialPara(short RingBack, short RingBack0, short BusyLen, short RingTimes);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern long NewReadPass(short wCardNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void D_SetWorkMode(short wChnlNo, byte cbWorkMode, byte cbModeVal);
//振铃及摘挂机函数;
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool RingDetect(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void OffHook(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void HangUp(short wChnlNo);
//放音函数;
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StartPlay(short wChnlNo, byte[] PlayBuf, int dwStartPos, int dwPlayLen);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StopPlay(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool CheckPlayEnd(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool StartPlayFile(short wChnlNo, byte[] FileName, int StartPos);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StopPlayFile(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void RsetIndexPlayFile(short Line);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool AddIndexPlayFile(short Line, byte[] FileName);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool StartPlayIndex(short wChnlNo, short[] pIndexTable, short wIndexLen);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool CheckIndexPlayFile(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StopIndexPlayFile(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool StartIndexPlayFile(short wChnlNo);
//录音函数
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StartRecordFile(short wChnlNo,byte[] FileName, int dwPlayLen);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StartRecordFileNew(short wChnlNo,byte[] FileName, int dwPlayLen, int dwRecordStartPos);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void CheckRecordEnd(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StopRecordFile(short wChnlNo);
//收码、拔号、信号音检测函数
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void InitDtmfBuf(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short GetDtmfCode(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern bool DtmfHit(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void StartSigCheck(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void FeedSigFunc();
//收主叫号码有关的函数
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern void ResetCallerIDBuffer(short wChnlNo);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short GetCallerIDRawStr(short wChnlNo, byte[] IDRawStr);
[DllImport("Tc08a32.dll",CharSet=CharSet.Auto)]
public static extern short GetCallerIDStr(short wChnlNo, byte[] IDStr);
//新增信号音函数
[DllImport("NewSig.dll",CharSet=CharSet.Auto)]
public static extern void Sig_Init(int Times);
}
}
我现在又在项目里加了一个类Class2,在Class2中需要调用类D160中的放音函数应该怎么实现呢?