commands/sms/smsevent.h
changeset 0 7f656887cf89
equal deleted inserted replaced
-1:000000000000 0:7f656887cf89
       
     1 // smsevent.h
       
     2 // 
       
     3 // Copyright (c) 2008 - 2010 Accenture. All rights reserved.
       
     4 // This component and the accompanying materials are made available
       
     5 // under the terms of the "Eclipse Public License v1.0"
       
     6 // which accompanies this distribution, and is available
       
     7 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 // 
       
     9 // Initial Contributors:
       
    10 // Accenture - Initial contribution
       
    11 //
       
    12 
       
    13 #ifndef __SMS_EVENT_H__
       
    14 #define __SMS_EVENT_H__
       
    15 
       
    16 #include <e32base.h>
       
    17 #include <etelmm.h>
       
    18 #include <fshell/ioutils.h>
       
    19 
       
    20 using namespace IoUtils;
       
    21 
       
    22 class CCmdSms;
       
    23 
       
    24 //
       
    25 // CSmsEventBase
       
    26 // abstrace base class providing functionality
       
    27 // common to all sms events
       
    28 //
       
    29 class CSmsEventBase : public CActive
       
    30 	{
       
    31 public:
       
    32 	// pure virtuals 
       
    33 	virtual void StartL() = 0;
       
    34 
       
    35 protected:
       
    36 	CSmsEventBase(CCmdSms& aObserver);
       
    37 
       
    38 protected:
       
    39 	CCmdSms& iObserver;
       
    40 	};
       
    41 
       
    42 //
       
    43 // CSmsEventDial
       
    44 // functionality specific to a dial event
       
    45 // 
       
    46 NONSHARABLE_CLASS(CSmsEventDial) : public CSmsEventBase
       
    47 	{
       
    48 public:
       
    49 	static CSmsEventDial* NewL(CCmdSms& aObserver, RCall::TTelNumberC& aTelNumber);
       
    50 	virtual ~CSmsEventDial();
       
    51 
       
    52 	// from CSmsEventBase 
       
    53 	virtual void StartL();
       
    54 	
       
    55 	// from CActive
       
    56 	virtual void RunL();
       
    57 	virtual void DoCancel();
       
    58 	virtual TInt RunError(TInt aError);
       
    59 private:
       
    60 	CSmsEventDial(CCmdSms& aObserver);
       
    61 	void ConstructL(RCall::TTelNumberC& aTelNumber);
       
    62 private:
       
    63 	RTelServer iTelServer;
       
    64 	RMobilePhone iPhone;
       
    65 	RMobileLine iLine;
       
    66 	RMobileCall iCall;
       
    67 	RMobilePhone::TMobileAddress iNumber;
       
    68 	TName iCallName;
       
    69 	RMobileCall::TMobileCallStatus iCallStatus;
       
    70 	RTimer iTimeout;
       
    71 	
       
    72 	enum TSmsEventState
       
    73 		{
       
    74 		ESmsEventNetworkIdle,
       
    75 		ESmsEventDial,
       
    76 		ESmsEventStatusChange,
       
    77 		ESmsEventWatchStatus
       
    78 		};
       
    79 	TSmsEventState iState;
       
    80 	};
       
    81 
       
    82 NONSHARABLE_CLASS(CSmsShellCommand) : public CSmsEventBase
       
    83 	{
       
    84 public:
       
    85 	static CSmsShellCommand* NewL(CCmdSms& aObserver, const TDesC& aCommandText, const TDesC& aSenderAddress);
       
    86 	~CSmsShellCommand();
       
    87 	void StartL();
       
    88 
       
    89 private:
       
    90 	CSmsShellCommand(CCmdSms& aObserver);
       
    91 	void ConstructL(const TDesC& aCommandText, const TDesC& aSenderAddress);
       
    92 	void RunL();
       
    93 	void DoCancel();
       
    94 
       
    95 private:
       
    96 	RChildProcess iProcess;
       
    97 	TFileName iScriptFile;
       
    98 	TBuf<32> iExeName;
       
    99 	CEnvironment* iScriptEnv;
       
   100 	RBuf iSmsSender;
       
   101 	};
       
   102 
       
   103 #endif // __SMS_EVENT_H__