cbsref/telephonyrefplugins/atltsy/atcommand/phonebook/inc/atphbkstorewrite.h
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
child 21 4814c5a49428
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file atphbkstorewrite.h
       
    15 // This contains CAtPhbkStoreWrite which is use to write a phonebook Entry
       
    16 // 
       
    17 
       
    18 #ifndef ATPHBKSTOREWRITE_H
       
    19 #define ATPHBKSTOREWRITE_H
       
    20 
       
    21 //system include 
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 //user include 
       
    26 #include "atcommandbase.h"
       
    27 
       
    28 /**
       
    29  * TPhonebookEntry
       
    30  *
       
    31  */
       
    32 class TPhonebookEntry
       
    33     {
       
    34 public:
       
    35 	TUint16     iIndex;
       
    36     TBuf16<20>  iNumber;
       
    37     TBuf16<14>  iText;	
       
    38     };
       
    39 
       
    40 /**
       
    41  * CAtPhbkStoreWrite
       
    42  *
       
    43  */
       
    44 class CAtPhbkStoreWrite : public CAtCommandBase
       
    45 	{
       
    46 public:
       
    47 	/**
       
    48 	* Destructor
       
    49 	*
       
    50 	*/
       
    51 	~CAtPhbkStoreWrite();
       
    52 	
       
    53 	/**
       
    54 	*  static NewL  
       
    55 	*
       
    56 	* @param aGloblePhone
       
    57 	* @param aCtsyDispatcherCallback
       
    58 	*/
       
    59 	static CAtPhbkStoreWrite* NewL(CGlobalPhonemanager& aGloblePhone, 
       
    60                                    CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    61 	
       
    62 	/**
       
    63 	*  static NewLC  
       
    64 	*
       
    65 	* @param aGloblePhone
       
    66 	* @param aCtsyDispatcherCallback
       
    67 	*/
       
    68 	static CAtPhbkStoreWrite* NewLC(CGlobalPhonemanager& aGloblePhone, 
       
    69                                     CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    70 
       
    71 	/**
       
    72 	* Virtual function. Inherited from CAtCommandBase
       
    73 	*  Start Execute AT Command
       
    74 	*/
       
    75 	virtual void ExecuteCommand();
       
    76 	
       
    77 	/**
       
    78 	* Will be called by AT Manager whenever a event was triggered
       
    79 	* 
       
    80 	* @param aEventSource
       
    81 	* @param aStatus
       
    82 	*/
       
    83 	virtual void EventSignal(TAtEventSource aEventSource, TInt aStatus);
       
    84 	
       
    85 	/**
       
    86 	* Virtual function. Inherited from CAtCommandBase
       
    87 	* 
       
    88 	* @param aResponseBuf Line buf reading from baseband 
       
    89 	*/
       
    90 	virtual void ParseResponseL(const TDesC8& aResponseBuf);
       
    91 	
       
    92 	/**
       
    93 	* Start this request
       
    94 	* 
       
    95 	*/
       
    96 	void StartRequest();
       
    97 	
       
    98     /**
       
    99 	*   set PhoneEntry passed by handler
       
   100 	*/
       
   101 	void SetPhonebookEntryL(const TDesC8& aEntry);
       
   102 	
       
   103 	/**
       
   104 	* Set Phonebook Type 
       
   105 	* 
       
   106 	* @param  aPhonebookType
       
   107 	*/
       
   108 	void SetPhonebookType(DispatcherPhonebook::TPhonebook aPhonebookType);
       
   109 protected:
       
   110 	/**
       
   111 	* Constructor
       
   112 	*
       
   113 	* @param aGloblePhone
       
   114 	* @param aCtsyDispatcherCallback
       
   115 	*/
       
   116 	CAtPhbkStoreWrite(CGlobalPhonemanager& aGloblePhone, 
       
   117                       CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
   118 
       
   119 	/**
       
   120 	* 2nd Constructor
       
   121 	*/
       
   122 	void ConstructL();
       
   123 private:
       
   124 	/**
       
   125 	*  Executer AT command for writing a phonebook entry
       
   126 	*/	
       
   127 	void WriteEntry();
       
   128 	
       
   129 	/**
       
   130 	* Get the maximum number length for each phonebook store type
       
   131 	*/
       
   132 	void GetMaxNumberLen();
       
   133 private:	
       
   134 	/**
       
   135 	*  save PhoneBookType by SetPhonebookType
       
   136 	*/	
       
   137 	DispatcherPhonebook::TPhonebook iPhoneBookType;
       
   138 
       
   139 	/**
       
   140 	*  state machine for EventSignal 
       
   141 	*/
       
   142 	enum 
       
   143 		{
       
   144 		ESetStoreName,
       
   145 		ESetStoreNameComplete,
       
   146 		EWriteEntry,
       
   147 		EWriteEntryComplete,
       
   148 		EATNotInProgress
       
   149 		}iState;
       
   150 	
       
   151 	/**
       
   152 	* The return error value of AT command executed 
       
   153 	*/		
       
   154 	TInt iError;	
       
   155 	
       
   156 	/**
       
   157 	*  The structure decoded for phonebook Entry 
       
   158 	*/
       
   159 	TPhonebookEntry iPhbkEntry;
       
   160 	
       
   161 	/**
       
   162 	* the maximum number length 
       
   163 	*/
       
   164 	TInt iMaxLen;
       
   165 	
       
   166 	}; // class CAtPhbkStoreWrite
       
   167 #endif // ATPHBKSTOREWRITE_H