The SystemInfo Service API of WRT 1.1 allows widgets to access and modify system information on a device. System information is represented as a set of system attributes. You can use the SystemInfo Service to create widgets that:
Read and modify system attribute values
Notify the user when system attribute values change
The system attributes are grouped into the following categories:
Battery
Connectivity
Device
Display
Features
General
Memory
Network
Only a few system attributes are modifiable and support change notifications. For more information about system attributes, see section System attributes
To create a service
object for the SystemInfo Service API, use Service.SysInfo
to
identify the service provider and ISysInfo
to identify
the supported interface:
var so = device.getServiceObject("Service.SysInfo", "ISysInfo");
The ISysInfo
interface provides the following methods:
Use the GetInfo()
method to retrieve information
about a system attribute.
Use the SetInfo()
method to modify the value of
a system attribute.
Use the GetNotification()
method to receive a notification
when the value of a system attribute is changed.
Use the Cancel()
method to cancel an ongoing asynchronous
call. This method is valid for any asynchronous call made through the SystemInfo
Service API.
To access and modify system information using the SystemInfo Service API:
Create a service
object for the API using device.getServiceObject()
.
Define the tasks you want to perform and choose the correct methods for them.
Optionally, define how you want the results filtered.
Define methods to process the results.
Retrieve the
results using the methods from step 2. Use asynchronous methods together with callback()
.
Process the results using the methods defined in step 4.
For the complete source of a sample widget that demonstrates how to use this service, see the full example.