Enumerating MTM's??

Login to reply to this topic.
Mon, 2004-07-26 14:57
Joined: 2004-06-11
Forum posts: 404
Hi All,
How do I enumerate all the MTM's registered on a device?
What classes are to be used and are there any code examples present?
Thanks and Regards.
--Mayur.


Thu, 2004-07-29 06:52
Joined: 2004-06-11
Forum posts: 404
Enumerating MTM's??
Hi all,
I got lead from another forum to find all the MTM's installed on a device.
The code for it is as follows :

// // enum_mtm.cpp
//
// Copyright (c) 2000 Symbian Ltd.  All rights reserved.
//will try to enumerate the mtm components on a device.
//

#include "CommonFramework.h"
#include <msvreg.h>
#include <e32base.h>
#include <e32cons.h>
#include <msvapi.h>
#include <sendas.h>
#include <badesca.h>

//This programs basically enumerates the names
//of all the MTM's present on a device.

LOCAL_C void consoleUIInstallL();

class CDummyObserver : public MSendAsObserver
{
 public:
  static CDummyObserver* NewL();
  virtual ~CDummyObserver();
  TInt GetMtmCount();
 private :
  //from MSendAsObserver
  TBool CapabilityOK(TUid aCapabilty, TInt aResponse);
  TInt RenderImage(TUid aPrinterUid, const TDesC& aFileName);
  void CancelRendering();

  CDummyObserver();
  void ConstructL();
 public:
  CSendAs *iSendAs;
};


TInt  CDummyObserver ::GetMtmCount()
{
 //This code enumerates all the MTM's present on a device
 //runs only on a real device and will crash in an emulator
    const CDesCArray& mtms = iSendAs->AvailableMtms();
   _LIT(KMsg,"\nMTM count : %d");
    console->Printf(KMsg,mtms.Count());
 for(TInt i=0;i<mtms.Count();i++){
  console->Printf(_L("\nMTM no.%d : %S"),i,&mtms[i]);
 }
 return KErrNone;
}

TBool CDummyObserver ::CapabilityOK(TUid aCapabilty, TInt aResponse)
{
 return ETrue;
}

TInt CDummyObserver ::RenderImage(TUid aPrinterUid, const TDesC& aFileName)
{
 return KErrNone;
}

void CDummyObserver ::CancelRendering()
{
}


CDummyObserver* CDummyObserver::NewL()
{
 CDummyObserver* self = new(ELeave) CDummyObserver();
 CleanupStack::PushL(self);
 self -> ConstructL();
 CleanupStack::Pop(); // self
 return self;
}

CDummyObserver::CDummyObserver()
{
}

CDummyObserver::~CDummyObserver()
{
 delete iSendAs;
}

void CDummyObserver::ConstructL()
{
 TRAPD(aError,iSendAs = CSendAs::NewL(*this));
}


LOCAL_C void doExampleL()
{
 TRAPD(aError,consoleUIInstallL());
}

class CExampleScheduler : public CActiveScheduler
{
 public :
  void Error(TInt aError)const;
};

void CExampleScheduler :: Error(TInt aError) const
{
 _LIT(KMsg,"Example Scheduler - error");
 User::Panic(KMsg,aError);
}

LOCAL_C void consoleUIInstallL()
{
 // Construct and install the active scheduler
 CExampleScheduler* eSch = new (ELeave) CExampleScheduler();
 CleanupStack::PushL(eSch);
 CActiveScheduler::Install(eSch);
 console->Printf(_L("\nScheduler installed.."));
 CDummyObserver *obsr = CDummyObserver::NewL();
 console->Printf(_L("\nCDummy constructed.."));
 CleanupStack::PushL(obsr);
 obsr->GetMtmCount();
 CleanupStack::PopAndDestroy(2); // scheduler
}

Bye.
--Mayur.

Fri, 2004-08-20 22:52
Anonymous (not verified)
Forum posts: 2043
Re: Enumerating MTM's??
Quote from: mayur_24
Hi All,
How do I enumerate all the MTM's registered on a device?
What classes are to be used and are there any code examples present?
Thanks and Regards.
--Mayur.


Since you asked this MTM related question so i thought u might know the answer of my question , i want to donload full email with text  message using pop mtm can u suggest how to do it , currently i can download the headers of mail but how to do the complete message download .
Regards
Siemens.
  • Login to reply to this topic.