📄 gaugethreshold_impl.cpp
字号:
CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetLowThreshold()//==============================================================================// SetLowThreshold() : //==============================================================================bool ByteGaugeThresholdImpl::SetLowThreshold( unsigned char lowThreshold ) { //(reinterpret_cast<ServerByteGaugeThreshold*>(GetInterface()))->SetLowThreshold( lowThreshold ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetLowThreshold")); vectParam.push_back(CStringHelper::Param2Str(lowThreshold)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting LowThreshold value"), m_sThresholdType.c_str(), IntelMobileText("SetLowThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetLowThreshold()//==============================================================================// GetOffset() : //==============================================================================unsigned char ByteGaugeThresholdImpl::GetOffset() { //return reinterpret_cast<ServerByteGaugeThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); unsigned char retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetOffset")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error retrieving Offset value"), m_sThresholdType.c_str(), IntelMobileText("GetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetOffset()//==============================================================================// SetOffset() : //==============================================================================bool ByteGaugeThresholdImpl::SetOffset( unsigned char offset ) { //(reinterpret_cast<ServerByteGaugeThreshold*>(GetInterface()))->SetOffset( offset ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetOffset")); vectParam.push_back(CStringHelper::Param2Str(offset)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Offset value"), m_sThresholdType.c_str(), IntelMobileText("SetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetOffset()//==============================================================================// GetInterface() : Returns the interface pointer, having instantiated it if needed.//==============================================================================void* ByteGaugeThresholdImpl::GetInterface(){ //cout << "m_pSvrThresholdObject " << m_pSvrThresholdObject << endl; EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("ByteGaugeThreshold")); //IPC support m_sName = "ByteGaugeThreshold"; m_nDataType = ID_TYPE_THRESHOLD; vector<string> vectParam, vectRtn; vectParam.push_back(CStringHelper::Param2Str(m_sName)); //printf("want to send %s\n",vectParam[0].c_str()); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, /*GetSvrObj()*/NULL, vectParam, vectRtn); //now GetSvrObj() should be null if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting GetInterface value"), m_sThresholdType.c_str(), IntelMobileText("GetInterface"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else CStringHelper::Str2Param(vectRtn[0], (int &)m_pSvrThresholdObject); //printf("getted %s\n",vectRtn[0].c_str()); } LeaveCriticalSection(&m_csIpc); return m_pSvrThresholdObject;} // GetInterface()// END CLASS DEFINITION GaugeThreshold//------------------------------------------------------------------------// // Class: IntGaugeThreshold////------------------------------------------------------------------------//==============================================================================// C-Tor() : Explicit constructor//==============================================================================IntGaugeThresholdImpl::IntGaugeThresholdImpl( Object* pOwner, int highThreshold, int lowThreshold, int offset ) : GaugeThresholdImpl( pOwner, IntelMobileText("IntGaugeThreshold") ){ SetHighThreshold( highThreshold ); SetLowThreshold ( lowThreshold ); if ( offset != 0 ) { SetOffset( offset ); }}//==============================================================================// Accessor methods//==============================================================================// GetHighThreshold() : //==============================================================================int IntGaugeThresholdImpl::GetHighThreshold() { //return reinterpret_cast<ServerIntGaugeThreshold*> (GetInterface())->GetHighThreshold(); //IPC support EnterCriticalSection(&m_csIpc); int 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 IntGaugeThresholdImpl::SetHighThreshold( int highThreshold ) { //(reinterpret_cast<ServerIntGaugeThreshold*>(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() : //==============================================================================int IntGaugeThresholdImpl::GetLowThreshold() { //return reinterpret_cast<ServerIntGaugeThreshold*> (GetInterface())->GetLowThreshold(); //IPC support EnterCriticalSection(&m_csIpc); int 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 { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetLowThreshold()//==============================================================================// SetLowThreshold() : //==============================================================================bool IntGaugeThresholdImpl::SetLowThreshold( int lowThreshold ) { //(reinterpret_cast<ServerIntGaugeThreshold*>(GetInterface()))->SetLowThreshold( lowThreshold ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetLowThreshold")); vectParam.push_back(CStringHelper::Param2Str(lowThreshold)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting LowThreshold value"), m_sThresholdType.c_str(), IntelMobileText("SetLowThreshold"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetLowThreshold()//==============================================================================// GetOffset() : //==============================================================================int IntGaugeThresholdImpl::GetOffset() { //return reinterpret_cast<ServerIntGaugeThreshold*> (GetInterface())->GetOffset(); //IPC support EnterCriticalSection(&m_csIpc); int retValue; vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("GetOffset")); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error retrieving Offset value"), m_sThresholdType.c_str(), IntelMobileText("GetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else { CStringHelper::Str2Param(vectRtn[0], retValue); LeaveCriticalSection(&m_csIpc); return retValue; }} // GetOffset()//==============================================================================// SetOffset() : //==============================================================================bool IntGaugeThresholdImpl::SetOffset( int offset ) { //(reinterpret_cast<ServerIntGaugeThreshold*>(GetInterface()))->SetOffset( offset ); //IPC support EnterCriticalSection(&m_csIpc); vector<string> vectParam, vectRtn; vectParam.push_back(IntelMobileText("SetOffset")); vectParam.push_back(CStringHelper::Param2Str(offset)); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, GetInterface(), vectParam, vectRtn); if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting Offset value"), m_sThresholdType.c_str(), IntelMobileText("SetOffset"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } LeaveCriticalSection(&m_csIpc); return true;} // SetOffset()//==============================================================================// GetInterface() : Returns the interface pointer, having instantiated it if needed.//==============================================================================void* IntGaugeThresholdImpl::GetInterface(){ EnterCriticalSection(&m_csIpc); if (m_pSvrThresholdObject == NULL) { //m_pSvrThresholdObject = GetNewServerThreshold(IntelMobileText("IntGaugeThreshold")); //IPC support m_sName = "IntGaugeThreshold"; m_nDataType = ID_TYPE_THRESHOLD; vector<string> vectParam, vectRtn; vectParam.push_back(CStringHelper::Param2Str(m_sName)); //printf("want to send %s\n",vectParam[0].c_str()); HRESULT hr = GetIpcClient()->IpcCall(m_nDataType, /*GetSvrObj()*/NULL, vectParam, vectRtn); //now GetSvrObj() should be null if ( FAILED( hr ) ) { IntelMobileException ex( IntelMobileText("Error setting GetInterface value"), m_sThresholdType.c_str(), IntelMobileText("GetInterface"), hr ); LeaveCriticalSection(&m_csIpc); throw( ex ); } else CStringHelper::Str2Param(vectRtn[0], (int &)m_pSvrThresholdObject); //printf("getted %s\n",vectRtn[0].c_str()); } LeaveCriticalSection(&m_csIpc); return m_pSvrThresholdObject;} // GetInterface()// END CLASS DEFINITION GaugeThreshold//------------------------------------------------------------------------// // Class: UIntGaugeThreshold////------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -