chxsymsysagentwatcher.cpp

来自「symbian 下的helix player源代码」· C++ 代码 · 共 102 行

CPP
102
字号

/*============================================================================*
 *
 * (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;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?