GetInfo
retrieves the value of a system attribute. It can be used in both synchronous and asynchronous mode.
The following are the examples for using GetInfo
:
Synchronous
self.sysinfo_handle.call("GetInfo", {"Entity": u"General", "Key": u"VibraActive", "SystemData": {"Status": 1}})
Asynchronous
event_id = sysinfo_handle.call("GetInfo", {"Entity": u"Network", "Key": u"LocationArea"}, callback=print_location_area)
where, print_location_area
is user defined function.
The following table summarizes the specification of GetInfo
:
Interface | ISysinfo |
Description | Retrieves the value of a system attribute. |
Response Model | Synchronous and asynchronous |
Pre-condition | ISysInfo Interface is loaded. |
Post-condition | Returns an object on success. |
Input Parameters
Input parameter specifies the Entity of system attribute information returned.
|
Output Parameters
Output parameter returns an object that contains the requested information. It also contains ErrorCode
and an 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 retrieve the current location area in synchronous mode:
import scriptext import e32 # Using e32.Ao_lock() so that the main function can wait # till the callback is hit. lock = e32.Ao_lock() # Callback function will be called when the requested service is complete def print_location_area(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 "Current Location Area is: " + input_params["ReturnValue"]["Status"] lock.signal() # Load sysinfo service sysinfo_handle = scriptext.load("Service.SysInfo", "ISysInfo") # Make a request to query the required information event_id = sysinfo_handle.call("GetInfo", {"Entity": u"Network", "Key": u"LocationArea"}, callback=print_location_area) print "Waiting for the request to be processed!" lock.wait() print "Request complete!"
See About this document... for information on suggesting changes.