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 11:56, 17 December 2007.

TSS000794 - Monitoring MMC insertion / removal events

From Forum Nokia Wiki


ID TSS000794 Creation date December 17, 2007
Platform S60 3rd Edition,
S60 3rd Edition, FP1
Devices  
Category Symbian C++ Subcategory Base/System

Overview

Applications can be notified about the insertion or removal of the MMC using the NotifyDiskSpace() method from class RFs.


Solution

In order to receive these events, the UI application should be made a system application to prevent it from being automatically closed when removing a memory card.

CEikonEnv::Static()->SetSystem( ETrue );
 

After this, notification requests for memory card insertion or removal can be created as follows:

const TInt64 KThreshold = 0x1000; // Threshold value for free disk space

CEikonEnv::Static()->FsSession().NotifyDiskSpace(KThreshold, EDriveE, iStatus);
SetActive();
 

RFs::NotifyDiskSpace() is an asynchronous method that completes when the threshold value is crossed (in either direction). The above code snippet is meant to be used inside a CActive-derived class.

These notifications can also be received from a non-UI application, by constructing a window group:

During the construction of a CActive-derived class:

// iWg is of type RWindowGroup*
// iWs is an open window server session (RWsSession)
// iFs is an open file server session (RFs)
   
iWg = new (ELeave) RWindowGroup( iWs );
User::LeaveIfError( iWg->Construct( (TUint32)iWg, EFalse ) );

iWg->SetOrdinalPosition( -1 );
iWg->EnableReceiptOfFocus( EFalse );
   
iWgName = CApaWindowGroupName::NewL( iWs );
iWgName->SetSystem( ETrue );
iWgName->SetHidden( ETrue );
iWgName->SetWindowGroupName( *iWg );
   
iFs.NotifyDiskSpace( KThreshold, EDriveE, iStatus );
SetActive();

Implementation of CActive::RunL():

if(iStatus == KErrNone)
  {
  // Threshold value has been crossed - memory card has been
  // inserted or removed
   
  iFs.NotifyDiskSpace(KThreshold, EDriveE, iStatus);
  SetActive();
  }

Implementation of CActive::DoCancel();

iFs.NotifyDiskSpaceCancel();


Related Discussions
Thread Thread Starter Forum Replies Last Post
Nokia mmc crashing every time carld38 Audio 0 2005-03-17 11:05
6600 mmc password soaringhigh Symbian User Interface 1 2005-02-02 11:24
Mobile Diagnostics and Monitoring-Info Need max_jung OMA DM/DS/CP 1 2005-12-02 03:02
MMC 128 mb, wont work Rodan General Discussion 1 2003-08-14 03:48
6630 & Rs-mmc snortch General Discussion 1 2005-01-22 21:00
 
Powered by MediaWiki