telephonyprotocols/pdplayer/umts/spudfsm/src/cpdpfsmfactory.cpp
changeset 73 70d75957b98f
parent 44 8b72faa1200f
equal deleted inserted replaced
69:b982c3e940f3 73:70d75957b98f
    30 #include "cpdpfsmfactory.h"
    30 #include "cpdpfsmfactory.h"
    31 
    31 
    32 // NewL 
    32 // NewL 
    33 CPdpFsmFactory* CPdpFsmFactory::NewL ()
    33 CPdpFsmFactory* CPdpFsmFactory::NewL ()
    34     {
    34     {
    35 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWL_1, ">>CPdpFsmFactory::NewL()");
    35 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWL_1, " NewL()");
    36 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWL_2, "<<CPdpFsmFactory::NewL()");
       
    37 	return new (ELeave) CPdpFsmFactory ();	
    36 	return new (ELeave) CPdpFsmFactory ();	
    38     }
    37     }
    39 
    38 
    40 #if defined(__VC32__)
    39 #if defined(__VC32__)
    41 #if (_MSC_VER >= 1200)
    40 #if (_MSC_VER >= 1200)
    68   iStateStopping (this),
    67   iStateStopping (this),
    69   iStateCreatingMbms(this),
    68   iStateCreatingMbms(this),
    70   iStateActivatingMbms(this),
    69   iStateActivatingMbms(this),
    71   iStateCreatedMbms(this)
    70   iStateCreatedMbms(this)
    72     {
    71     {
    73 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CTOR_1, ">>CPdpFsmFactory::CPdpFsmFactory()");
    72 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CTOR_1, " Constructor");
    74 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CTOR_2, "<<CPdpFsmFactory::CPdpFsmFactory()");
       
    75     }
    73     }
    76 
    74 
    77 
    75 
    78 CPdpFsmFactory::~CPdpFsmFactory()
    76 CPdpFsmFactory::~CPdpFsmFactory()
    79     {
    77     {
    80 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DTOR_1, ">>CPdpFsmFactory::~CPdpFsmFactory()");
    78 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DTOR_1, " Destructor");
    81 
    79 
    82 	iContexts.DeleteAll();
    80 	iContexts.DeleteAll();
    83     iContexts.Reset();
    81     iContexts.Reset();
    84 	
    82 	
    85     delete iEtelDriverInput;   
    83     delete iEtelDriverInput;   
    86     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DTOR_2, "<<CPdpFsmFactory::~CPdpFsmFactory()");
       
    87     }
    84     }
    88 
    85 
    89 
    86 
    90 void CPdpFsmFactory::InitL(const TName& aTsyName, CPdpFsmInterface * aPdpFsmInterface)
    87 void CPdpFsmFactory::InitL(const TName& aTsyName, CPdpFsmInterface * aPdpFsmInterface)
    91     {
    88     {
    92 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_INITL_1, ">>CPdpFsmFactory::InitL()");
    89 	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_INITL_1, " Tsy Name [%S]", aTsyName);
    93 
    90 
    94 	iPdpFsmInterface = aPdpFsmInterface;
    91 	iPdpFsmInterface = aPdpFsmInterface;
    95 	
       
    96 	iTsyName = aTsyName;
    92 	iTsyName = aTsyName;
    97 
    93 
    98 	// lets kick off the ETelDriver first then we only alloc FSMs if it works
    94 	// lets kick off the ETelDriver first then we only alloc FSMs if it works
    99 	//
    95 	//
   100 	iEtelDriverInput = new (ELeave) REtelDriverInput;
    96 	iEtelDriverInput = new (ELeave) REtelDriverInput;
   101 
       
   102 	iEtelDriverInput->OpenL (*iPdpFsmInterface);
    97 	iEtelDriverInput->OpenL (*iPdpFsmInterface);
   103 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_INITL_2, "<<CPdpFsmFactory::InitL()");
       
   104 	// Only create PDP contexts if specifically requested.
    98 	// Only create PDP contexts if specifically requested.
   105     }
    99     }
   106 
   100 
   107 
   101 
   108 void CPdpFsmFactory::Close (void)
   102 void CPdpFsmFactory::Close (void)
   109     {
   103     {
   110 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CLOSE_1, ">>CPdpFsmFactory::Close()");
   104 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CLOSE_1, " Close()");
   111 	// in OOM conditions iEtelDriveInput may not have successfully
   105 	// in OOM conditions iEtelDriveInput may not have successfully
   112 	// been created, check here for safety.
   106 	// been created, check here for safety.
   113 	if (iEtelDriverInput != NULL)
   107 	if (iEtelDriverInput != NULL)
   114 	    {
   108 	    {
   115         iEtelDriverInput->Close();
   109         iEtelDriverInput->Close();
   116 	    }
   110 	    }
   117 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_CLOSE_2, "<<CPdpFsmFactory::Close()");
       
   118     }
   111     }
   119 
   112 
   120 
   113 
   121 /** 
   114 /** 
   122 @return may return NULL if there is no PDP context with that Id
   115 @return may return NULL if there is no PDP context with that Id
   123 */
   116 */
   124 CPdpFsm* CPdpFsmFactory::GetFsmContext (TContextId aPdpId)
   117 CPdpFsm* CPdpFsmFactory::GetFsmContext (TContextId aPdpId)
   125     {
   118     {
   126 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_GETFSMCONTEXT_1, ">>CPdpFsmFactory::GetContext()");
   119     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_GETFSMCONTEXT_1, " for context id [%d]", aPdpId);
   127 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_GETFSMCONTEXT_2, "<<CPdpFsmFactory::GetContext()");
       
   128 	return iContexts[aPdpId];
   120 	return iContexts[aPdpId];
   129     }
   121     }
   130 
   122 
   131 
   123 
   132 const TName& CPdpFsmFactory::TsyName(void)
   124 const TName& CPdpFsmFactory::TsyName(void)
   138 TInt CPdpFsmFactory::NewFsmContext(TContextId aPdpId)
   130 TInt CPdpFsmFactory::NewFsmContext(TContextId aPdpId)
   139 #else
   131 #else
   140 TContextId CPdpFsmFactory::NewFsmContextL(MPdpFsmEventHandler& aPdpFsmEventHandler,SpudMan::TPdpContextType aContextType)
   132 TContextId CPdpFsmFactory::NewFsmContextL(MPdpFsmEventHandler& aPdpFsmEventHandler,SpudMan::TPdpContextType aContextType)
   141 #endif
   133 #endif
   142     {
   134     {
   143 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWFSMCONTEXTL_1, ">>CPdpFsmFactory::NewFsmContext()");
   135 	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWFSMCONTEXTL_1, " for context type [%d]", aContextType);
   144 
   136 
   145 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
   137 #ifndef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
   146 	TInt ret = KErrNone;
   138 	TInt ret = KErrNone;
   147 	ASSERT(ContextIdIsValid(aPdpId));
   139 	ASSERT(ContextIdIsValid(aPdpId));
   148     if (!HaveFsmContext(aPdpId))
   140     if (!HaveFsmContext(aPdpId))
   166         {
   158         {
   167         CPdpFsm* p = CPdpFsm::NewL(i, this, iEtelDriverInput, aPdpFsmEventHandler, aContextType);
   159         CPdpFsm* p = CPdpFsm::NewL(i, this, iEtelDriverInput, aPdpFsmEventHandler, aContextType);
   168         iContexts[i] = p;
   160         iContexts[i] = p;
   169         iEtelDriverInput->CreatePdpL(i, aContextType);
   161         iEtelDriverInput->CreatePdpL(i, aContextType);
   170         }
   162         }
   171     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWFSMCONTEXTL_3, "<<CPdpFsmFactory::NewFsmContext()");
   163 
       
   164     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_NEWFSMCONTEXTL_3, " Return Context Id [%d]", i);
   172     return i;
   165     return i;
   173 #endif	
   166 #endif	
   174     }
   167     }
   175    
   168    
   176 TInt CPdpFsmFactory::DeleteFsmContext(TContextId aPdpId)
   169 TInt CPdpFsmFactory::DeleteFsmContext(TContextId aPdpId)
   177     {
   170     {
   178 	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DELETEFSMCONTEXT_1, ">>CPdpFsmFactory::DeleteFsmContext()");
       
   179 	ASSERT(ContextIsValid(aPdpId));
   171 	ASSERT(ContextIsValid(aPdpId));
       
   172     OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DELETEFSMCONTEXT_1, " for context name [%S]", iContexts[aPdpId]->GetDataChannelV2().iChannelId);
   180 
   173 
   181     delete iContexts[aPdpId];
   174     delete iContexts[aPdpId];
   182     iContexts[aPdpId] = NULL;
   175     iContexts[aPdpId] = NULL;
   183     OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CPDPFSMFACTORY_DELETEFSMCONTEXT_2, "<<CPdpFsmFactory::DeleteFsmContext()");
       
   184 	return KErrNone;
   176 	return KErrNone;
   185     }
   177     }
   186     
   178