2013-06-24 71 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