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 17:37, 23 June 2008.

How use NotifyChange to get camera clicks

From Forum Nokia Wiki

Does your application need a notification whenever a photo is clicked through the camera application? Well, here is how you can achieve it. The following article shows how your application can get a notification as soon as a photo is clicked and stored in the Phone memory, i.e., the C:\Nokia\Images folder. It is achieved using the NotifyChange API of the RFs server.

Remember to include PlatformEnv.lib in your mmp file if you are using the PathInfo API's

#ifndef _NOTIFY_C_
#define _NOTIFY_C_
#include "MyDirObserver.h"
 
class CMyCNotify : public CActive
{
public:
	CMyCNotify(RFs& aFs, MDirObserver& aDirObserver);
	~CMyCNotify();
 
	void StartMonitoring();
 
public: // CActive
	void RunL();
	void DoCancel();
 
private:
        RFs&           iFs;
	MDirObserver&  iDirObserver;
};
#endif
#include <f32file.h>
#include <e32base.h>
#include <eikenv.h>
#include <PathInfo.h>
 
#include "MyCNotify.h"
 
CMyCNotify::CMyCNotify(RFs& aFs, MDirObserver& aDirObserver)
  :  CActive(EPriorityStandard),
     iFs(aFs),
     iDirObserver(aDirObserver)
{	
	CActiveScheduler::Add(this);
}
 
CMyCNotify::~CMyCNotify()
{
	Cancel();
}
 
void CMyCNotify::RunL()
{
    if(iStatus==KErrNone)
    {	
	iDirObserver.CChange();
	StartMonitoring();
    }
    else
        ; // there was an error so all monitoring will now stop
}
 
void CMyCNotify::DoCancel()
{
	iFs.NotifyChangeCancel(iStatus);
}
 
void CMyCNotify::StartMonitoring()
{
   if(!IsActive())	
        {
        TFileName path = PathInfo::PhoneMemoryRootPath();
        path.Append(PathInfo::ImagesPath());
 
	iFs.NotifyChange(ENotifyWrite,iStatus, path));
	
	SetActive();
        }
   else
        ; // already waiting for a change so do nothing
}

and finally implement the interface

#ifndef _DIROBSERVER_H_
#define _DIROBSERVER_H_
 
class MDirObserver
{
public:
    virtual void CChange() = 0;
    virtual ~MDirObserver(){}
};
 
#endif

Similarly a notifier can be implemented on E:\Images to capture photos from MMC using PathInfo::MemoryCardRootPath(). Also the same can be used for videos, recorder, etc.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Problem in using RFs::NotifyChange()..? sumit_rusia General Symbian C++ 9 2007-09-04 11:26
N70 CAMERA PROBLEM ahmedksal General Discussion 1 2006-10-28 19:51
Getting the current skin name thewisemonkey Symbian User Interface 21 2008-04-20 17:30
feature not support for camera sandy_zeng General Symbian C++ 1 2007-10-23 12:30
Camera Cover PankajNeve General Symbian C++ 1 2007-10-16 11:42
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX