chxsymsysagentwatcher.cpp
上传用户:dangjiwu
上传日期:2013-07-19
资源大小:42019k
文件大小:3k
源码类别:
Symbian
开发平台:
Visual C++
- /*============================================================================*
- *
- * (c) 1995-2002 RealNetworks, Inc. Patents pending. All rights reserved.
- *
- *============================================================================*/
- //
- // central repository of information about the state, particularly
- // relating to power and communications, of the Symbian OS phone
- //
- // each event has a UID
- //
- // see "Using the System Agent interface" in docs; also "SACLS.H"
- //
- // e.g., these variables can be queried or watched:
- //
- // KUidNetworkStatus
- // KUidNetworkStrength
- // KUidIrdaStatus
- // KUidCurrentCall
- //
- // *** KUidCurrentCall event types are:
- //
- // ESACallNone,
- // ESACallVoice,
- // ESACallFax,
- // ESACallData,
- // ESACallAlerting,
- // ESACallRinging,
- // ESACallAlternating
- //
- #include "chxsymsysagentwatcher.h"
- #include "hxsym_leaveutil.h"
- #include "chxavutil.h"
- ///////////////////////////////////
- // ctor
- CHXSymSysAgentWatcher::CHXSymSysAgentWatcher()
- {
- }
- ///////////////////////////////////
- // dtor
- CHXSymSysAgentWatcher::~CHXSymSysAgentWatcher()
- {
- StopWatching();
- m_sa.Close();
- }
- ////////////////////////////////////////////////////////
- // event defined in sacls.h
- void CHXSymSysAgentWatcher::ConstructL(const TUid& idEvent, TInt activePriority)
- {
- BaseConstructL(activePriority);
- HXSYM_LEAVE_IF_ERR(m_sa.Connect());
- // type of event we are watching (e.g., phone event)
- m_event.SetUid(idEvent);
- }
- ////////////////////////////////////////////////////////
- //
- void CHXSymSysAgentWatcher::DoCancelRequest(const CHXAvActiveCmplPtr& spActive)
- {
- m_sa.NotifyEventCancel();
- }
- ////////////////////////////////////////////////////////
- // issue request for event notification:
- //
- // when event occurs, use GetSaEvent() to get event info
- //
- void CHXSymSysAgentWatcher::DoIssueRequest(const CHXAvActiveCmplPtr& spActive)
- {
- m_event.SetRequestStatus(spActive->Status());
- // request notification when state of variable changes
- m_sa.NotifyOnEvent(m_event);
- }
- ////////////////////////////////////////////////////////
- // primarily so you can call State() to get current state
- // of a variable after an event occurs
- //
- const TSysAgentEvent& CHXSymSysAgentWatcher::GetSaEvent() const
- {
- return m_event;
- }
- ////////////////////////////////////////////////////////
- // primarily so you can query current values (GetState, GetStates)
- // and possibly set event buffering
- //
- RSystemAgent& CHXSymSysAgentWatcher::GetSa()
- {
- return m_sa;
- }