2013-06-24 69 views
0

我無法找到如何從Windows 7移動寬帶API獲取服務提供商名稱。 provider.providerName總是返回一個空字符串,但在英國EE的providerID是正確的(23430)。移動寬帶 - 如何獲取服務提供商名稱

下面顯示了用於獲取此信息的片段。 Mbn接口的所有其他方面的工作 包括配置文件等,但我無法找到如何獲得名稱!

我錯過了什麼嗎? ,請問我的最後一期中有人能幫助我嗎?

注意:Windows VAN顯示服務提供商。

我非常感謝

薩拉

/// 
/// Check the reported state of this interface 

    switch (readyState) 
    { 
     case MBN_READY_STATE.MBN_READY_STATE_INITIALIZED: 

     /// interface is initialised and has active SIM 
     /// so lets get service providor information 
     /// 
     MBN_PROVIDER provider = mobileInterface.GetHomeProvider(); 

     mi.Provider = provider.providerName;  // Always "" 
     mi.ProviderID = provider.providerID;  // but this is correct 
     mi.ProviderState = provider.providerState;  // as is all this 
     mi.Signaldbm = mbnGetSignal(mi.InterfaceID); 
     mi.Signalbar = mbnConvertSignal(mi.Signaldbm); 
     mi.Message = "Ready"; 
     break; 

系統設置

的Windows 7聯想筆記本電腦,F3507g內置調制解調器

回答

0

此處提供了配置連接編程方式是我的解決方案答案: C# Read Windows Mobile Broadband connection properties

幫我通過在接口迭代,然後調用GetConnectionProfiles()傳遞接口作爲參數,然後裝載有一個XMLDocument找到摘要名稱(netsh的MBN顯示配置文件)的IMbnConnectionProfile GetProfileXMLData

的摘要名稱是XmlDocument的[「MbnProfile」] [「Name」]。InnerText

它看起來很多工作,但如果你只需要擔心一個接口和一個配置文件,你可以使用每個數組的第一個元素。我會粘貼我的代碼,但它的VB

Dim mcpm As MbnConnectionProfileManager = New MbnConnectionProfileManager() 
Dim imcpm As IMbnConnectionProfileManager = DirectCast(mcpm, IMbnConnectionProfileManager) 
Dim connectionProfiles() As IMbnConnectionProfile 


Dim mim As MbnInterfaceManager = New MbnInterfaceManager() 
Dim imim As IMbnInterfaceManager = DirectCast(mim, IMbnInterfaceManager) 
Dim interfaceArray() As IMbnInterface = imim.GetInterfaces() 

For Each i As IMbnInterface In interfaceArray 
    connectionProfiles = imcpm.GetConnectionProfiles(i) 
    For Each c As IMbnConnectionProfile In connectionProfiles 
     Dim doc As System.Xml.XmlDocument = New System.Xml.XmlDocument() 
     doc.LoadXml(c.GetProfileXmlData()) 

     cmbMBNProfileName.Items.Add(doc("MBNProfile")("Name").InnerText) 
    Next 
Next