⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaugethreshold_impl.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 5 页
字号:
/*

Copyright (c) 2008, Intel Corporation. 

All rights reserved.

 

Redistribution and use in source and binary forms, with or without modification, 
are permitted provided that the following conditions are met:


    * Redistributions of source code must retain the above copyright notice, 
this list of conditions and the following disclaimer.

    * Redistributions in binary form must reproduce the above copyright notice, 
this list of conditions and the following disclaimer in the documentation and/or 
other materials provided with the distribution.

    * Neither the name of Intel Corporation nor the names of its contributors 
may be used to endorse or promote products derived from this software without 
specific prior written permission.

 

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
OF SUCH DAMAGE.

*///==============================================================================// GaugeThreshold_Impl.cpp //       Implementation of base class GaugeThresholdImpl//==============================================================================#include "GaugeThreshold_Impl.h"  #include "../Base/base_Exception.h"//#include "IntelMobile_Server/IntelMobile_Server.h"#include "../Ipc_Support.h"//==============================================================================// C-Tor() : Explicit constructor//==============================================================================GaugeThresholdImpl::GaugeThresholdImpl( Object*                 pOwner,                                        IntelMobileChar*                sType )                  : ThresholdImpl( pOwner, sType ){}//==============================================================================// D-Tor() : //==============================================================================GaugeThresholdImpl::~GaugeThresholdImpl(){}//==============================================================================// GetNotifyHigh() : //==============================================================================bool GaugeThresholdImpl::GetNotifyHigh()          {  //   return (reinterpret_cast<ServerGaugeThreshold*>(GetInterface()))->GetNotifyHigh();	//IPC support	EnterCriticalSection(&m_csIpc);	bool retValue;	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("GetNotifyHigh"));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {  		IntelMobileException ex( IntelMobileText("Error retrieving NotifyHigh value"), m_sThresholdType.c_str(), IntelMobileText("GetNotifyHigh"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex ); 	}	else	{		CStringHelper::Str2Param(vectRtn[0], retValue);	 	LeaveCriticalSection(&m_csIpc);		return retValue;	}} // GetNotifyHigh()//==============================================================================// SetNotifyHigh() : //==============================================================================bool GaugeThresholdImpl::SetNotifyHigh( bool bNotifyHigh )          { 	//(reinterpret_cast<ServerGaugeThreshold*>(GetInterface()))->SetNotifyHigh( bNotifyHigh);	//bool retValue;	//IPC support	EnterCriticalSection(&m_csIpc);	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("SetNotifyHigh"));	vectParam.push_back(CStringHelper::Param2Str(bNotifyHigh));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {        IntelMobileException ex( IntelMobileText("Error setting NotifyHigh value"), m_sThresholdType.c_str(), IntelMobileText("SetNotifyHigh"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex );     }	//CStringHelper::Str2Param(vectRtn[0], retValue);	//return retValue;	LeaveCriticalSection(&m_csIpc);    return true;} // SetNotifyHigh()//==============================================================================// GetNotifyLow() : //==============================================================================bool GaugeThresholdImpl::GetNotifyLow()          {   // return (reinterpret_cast<ServerGaugeThreshold*>(GetInterface()))->GetNotifyLow();	//IPC support	EnterCriticalSection(&m_csIpc);	bool retValue;	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("GetNotifyLow"));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {		  IntelMobileException ex( IntelMobileText("Error retrieving NotifyLow value"), m_sThresholdType.c_str(), IntelMobileText("GetNotifyLow"), hr );	 	LeaveCriticalSection(&m_csIpc);            throw( ex ); 	}	else	{		CStringHelper::Str2Param(vectRtn[0], retValue);	 	LeaveCriticalSection(&m_csIpc);		return retValue;	}} // GetNotifyLow()//==============================================================================// SetNotifyLow() : //==============================================================================bool GaugeThresholdImpl::SetNotifyLow( bool bNotifyLow )          {   	//(reinterpret_cast<ServerGaugeThreshold*>(GetInterface()))->SetNotifyLow( bNotifyLow );	//IPC support	EnterCriticalSection(&m_csIpc);	bool retValue;	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("SetNotifyLow"));	vectParam.push_back(CStringHelper::Param2Str(bNotifyLow));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {        IntelMobileException ex( IntelMobileText("Error setting NotifyLow value"), m_sThresholdType.c_str(), IntelMobileText("SetNotifyLow"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex );     }	else	{		CStringHelper::Str2Param(vectRtn[0], retValue);	 	LeaveCriticalSection(&m_csIpc);		return retValue;	}	LeaveCriticalSection(&m_csIpc);    return true;} // SetNotifyLow()/*//==============================================================================// AddObserver() : //==============================================================================bool GaugeThresholdImpl::AddObserver( ObserverImpl& observer  ) {     EventClientImpl::AddObserver( Event::eThresholdHigh, observer );	return EventClientImpl::AddObserver( Event::eThresholdLow, observer );} // AddObserver()//==============================================================================// RemoveObserver() : //==============================================================================bool GaugeThresholdImpl::RemoveObserver( ObserverImpl& observer ) {     EventClientImpl::RemoveObserver( Event::eThresholdHigh, observer );	return EventClientImpl::RemoveObserver(  Event::eThresholdLow, observer );} // RemoveObserver()//==============================================================================// RemoveObservers() : //==============================================================================bool GaugeThresholdImpl::RemoveObservers( ) { 	bool bRemoved = false;	CClientImplEventManager &eventMgr = CClientImplEventManager::GetClientImplEventManagerInst();    //CEventBind  *pEb = eventMgr.GetEventBind(this, Event::eThresholdHigh );	//if (NULL != pEb)	{		bRemoved = eventMgr.RemoveObservers(Event::eThresholdHigh, this);	}		//pEb = eventMgr.GetEventBind( this, Event::eThresholdLow );	//if (NULL != pEb)	{		//return bRemoved & eventMgr.RemoveObservers(pEb->GetHandle());		return bRemoved & eventMgr.RemoveObservers( Event::eThresholdLow, this );	}    return false; } // RemoveObservers()//==============================================================================// SetObserverEvent() : //==============================================================================bool GaugeThresholdImpl::SetObserverEvent( ) { 	bool bRet = false;	Event * event = ThresholdImpl::CreateClassEvent( Event::eThresholdHigh );	bRet = EventClientImpl::UpdateEvent( Event::eThresholdHigh, *event);	delete event;	event = ThresholdImpl::CreateClassEvent( Event::eThresholdLow );	bRet &= EventClientImpl::UpdateEvent( Event::eThresholdLow, *event);	delete event;	return bRet;} // SetObserverEvent()*///==============================================================================// GetDistinctEvent() : //==============================================================================Event::EventType GaugeThresholdImpl::GetDistinctEvent( ) {     return Event::eThresholdHigh;} // GetDistinctEvent()//------------------------------------------------------------------------// // Class: ByteGaugeThreshold////------------------------------------------------------------------------//==============================================================================// C-Tor() : Constructor//==============================================================================ByteGaugeThresholdImpl::ByteGaugeThresholdImpl( Object*       pOwner,                                                unsigned char highThreshold,                                                 unsigned char lowThreshold,                                                 unsigned char offset )                      : GaugeThresholdImpl( pOwner, IntelMobileText("ByteGaugeThreshold") ){    SetHighThreshold( highThreshold );    SetLowThreshold ( lowThreshold  );    if ( offset != 0U )    {        SetOffset( offset );    }}//==============================================================================// Accessor methods//==============================================================================// GetHighThreshold() : //==============================================================================unsigned char ByteGaugeThresholdImpl::GetHighThreshold()          { 	//return reinterpret_cast<ServerByteGaugeThreshold*> (GetInterface())->GetHighThreshold();	//IPC support	EnterCriticalSection(&m_csIpc);	unsigned char retValue;	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("GetHighThreshold"));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {        IntelMobileException ex( IntelMobileText("Error retrieving HighThreshold value"), m_sThresholdType.c_str(), IntelMobileText("GetHighThreshold"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex );     }	else	{		CStringHelper::Str2Param(vectRtn[0], retValue);	 	LeaveCriticalSection(&m_csIpc);		return retValue;	}} // GetHighThreshold()//==============================================================================// SetHighThreshold() : //==============================================================================bool ByteGaugeThresholdImpl::SetHighThreshold( unsigned char highThreshold )          { 	//(reinterpret_cast<ServerByteGaugeThreshold*>(GetInterface()))->SetHighThreshold( highThreshold );		//IPC support	EnterCriticalSection(&m_csIpc);	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("SetHighThreshold"));	vectParam.push_back(CStringHelper::Param2Str(highThreshold));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {        IntelMobileException ex( IntelMobileText("Error setting HighThreshold value"), m_sThresholdType.c_str(), IntelMobileText("SetHighThreshold"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex );     }					LeaveCriticalSection(&m_csIpc);    return true;} // SetHighThreshold()//==============================================================================// GetLowThreshold() : //==============================================================================unsigned char ByteGaugeThresholdImpl::GetLowThreshold()          {    //return reinterpret_cast<ServerByteGaugeThreshold*> (GetInterface())->GetLowThreshold();	//IPC support	EnterCriticalSection(&m_csIpc);    unsigned char retValue;	vector<string> vectParam, vectRtn;	vectParam.push_back(IntelMobileText("GetLowThreshold"));		HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn);	if ( FAILED( hr ) )    {        IntelMobileException ex( IntelMobileText("Error retrieving LowThreshold value"), m_sThresholdType.c_str(), IntelMobileText("GetLowThreshold"), hr );	 	LeaveCriticalSection(&m_csIpc);        throw( ex );     }	else	{

⌨️ 快捷键说明

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