📄 instance_bandwidth.cpp
字号:
{ try { float socketRxRate = 0; if ((::GetSessionMeasuredRateRx(socketid, &socketRxRate))==BW_RET_OK) return socketRxRate; else return INVALID_GET_DATA; } catch(...) { //THROWIMEXCEPTION(8004328F); }}float BandwidthInstanceObject::GetEffectiveSessionLimitTx( unsigned __int64 socketid ){ try { float effctiveSessionLimitTx =0; if ((::GetEffectiveLimitSessionTx(socketid,&effctiveSessionLimitTx))==BW_RET_OK || (::GetEffectiveLimitSessionTx(socketid,&effctiveSessionLimitTx))==BW_RET_FALSE) return effctiveSessionLimitTx; else { /* if (effctiveSessionLimitTx <0)*/ return INVALID_GET_DATA; /*else return effctiveSessionLimitTx;*/ } } catch(...) { //THROWIMEXCEPTION(80043292); }}float BandwidthInstanceObject::GetEffectiveSessionLimitRx( unsigned __int64 socketid ){ try { float effctiveSessionLimitRx =0; if ((::GetEffectiveLimitSessionRx(socketid,&effctiveSessionLimitRx)) == BW_RET_OK || (::GetEffectiveLimitSessionRx(socketid,&effctiveSessionLimitRx)) == BW_RET_FALSE) return effctiveSessionLimitRx; else { /* if (effctiveSessionLimitRx <0)*/ return INVALID_GET_DATA; /*else return effctiveSessionLimitRx;*/ } } catch(...) { //THROWIMEXCEPTION(80043293); }}bool BandwidthInstanceObject::GetSessionAdaptivelyLimitable( unsigned __int64 socketid ){ try { SessionEntry sessionentry; ::GetSession(socketid,&sessionentry); return sessionentry.Stats.AdaptivelyLimitable; return NULL; } catch(...) { //THROWIMEXCEPTION(800432A1); }}bool BandwidthInstanceObject::GetSessionAdaptive( unsigned __int64 socketid ){ try { SessionEntry sessionentry; ::GetSession(socketid,&sessionentry); return sessionentry.Stats.Adaptive; return NULL; } catch(...) { //THROWIMEXCEPTION(800432A2); }}bool BandwidthInstanceObject::SetSessionAdaptive( unsigned __int64 socketid, bool IsAdaptive ){ try { if (IsAdaptive) { if ((::EnableSessionAdaptive(socketid,false)) == BW_RET_OK) return true; else return false; } else { if ((::DisableSessionAdaptive(socketid,false)) == BW_RET_OK) return true; else return false; } } catch(...) { //THROWIMEXCEPTION(80043294); }}bool BandwidthInstanceObject::GetSessionLimitedTx( unsigned __int64 socketid ){ try { SessionEntry sessionentry; if ((::GetSession(socketid,&sessionentry)) == BW_RET_OK) return sessionentry.Stats.Tx.Limited; //else //THROWIMEXCEPTION(80043295); } catch(...) { //THROWIMEXCEPTION(80043295); }}bool BandwidthInstanceObject::GetSessionLimitedRx( unsigned __int64 socketid ){ try { SessionEntry sessionentry; ::GetSession(socketid,&sessionentry); return sessionentry.Stats.Rx.Limited; } catch(...) { //THROWIMEXCEPTION(80043296); }}bool BandwidthInstanceObject::SetSessionLimitedTx( unsigned __int64 socketid, bool IsLimited ){ try { if(IsLimited) { if ((::EnableSessionLimitTx(socketid,false))==BW_RET_OK) return true; else return false; } else { if ((::DisableSessionLimitTx(socketid,false))==BW_RET_OK) return true; else return false; } } catch(...) { //THROWIMEXCEPTION(80043297); }}bool BandwidthInstanceObject::SetSessionLimitedRx( unsigned __int64 socketid, bool IsLimited ){ try { if (IsLimited) { if ( (::EnableSessionLimitRx(socketid,false)) ==BW_RET_OK ) return true; else return false; } else { if ((::DisableSessionLimitRx(socketid,false)) == BW_RET_OK) return true; else return false; } } catch(...) { //THROWIMEXCEPTION(80043298); }}//==============================================================================//==============================================================================//// Bandwidth Properties////==============================================================================//==============================================================================void BandwidthTheoreticalSystemRateTxClass::GetValueImpl(){ try { ServerLinkProtocolInstanceObject *pLinkProtocolInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; unsigned __int64 pSystemMaxTxRate = 0; ServerInstanceCollection* pLinkProtocolInstanceCollection = NULL; if (pLinkProtocolInstanceCollection = ((ServerLinkProtocolClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("LinkProtocol")))).GetInstances()) { pLinkProtocolInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pLinkProtocolInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pLinkProtocolInstanceCollection->Next( (ServerInstanceObject**)&pLinkProtocolInstance, &iEnumIndex, iChangedIndex ) ) break; else { /* if (pSystemMaxTxRate < (pLinkProtocolInstance->MaxLinkSpeed).GetValue()) { pSystemMaxTxRate = (pLinkProtocolInstance->MaxLinkSpeed).GetValue(); } */ unsigned __int64 protocolsupportedMaxTxRate =0; for (unsigned int i =0; i < pLinkProtocolInstance->DataRatesTx.GetSize();i++) { if (protocolsupportedMaxTxRate < pLinkProtocolInstance->DataRatesTx.GetValue(i)) protocolsupportedMaxTxRate =pLinkProtocolInstance->DataRatesTx.GetValue(i); } if (pSystemMaxTxRate < protocolsupportedMaxTxRate) pSystemMaxTxRate = protocolsupportedMaxTxRate; else if (!(bHasNext = pLinkProtocolInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } } else this->SetNull( true ); } this->SetValueImpl((float )pSystemMaxTxRate/1000); } catch(ServerException se) { if (se.IfServerBaseObjectException()) { ServerException nse(IntelMobileText("80043290")); nse.SetParent( &se ); throw nse; } throw se; } catch(...) { //THROWIMEXCEPTION(80043290); }}void BandwidthTheoreticalSystemRateRxClass::GetValueImpl(){ try { ServerLinkProtocolInstanceObject *pLinkProtocolInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; unsigned __int64 pSystemMaxRxRate = 0; ServerInstanceCollection* pLinkProtocolInstanceCollection = NULL; if (pLinkProtocolInstanceCollection = ((ServerLinkProtocolClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("LinkProtocol")))).GetInstances()) { pLinkProtocolInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pLinkProtocolInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pLinkProtocolInstanceCollection->Next( (ServerInstanceObject**)&pLinkProtocolInstance, &iEnumIndex, iChangedIndex ) ) break; else { /* if (pSystemMaxTxRate < (pLinkProtocolInstance->MaxLinkSpeed).GetValue()) { pSystemMaxTxRate = (pLinkProtocolInstance->MaxLinkSpeed).GetValue(); } */ unsigned __int64 protocolsupportedMaxRxRate =0; for (unsigned int i =0; i < pLinkProtocolInstance->DataRatesRx.GetSize();i++) { if (protocolsupportedMaxRxRate < pLinkProtocolInstance->DataRatesRx.GetValue(i)) protocolsupportedMaxRxRate =pLinkProtocolInstance->DataRatesRx.GetValue(i); } if (pSystemMaxRxRate < protocolsupportedMaxRxRate) pSystemMaxRxRate = protocolsupportedMaxRxRate; else if (!(bHasNext = pLinkProtocolInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } } else this->SetNull( true ); } this->SetValueImpl((float )pSystemMaxRxRate/1000); } catch(ServerException se) { if (se.IfServerBaseObjectException()) { ServerException nse(IntelMobileText("80043291")); nse.SetParent( &se ); throw nse; } throw se; } catch(...) { //THROWIMEXCEPTION(80043291); }}void BandwidthSystemRateTxClass::GetValueImpl(){ try { /* ServerNetworkAdapterInstanceObject *pNetworkAdapterInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; unsigned __int64 pSystemTxRate = 0; ServerInstanceCollection* pNetworkAdapterInstanceCollection = NULL; if (pNetworkAdapterInstanceCollection = ((ServerNetworkAdapterClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("NetworkAdapter"))).GetInstances()) { pNetworkAdapterInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pNetworkAdapterInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pNetworkAdapterInstanceCollection->Next( (ServerInstanceObject**)&pNetworkAdapterInstance, &iEnumIndex, iChangedIndex ) ) break; else { pSystemTxRate += ((BandwidthInstanceObject*)(this->_pThis))->GetTxRateByAdapter(pNetworkAdapterInstance->GetKey()); } if (!(bHasNext = pNetworkAdapterInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } } this->SetValue( pSystemTxRate ); */ ServerLinkProtocolInstanceObject *pLinkProtocolInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; float pSystemTxRate = 0; ServerInstanceCollection* pLinkProtocolInstanceCollection = NULL; if (pLinkProtocolInstanceCollection = ((ServerLinkProtocolClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("LinkProtocol")))).GetInstances()) { pLinkProtocolInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pLinkProtocolInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pLinkProtocolInstanceCollection->Next( (ServerInstanceObject**)&pLinkProtocolInstance, &iEnumIndex, iChangedIndex ) ) break; else { //pSystemTxRate += ((BandwidthInstanceObject*)(this->_pThis))->GetTxRateByProtocol(pLinkProtocolInstance->GetKey()); pSystemTxRate += GetTxRateByProtocol(pLinkProtocolInstance->GetKey()); } if (!(bHasNext = pLinkProtocolInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } } this->SetValueImpl( pSystemTxRate/1000 ); } catch(ServerException se) { if (se.IfServerBaseObjectException()) { ServerException nse(IntelMobileText("80043285")); nse.SetParent( &se ); throw nse; } throw se; } catch(...) { //THROWIMEXCEPTION(80043285); }}void BandwidthSystemRateRxClass::GetValueImpl(){ try { /* ServerNetworkAdapterInstanceObject *pNetworkAdapterInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; unsigned __int64 pSystemRxRate = 0; ServerInstanceCollection* pNetworkAdapterInstanceCollection = NULL; if (pNetworkAdapterInstanceCollection = ((ServerNetworkAdapterClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("NetworkAdapter"))).GetInstances()) { pNetworkAdapterInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pNetworkAdapterInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pNetworkAdapterInstanceCollection->Next( (ServerInstanceObject**)&pNetworkAdapterInstance, &iEnumIndex, iChangedIndex ) ) break; else { pSystemRxRate += ((BandwidthInstanceObject*)(this->_pThis))->GetRxRateByAdapter(pNetworkAdapterInstance->GetKey()); } if (!(bHasNext = pNetworkAdapterInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } } this->SetValue( pSystemRxRate ); */ ServerLinkProtocolInstanceObject *pLinkProtocolInstance; long iChangedIndex = 0; // to act like client int iEnumIndex = 0; float pSystemRxRate = 0; ServerInstanceCollection* pLinkProtocolInstanceCollection = NULL; if (pLinkProtocolInstanceCollection = ((ServerLinkProtocolClassObject&)(GetLayer()->GetLayerClassObject(IntelMobileText("LinkProtocol")))).GetInstances()) { pLinkProtocolInstanceCollection->Reset(&iChangedIndex); bool bHasNext; if ( bHasNext = pLinkProtocolInstanceCollection->HasNext(iEnumIndex, iChangedIndex )) { while ( bHasNext ) { if ( !pLinkProtocolInstanceCollection->Next( (ServerInstanceObject**)&pLinkProtocolInstance, &iEnumIndex, iChangedIndex ) ) break; else { //pSystemRxRate += ((BandwidthInstanceObject*)(this->_pThis))->GetRxRateByProtocol(pLinkProtocolInstance->GetKey()); pSystemRxRate += GetRxRateByProtocol(pLinkProtocolInstance->GetKey()); } if (!(bHasNext = pLinkProtocolInstanceCollection->HasNext( iEnumIndex, iChangedIndex ))) break; } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -