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

一、开发环境:

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; 
      }     
     }   
 }          

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值