📄 defs.pas
字号:
{*******************************************************}
{ }
{ Icall Definitions unit }
{ Common isdn API v. 1.0.2 }
{ }
{ Freeware }
{ }
{ Translator: Stratos Christodoulou }
{ }
{ Version 1.0.2 }
{ Added comments }
{*******************************************************}
unit defs;
interface
uses windows;
Const
SUCCESS = $0;
HeaderLength=8;
//Profile Consts
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^Global options^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
INTERNAL_CON_SUP=$1;
EXTERNAL_EQ_SUP=$2;
HANDSET_SUP=$6;
DTMF_SUP=$8;
SUPLEMENT_SUP=$10;
LEASED_LINES=$20;
PAR_b_SUP=$40;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^B1 protocol^^^^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
_64_KB_HDLC=$1;
_64_KB_TRAN=$2;
V110_ASYNC=$4;
V110_SYNC_HDLC=$8;
FAX_G3=$10;
_64_KB_INV_HDLC=$20;
_56_KB_TRAN=$40;
MODEM=$80;
MODEM_ASYNC=$100;
MODEM_SYNC_HDLC=$200;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^B2 protocol^^^^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
ISO_7776=$1;
TRANSPARENT=$2;
SDLC=$4;
LAPD=$8;
T30_FAX_G3=$10;
PPP=$20;
TRANSPARENT_IGN=$40;
MODEM_ERROR_COR=$80;
V42_COMP=$100;
V120_ASYNC=$200;
V120_V42=$400;
V120_TRANS=$800;
LAPD_SAPI=$1000;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^B3 protocol^^^^^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
TR_ALW_SET=$1;
T90NL=$2;
ISO8208=$4;
X25DCE=$8;
T30_FAX_G3_=$10;
T30_FAX_G3_EX=$20;
_MODEM=$80;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^^^CAPI COMMANDS^^^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
CAPI_ALERT = $1;
CAPI_CONNECT = $2;
CAPI_CONNECT_ACTIVE = $3;
CAPI_CONNECT_B3_ACTIVE = $83;
CAPI_CONNECT_B3 = $82;
CAPI_CONNECT_B3_T90_ACTIVE = $88;
CAPI_DATA_B3 = $86;
CAPI_DISCONNECT_B3 = $84;
CAPI_DISCONNECT = $4;
CAPI_FACILITY = $80;
CAPI_INFO = $8;
CAPI_LISTEN = $5;
CAPI_MANUFACTURER = $FF;
CAPI_RESET_B3 = $87;
CAPI_SELECT_B_PROTOCOL = $41;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^^^CAPI SubCOMMANDS^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
CAPI_REQ = $80;
CAPI_CONF = $81;
CAPI_IND = $82;
CAPI_RESP = $83;
Type
//^^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^^^^Some Types from C++^
//^^^^^^^^^^^^^^^^^^^^^^^^^^
pDWORD = ^DWORD;
PVoid = ^Pointer;
ppVoid = ^pVoid;
//Holds the capi version
Tversion = Record
CAPIMajor:Dword;
CAPIMinor:dword;
ManufacturerMajor:dword;
ManufacturerMinor:dword;
end;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//^^^The message Header^^^^
//^^^^^^^^^^^^^^^^^^^^^^^^^
TMessageHeader = Record
TotalLength:word;
ApplID:word;
Command:byte;
SubCommand:byte;
MessageNumber:byte;
end;
//^^^^^^^^^^^^^^^^^^^^^^^^^
//Profile Structure
//^^^^^^^^^^^^^^^^^^^^^^^^^
TProfileStruct = Record
InstalledControllers:word;
SupportedChannels:word;
GlobalOptions:Dword;
B1Proto:Dword;
B2Proto:DWORD;
B3Proto:DWORD;
End;
//Listen rquest message structure
TListen_REQ = Record
TotalLength:word;
ApplID:word;
Command:byte;
SubCommand:byte;
MessageNumber:byte;
Controller:DWORD;
infoMask:DWORD;
CIPMask:DWORD;
CIPMASK2:DWORD;
CallingPartyNumber:Byte;
CalledPartyNumber:Byte;
end;
//Alert network for a call message structure
TAlertREQ = record
length : SmallInt;
Applid : SmallInt;
Command : Byte;
SubCommand : Byte;
Message_Number: SmallInt;
PLCI : integer;
BCI : SmallInt;
kpf : Byte;
uud : Byte;
fda : Byte;
end;
//Respond to a connection indication message
TConnectResp = record
Command : Byte;
SubCommand : Byte;
PLCI : integer;
REJECT : SmallInt;
BProtocol : Integer;
ConnectedNumber : Integer;
ConnectedSubaddress: Integer;
LLC : Integer;
AdditionalInfo : Integer;
end;
//An info indication message
TInfoInd = record
PLCI : integer;
InfoNumberLSB: Byte;
InfoNumerbMSB: Byte;
InfoElement : array[0..99] of Byte;
end;
//Respond to an info indication message
TInfoResp = record
Length : SmallInt;
Applid : SmallInt;
Command : Byte;
SubCommand : Byte;
Message_Number: SmallInt;
PLCI : Integer;
end;
//A disconnection indication message
TDisconnectInd = record
PLCI : Integer;
Reason: SmallInt;
end;
//A disconnection responce message
TDisconnectResp = record
Length : SmallInt;
Applid : SmallInt;
Command : Byte;
SubCommand : Byte;
Message_Number: SmallInt;
PLCI : Integer;
end;
//A connection indication message
TConnectInd = record
PLCI : integer;
CIP : SmallInt;
Buffer: array[0..99] of char;
end;
//A request for Listening isdn events
TListenReq = record
Controller:DWORD;
Info:word;
end;
//CAPI 2.0 DLL FUNCTIONS
function CAPI_REGISTER(MessageBufferSize,maxLogicalConnection,maxBdataBlocks,maxBdataLen:DWORD;pApplID:pDWORD):DWORD;stdcall;external 'capi2032.dll';
function CAPI_RELEASE(ApplID:DWORD):DWORD;stdcall;external 'capi2032.dll';
function CAPI_INSTALLED:DWORD;stdcall;external 'capi2032.dll';
function CAPI_WAIT_FOR_SIGNAL(ApplID:DWORD):DWORD;stdcall;external 'capi2032.dll';
function CAPI_GET_MESSAGE(ApplId:DWORD;ppCapiMessage:pVoid):DWORD;stdcall;external 'capi2032.dll';
function CAPI_GET_PROFILE(SzBuffer:pVoid;CtrlNr:DWORD):DWORD;stdcall;external 'capi2032.dll';
function CAPI_GET_VERSION(pCAPIMajor, pCAPIMinor,pManufacturerMajor,pManufacturerMinor: pointer): DWord; stdcall;external 'capi2032.dll';
function CAPI_GET_MANUFACTURER(SzBuffer: pointer): DWORD; stdcall; external 'Capi2032.dll';
function CAPI_GET_SERIAL_NUMBER(SzBuffer: pointer): DWORD; stdcall; external 'Capi2032.dll';
Function CAPI_PUT_MESSAGE(const AppId: Dword; Req: pointer): DWORD; stdcall; external 'Capi2032.dll';
procedure RtlMoveMemory(MessageHeader: Pointer; const lpCapiBuffer: DWORD; const HeaderLength: integer); stdcall;external 'Kernel32.dll';
//Return the number of isdn controllers insalled on the system
Function GetActivesControllers:WORD;
//If returns <>0 then everything is ok! You don't have to call this
//function directly, component do it automatically
Function RegisterCapi:Dword;
//Release the capi handler, and frees the memory
Procedure ReleaseCapi(ApplID:DWORD);
//Returns a Tversion about the isdn controller
Function GetVersion:Tversion;
//Returns the manufacture of the isdn controller
Function GetManufacturer:string;
//Return the serial number of the isdn controller
Function GetSerial:string;
implementation
Function GetActivesControllers:WORD;
var
szBuf:array[0..64] of byte;
dwRet:DWORD;
Profile:^TProfileStruct;
begin
Result:=0;
if CAPI_INSTALLED=SUCCESS Then
begin
Dwret:=CAPI_GET_PROFILE(@szBuf,0);
if dwRet=SUCCESS then
begin
Profile:=@szBuf;
Result:=Profile.InstalledControllers;
end;
end;
end;
Function RegisterCapi:Dword;
var
dwRet:DWORD;
ApplID:DWORD;
Begin
Result:=0;
dwRet:=CAPI_REGISTER(3072,2,7,2048,@ApplID);
if dwRet=SUCCESS then
Result:=ApplID;
end;
Procedure ReleaseCapi(ApplID:DWORD);
var
dwRet:DWORD;
begin
dwRet:=CAPI_RELEASE(ApplID);
if dwRet<>SUCCESS then
ApplID:=0;
end;
Function GetVersion;
var
CAPIMajor:Dword;
CAPIMinor:dword;
ManufacturerMajor:dword;
ManufacturerMinor:dword;
af:TVERSION;
begin
af.CAPIMajor:=0;
af.CAPIMinor:=0;
af.ManufacturerMajor:=0;
af.ManufacturerMinor:=0;
result:=af;
if CAPI_GET_VERSION(@CAPIMajor,@CAPIMinor,@ManufacturerMajor,@ManufacturerMinor)=SUCCESS then
begin
result.CAPIMajor:=CAPIMajor;
result.CAPIMinor:=CAPIMinor;
result.ManufacturerMajor:=ManufacturerMajor;
result.ManufacturerMinor:=ManufacturerMinor;
end;
end;
Function GetManufacturer;
var
Manufacturer: array[0..63] of char;
begin
result:='';
if CAPI_GET_MANUFACTURER( @Manufacturer)=SUCCESS then
result:= Manufacturer;
end;
Function GetSerial;
var
Serial: array[0..7] of char;
begin
result:='';
if CAPI_GET_SERIAL_NUMBER( @serial)=SUCCESS then
result:= serial;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -