31 October 2005

Do action for all files in some directory on all drives in Symbian

In SDL there is a useful sample of how to run through all files in directory:


void ForAllMatchingFiles(RFs& aSession, const TDesC& aWildName, const TDesC& aScanDir)
{
TFindFile file_finder(aSession);
CDir* file_list;
TInt err = file_finder.FindWildByDir(aWildName,aScanDir, file_list);
while (err==KErrNone)
{
TInt i;
for (i=0; i < Count(); i++)
{
TParse fullentry;
fullentry.Set((*file_list)[i].iName, &file_finder.File(),NULL);

// Do something with the full Symbian OS filename

DoOneFile(aSession, fullentry.FullName());
}
delete file_list;
err=file_finder.FindWild(file_list);
}
}

26 October 2005

Pics of Symbian smartphone Nokia N71 prototype

In the Internet show up pictures of prototype of the new Nokia Symbian-smartphone N71. Here is the link. And here is one of the pictures:

More about writable descriptor

Code in previous post about writable descriptor was related to use members of class. If you need the descriptor only in small pieceof code then you can write like this:

TPtr8 iWriteDes(iHeapDes->Des());

22 October 2005

How to convert TInt64 to string on Symbian?

Sometimes you need to display some TInt64 on screen so you need to convert it to string representation. But unfortunately you can’t display it using Format() function of Symbian descriptors. What to do? You have to use functions AppendNum() or Num() which can take as parameter TInt64. Code will look like this:

    TInt64 n = 123456789;
    TBuf<64> tInt64;
    tInt64.AppendNum( n );
    tSomeString.Format( “I have this value - %S”, &tInt64 );

20 October 2005

How to assign writable descriptor in Symbian

When you need a writable descriptor like TDes8 to pass as reference into a function ( like FillMyDes(TDes8& aDes) ), and later this function will fill it with data, you probably want to allocate this descriptor in Symbian heap. So you are writing this code:

    HBufC8* iHeapDes = HBufC8::NewL(KSIZE);

And then you want to store writable descriptor for later use like this:

    TPtr8 iWriteDes(NULL,0);
    iWriteDes = iHeapDes->Des();

But iWriteDes don’t becomes what you really wanted. Because you make mistake in previous line of code, you haven’t assigned descriptor, you just trieв to copy the data contained in heap descriptor to you writable descriptor. The right code will look like this:

    iWriteDes.Set( iHeapDes->Des() );

Now you got correct writable descriptor in iWriteDes.

19 October 2005

How to kill another process by its name

This code snippet will kill process with name KPROCNAME

TFullName theName;
TFindProcess process;
while ( process.Next( theName ) != KErrNotFound )
{
if ( ( theName.Find( KPROCNAME ) != KErrNotFound ) )
{
RProcess aProcess;
aProcess.Open( process );
aProcess.Kill(0);
aProcess.Close();
}
}

18 October 2005

Do you know how to convert to AMR using CMMFCodec?

This task can be tricky because of lack of the documentation on AMR-NB codec in Symbian. The following code will work on Series 60 2.0 devices:

First of all we declare missing declaration from old AmrCodec.h from Series 60 1.0 SDK:

class TAmrEncParams

{

public:

inline TAmrEncParams();

public:

TInt iMode; // encoding mode 0-7 (0=MR475,1=MR515,...,7=MR122,
default 7)


TInt iDTX; // DTX flag (TRUE or default FALSE)

};

TAmrEncParams::TAmrEncParams() :

iMode(7), iDTX(0) {}

And we will also declare UIDs of AMR codecs:

#define KAdvancedUidCodecPCM16ToAMR 0x101FAF68
#define KAdvancedUidCodecAMRToPCM16 0x101FAF67

This is the function that convers PCM data to AMR-NB (note that CMMFPtrBuffer class you can use only on Series 60 2.0 FP2 SDK, on earlier SDKs you have to use CMMFDescriptorBuffer). Size of aDes parameter is supposed to be equal to 320 bytes.

HBufC8* ConvertFromPCMToAMRNBL( const TPtr8& aDes, TInt aMode )

{

TAmrEncParams taepParams;

taepParams.iMode = aMode;

cmmfcCodec = CMMFCodec::NewL(TUid::Uid(KAdvancedUidCodecPCM16ToAMR ));

CleanupStack::PushL( cmmfcCodec );

cmmfcCodec->ConfigureL( TUid::Uid(KAdvancedUidCodecPCM16ToAMR), ( const TDesC8& ) taepParams );
ptrbPCM16 = CMMFPtrBuffer::NewL();

CleanupStack::PushL( ptrbPCM16 );

ptrbPCM16->SetPtr( aDes );

desbAMRNB = CMMFDescriptorBuffer::NewL( 32 );

CleanupStack::PushL( desbAMRNB );

TCodecProcessResult result = cmmfcCodec->ProcessL( * ptrbPCM16, * desbAMRNB );

if ( ( result.iStatus != TCodecProcessResult::EProcessComplete )

( result.iSrcBytesProcessed != ( TUint ) aDes.Length() ) )

return NULL;

CleanupStack::Pop( 2 ); // cmmfcCodec, ptrbPCM16

HBufC8* pAMRData = desbAMRNB->Data().AllocL();

CleanupStack::Pop( 1 ); // desbAMRNB

return pAMRData;

}

16 September 2005

ScreenFTP

Did you hear something about this very interesting software ScreenFTP?  This is a new concept of transferring information between PC and your phone. This software uses PC’s display and phones camera to transfer data between PC and phone. Speed of this data channel reaches 1.3 Kbps. They have developed this application for Nokia 6600 phone. You can download it from the site and try to use on your phone.  

09 August 2005

Full duplex audio on Nokia 6630, 6680

There is first known application "Useful Skype Phone for Nokia 6630, 6680" that uses full duplex audio feature on the Nokia 6630, Nokia 6680 phone.
I hope soon this feature will be at public access to all developers.

05 August 2005

There is new newsgroup at publicnews.symbiandevnet.com news-server

New group is called discussion.Symbian.Signed. As written in welcome to the group:
"Just as with the other newsgroups on this server, Symbian has created discussion.Symbian.Signed to be a free, public, self-help discussion forum fordevelopers using the Symbian Signed process. Please feel free to post (andanswer!) any questions about Symbian Signed in this group instead of in theother ones on this server. Again, just like the other groups, this forum will beread/monitored by Symbian staff who will respond on a 'best effort' basis to tryand help the community, but we can't offer any *guaranteed* answers in any fixedtime-frame. As usual, however, we will do our best! We will also attempt to turnany questions which arise regularly in to FAQs to help other developers infuture."
news://publicnews.symbiandevnet.com/discussion.Symbian.Signed

04 August 2005

EHeretic - port of the Raven/Id first person shooter game Heretic to the A92x, A1000, Pxxx phones.

Another port of shooter to the Symbian. Main interest to developer - code of the game is open source.
http://home.comcast.net/~stevesprojects/#EHeretic

symbiancodex.com



There is a new site http://www.symbiancodex.com/ created by Simon Judge. The idea of this site is to create search mechanism through the most of opened code sources for Symbian in public access. Sometimes it's more effective than searching across all of the Internet via Google.