专题一 Symbian如何获取通讯参数之Signal Strength

一、开发环境

   IDE:Carbide.C++2.0

   SDK:S60 3rd

二、功能介绍

   获取手机信号的强弱(Signal Strength)。

三、开发说明

   S60 3rd版本中,手机信号量的获取与之前的版本有很大的区别。主要是通过CTelephony的GetNetworkInfo()函数获取,本文提供的是SDK中的一个例子:

#include <e32base.h>
#include <Etel3rdParty.h>

class CClientApp : public CActive
    {

private:
    CTelephony* iTelephony;
    CTelephony::TSignalStrengthV1 iSigStrengthV1;
    CTelephony::TSignalStrengthV1Pckg iSigStrengthV1Pckg;

public:
    CClientApp(CTelephony* aTelephony);
    void SomeFunction();

private:
    /*
       These are the pure virtual methods from CActive that
       MUST be implemented by all active objects
       */
    void RunL();
    void DoCancel();
   };

CClientApp::CClientApp(CTelephony* aTelephony)
    : CActive(EPriorityStandard),
      iTelephony(aTelephony),
      iSigStrengthV1Pckg(iSigStrengthV1)
    {
    //default constructor
    }

void CClientApp::SomeFunction()
    {
    iTelephony->GetSignalStrength(iStatus, iSigStrengthV1Pckg);
    SetActive();
    }

void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       TInt32 sigStrength = iSigStrengthV1.iSignalStrength;
       TInt8 bar = iSigStrengthV1.iBar;
       }
    }

void CClientApp::DoCancel()
    {
    iTelephony->CancelAsync(CTelephony::EGetSignalStrengthCancel);
    }

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值