6.7.4 RequestNotification

RequestNotification is used to request notification for the updates occurring to log and register for any changes happening to event log.
It is used in asynchronous mode only.

The following is an example for using RequestNotification:

logging_id = logging_handle.call('RequestNotification', {'Type': u'Log', 'Filter': {'DelayTime': 600000}}, callback=logging_app_callback)

where, logging_app_callback is user defined function.

The following table summarizes the specification of RequestNotification:

Interface IDataSource
Description Registers for the changes occurring to the event log.
Response Model Asynchronous
Pre-condition IDataSource interface is loaded.
Post-condition Nil

Input Parameters

Input parameter specifies the Type and delay time in microseconds, which elapses before the notification request can complete.

Table 6.158: Input parameters for RequestNotification
Name Type Range Description
Type unicode string Log Specifies the Content Type.
Filter map
DelayTime: 32 bit int
NA The minimum time in microseconds, which elapses before the notification request can complete.


Output Parameters

Output contains ErrorCode and ErrorMessage, if the operation fails.

Table 6.159: Output parameters for RequestNotification
Name Type Range Description
ErrorMessage string NA Error Description in Engineering English.
ErrorCode 32 bit int NA Contains the SAPI specific error code when the operation fails.


Errors

The following table lists the error codes and their values:

Table 6.160: Error codes
Error code value Description
1000 Invalid service argument
1002 Bad argument type
1003 Missing argument
1004 Service not supported
1012 Item not found


Error Messages

The following table lists the error messages and their description:

Table 6.161: Error messages
Error messages Description
Logging:RequestNotification:TypeInvalid Invalid Type is passed to contenttype parameter.
Logging:RequestNotification:TypeMissing Content Type missing in the inputparam list.
Logging:RequestNotification:FilterMissing Filter map missing in inputparam list.
Logging:RequestNotification:FilterInvalid Invalid Type is passed to Filter parameter.
Logging:RequestNotification:DelayTimeMissing DelayTime is missing in the Filter Map.
Logging:RequestNotification:DelayTimeInvalid Invalid Type is passed to DelayTime parameter.


Example

The following sample code illustrates how to register changes in the event log, in asynchronous mode:

import scriptext
import e32
lock = e32.Ao_lock()

def logging_app_callback(trans_id, event_id, input_params):
    if trans_id != logging_id and event_id != scriptext.EventCompleted:
        print "Error in servicing the request"
        print "Error code is: " + str(input_params["ReturnValue"]["ErrorCode"])
        if "ErrorMessage" in input_params["ReturnValue"]:
            print "Error message is: " + input_params["ReturnValue"]["ErrorMessage"]
    else:
        print "Changes in the Log Event Notified "

    lock.signal()

# Load appmanage service
# Load the desired SAPI
logging_handle = scriptext.load('Service.Logging', 'IDataSource')
logging_id = logging_handle.call('RequestNotification',
    {'Type': u'Log', 'Filter': {'DelayTime': 600000}},
        callback=logging_app_callback)

print "Waiting for the request to be processed!"
lock.wait()

print "Request complete!"

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