A component with appropriate platform security capabilities can request a change to a system-wide property value. The SSM distributes notifications of the changing of system-wide property values to components that have requested notifications.
System-wide properties are attributes of a device that have system-wide significance. It allows components to be aware of the device state. They are defined by system-wide property policies within a SSM plug-in that can be customized by licensees. These policies determine the set of properties, their permissible values and transitions, and the tasks that are performed when each value changes.
Follow the steps given below to monitor a system-wide property:
The following example code shows how a while loop is used to remove cache files from disk when the ESystemDriveSpace (one of the system-wide property) property becomes ELow or ECritical.
Note: The ESystemDriveSpace property is an example property and is not part of a defined API to be delivered by the Symbian platform as part of the System State Management Architecture
void RunCacheLoopL() { RSsmSystemWideProperty diskStatus; User::LeaveIfError( diskStatus.Connect( ESystemDriveSpace ) ); TRequestStatus status; diskStatus.Subscribe( status ); while( ETrue ) { User::WaitForRequest( status ); if( status != KErrNone ) { // Handle error } // Re-subscribe before you read so that you do not miss any notifications diskStatus.Subscribe( status ); TInt value = diskStatus.GetValue(); switch ( value ) { case ENormal: EnableDiskCache(); break; case ELow: // Fall through case ECritical: DisableDiskCache(); RemoveDiskCache(); break; } } }
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.