6.3.6 RequestNotification
RequestNotification
is used to notify the registered client when events such as entry creation, updation, or deletion occurs in a specified calendar. If no calendar is specified, the default calendar is used. This is an asynchronous method.
The following is an example for using RequestNotification
:
event_id = calendar_handle.call("RequestNotification", {'Type': u'CalendarEntry'}, callback=calendar_callback)
The following table summarizes the specification of RequestNotification
:
Interface |
IDataSource |
Description |
Notifies when add, delete, or modify is performed on the entries in the calendar store. |
Response Model |
Asynchronous |
Pre-condition |
IDataSource interface is loaded. |
Post-condition |
Nil |
Note |
The specified calendar must exist. |
Input Parameters
Input parameter specifies the Type and its details to perform operation.
Table 6.52:
Input parameters RequestNotification
Name |
Type |
Range |
Description |
Type |
unicode string |
CalendarEntry |
Performs the operation on calendar entries. |
[Filter] |
map |
[CalendarName]: unicode string
[LocalIdList]: List of unicode strings
[EndRange]: datetime
[IncludeUndatedTodos]: bool |
If this entry is not specified then, notifies changes to the default calendar. CalendarName must be in the format Drivexxx:FileNamexxx.
LocalIdList specifies Ids for notification. These are obtained by a call to Getlist . If it is not specified all the entries are considered.
The StartRange and EndRange fields specify the time range during which notifications are required.
IncludeUndatedTodos specifies whether notifications are required for ToDo entries that have no date. |
|
Output Parameters
Output parameter contains the type of modification performed on the entries in the Calendar store and the LocalId
of that entry. It also contains ErrorCode
, and an ErrorMessage
, if the operation fails.
Table 6.53:
Output parameters RequestNotification
Name |
Type |
Range |
Description |
ErrorCode |
int |
NA |
Service specific error code on failure of the operation. |
ErrorMessage |
string |
NA |
Error description in Engineering English. |
ReturnValue |
Iterator (map) |
ChangeType: string: Add
Delete
Modify
Unknown
LocalId: string |
The ChangeType field indicates the type of modification made to the entries in the calendar store.
The LocalId gives the Id of the entry that is modified, added, or deleted. |
|
Errors
The following table lists the errors and their values:
Table 6.54:
Error codes
Error code value |
Description |
1000 |
Service argument out of range |
|
Error Messages
the following table lists the error messages and their description:
Table 6.55:
Error messages
Error messages |
Description |
Calendar:RequestNotification:CalendarName is invalid |
Invalid type is passed for CalendarName |
Calendar:RequestNotification:Type is invalid |
RequestNotification called with invalid Type |
Calendar:RequestNotification:StartRange is invalid |
Invalid type for Filter:StartRange parameter |
Calendar:RequestNotification:EndRange is invalid |
IInvalid type for Filter:EndRange parameter |
Calendar:RequestNotification:IncludeUndatedTodos is invalid |
Invalid type for Filter: IncludeUndatedTodos parameter. |
Calendar:RequestNotification:FileName is invalid |
Invalid type for FileName parameter or, FileName exceeds 239 characters |
Calendar:RequestNotification:LocalIdList is invalid |
Invalid type for Filter:LocalIdList parameter or, LocalIdList contains invalid data |
Calendar:RequestNotification:Filter is invalid |
Invalid type for Filter parameter |
|
Example
import scriptext
import e32
lock = e32.Ao_lock()
calendar_handle = scriptext.load('Service.Calendar', 'IDataSource')
def calendar_callback(trans_id, event_id, input_params):
if event_id != scriptext.EventCompleted:
# Check the event status
print "Error in retrieving required info"
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 "Modification is: " + str(input_params["ReturnValue"]["ChangeType"])
lock.signal()
# Make a request to get notification
event_id = calendar_handle.call("RequestNotification", {'Type': u'CalendarEntry'}, callback=calendar_callback)
lock.wait()
Release 2.0.0 final , documentation updated on 10 Feb 2010.
See About this document... for information on suggesting changes.