Everytime, hbTapi calls an asynchronous TAPI function, an internal request
object will be created. This object holds information like the request
ID, the request type, a timeout value and the participating objects (e.g.
calls). SetRequestNode can be used to store your own information within
the request object. Especially if you are using the asynchronus mode of
hbTapi, this function is very helpfull. It provides you with a simple
possibility to bundle information with a request identified by its request
ID.
ID of an existing request. Use ThbTapiPhone.LastRequestID
to get the RequestID of an asynchronous function call.
Ident
Identifier of the needed information. There are two kinds of identifiers:
internal and user defined. All Internal identifiers are beginning
with a '&' like '&TapiRequest' and can't be set with this
procedure.
A user defined identifier has to start with a character or an underscore
and must not contain spaces. There can be characters, numbers or underscores
following the first character. An Identifier is not case sensitive.
Valid identifiers are: Value1, Time, Count_1
Value
Value as a variant you want to store with the request.
You are able to transfer any type a variant accepts.
Remarks
The request exists between the calling of the initiating
method resp. setting the initiating and the corresponding reply event
(ThbTapiPhone.OnTapiReply). Calling SetRequestNote with an old request id
will raise an exception.
The following example shows how to store an information
together with the request and how to retrieve it back in ThbTapiPhone.OnTapiReply.
The text to be shown on the phones display is stored in the request note
'DisplayText' and is retrieved and used in ThbTapiPhone.OnTapiReply to display
a message dialog.
interface
uses hbTapi, tapi, ...
procedure TForm1.SetPhoneDisply(AText: String);
begin
try
TapiPhone1.Display.Text := AText;
TapiPhone1.SetRequestNote(TapiPhone1.LastRequestID,
'DisplayText', AText);
except
on E:EhbTapiError do
MessageDlg('Setting the display failed!
' + E.Message, mtError, [mbok], 0);
end;
end;
procedure TForm1.TapiPhone1TapiReply(Sender:
TObject; RequestID, ReplyCode: Cardinal);
begin
if (ReplyCode <> 0) then
begin
if TapiPhone1.GetRequestNote(RequestID, '&TapiRequest')
= TAPIREQUEST_PHONESETDISPLAY then
MessageDlg(Format('TapiReply: Setting
the display text "%s" failed! %s', [TapiPhone1.GetRequestNote(RequestID,
'DisplayText')),
nbsp; GetTapiErrorMessage(ReplyCode)]),
mtError, [mbOK], 0);
else
MessageDlg('TapiReply: Error' +#13
+ #10 + GetTapiErrorMessage(ReplyCode), mtError, [mbOK], 0);
end
end;