Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Using the System Agent for getting notifications on Symbian (S60 2nd Edition)

From Wiki
Jump to: navigation, search

The (deprecated) System Agent was used in S60 1st and 2nd Edition Devices to get system event and other notification.

Warning.pngWarning: From S60 3rd Edition is replaced by the Publish & Subscribe framework

Article Metadata
Platform(s): S60 1st Edition, S60 2nd Edition
S60 1st Edition
Keywords: RSystemAgent, RSAVarChangeNotify
Created: vasant21 (24 May 2007)
Updated: hamishwillee (18 Nov 2011)
Reviewed: hamishwillee (18 Nov 2011)
Last edited: hamishwillee (18 Nov 2011)


The System Agent is a Symbian C++ server that provides a generic framework of notifications and system event state monitoring. It provides clients with access to the information through client-side handles.

  • The two main classes involved are RSystemAgent and RSAVarChangeNotify.
  • RSystemAgent is used to get data and also to register interest in a change to a value.
  • RSAVarChangeNotify is used to tell System Agent that a state has changed. Once System Agent is notified of a change, it pushes this information out to all parties who have registered an interest in that state.
  • All System Agent information is stored via a UID. The System Agent values that are supported by default are stored in sacls.h. The list includes KUidPhonePwr, KUidSIMStatus, KUidNetworkStatus, KUidNetworkStrength, KUidChargerStatus, KUidBatteryStrength, KUidCurrentCall, KUidDataPort, KUidInboxStatus, KUidOutboxStatus, KUidClock, KUidAlarm and KUidIrdaStatus.

Code example

The following example code shows how System Agent could be used inside an active object:

RSystemAgent sysAgent;
TSysAgentEvent sysAgentEvent;
// aUid is the UID we want to monitor.
// We want notification of the item change ..

The example shows the connection to the System Agent server, and the call to NotifyOnEvent tells System Agent that you wish to be notified when the value of the item associated to aUid changes. The application will be notified through the completion of the request associated with the trequestStatus, which is set in the TSysAgentEvent. This will result in the RunL on the active object to be invoked.

Advanced Monitoring

More advanced monitoring of system data can be achieved through the use of TSysAgentCondition, which allows for notification when one of the conditions ESysAgentEquals, ESysAgentNotEquals, ESysAgentGreaterThan or ESysAgentLessThan is met. In this case, RSystemAgent::NotifyOnCondition() is used.

This page was last modified on 18 November 2011, at 04:22.
32 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.