📄 instance_linkprotocol.cpp
字号:
pThis->Unlock(); }catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043149"); }}//============================================================================void LinkProtocol_StateClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_StateClass::GetValueImpl()") ); static IntelMobileLinkProtocolProtocolStateEnum StateArray[4] = { LinkProtocolProtocolStateEnum::DeviceNotPresent, LinkProtocolProtocolStateEnum::DevicePresent, LinkProtocolProtocolStateEnum::MediaPresent, LinkProtocolProtocolStateEnum::NonZeroIpAddress}; DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try { pThis->Lock(); netdev_dev netdev; if(netdev_get_device(pThis->GetKey().c_str(), netdev) != NETDEV_SUCCESS) { pThis->Unlock(); throw; } netdev_enabled enabled; netdev_running running; netdev_ipaddr ipaddr; char index = 0; if(netdev_get_enabled(netdev, enabled) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } if(netdev_get_running(netdev, running) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } if(netdev_get_ipaddr(netdev, ipaddr) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } if(enabled == ENABLED_UP) { index = 1; if(running = RUNNING_RUN) { index += 1; if(ipaddr != 0) { index += 1; } } } this->SetValueImpl(StateArray[index]); pThis->Unlock(); } catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043143"); }}//=============================================================================void LinkProtocol_IdClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_Idclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try{ this->SetValueImpl(pThis->GetKey()); } catch(...) { THROWIMEXCEPTION("80043147"); }}//============================================================================void LinkProtocol_DeviceIdClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_DeviceIdclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try{ this->SetValueImpl(pThis->GetKey()); }catch(...) { THROWIMEXCEPTION("80043147"); }}//=============================================================================void LinkProtocol_FullDeviceIdClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_FullDeviceIdclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try{ this->SetValueImpl(pThis->GetKey()); }catch(...) { THROWIMEXCEPTION("80043147"); }}//=============================================================================void LinkProtocol_MaxLinkSpeedClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_MaxLinkSpeedclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try{ pThis->Lock(); netdev_dev netdev; if(netdev_get_device(pThis->GetKey().c_str(), netdev) != NETDEV_SUCCESS) { pThis->Unlock(); throw; } netdev_type type; if(netdev_get_type(netdev, type) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } const IntelMobileUInt64 maxLinkSpeed8023 = 10000000; //10Mbps const IntelMobileUInt64 maxLinkSpeed80211 = 11000000; //11Mbps const IntelMobileUInt64 maxLinkSpeedBluetooth = 721000; //721Kbps switch(type){ case TYPE_802_3: this->SetValueImpl(maxLinkSpeed8023); break; case TYPE_802_11: this->SetValueImpl(maxLinkSpeed80211); break; case TYPE_BLUETOOTH: this->SetValueImpl(maxLinkSpeedBluetooth); break; case TYPE_UNKNOWN: default: this->SetNull(true); } pThis->Unlock(); } catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043148"); }}//=============================================================================void LinkProtocol_OidsClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_Oidsclass::GetValueImpl()") ); this->SetNull(true);}//=============================================================================void LinkProtocol_OidDescriptionsClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_OidDescriptionsclass::GetValueImpl()") ); this->SetNull(true);}//==============================================================================void LinkProtocol_IpAddressClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_IpAddressclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = reinterpret_cast<DefaultLinkProtocolInstanceObject*>(_pThis); if ( !pThis ) return; try { pThis->Lock(); netdev_dev netdev; if(netdev_get_device(pThis->GetKey().c_str(), netdev) != NETDEV_SUCCESS) { pThis->Unlock(); throw; } netdev_ipaddr ipaddr; if(netdev_get_ipaddr(netdev, ipaddr) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } //convert integer to string struct in_addr inaddr; inaddr.s_addr = ipaddr; IntelMobileString IpAddress(inet_ntoa(inaddr)); this->SetValueImpl ( IpAddress ); pThis->Unlock(); } catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043145"); }}//==========================================================================void LinkProtocol_MacAddressClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: LinkProtocol_MacAddressclass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = (DefaultLinkProtocolInstanceObject*)_pThis; if ( !pThis ) return; try { pThis->Lock(); netdev_dev netdev; if(netdev_get_device(pThis->GetKey().c_str(), netdev) != NETDEV_SUCCESS) { pThis->Unlock(); throw; } netdev_hwaddr hwaddr; if(netdev_get_hwaddr(netdev, hwaddr) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } if(this->GetSize()!=6) { this->Clear(); for(int i=0; i<6; i++) { this->InsertValueImpl(hwaddr[i]); } } else { for(int i=0; i<6; i++) this->SetValueImpl(i, hwaddr[i]); } pThis->Unlock(); } catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043183"); }}//==========================================================================void LinkProtocol_MulticastAddressesClass::GetValueImpl(){ _Log( LOG_DEBUG_DEVICE, IntelMobileText("Trace: MulticastAddressesClass::GetValueImpl()") ); DefaultLinkProtocolInstanceObject* pThis = (DefaultLinkProtocolInstanceObject*)_pThis; if ( !pThis ) return; try{ pThis->Lock(); netdev_dev netdev; if(netdev_get_device(pThis->GetKey().c_str(), netdev) != NETDEV_SUCCESS) { pThis->Unlock(); throw; } vector<netdev_maddr> maddr_list; if(netdev_get_multicast(netdev, maddr_list) != NETDEV_SUCCESS) { this->SetNull(true); pThis->Unlock(); return; } this->Clear(); vector<netdev_maddr>::iterator itr = maddr_list.begin(); for(; itr != maddr_list.end(); itr++) { struct in_addr inaddr; inaddr.s_addr = *itr; IntelMobileString MultiAddress(inet_ntoa(inaddr)); this->InsertValueImpl(MultiAddress); } pThis->Unlock(); } catch(...) { pThis->Unlock(); THROWIMEXCEPTION("80043185"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -