GetList is used to retrieve information about landmarks, landmark categories, or landmark databases. Landmarks and landmark categories are retrieved from the specified landmark database or, if no database is specified, from the default one.
The following are the examples for using GetList:
Synchronous
landmarkinfo = landmark_handle.call('GetList', {'Type': u'Landmark',
'Filter':{'uDatabaseURI': u'dataBaseUri',
'LandmarkName': u'AnyLandMarkNm'},
'Sort' :{'Key': u'LandmarkName',
'Order': u'Descending'}})
Asynchronous
event_id = landmark_handle.call('GetList', {'Type': u'Landmark',
'Filter':{'uDatabaseURI':u'dataBaseUri',
'LandmarkName':u'AnyLandMarkNm'},
'Sort':{'Key':u'LandmarkName',
'Order':u'Descending'}},
callback=get_list)
where, get_list is a user defined callback function.
The following table summarizes the specification of GetList:
| Interface | IDataSource |
| Description | Retrieves an iterable on items qualified by search criteria. |
| Response Model | Synchronous and asynchronous, depending on the criteria and use case. |
| Pre-condition | IDataSource interface is loaded. |
| Post-condition | The iterable points to the first element in the list from an active or specified database. The default or active database opened for reading landmarks and categories. Creates the database, if it does not exist and is set as active. |
Input Parameters
Input parameter specifies what landmark information is returned and how the returned information is sorted.
|
Output Parameters
Output parameters contain the requested information. They also contain ErrorCode, and ErrorMessage if the operation fails.
|
Errors
The following table lists the error codes and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to query a list of Landmarks with search criteria, in asynchronous mode:
import scriptext
import e32
# Using e32.Ao_lock() to make main function wait till callback is hit
lock = e32.Ao_lock()
# Callback function will be called when the requested service is complete
def get_list(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:" + input_params["ReturnValue"]["ErrorMessage"]
else:
print "The landmarks are"
for i in input_params["ReturnValue"]:
print "Name of Landmark"
print i["LandmarkName"]
print "Description of Landmark"
print i['LandmarkDesc']
lock.signal()
# Async Query a list of Landmarks with search criteria
landmark_handle = scriptext.load('Service.Landmarks', 'IDataSource')
event_id = landmark_handle.call('GetList', {'Type': u'Landmark',
'Filter': {'uDatabaseURI':u'dataBaseUri',
'LandmarkName':u'AnyLandMarkNm'},
'Sort': {'Key':u'LandmarkName',
'Order':u'Descending'}},
callback=get_list)
print "Waiting for the request to be processed!"
lock.wait()
print "Request complete!"
See About this document... for information on suggesting changes.