您的位置:首页 > 其它

专题一 Symbian 如何获取通信参数获取之WLan MAC

2010-01-26 16:35 169 查看
一、开发环境:

1. IDE:Carbide C++2.0

2. SDK:Symbian S60 3rd +API plug-in for S60 3rd

二、功能介绍

1.获取Symbian S60 3rd手机WLan mac地址。

2.获取Symbian S60 3rd手机WLan 状态。

三、开发说明:

1.新建Symbian OS C++ project.

2.工程类型选择:Gui Application

3.引入头文件:

#include <e32property.h>
#include <wlaninternalpskeys.h>

4.引入Lib文件:euser

5.添加Menu项:

EWLanMAC,
EWLanStatus

6.添加EWLanMAC的响应函数:

void CWLanInfoAppUi::GetWLanMacAddress()
{
TBuf8<20> address;
TInt ret=RProperty::Get(KPSUidWlan,KPSWlanMacAddress,address);
if(ret!=KErrNone)
{
if(ret==KErrNotFound)
CEikonEnv::InfoWinL(_L("WLan MAC Address /n"),_L("Not Found"));
}
else
{
TBuf<20> wlanMACAddress;
for ( TInt i = 0; i < address.Length(); i++ )
{
TUint16 addbyte = address[i];
wlanMACAddress.AppendNum( addbyte,EHex );
if(i < address.Length()-1)
wlanMACAddress.Append(_L(":"));
}
CEikonEnv::InfoWinL(_L("WLan MAC Address /n"),wlanMACAddress);
}
}
7.添加EWLanStatus的消息相应函数:

void CWLanInfoAppUi::GetWLanIndicatorStatus()
{
TInt value;
RProperty::Get(KPSUidWlan,KPSWlanIndicator,value);
CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
TBuf<25> msg;
switch(value)
{
case EPSWlanIndicatorNone:
{
msg.Copy(_L("No Wlan Indicator"));
informationNote->ExecuteLD(msg);
break;
}
case EPSWlanIndicatorAvailable:
{
msg.Copy(_L("Wlan Indicator Available"));
informationNote->ExecuteLD(msg);
break;
}
case EPSWlanIndicatorActive:
{
msg.Copy(_L("Wlan is Active"));
informationNote->ExecuteLD(msg);
break;
}
case EPSWlanIndicatorActiveSecure:
{
msg.Copy(_L("Wlan is Active & secure")); // WEP key enabled
informationNote->ExecuteLD(msg);
break;
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: