adaptationlayer/modematadaptation/modematcontroller_exe/src/cmodematsrv.cpp
changeset 5 8ccc39f9d787
parent 0 63b37f68c1ce
child 8 6295dc2169f3
equal deleted inserted replaced
4:510c70acdbf6 5:8ccc39f9d787
   202         HandleUnsolicitedData( aDteId, aResponse);
   202         HandleUnsolicitedData( aDteId, aResponse);
   203         }
   203         }
   204     C_TRACE ((_T("<<CModemAtSrv::HandleATResponse()") ));
   204     C_TRACE ((_T("<<CModemAtSrv::HandleATResponse()") ));
   205     }
   205     }
   206 
   206 
   207 void CModemAtSrv::ConnectToModem(CModemAtSession* aSession) 
   207 TInt CModemAtSrv::ConnectToModem(CModemAtSession* aSession) 
   208     {
   208     {
   209     C_TRACE ((_T(">>CModemAtSrv::ConnectToModem 0x%x"), aSession));
   209     C_TRACE ((_T(">>CModemAtSrv::ConnectToModem 0x%x"), aSession));
   210     TInt type = aSession->GetPluginType();
   210     TInt type = aSession->GetPluginType();
   211    
   211    
   212     C_TRACE(( _L("session count: %d, type: %d"), iSessions.Count(), type ));
   212     C_TRACE(( _L("session count: %d, type: %d"), iSessions.Count(), type ));
   222             {
   222             {
   223             if( type == iSessions[i]->GetPluginType())
   223             if( type == iSessions[i]->GetPluginType())
   224                 {
   224                 {
   225                 TRACE_ASSERT_ALWAYS;
   225                 TRACE_ASSERT_ALWAYS;
   226                 aSession->SetDteId( dteid );
   226                 aSession->SetDteId( dteid );
   227                 aSession->ModemConnected((TInt)KErrAlreadyExists);
   227                 C_TRACE ((_T("<<CModemAtSrv::ConnectToModem KErrAlreadyExists 0x%x"), aSession));
   228                 C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
   228                 return KErrAlreadyExists;
   229                 return;
       
   230                 }
   229                 }
   231             //add current session to route table
   230             //add current session to route table
   232             C_TRACE((_L("AddSessionToRouteTable type: %d, dteid: %d"), type, aSession->GetDteId()));
   231             C_TRACE((_L("AddSessionToRouteTable type: %d, dteid: %d"), type, aSession->GetDteId()));
   233             iRouteTable[aSession->GetPluginType()][dteid] = aSession;
   232             iRouteTable[aSession->GetPluginType()][dteid] = aSession;
   234             C_TRACE((_L("Interface exists=> %d"),dteid));
   233             C_TRACE((_L("Interface exists=> %d"),dteid));
   235           
   234 
   236             aSession->SetDteId( dteid );
   235             aSession->SetDteId( dteid );
   237             aSession->ModemConnected(KErrNone); //connected
   236             C_TRACE ((_T("<<CModemAtSrv::ConnectToModem KErrNone 0x%x"), aSession));
   238             C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
   237             return KErrNone;
   239             return;
   238             }
   240             }
   239         }
   241         }
   240 
   242              
       
   243     //no AT-plugin& Common plugin, find first free dteid
   241     //no AT-plugin& Common plugin, find first free dteid
   244     TInt dteId = 0;
   242     TInt dteId = 0;
   245     while(iRouteTable[0][dteId] || iRouteTable[1][dteId])
   243     while(iRouteTable[0][dteId] || iRouteTable[1][dteId])
   246         {
   244         {
   247         dteId++;
   245         dteId++;
   249     ASSERT_PANIC_ALWAYS( dteId < KMaxDteIdCount );
   247     ASSERT_PANIC_ALWAYS( dteId < KMaxDteIdCount );
   250     iRouteTable[type][dteId] = aSession;
   248     iRouteTable[type][dteId] = aSession;
   251     C_TRACE((_L("Added new dteid: %d"),dteId));
   249     C_TRACE((_L("Added new dteid: %d"),dteId));
   252 
   250 
   253     aSession->SetDteId(dteId);
   251     aSession->SetDteId(dteId);
   254     iHandler->Connect(dteId);
   252     C_TRACE ((_T("<<CModemAtSrv::ConnectToModem session: 0x%x"), aSession));
   255     C_TRACE ((_T("<<CModemAtSrv::ConnectToModem 0x%x"), aSession));
   253     return iHandler->Connect( dteId );
   256     }
   254     }
   257 
   255 
   258 void CModemAtSrv::AddToSendFifo( const TUint8 aDteId,
   256 void CModemAtSrv::AddToSendFifo( const TUint8 aDteId,
   259     const TATPluginInterface aPluginType,
   257     const TATPluginInterface aPluginType,
   260     CAtMessage* aMessage )
   258     CAtMessage* aMessage )