detect the memory card

Login to reply to this topic.
Fri, 2006-07-21 07:28
Joined: 2006-04-28
Forum posts: 84
Hi all

    I m using SDK 7.0 for S60 2nd edition with codewarrior IDE. I am using Nokia 6600 for testing. Can anybody suggest a way to detect the presence of the MMC card in the phone when my application starts up.
    I checked up with RFs::DriveList() and RFs::Drive() functions but could not get info that where can i detect abt memory card. In most cases memory card have the drive letter E:, but i don't think that it is mandatory to have E: as the drive letter for memory card. Can anyone clear me on that too.
    I just want to check the presence of MMC card at the start of the application and display the dynamic menu accordingly.

Cheers!!!

Nitin Sahdev
Symbian Developer


Fri, 2006-07-21 08:44
Forum Nokia Champion
Joined: 2003-06-10
Forum posts: 720
Re: detect the memory card
The memory card on every single Symbian OS device to date has been E: (except on the N91, where it is the hard disk; the N91 does not support a removable card at all), so you can pretty much trust that if there is no E:, there is no memory card (or other additional memory like a hard disk).

Of course, the future might bring devices with more than one card,  but then those devices are not likely to be based on Symbian 7.0s/S60 2.0. Wink
Fri, 2006-07-21 14:26
Joined: 2006-04-28
Forum posts: 84
Re: detect the memory card
hi N/A
     Firstly what does this N/A mean (is it Not Applicable). Just kidding...

Thanks anyways for ur help. Earlier I got a reply from Dip who gave me the idea to use PathInfo::MemoryCardRootPath() method to get the root of the memory card, but now i have hardcoded the path to e:\\system\\apps\\xyz\\*  .  Now i just want to check that wether does E:\ drive exist or not.

For that i used the RFs::DriveList() method,to get the list of drives. What i get is a value that I m unable to read. I am using the following code.

TBuf8<50> MemoryCardPath;

RFs rfs;
rfs.Connect();
rfs.DriveList(MemoryCardPath);
rfs.Close();

when i display MemoryCardPath, it gives an unreadable sort of value. Can u explain on that a bit.

Cheers!!!

Nitin Sahdev
Symbian Developer

Mon, 2006-07-24 07:50
Joined: 2006-04-05
Forum posts: 104
Re: detect the memory card
Hi,

I'm not sure that this assumption is quite right.  It might well be valid on series 60 that the memory card drive is always E but i don't think that holds for UIQ.  (i know sahdev_nitin is using series 60 but N/A makes reference to all symbian OS devices).

I've got a P910i sitting in front of me an the QFileman application is telling me that i´ve got an:

A: (rom drive)
C:
D: (no name)
Z: (rom drive)

if i take the card out the "no name" bit dissapears and i´m just left with D:

I think sahdev_nitin was on the right lines to begin with.  i use the RFs::DriveList() and RFs::Drive() methods.  I then use the TDriveInfo.iType to get back a TMedaType (which is helpfuly not documented in my 7.0s sdk but have a look in the header and you'll see that the options are self explanitory).

PL
Mon, 2006-07-24 16:26
Joined: 2006-04-28
Forum posts: 84
Re: detect the memory card
hi petxolobo

    Ya i also used DriveList() method and it did return me the list, but is there any special distinction between a simple drive or a memory card. How can i diffrentiate between a normal drive and a memory card.
    In the description of RFs::DriveList() i got, that it will return a 26byte array for each character DriveA,DriveB....

But when i made a check at index 4, i.e DriveE then nothing was returned. Can you help on that.

Cheers!!!!

Nitin Sahdev
Symbian Developer

Wed, 2006-07-26 10:46
Joined: 2006-04-05
Forum posts: 104
Re: detect the memory card
Hi,

It's a while since I did this but here goes...

You use the RFs::DriveList to get back a list of ALL drives (ie A through Z).  This list of type TDriveList which is nothing more than an array of 8 bits chars.  The idea is that you now have an array where element zero is drive A, one is B etc.  This element will be either 1 or 0 (i think) where 1 means that the drive exists and 0 that it doesn´t.

You then loop through this list and for every drive that exists you call RFs::Drive to get back a TDriveInfo class.  You can inspect the TDriveInfo.iType element which is of the type TMediaType (which as i mentioned before isn´t documented in the 7.0s help).  TMediaType is defined in the e32std.h as:

enum TMediaType
   {
   EMediaNotPresent,
EMediaUnknown,EMediaFloppy,EMediaHardDisk,EMediaCdRom,
   EMediaRam,EMediaFlash,EMediaRom,EMediaRemote
   };

It's a bit "round the houses" but it gets you there in the end and i guess it's not something you do every other millisecond so i don't suppose you'll see a performance hit.

PL
Wed, 2006-07-26 18:20
Joined: 2006-04-28
Forum posts: 84
Re: detect the memory card
hi petxolobo

    Thnx buddy, it worked fine. I got the solution after a few hick-ups, but now its resolved. thnx.
    But still i m curious to know that if we don't use TMediaType enum, then is it possible to check what type of drive it is. Try answering if you have any sort of an idea abt it.


Cheers!!!

Nitin Sahdev
Symbian Developer

  • Login to reply to this topic.