6.6.3 CancelNotification

CancelNotification method is used to cancel an outstanding asynchronous call.

The following is an example for using CancelNotification:

cancel_output = location_handle.call('CancelNotification', {'CancelRequestType': u'GetLocCancel'})

The following table summarizes the specification of CancelNotification:

Interface ILocation
Description Cancels the registered listeners with the service provider.
Response Model Synchronous
Pre-condition Device must be Location aware (that is, it must have some location service provider in form of GPS, AGPS, or Bluetooth).

ILocation interface loaded.

Post-condition Nil

Input Parameters

The parameters specify whether to cancel a GetList call or a Trace call. The object must contain the CancelRequestType property (unicode string) that is used to specify the type of call to cancel.

Table 6.132: Input parameters for CancelNotification
Name Type Range Description
CancelRequestType unicode string TraceCancel
GetLocCancel
Contains specific information about the type of notification expected to be canceled.


Output Parameters

Output parameters contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.133: Output parameters for CancelNotification
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.


Errors

The following table lists the error codes and their values:

Table 6.134: Error codes
Error code value Description
1000 Invalid service argument
1012 Item not found


Error Messages

The following table lists the error messages and their description:

Table 6.135: Error messages
Error messages Description
Location:Cancel:BadArgument - cancel type Indicates error in supplied cancel type.
Location:Cancel:Missing cancel type Indicates missing cancel type in input.
Location:Cancel:Wrong cancel type Indicates cancel type supplied is wrong.


Example

The following sample code illustrates how to cancel the registered listeners with the service provider:

import scriptext
location_handle = scriptext.load('Service.location', 'ILocation')

try:
    cancel_output = location_handle.call('CancelNotification', {'CancelRequestType':  u'GetLocCancel'})
    errorcode = cancel_output["ErrorCode"]
    if errorcode != 0:
        print "Error in cancelling the request"
    else:
        ret_val = cancel_output["ReturnValue"]

        print "The cancellation request is successful"

except scriptext.ScriptextError, err:
    print "Error performing the operation : ", err

See About this document... for information on suggesting changes.