MIME Recoganizer
| Wed, 2005-04-27 13:14 | |
|
hi,
djgtram wrote: I have a recognizer in place, it starts my application all right when a corresponding file is clicked on in the Inbox. I am new to symbian. i want to develop a recoganizer which starts my application when a corresponding file is clicked on in the Inbox. here is my recoganizer code _LIT8( KMyMimeType, "application/vnd.mymime" ); _LIT( KDotMymime,".mym" ); // File header to look for from the data _LIT8( KMyMimeHeader, "#!MY" ); // TUid of the recognizer const TUid KUidMyMimeRecognizer = { 0x100530 } ; #define KEzRecognizerBufferSize 128 _LIT(KEzRegExe,"c:\\system\\Apps\\HelloWorld\\HelloWorld.app"); _LIT(KRegUpThreadName,"RecogExThr"); GLDEF_C TInt E32Dll(TDllReason /*aReason*/) { return(KErrNone); } EXPORT_C CApaDataRecognizerType *CreateRecognizer() { // Create a recognizer instance CApaDataRecognizerType *me = new CRecog(); return(me); } CRecog::CRecog() :CApaDataRecognizerType(KUidMyMimeRecognizer, CApaDataRecognizerType::EHigh ) { iCountDataTypes=1; } TUint CRecog::PreferredBufSize() { return(KEzRecognizerBufferSize); } TDataType CRecog::SupportedDataTypeL(TInt /*aIndex*/) const { return(TDataType(KMyMimeType)); } void CRecog::DoRecognizeL(TDesC& aName, const TDesC8& aBuffer) { // Initialise the result status iConfidence = ENotRecognized; iDataType = TDataType(KMyMimeType); // Check that we got the required amount of data if(aBuffer.Length()<KEzRecognizerBufferSize) return; // Check that the file name corresponds to our criteria TBool nameOK(EFalse); nameOK=NameRecognized(aName); // Check that the data corresponds to our criteria TBool headerOK(EFalse); headerOK=HeaderRecognized(aBuffer); if( nameOK && headerOK) { iConfidence=ECertain; } else if(!nameOK && headerOK) { iConfidence=EPossible; } else return; } TBool CRecog::NameRecognized(const TDesC& aName) { TBool res=EFalse; if(aName.Length()>5) { TInt dotPos = aName.LocateReverse( '.' ); if (dotPos != KErrNotFound) { TInt extLength = aName.Length() - dotPos; HBufC* ext = aName.Right( extLength ).AllocL(); CleanupStack::PushL( ext ); if ( ext->CompareF(KDotMymime) == 0 ) { res = ETrue; } CleanupStack::PopAndDestroy(); // ext } } return(res); } TBool CRecog::HeaderRecognized(const TDesC8& aBuf) { if(aBuf.Find(KMyMimeHeader)==0) return ETrue; return EFalse; } Is there is any change that i have to do in my Recoganizer code? in .mmp file TARGET RecogEx.mdl TARGETTYPE mdl UID 0x10003A19 0x01EF0010 TARGETPATH \system\recogs\ SOURCEPATH ..\src SOURCE RecogEx.cpp USERINCLUDE ..\inc SYSTEMINCLUDE \epoc32\include LIBRARY euser.lib LIBRARY apmime.lib apparc.lib apgrfx.lib LIBRARY efsrv.lib flogger.lib in 01EF0010.ini SDDataDir=c:\system\Apps\HelloWorld\HelloWorld.app It should start HelloWorld.app when a test.mym file is clicked on in the Inbox. apart from the above, i am creating .rss file which contains the following code / // MyFirmApp.RSS // #include <aiftool.rh> RESOURCE AIF_DATA { // Example application's app_uid = 0x10005b8e; // Number of icons to be included in AIF file num_icons = 1; // Application capabilities. // Viewer applications in Series60 must support embedding embeddability = KAppEmbeddable; hidden=KAppNotHidden; // MIME types application supports datatype_list= { DATATYPE { priority = EDataTypePriorityNormal; type = "application/vnd.mymime"; } }; } // AIF_DATA app_uid = 0x10005b8e i want to know this 0x10005b8e(this for .rss to create .aif file) is different from 0x01EF0010 (this is from recoganizer.mmp) or same id i have to use. i have created .aif file for MyFirmApp.RSS using aif tool. but i don't know where to specify the .aif file. i have done the above steps. Apart from this what are the other steps that I have to do to get it work. In document handler pdf file, there are following 4 steps : 1. Declare default document name in resources. 2. Check the Embedding Status of Your Application 3. Delegate the exit mode to the observer. 4. Overload CAknDocument: OpenFileL function How to achieve the above four steps? If you have any example or step by step procedure, pls give it to me otherwise guide me how to go about it. |
|





