Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 08:29, 4 January 2008.

How to detect when a charger is connected

From Forum Nokia Wiki

This is done using GetIndicator() function from CTelephony class.

  • Libraries needed: Etel3rdParty.lib and euser.lib
  • Asynchronous call; so to cancel it use CTelephony::EGetIndicatorCancel


class CClientApp : public CActive
    {
 
private:
    CTelephony* iTelephony;
    CTelephony::TIndicatorV1 iIndicatorV1;
    CTelephony::TIndicatorV1Pckg iIndicatorV1Pckg;
public:
    CClientApp(CTelephony* aTelephony);
    void DetectCharger();
 
private:
    void RunL();
    void DoCancel();
   };
 
CClientApp::CClientApp(CTelephony* aTelephony)
    : CActive(EPriorityStandard),
      iTelephony(aTelephony),
      iIndicatorV1Pckg(iIndicatorV1)
    {
    //Constructor
    }
 
void CClientApp::DetectCharger()
    {
    iTelephony->GetIndicator(iStatus, iIndicatorV1Pckg);
    SetActive();
    }
 
void CClientApp::RunL()
    {
    if(iStatus==KErrNone)
       {
       if(iIndicatorV1.iCapabilities & CTelephony::KIndChargerConnected)
          {
          //We can detect when a charger is connected
          if(iIndicatorV1.iIndicator & CTelephony::KIndChargerConnected)
             {
               //Now, charger is connected
             }
          else
             {
               //Here, charger is not connected
             }
          }
       else
          {
             //Here, we do not know whether or not a charger is connected
          }
       }
    }
 
//To cancel this asynchronous call
void CClientApp::DoCancel()
    {
    iTelephony->CancelAsync(CTelephony::EGetIndicatorCancel);
    }




Wiki Internal Links

Related Discussions
Thread Thread Starter Forum Replies Last Post
Bug with Nokia 6230i S_S_snake General Discussion 4 2006-10-19 18:01
3650 data sync/ Desktop PC bl@bl@ General Discussion 0 2003-07-08 15:40
How to chek if application exists on device manishraj General Symbian C++ 7 2007-10-03 11:14
SDK functionality (technical) AKeskinen PC Suite API and PC Connectivity SDK 1 2003-04-29 15:36
MetroTrkProtocolPlugin:can't connected to MetroTRK pradeepmisra Carbide.c++ and CodeWarrior Tools 0 2007-01-11 14:43
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX