diff -r 913c9751c067 -r 716254ccbcc0 org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/org.symbian.tools.wrttools.doc.WebDeveloper/html/GUID-C7C3B541-8D28-4DC6-9003-ECF57F26C608.html Fri Mar 05 19:11:15 2010 -0800 @@ -0,0 +1,137 @@ + + +Defining +the callback handler for an asynchronous method

Defining +the callback handler for an asynchronous method

+

The callback handler method is used with an asynchronous method call +to retrieve the information requested by the call. The asynchronous call initiates +the callback handler and then returns a TransactionID. +This ID is used to map the asynchronous call to the correct callback handler +instance and the result information it returns. You can call the result handler +method from within the callback handler.

+

Define a callback handler method for any Service +API method that is called asynchronously. Use the following method +signature:

+ + + +
callback(transId, eventCode, result)
+

The system supplies the expected arguments:

+
+ + + + + + + + + + + + + + + + + + + + + + +
Table: Callback arguments
+

Argument

+
+

Description

+
+

Value

+
+

transId

+
+

This is a number representing the transaction that called the callback +handler.

+

TransactionID was returned as part of the result +of the initial asynchronous call.

+
 
+

eventCode

+
+

This is a number representing the callback return status.

+
+

Value - Description:

+

2 - Event completed

+

4 - Event error

+

9 - Event in progress

+
+

result

+
+

This is an object for holding the callback return value.

+
+

See the following table.

+
+

The callback handler returns an object that contains the requested information, +an error code, and an error message:

+
+ + + + + + + + + + + + + + + + + + + + + +
Table: Callback return +value
+

Property

+
+

Description

+
+

Value

+
+

[result.ReturnValue]

+
+

This contains the information requested by the asynchronous call that +initiated the callback handler.

+

If an asynchronous call does not request any information to be returned, +this property is not included in the callback return value. In this case, +the callback handler only returns ErrorCode and ErrorMessage.

+
+

Depends on the Service +API and the asynchronous method that was called. Not all calls return +this property. See the appropriate method definition.

+
+

result.ErrorCode

+
+

This is a number that specifies a predefined error code.

+
+

See Service API error codes.

+
+

result.ErrorMessage

+
+

This is a text string that describes the error.

+
+

Depends on the Service +API and the asynchronous method that was called. See the appropriate +method definition.

+
+

+ + + +

\ No newline at end of file