connectionmonitoring/connmon/connectionmonitor/src/ConnMonCli.cpp
changeset 71 9f263f780e41
parent 0 5a93021fdf25
equal deleted inserted replaced
70:ac5daea24fb0 71:9f263f780e41
   143         {
   143         {
   144         // A new event has arrived
   144         // A new event has arrived
   145         switch ( iEventInfo.iEventType )
   145         switch ( iEventInfo.iEventType )
   146             {
   146             {
   147             case EConnMonCreateConnection :
   147             case EConnMonCreateConnection :
   148                 iConnMonEvent = new (ELeave) CConnMonCreateConnection(
   148                 iConnMonEvent = new CConnMonCreateConnection(
   149                         iEventInfo.iConnectionId );
   149                         iEventInfo.iConnectionId );
   150                 break;
   150                 break;
   151 
   151 
   152             case EConnMonDeleteConnection :
   152             case EConnMonDeleteConnection :
   153                 iConnMonEvent = new (ELeave) CConnMonDeleteConnection(
   153                 iConnMonEvent = new CConnMonDeleteConnection(
   154                         iEventInfo.iConnectionId,
   154                         iEventInfo.iConnectionId,
   155                         iEventInfo.iData,
   155                         iEventInfo.iData,
   156                         iEventInfo.iData2,
   156                         iEventInfo.iData2,
   157                         iEventInfo.iData3 );
   157                         iEventInfo.iData3 );
   158                 break;
   158                 break;
   159 
   159 
   160             case EConnMonDownlinkDataThreshold :
   160             case EConnMonDownlinkDataThreshold :
   161                 iConnMonEvent = new (ELeave) CConnMonDownlinkDataThreshold(
   161                 iConnMonEvent = new CConnMonDownlinkDataThreshold(
   162                         iEventInfo.iConnectionId,
   162                         iEventInfo.iConnectionId,
   163                         iEventInfo.iSubConnectionId,
   163                         iEventInfo.iSubConnectionId,
   164                         iEventInfo.iData );
   164                         iEventInfo.iData );
   165                 break;
   165                 break;
   166 
   166 
   167             case EConnMonUplinkDataThreshold :
   167             case EConnMonUplinkDataThreshold :
   168                 iConnMonEvent = new (ELeave) CConnMonUplinkDataThreshold(
   168                 iConnMonEvent = new CConnMonUplinkDataThreshold(
   169                         iEventInfo.iConnectionId,
   169                         iEventInfo.iConnectionId,
   170                         iEventInfo.iSubConnectionId,
   170                         iEventInfo.iSubConnectionId,
   171                         iEventInfo.iData );
   171                         iEventInfo.iData );
   172                 break;
   172                 break;
   173 
   173 
   174             case EConnMonNetworkStatusChange :
   174             case EConnMonNetworkStatusChange :
   175                 iConnMonEvent = new (ELeave) CConnMonNetworkStatusChange(
   175                 iConnMonEvent = new CConnMonNetworkStatusChange(
   176                         iEventInfo.iConnectionId,
   176                         iEventInfo.iConnectionId,
   177                         iEventInfo.iData );
   177                         iEventInfo.iData );
   178                 break;
   178                 break;
   179 
   179 
   180             case EConnMonConnectionStatusChange :
   180             case EConnMonConnectionStatusChange :
   181                 iConnMonEvent = new (ELeave) CConnMonConnectionStatusChange(
   181                 iConnMonEvent = new CConnMonConnectionStatusChange(
   182                         iEventInfo.iConnectionId,
   182                         iEventInfo.iConnectionId,
   183                         iEventInfo.iSubConnectionId,
   183                         iEventInfo.iSubConnectionId,
   184                         iEventInfo.iData );
   184                         iEventInfo.iData );
   185                 break;
   185                 break;
   186 
   186 
   187             case EConnMonConnectionActivityChange :
   187             case EConnMonConnectionActivityChange :
   188                 iConnMonEvent = new (ELeave) CConnMonConnectionActivityChange(
   188                 iConnMonEvent = new CConnMonConnectionActivityChange(
   189                         iEventInfo.iConnectionId,
   189                         iEventInfo.iConnectionId,
   190                         iEventInfo.iSubConnectionId,
   190                         iEventInfo.iSubConnectionId,
   191                         iEventInfo.iData );
   191                         iEventInfo.iData );
   192                 break;
   192                 break;
   193 
   193 
   194             case EConnMonNetworkRegistrationChange :
   194             case EConnMonNetworkRegistrationChange :
   195                 iConnMonEvent = new (ELeave) CConnMonNetworkRegistrationChange(
   195                 iConnMonEvent = new CConnMonNetworkRegistrationChange(
   196                         iEventInfo.iConnectionId,
   196                         iEventInfo.iConnectionId,
   197                         iEventInfo.iData );
   197                         iEventInfo.iData );
   198                 break;
   198                 break;
   199 
   199 
   200             case EConnMonBearerChange :
   200             case EConnMonBearerChange :
   201                 iConnMonEvent = new (ELeave) CConnMonBearerChange(
   201                 iConnMonEvent = new CConnMonBearerChange(
   202                         iEventInfo.iConnectionId,
   202                         iEventInfo.iConnectionId,
   203                         iEventInfo.iData );
   203                         iEventInfo.iData );
   204                 break;
   204                 break;
   205 
   205 
   206             case EConnMonSignalStrengthChange :
   206             case EConnMonSignalStrengthChange :
   207                 iConnMonEvent = new (ELeave) CConnMonSignalStrengthChange(
   207                 iConnMonEvent = new CConnMonSignalStrengthChange(
   208                         iEventInfo.iConnectionId,
   208                         iEventInfo.iConnectionId,
   209                         iEventInfo.iData );
   209                         iEventInfo.iData );
   210                 break;
   210                 break;
   211 
   211 
   212             case EConnMonBearerAvailabilityChange :
   212             case EConnMonBearerAvailabilityChange :
   213                 iConnMonEvent = new (ELeave) CConnMonBearerAvailabilityChange(
   213                 iConnMonEvent = new CConnMonBearerAvailabilityChange(
   214                         iEventInfo.iConnectionId,
   214                         iEventInfo.iConnectionId,
   215                         iEventInfo.iData );
   215                         iEventInfo.iData );
   216                 break;
   216                 break;
   217 
   217 
   218             case EConnMonIapAvailabilityChange :
   218             case EConnMonIapAvailabilityChange :
   219                 iConnMonEvent = new (ELeave) CConnMonIapAvailabilityChange(
   219                 iConnMonEvent = new CConnMonIapAvailabilityChange(
   220                         iEventInfo.iConnectionId,
   220                         iEventInfo.iConnectionId,
   221                         reinterpret_cast<const TConnMonIapInfo*>( iExtraBuf.Ptr() ) );
   221                         reinterpret_cast<const TConnMonIapInfo*>( iExtraBuf.Ptr() ) );
   222                 break;
   222                 break;
   223 
   223 
   224             case EConnMonTransmitPowerChange :
   224             case EConnMonTransmitPowerChange :
   225                 iConnMonEvent = new (ELeave) CConnMonTransmitPowerChange(
   225                 iConnMonEvent = new CConnMonTransmitPowerChange(
   226                         iEventInfo.iConnectionId,
   226                         iEventInfo.iConnectionId,
   227                         iEventInfo.iData );
   227                         iEventInfo.iData );
   228                 break;
   228                 break;
   229 
   229 
   230             case EConnMonSNAPsAvailabilityChange :
   230             case EConnMonSNAPsAvailabilityChange :
   231                 iConnMonEvent = new (ELeave) CConnMonSNAPsAvailabilityChange(
   231                 iConnMonEvent = new CConnMonSNAPsAvailabilityChange(
   232                         iEventInfo.iConnectionId, iEventInfo.iData,
   232                         iEventInfo.iConnectionId, iEventInfo.iData,
   233                         reinterpret_cast< const TConnMonSNAPInfo* >( iExtraBuf.Ptr() ) );
   233                         reinterpret_cast< const TConnMonSNAPInfo* >( iExtraBuf.Ptr() ) );
   234                 break;
   234                 break;
   235 
   235 
   236             case EConnMonNewWLANNetworkDetected :
   236             case EConnMonNewWLANNetworkDetected :
   237                 iConnMonEvent = new (ELeave) CConnMonNewWLANNetworkDetected(
   237                 iConnMonEvent = new CConnMonNewWLANNetworkDetected(
   238                         iEventInfo.iConnectionId );
   238                         iEventInfo.iConnectionId );
   239                 break;
   239                 break;
   240 
   240 
   241             case EConnMonOldWLANNetworkLost :
   241             case EConnMonOldWLANNetworkLost :
   242                 iConnMonEvent = new (ELeave) CConnMonOldWLANNetworkLost(
   242                 iConnMonEvent = new CConnMonOldWLANNetworkLost(
   243                         iEventInfo.iConnectionId );
   243                         iEventInfo.iConnectionId );
   244                 break;
   244                 break;
   245 
   245 
   246             case EConnMonPacketDataUnavailable :
   246             case EConnMonPacketDataUnavailable :
   247                 iConnMonEvent = new (ELeave) CConnMonPacketDataUnavailable(
   247                 iConnMonEvent = new CConnMonPacketDataUnavailable(
   248                         iEventInfo.iConnectionId );
   248                         iEventInfo.iConnectionId );
   249                 break;
   249                 break;
   250 
   250 
   251             case EConnMonPacketDataAvailable :
   251             case EConnMonPacketDataAvailable :
   252                 iConnMonEvent = new (ELeave) CConnMonPacketDataAvailable(
   252                 iConnMonEvent = new CConnMonPacketDataAvailable(
   253                         iEventInfo.iConnectionId );
   253                         iEventInfo.iConnectionId );
   254                 break;
   254                 break;
   255 
   255 
   256             case EConnMonBearerInfoChange :
   256             case EConnMonBearerInfoChange :
   257                 iConnMonEvent = new (ELeave) CConnMonBearerInfoChange(
   257                 iConnMonEvent = new CConnMonBearerInfoChange(
   258                         iEventInfo.iConnectionId,
   258                         iEventInfo.iConnectionId,
   259                         iEventInfo.iData );
   259                         iEventInfo.iData );
   260                 break;
   260                 break;
   261 
   261 
   262             case EConnMonBearerGroupChange :
   262             case EConnMonBearerGroupChange :
   263                 iConnMonEvent = new (ELeave) CConnMonBearerGroupChange(
   263                 iConnMonEvent = new CConnMonBearerGroupChange(
   264                         iEventInfo.iConnectionId,
   264                         iEventInfo.iConnectionId,
   265                         iEventInfo.iData2,
   265                         iEventInfo.iData2,
   266                         iEventInfo.iData3,
   266                         iEventInfo.iData3,
   267                         iEventInfo.iData );
   267                         iEventInfo.iData );
   268                 break;
   268                 break;
   269 
   269 
   270             default:
   270             default:
   271                 if ( iEventInfo.iEventType >= EConnMonPluginEventBase )
   271                 if ( iEventInfo.iEventType >= EConnMonPluginEventBase )
   272                     {
   272                     {
   273                     // Size of the data is in 'iEventInfo.iData2'
   273                     // Size of the data is in 'iEventInfo.iData2'
   274                     iConnMonEvent = new (ELeave) CConnMonGenericEvent(
   274                     iConnMonEvent = new CConnMonGenericEvent(
   275                             iEventInfo.iEventType,
   275                             iEventInfo.iEventType,
   276                             iEventInfo.iConnectionId,
   276                             iEventInfo.iConnectionId,
   277                             reinterpret_cast<TAny*>( &( iEventInfo.iData ) ) );
   277                             reinterpret_cast<TAny*>( &( iEventInfo.iData ) ) );
   278                     }
   278                     }
   279                 else
   279                 else
   280                     {
   280                     {
   281                     iConnMonEvent = new (ELeave) CConnMonEventBase(
   281                     iConnMonEvent = new CConnMonEventBase(
   282                             iEventInfo.iEventType,
   282                             iEventInfo.iEventType,
   283                             iEventInfo.iConnectionId );
   283                             iEventInfo.iConnectionId );
   284                     }
   284                     }
   285             }
   285             }
   286 
   286 
   287         // Deliver the event to client handler
   287         // Deliver the event to client handler
   288         TRAPD( leaveCode,
   288         if ( iConnMonEvent )
   289                 iObserver->EventL( reinterpret_cast<CConnMonEventBase&>( *iConnMonEvent ) ) );
   289             {
   290 
   290             TRAPD( leaveCode,
   291         delete iConnMonEvent;
   291                    iObserver->EventL( reinterpret_cast<CConnMonEventBase&>( *iConnMonEvent ) ) );
   292         iConnMonEvent = NULL;
   292 
   293 
   293             delete iConnMonEvent;
   294         LOGIT6("Client [%d]: GOT EVENT: type %d, id %d, data1 %d, data2 %d, data3 %d",
   294             iConnMonEvent = NULL;
   295                 &iSession,
   295                    
   296                 iEventInfo.iEventType,
   296             LOGIT6("Client [%d]: GOT EVENT: type %d, id %d, data1 %d, data2 %d, data3 %d",
   297                 iEventInfo.iConnectionId,
   297                     &iSession,
   298                 iEventInfo.iData,
   298                     iEventInfo.iEventType,
   299                 iEventInfo.iData2,
   299                     iEventInfo.iConnectionId,
   300                 iEventInfo.iData3 )
   300                     iEventInfo.iData,
       
   301                     iEventInfo.iData2,
       
   302                     iEventInfo.iData3 )
       
   303             
       
   304             // If leave occurs in EventL, log and ignore
       
   305             if ( leaveCode )
       
   306                 {
       
   307                 LOGIT2("Client [%d]: CConnMonEventHandler::RunL() iObserver->EventL() call left <%d>",
       
   308                        &iSession, leaveCode)
       
   309                 }
       
   310             }
       
   311         else
       
   312             {
       
   313             LOGIT1("Client [%d]: CConnMonEventHandler::RunL() failed in creating iConnMonEvent.", &iSession )
       
   314             }
   301 
   315 
   302         // Initiate the next receive
   316         // Initiate the next receive
   303         ReceiveNotification();
   317         ReceiveNotification();
   304 
       
   305         // If leave occurs in EventL, log and ignore
       
   306         if ( leaveCode )
       
   307             {
       
   308             LOGIT2("Client [%d]: CConnMonEventHandler::RunL() iObserver->EventL() call left <%d>",
       
   309                     &iSession, leaveCode)
       
   310             }
       
   311         }
   318         }
   312     else
   319     else
   313         {
   320         {
   314         LOGIT2("Client [%d]: CConnMonEventHandler::RunL() failed <%d>", &iSession, iStatus.Int())
   321         LOGIT2("Client [%d]: CConnMonEventHandler::RunL() failed <%d>", &iSession, iStatus.Int())
   315         }
   322         }