Class TTAPILine (unit TAPILine) |
Inherits from
TComponent
Public declarations
constructor Create (AOwner: TComponent);
procedure Close;
procedure ConfigDialog;
destructor Destroy;
function Drop: boolean;
function FillTAPILine (sl: TStrings): DWORD;
FUNCTION: void FillTAPILine(HWND) // PURPOSE: Fills the 'TAPI Line' control with the available line devices.
function GetIcon: HICON;
function MakeCall: boolean;
if Assigned (dwRequestMakeCall) Then dwRequestMakeCall (self);
procedure Open;
FDirectAccessLogFile := '';
function Read(wantedToRead: DWORD):string;
GetCommMask (hCommFile, fdwEvtMask); fdwEvtMask := fdwEvtMask or EV_RXCHAR; SetCommMask (hCommFile, fdwEvtMask);
function ReadLargeData (buffer: PChar; wantedToRead: DWORD):LONG;
procedure TranslateDialog;
function VerifyUsableLine (dwDeviceID: DWORD): LONG;
FUNCTION: long VerifyUsableLine(DWORD) // PURPOSE: Verifies that a specific line device is useable by TapiComm.
function Write (const sData: String): Boolean;
function ClearCommErrorToStr (dwErrorFlags : DWORD) : string;
end of ReadCommBlock(
function GetLineName (lpLineDevCaps_: LPLINEDEVCAPS): string;
for dwDeviceID := 0 to dwNumDevs-1 do
function I_lineNegotiateAPIVersion (dwDeviceID: DWORD): DWORD;
function I_lineNegotiateLegacyAPIVersion (dwDeviceID: DWORD): DWORD;
FUNCTION: DWORD I_lineNegotiateLegacyAPIVersion(DWORD) // PURPOSE: Negotiate an API Version to use for a specific device.
function LineCallStateInfoToStr (CallState, Info : DWORD) : string;
function LineCallStateToStr (CallState : DWORD) : string;
* TAPILine
procedure MakeDirectAccessScript;
Procedure OnConnectionInt;
procedure OnReply (dwParam1: DWORD; dwErrorCode: DWORD);
Perform a direct access to device
procedure SetCountryCode (value: integer);
procedure SetDevIDToInitialize (value: DWORD);
procedure SetInfoLabel(Value: TStatusPanel);
procedure SetLines (Value: TStrings);
Make sure the "comm/datamodem" device class is supported Note that we don't want any of the 'extra' information normally returned in the VARSTRING structure.
procedure SetPhoneNumber (value: String);
end of ReadCommBlock(
procedure SetWaitForCall (value: boolean);
procedure WriteLog (tag: string; responce: string; slLog: TStringList);
SetThreadPriority (GetCurrentThread, THREAD_PRIORITY_NORMAL);
property About : TAboutTAPILineProperty
property CountryCode : integer
property DeviceDirectAccess : boolean
property DevIdToInitialize : DWORD
property DirectAccessLogFile : string
property DirectAccessScript : TStrings
property PhoneNumber : string
property WaitForCall : boolean
event OnBusy : TNotifyEvent
event OnCallAnswering : TNotifyEvent
event OnCallOffering : TNotifyEvent
event OnClose : TNotifyEvent
event OnConnection : TNotifyEvent
event OnDisconnect : TNotifyEvent
event OnDropCall : TNotifyEvent
event OnOpen : TNotifyEvent
bConnected : boolean;
Number of TAPI devices
bDropped : boolean;
Public declarations
InfoLabel : TStatusPanel;
NumDevs : Integer;
Version : DWORD;
anotherData : string;
Call : HCALL;
dwRequestAnswer : DWORD;
call in
dwRequestDrop : DWORD;
dwRequestMakeCall : DWORD;
eventCallInProcess : TEvent;
FAbout : TAboutTAPILineProperty;
Private declarations
FCountryCode : integer;
FDevIDToInitialize : DWORD;
FDirectAccess : boolean;
FDirectAccessLogFile : string;
FDirectAccessScript : TStrings;
file name
FInfoLabel : TStatusPanel;
FOnBusy : TNotifyEvent;
FOnCallAnswering : TNotifyEvent;
FOnCallOffering : TNotifyEvent;
FOnClose : TNotifyEvent;
FOnConnection : TNotifyEvent;
FOnDisconnect : TNotifyEvent;
FOnDropCall : TNotifyEvent;
FOnOpen : TNotifyEvent;
FPhoneNumber : string;
FWaitForCall : boolean;
hCommFile : LONG;
Line : HLINE;
LineApp : HLINEAPP;
Parent : TComponent;
sDirectAccessResult : string;
constructor Create (AOwner: TComponent);
procedure Close;
procedure ConfigDialog;
destructor Destroy;
function Drop: boolean;
function FillTAPILine (sl: TStrings): DWORD;
FUNCTION: void FillTAPILine(HWND) // PURPOSE: Fills the 'TAPI Line' control with the available line devices. // PARAMETERS: hwndDlg - handle to the current "Dial" dialog // RETURN VALUE: none // COMMENTS: // This function enumerates through all the TAPI line devices and queries each for the device name. The device name is then put into the 'TAPI Line' control. These device names are kept in order rather than sorted. This allows "Dial" to know which device ID the user selected just by the knowing the index of the selected string. // There are default values if there isn't a device name, if there is an error on the device, or if the device name is an empty string. The device name is also checked to make sure it is null terminated. // Note that a Legacy API Version is negotiated. Since the fields in the LINEDEVCAPS structure that we are interested in haven't moved, we can negotiate a lower API Version than this sample is designed for and still be able to access the necessary structure members. // The first line that is usable by TapiComm is selected as the 'default' line. Also note that if there was a previously selected line, this remains the default line. This would likely only occur if this function is called after the dialog has initialized once; for example, if a new line is added. // //
function GetIcon: HICON;
function MakeCall: boolean;
if Assigned (dwRequestMakeCall) Then dwRequestMakeCall (self);
procedure Open;
FDirectAccessLogFile := '';
function Read(wantedToRead: DWORD):string;
GetCommMask (hCommFile, fdwEvtMask); fdwEvtMask := fdwEvtMask or EV_RXCHAR; SetCommMask (hCommFile, fdwEvtMask);
function ReadLargeData (buffer: PChar; wantedToRead: DWORD):LONG;
procedure TranslateDialog;
function VerifyUsableLine (dwDeviceID: DWORD): LONG;
FUNCTION: long VerifyUsableLine(DWORD) // PURPOSE: Verifies that a specific line device is useable by TapiComm. // PARAMETERS: dwDeviceID - The ID of the line device to be verified // RETURN VALUE: Returns SUCCESS if dwDeviceID is a usable line device. Returns a LINENOTUSEABLE_ constant otherwise. // COMMENTS: // VerifyUsableLine takes the give device ID and verifies step by step that the device supports all the features that TapiComm requires. // //
function Write (const sData: String): Boolean;
function ClearCommErrorToStr (dwErrorFlags : DWORD) : string;
end of ReadCommBlock(
function GetLineName (lpLineDevCaps_: LPLINEDEVCAPS): string;
for dwDeviceID := 0 to dwNumDevs-1 do
function I_lineNegotiateAPIVersion (dwDeviceID: DWORD): DWORD;
function I_lineNegotiateLegacyAPIVersion (dwDeviceID: DWORD): DWORD;
FUNCTION: DWORD I_lineNegotiateLegacyAPIVersion(DWORD) // PURPOSE: Negotiate an API Version to use for a specific device. // PARAMETERS: dwDeviceID - device to negotiate an API Version for. // RETURN VALUE: Returns the API Version to use for this line if successful. Returns 0 if negotiations fall through. // COMMENTS: // This wrapper is slightly different from the I_lineNegotiateAPIVersion. This wrapper allows TapiComm to negotiate an API version between 1.3 and SAMPLE_TAPI_VERSION. Normally, this sample is specific to API Version SAMPLE_TAPI_VERSION. However, there are a few times when TapiComm needs to get information from a service provider, but also knows that a lower API Version would be ok. This allows TapiComm to recognize legacy service providers even though it can't use them. 1.3 is the lowest API Version a legacy service provider should support. // //
function LineCallStateInfoToStr (CallState, Info : DWORD) : string;
function LineCallStateToStr (CallState : DWORD) : string;
* TAPILine
procedure MakeDirectAccessScript;
Procedure OnConnectionInt;
procedure OnReply (dwParam1: DWORD; dwErrorCode: DWORD);
Perform a direct access to device
procedure SetCountryCode (value: integer);
procedure SetDevIDToInitialize (value: DWORD);
procedure SetInfoLabel(Value: TStatusPanel);
procedure SetLines (Value: TStrings);
Make sure the "comm/datamodem" device class is supported Note that we don't want any of the 'extra' information normally returned in the VARSTRING structure. All we care about is if lineGetID succeeds. {GetMem(LPVOID(lpVarString_), sizeof(VARSTRING) + 1024);
ZeroMem (PChar(lpVarString_));
lpVarString_^.dwTotalSize:=sizeof(VARSTRING) + 1024;
// Fill the VARSTRING structure
TapiCheck (lineGetID (hLine_, 0, hCall_, LINECALLSELECT_LINE,
lpVarString_, 'comm/datamodem'));
procedure SetPhoneNumber (value: String);
end of ReadCommBlock(
procedure SetWaitForCall (value: boolean);
procedure WriteLog (tag: string; responce: string; slLog: TStringList);
SetThreadPriority (GetCurrentThread, THREAD_PRIORITY_NORMAL);
property About : TAboutTAPILineProperty
property CountryCode : integer
property DeviceDirectAccess : boolean
property DevIdToInitialize : DWORD
property DirectAccessLogFile : string
property DirectAccessScript : TStrings
property PhoneNumber : string
property WaitForCall : boolean
event OnBusy : TNotifyEvent
event OnCallAnswering : TNotifyEvent
event OnCallOffering : TNotifyEvent
event OnClose : TNotifyEvent
event OnConnection : TNotifyEvent
event OnDisconnect : TNotifyEvent
event OnDropCall : TNotifyEvent
event OnOpen : TNotifyEvent
bConnected : boolean;
Number of TAPI devices
bDropped : boolean;
Public declarations
InfoLabel : TStatusPanel;
NumDevs : Integer;
Version : DWORD;
anotherData : string;
Call : HCALL;
dwRequestAnswer : DWORD;
call in
dwRequestDrop : DWORD;
dwRequestMakeCall : DWORD;
eventCallInProcess : TEvent;
FAbout : TAboutTAPILineProperty;
Private declarations
FCountryCode : integer;
FDevIDToInitialize : DWORD;
FDirectAccess : boolean;
FDirectAccessLogFile : string;
FDirectAccessScript : TStrings;
file name
FInfoLabel : TStatusPanel;
FOnBusy : TNotifyEvent;
FOnCallAnswering : TNotifyEvent;
FOnCallOffering : TNotifyEvent;
FOnClose : TNotifyEvent;
FOnConnection : TNotifyEvent;
FOnDisconnect : TNotifyEvent;
FOnDropCall : TNotifyEvent;
FOnOpen : TNotifyEvent;
FPhoneNumber : string;
FWaitForCall : boolean;
hCommFile : LONG;
Line : HLINE;
LineApp : HLINEAPP;
Parent : TComponent;
sDirectAccessResult : string;